Skip to content

Commit

Permalink
4.0.10
Browse files Browse the repository at this point in the history
  • Loading branch information
phpfoxdev committed Nov 16, 2015
1 parent 4bf7610 commit df4a144
Show file tree
Hide file tree
Showing 327 changed files with 33,753 additions and 3,555 deletions.
2 changes: 1 addition & 1 deletion PF.Base/composer.json
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"require": {
"twig/twig": "1.18.*@dev",
"leafo/lessphp": "0.4.0",
"oyejorge/less.php": "1.7.0.9",
"filp/whoops": "1.*",
"ircmaxell/password-compat": "~1.0",
"phpmailer/phpmailer": "dev-master",
Expand Down
62 changes: 57 additions & 5 deletions PF.Base/include/library/phpfox/database/dba.class.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ abstract class Phpfox_Database_Dba implements Phpfox_Database_Interface
* @var array
*/
protected $_aQuery = array();

protected $_sSingleData = '';

/**
* Array of all the words that cannot be used
Expand Down Expand Up @@ -160,7 +162,16 @@ public function select($sSelect)

return $this;
}


/**
* @param $file_name
* @return $this
*/
public function singleData($file_name)
{
$this->_sSingleData = $file_name;
return $this;
}
/**
* Stores the WHERE part of a query
* Example using a string method:
Expand Down Expand Up @@ -539,7 +550,13 @@ public function execute($sType = null, $aParams = array())
$sCacheId = $oCache->set($aParams['cache_name']);
if ((isset($aParams['cache_limit']) && ($aRows = $oCache->get($sCacheId, $aParams['cache_limit']))) || ($aRows = $oCache->get($sCacheId)))
{
return $aRows;
if (!empty($this->_sSingleData))
{
return $this->_singleData($aRows);
} else
{
return $aRows;
}
}
}

Expand Down Expand Up @@ -583,9 +600,14 @@ public function execute($sType = null, $aParams = array())
{
$this->freeResult();
}

return $aRows;
}
if (!empty($this->_sSingleData))
{
return $this->_singleData($aRows);
} else
{
return $aRows;
}
}

/**
* We clean out the query we just ran so another query can be built
Expand Down Expand Up @@ -944,6 +966,36 @@ public function searchKeywords($sField, $sStr)

return $sQuery;
}

/**
* Return data for you can easier process
* @param $data: data return from query
* @param $field_name: field you want to use
* @return array
*/
private function _singleData($data)
{
if (isset($this->_sSingleData))
{
$field_name = $this->_sSingleData;
if (count($data))
{
$result = array();
foreach ($data as $sub_data)
{
$result[] = isset($sub_data[$field_name]) ? $sub_data[$field_name] : null;
}
return $result;
} else
{
return $data;
}
} else
{
return $data;
}

}

/**
* Takes into account html entities to return the ucwords and strtolower in an array.
Expand Down
2 changes: 1 addition & 1 deletion PF.Base/include/library/phpfox/editor/editor.class.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public function get($iId, $aParams = array(), $bForce = false)
$sStr .= '<div class="edit_menu_container">' . "\n";
// $sStr .= '<div id="js_editor_menu_' . $iId . '" class="editor_menu"></div>' . "\n";
$sStr .= '<script type="text/javascript">$Behavior.getEditor = function() { Editor.setId(\'' . $iId . '\'); };</script>' . "\n";
$sStr .= '<div id="layer_' . $iId . '"><textarea ' . $placeholder . (isset($aParams['enter']) ? 'class="on_enter_submit"' : '') . ' name="val[' . $iId . ']" rows="' . (isset($aParams['rows']) ? $aParams['rows'] : '12') . '" cols="' . (isset($aParams['cols']) ? $aParams['cols'] : '50') . '" id="' . $iId . '"' . (isset($aParams['tabindex']) ? ' tabindex="' . $aParams['tabindex'] . '"' : '') . '>' . $this->getValue($iId, (isset($aParams['default_value']) ? $aParams['default_value'] : null)) . '</textarea></div>';
$sStr .= '<div id="layer_' . $iId . '"><textarea ' . $placeholder . (isset($aParams['enter']) ? 'class="form-control on_enter_submit"' : 'class="form-control"') . ' name="val[' . $iId . ']" rows="' . (isset($aParams['rows']) ? $aParams['rows'] : '12') . '" cols="' . (isset($aParams['cols']) ? $aParams['cols'] : '50') . '" id="' . $iId . '"' . (isset($aParams['tabindex']) ? ' tabindex="' . $aParams['tabindex'] . '"' : '') . '>' . $this->getValue($iId, (isset($aParams['default_value']) ? $aParams['default_value'] : null)) . '</textarea></div>';
$sStr .= "\n" . '</div>';
}
else
Expand Down
27 changes: 20 additions & 7 deletions PF.Base/include/library/phpfox/image/helper.class.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -266,15 +266,28 @@ public function display($aParams, $bIsLoop = false)
}

$parts = explode(' ', $name);
$first = '';
$last = '';
if (strlen($name) > 2) {
$first = $name[0];
$last = $name[1];
$name = trim($name);
$first = 'P';
$last = 'F';
if (strlen($name) >= 2) {
if (ctype_alnum($name[0])){
$first = $name[0];
}
if (ctype_alnum($name[1])){
$last = $name[1];
}
if (isset($parts[1])) {
$last = $parts[1][0];
$lastChar = trim($parts[1]);
if (!empty($lastChar)){
$last = $lastChar[0];
}
}
}
} elseif(strlen($name) >= 1){
if (ctype_alnum($name[0])){
$first = $name[0];
$last = $name[0];
}
}

if (isset($aParams['max_width'])) {
$sImageSize = '_' . $aParams['max_width'];
Expand Down
5 changes: 5 additions & 0 deletions PF.Base/include/library/phpfox/module/module.class.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -744,6 +744,11 @@ public function getModuleBlocks($iId, $bForce = false)
$aBlocks[$iId] = true;
}

// support clean template
if($iId == 1 && !Phpfox::isAdminPanel() && Phpfox_Template::instance()->getThemeFolder() == 'bootstrap'){
array_unshift($aBlocks[ $iId ],'core.template-menusub');
}

if ($iId == '3' && !Phpfox::isAdminPanel()) {
// \Phpfox::getBlock('ad.display', array('block_id' => 3));
$aBlocks[$iId][] = 'ad.display';
Expand Down
24 changes: 8 additions & 16 deletions PF.Base/include/library/phpfox/parse/output.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -216,20 +216,10 @@ public function replaceHashTags($sTxt)
$sTxt = preg_replace_callback("/(&#+[0-9+]+;)/", array($this, '_replaceUnicode'), $sTxt);
// http://www.phpfox.com/tracker/view/14956/
$sTxt = preg_replace_callback("/(\-?color:)\s*#([A-F0-9]{3,6})/i", array($this, '_replaceHexColor'), $sTxt);
// $sTxt = preg_replace_callback("/(#[\wa-zA-Z0-9\[\]\/]+)/u", array($this, '_replaceHashTags'), $sTxt);

$sTxt = preg_replace_callback("/(#[^\s]*)/i", array($this, '_replaceHashTags'), $sTxt);
$sTxt = preg_replace('/\[UNICODE\]([0-9]+)\[\/UNICODE\]/', '&#\\1;', $sTxt);

$sReturn = '';
$aParts = explode(' ', ' ' . $sTxt);
foreach ($aParts as $sPart) {
if (substr($sPart, 0, 1) == '#') {
$sPart = $this->_replaceHashTags([$sPart, $sPart]);
}
$sReturn .= $sPart . ' ';
}

return trim($sReturn);
return $sTxt;
}

public function getHashTags($sTxt)
Expand Down Expand Up @@ -568,6 +558,8 @@ public function ajax($sTxt)
*/
public function shorten($html, $maxLength, $sSuffix = null, $bHide = false)
{
mb_internal_encoding('UTF-8');

if ($maxLength === 0 || $this->hasReachedMaxLine() || Phpfox::getParam('language.no_string_restriction'))
{
return $html;
Expand Down Expand Up @@ -627,15 +619,15 @@ public function shorten($html, $maxLength, $sSuffix = null, $bHide = false)
}
}

$position = $tagPosition + strlen($tag);
$position = $tagPosition + mb_strlen($tag);
}

// Print any remaining text.
if ($printedLength < $maxLength && $position < strlen($html))
{
$sNewString .= substr($html, $position, $maxLength - $printedLength);
$sNewString .= mb_strcut($html, $position, $maxLength - $printedLength);
}

// Close any open tags.
while (!empty($tags))
{
Expand Down
37 changes: 24 additions & 13 deletions PF.Base/include/library/phpfox/phpfox/phpfox.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class Phpfox
/**
* Product Version : major.minor.maintenance [alphaX, betaX or rcX]
*/
const VERSION = '4.0.9';
const VERSION = '4.0.10';

/**
* Product Code Name
Expand Down Expand Up @@ -1082,12 +1082,6 @@ public static function getMasterFiles()
{
$aOut = array(
'<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css?v=' . Phpfox_Template::instance()->getStaticVersion() . '" rel="stylesheet">',
'layout.css' => 'style_css',
'common.css' => 'style_css',
'thickbox.css' => 'style_css',
'jquery.css' => 'style_css',
'comment.css' => 'style_css',
'pager.css' => 'style_css',
'jquery/jquery.js' => 'static_script',
'jquery/ui.js' => 'static_script',
'jquery/plugin/jquery.nanoscroller.min.js' => 'static_script',
Expand All @@ -1099,6 +1093,15 @@ public static function getMasterFiles()
'feed.js' => 'module_feed'
);

if(Phpfox::isAdminPanel()) {
$aOut = array_merge(array('layout.css' => 'style_css',
'common.css' => 'style_css',
'thickbox.css' => 'style_css',
'jquery.css' => 'style_css',
'comment.css' => 'style_css',
'pager.css' => 'style_css'), $aOut);
}

(($sPlugin = Phpfox_Plugin::get('get_master_files')) ? eval($sPlugin) : false);
return $aOut;
}
Expand Down Expand Up @@ -1130,10 +1133,13 @@ public static function run()
$aLocale = Phpfox_Locale::instance()->getLang();
$oReq = Phpfox_Request::instance();
$oModule = Phpfox_Module::instance();

if ($oReq->segment(1) == 'favicon.ico') {
header('Content-type: image/x-icon');
echo file_get_contents('http://www.phpfox.com/favicon.ico');
if (file_exists(PHPFOX_DIR . '../favicon.ico')){
echo file_get_contents(PHPFOX_DIR . '../favicon.ico');
} else {
echo file_get_contents('http://www.phpfox.com/favicon.ico');
}
exit;
}

Expand Down Expand Up @@ -1201,7 +1207,11 @@ public static function run()
$Theme = $oTpl->theme()->get();
$Service = new Core\Theme\Service($Theme);
if ($sType == 'text/css') {
echo $Service->css()->getParsed();
if (file_exists($sPath)){
echo @file_get_contents($sPath);
} else {
echo $Service->css()->getParsed();
}
}
else {
echo $Service->js()->get();
Expand Down Expand Up @@ -1251,7 +1261,8 @@ public static function run()
);

$oTpl->setHeader(array(
'<meta name="viewport" content="width=320; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;" />',
'<meta http-equiv="X-UA-Compatible" content="IE=edge">',
'<meta name="viewport" content="width=device-width, initial-scale=1">',
'<meta http-equiv="Content-Type" content="text/html; charset=' . $aLocale['charset'] . '" />',
'<meta http-equiv="cache-control" content="no-cache" />',
'<meta http-equiv="expires" content="-1" />',
Expand All @@ -1269,7 +1280,7 @@ public static function run()
$oTpl->setPhrase(array('friend.show_more_results_for_search_term'));
}

if (PHPFOX_DEBUG)
if (PHPFOX_DEBUG && self::isAdminPanel())
{
$oTpl->setHeader('cache', array('debug.css' => 'style_css'));
}
Expand Down Expand Up @@ -1492,7 +1503,6 @@ public static function run()
$blocks[$location] = [];
foreach ($aBlocks as $sBlock) {
Phpfox::getBlock($sBlock);

$blocks[$location][] = ob_get_contents(); ob_clean();
}
}
Expand All @@ -1512,6 +1522,7 @@ public static function run()
$error = ob_get_contents(); ob_clean();

$controller = Phpfox_Module::instance()->getFullControllerName();

$data = json_encode([
'content' => str_replace(['&#039;'], ["'"], Phpfox_Parse_Input::instance()->convert($content)),
'title' => html_entity_decode($oTpl->instance()->getTitle()),
Expand Down
14 changes: 7 additions & 7 deletions PF.Base/include/library/phpfox/template/cache.class.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -1060,7 +1060,7 @@ private function _parseFunction($sFunction, $sModifiers, $sArguments)
$bUseJquery = false;
}

$sMonth = '<select name="val[' . $sPrefix . 'month]" id="' . $sPrefix . 'month" class="js_datepicker_month">' . "\n";
$sMonth = '<select class="form-control" name="val[' . $sPrefix . 'month]" id="' . $sPrefix . 'month" class="js_datepicker_month">' . "\n";
if (!isset($aArgs['default_all']))
{
$sMonth .= "\t\t" . '<option value=""><?php echo Phpfox::getPhrase(\'core.month\'); ?>:</option>' . "\n";
Expand Down Expand Up @@ -1088,7 +1088,7 @@ private function _parseFunction($sFunction, $sModifiers, $sArguments)
}
$sMonth .= "\t\t" . '</select>' . "\n";

$sDay = "\t\t" . '<select name="val[' . $sPrefix . 'day]" id="' . $sPrefix . 'day" class="js_datepicker_day">' . "\n";
$sDay = "\t\t" . '<select class="form-control" name="val[' . $sPrefix . 'day]" id="' . $sPrefix . 'day" class="js_datepicker_day">' . "\n";
if (!isset($aArgs['default_all']))
{
$sDay .= "\t\t" . '<option value=""><?php echo Phpfox::getPhrase(\'core.day\'); ?>:</option>' . "\n";
Expand Down Expand Up @@ -1127,7 +1127,7 @@ private function _parseFunction($sFunction, $sModifiers, $sArguments)

$sYear = '<?php $aYears = range(' . $aArgs['start_year'] . ', ' . $aArgs['end_year'] . '); ?>';
$sYear .= '<?php $aParams = (isset($aParams) ? $aParams : Phpfox::getLib(\'phpfox.request\')->getArray(\'val\')); ?>';
$sYear .= "\t\t" . '<select name="val[' . $sPrefix . 'year]" id="' . $sPrefix . 'year" class="js_datepicker_year">' . "\n";
$sYear .= "\t\t" . '<select class="form-control" name="val[' . $sPrefix . 'year]" id="' . $sPrefix . 'year" class="js_datepicker_year">' . "\n";
if (!isset($aArgs['default_all']))
{
$sYear .= "\t\t" . '<option value=""><?php echo Phpfox::getPhrase(\'core.year\'); ?>:</option>' . "\n";
Expand Down Expand Up @@ -1206,7 +1206,7 @@ private function _parseFunction($sFunction, $sModifiers, $sArguments)
$sReturn .= Phpfox::getPhrase($sCustomPhrase);
}
$aHours = range(0, 23);
$sReturn .= "\t\t" . '<select name="val[' . $sPrefix . 'hour]" id="' . $sPrefix . 'hour">' . "\n";
$sReturn .= "\t\t" . '<select class="form-control" name="val[' . $sPrefix . 'hour]" id="' . $sPrefix . 'hour">' . "\n";
foreach ($aHours as $iHour)
{
if (isset($aArgs['start_hour']))
Expand Down Expand Up @@ -1244,7 +1244,7 @@ private function _parseFunction($sFunction, $sModifiers, $sArguments)
$sReturn .= '</div>';
}

return $sReturn;
return '<div class="form-inline select_date">'. $sReturn . '</div>';

break;
case 'select_location':
Expand All @@ -1255,7 +1255,7 @@ private function _parseFunction($sFunction, $sModifiers, $sArguments)
}
$bIsMultiple = isset($aArgs['multiple']) && !empty($aArgs['multiple']);

$sCountries = '<select '. ( $bIsMultiple ? 'multiple="multiple" ' : '') .'name="val[' . (isset($aArgs['name']) ? $this->_removeQuote($aArgs['name']) : 'country_iso') . ']'. ($bIsMultiple ? '[]':'') .'" id="' . (isset($aArgs['name']) ? $this->_removeQuote($aArgs['name']) : 'country_iso') . '"' . (isset($aArgs['style']) ? ' style=' . $aArgs['style'] . '' : '') . '>' . "\n";
$sCountries = '<select class="form-control" '. ( $bIsMultiple ? 'multiple="multiple" ' : '') .'name="val[' . (isset($aArgs['name']) ? $this->_removeQuote($aArgs['name']) : 'country_iso') . ']'. ($bIsMultiple ? '[]':'') .'" id="' . (isset($aArgs['name']) ? $this->_removeQuote($aArgs['name']) : 'country_iso') . '"' . (isset($aArgs['style']) ? ' style=' . $aArgs['style'] . '' : '') . '>' . "\n";
$sCountries .= "\t\t" . '<option value="">' . (isset($aArgs['value_title']) ? $this->_removeQuote($aArgs['value_title']) : '<?php echo Phpfox::getPhrase(\'core.select\'); ?>:') . '</option>' . "\n";
foreach (Phpfox::getService('core.country')->get() as $sIso => $sCountry)
{
Expand All @@ -1278,7 +1278,7 @@ private function _parseFunction($sFunction, $sModifiers, $sArguments)
{
$aArgs['value_title'] = Phpfox::getPhrase(str_replace(array('phrase var=','"',"'"),'',$aArgs['value_title']));
}
$sGenders = '<select name="val[gender]" id="gender">' . "\n";
$sGenders = '<select class="form-control" name="val[gender]" id="gender">' . "\n";
$sGenders .= "\t\t" . '<option value="">' . (isset($aArgs['value_title']) ? $this->_removeQuote($aArgs['value_title']) : '<?php echo Phpfox::getPhrase(\'core.select\'); ?>:') . '</option>' . "\n";
foreach (Phpfox::getService('core')->getGenders(true) as $iKey => $sGender)
{
Expand Down
Loading

0 comments on commit df4a144

Please sign in to comment.