1
0
mirror of https://github.com/e107inc/e107.git synced 2025-01-17 04:38:27 +01:00

PHP8 Fixes. Renamed 'search' class (in search.php) to 'search_front' to avoid conflicts.

This commit is contained in:
Cameron 2021-01-20 12:07:29 -08:00
parent 17dfe4149e
commit ab75f150f8
7 changed files with 39 additions and 25 deletions

View File

@ -14,7 +14,7 @@ function search_shortcode($parm=null)
$text = ""; $text = "";
if(!isset($SEARCH_SHORTCODE)) if(empty($SEARCH_SHORTCODE))
{ {
if(!$SEARCH_SHORTCODE = e107::getCoreTemplate('search','shortcode')) if(!$SEARCH_SHORTCODE = e107::getCoreTemplate('search','shortcode'))
{ {
@ -22,6 +22,11 @@ function search_shortcode($parm=null)
} }
} }
if(empty($SEARCH_SHORTCODE))
{
trigger_error('$SEARCH_SHORTCODE template was empty', E_USER_NOTICE);
return null;
}
$ref = array(); $ref = array();
@ -60,10 +65,7 @@ function search_shortcode($parm=null)
$page = 'all'; $page = 'all';
} }
if(empty($SEARCH_SHORTCODE))
{
return null;
}
$sc = e107::getScBatch('search'); $sc = e107::getScBatch('search');
$sc->wrapper('search/shortcode'); $sc->wrapper('search/shortcode');

View File

@ -2202,20 +2202,22 @@ class e_admin_controller
$triggerEnabled = $this->triggersEnabled(); $triggerEnabled = $this->triggersEnabled();
if(!e_AJAX_REQUEST && $triggerEnabled) if(!e_AJAX_REQUEST && $triggerEnabled)
{ {
$posted = $request->getPosted(); if($posted = $request->getPosted())
foreach ($posted as $key => $value)
{ {
if(strpos($key, 'etrigger_') === 0) foreach ($posted as $key => $value)
{ {
$actionTriggerName = $this->toMethodName($action.$request->camelize(substr($key, 9)), 'trigger', false); if(strpos($key, 'etrigger_') === 0)
if(method_exists($this, $actionTriggerName))
{ {
$this->$actionTriggerName($value); $actionTriggerName = $this->toMethodName($action.$request->camelize(substr($key, 9)), 'trigger', false);
} if(method_exists($this, $actionTriggerName))
//Check if triggers are still enabled {
if(!$triggerEnabled) $this->$actionTriggerName($value);
{ }
break; //Check if triggers are still enabled
if(!$triggerEnabled)
{
break;
}
} }
} }
} }
@ -3878,6 +3880,7 @@ class e_admin_controller_ui extends e_admin_controller
case 'datestamp': case 'datestamp':
$opt = array();
if(!is_numeric($value)) if(!is_numeric($value))
{ {
if(!empty($attributes['writeParms'])) if(!empty($attributes['writeParms']))
@ -3893,7 +3896,7 @@ class e_admin_controller_ui extends e_admin_controller
} }
$format = $opt['type'] ? ('input'.$opt['type']) : 'inputdate'; $format = !empty($opt['type']) ? ('input'.$opt['type']) : 'inputdate';
$value = trim($value) ? e107::getDate()->toTime($value, $format) : 0; $value = trim($value) ? e107::getDate()->toTime($value, $format) : 0;
} }
break; break;
@ -5583,6 +5586,8 @@ class e_admin_ui extends e_admin_controller_ui
$data = $this->featurebox; $data = $this->featurebox;
$scount = 0; $scount = 0;
$category = 0;
foreach($selected as $id) foreach($selected as $id)
{ {
if(!$tree->hasNode($id)) if(!$tree->hasNode($id))
@ -5639,7 +5644,7 @@ class e_admin_ui extends e_admin_controller_ui
if($scount > 0) if($scount > 0)
{ {
e107::getMessage()->addSuccess(LAN_CREATED. ' (' .$scount. ') ' .LAN_PLUGIN_FEATUREBOX_NAME); e107::getMessage()->addSuccess(LAN_CREATED. ' (' .$scount. ') ' .LAN_PLUGIN_FEATUREBOX_NAME);
e107::getMessage()->addSuccess("<a class='btn btn-small btn-primary' href='".e_PLUGIN_ABS."featurebox/admin_config.php?searchquery=&filter_options=fb_category__{$category}'".LAN_CONFIGURE. ' ' .LAN_PLUGIN_FEATUREBOX_NAME. '</a>'); e107::getMessage()->addSuccess("<a class='btn btn-small btn-primary' href='".e_PLUGIN_ABS."featurebox/admin_config.php?searchquery=&filter_options=fb_category__{$category}' ".LAN_CONFIGURE. ' ' .LAN_PLUGIN_FEATUREBOX_NAME. '</a>');
return $scount; return $scount;
} }

View File

@ -1272,8 +1272,15 @@ class e_parse_shortcode
if (class_exists($_class, false)) // prevent __autoload - performance if (class_exists($_class, false)) // prevent __autoload - performance
{ {
// SecretR - fix array(parm, sc_mode) causing parm to become an array, see issue 424 // SecretR - fix array(parm, sc_mode) causing parm to become an array, see issue 424
// $ret = call_user_func(array($_class, $_function), $parm, $sc_mode); if(!method_exists($_class, $_function))
$ret = e107::callMethod($_class, $_function, $parm, $sc_mode); // v2.3.1 {
trigger_error($_function." doesn't exist in ".$_path, E_USER_NOTICE);
}
else
{
$ret = call_user_func(array($_class, $_function), $parm, $sc_mode);
}
} }
elseif (function_exists($_function)) elseif (function_exists($_function))
{ {

View File

@ -1370,7 +1370,7 @@ i.e-cat_users-32{ background-position: -555px 0; width: 32px; height: 32px; }
continue; continue;
} }
if (isset($e107_vars[$act]['divider'])) if (isset($e107_vars[$act]['divider']) && !empty($tmpl['divider']))
{ {
// $text .= "<li class='divider'></li>"; // $text .= "<li class='divider'></li>";
$text .= $tmpl['divider']; $text .= $tmpl['divider'];

View File

@ -1025,7 +1025,7 @@ class e107Test extends \Codeception\Test\Unit
$all = e107::getAddonConfig('e_url'); $all = e107::getAddonConfig('e_url');
foreach($all as $plugin => $var) foreach($all as $plugin => $var)
{ {
if($plugin === 'gallery') // fixme - sef may be enabled or disabled each time tests are run if($plugin === 'gallery' || $plugin === 'rss_menu') // fixme - sef may be enabled or disabled each time tests are run
{ {
continue; continue;
} }

View File

@ -123,7 +123,7 @@
continue; continue;
} }
echo " --- ".$file." --- \n"; // echo " --- ".$file." --- \n";
ob_start(); ob_start();
// test for PHP Notice/Warning etc. // test for PHP Notice/Warning etc.
$error = false; $error = false;

View File

@ -43,7 +43,7 @@ if (isset($_GET['t']) && is_numeric($_GET['t']))
} }
class search extends e_shortcode class search_front extends e_shortcode
{ {
private $search_prefs = array(); private $search_prefs = array();
@ -1006,7 +1006,7 @@ class search extends e_shortcode
} }
$srchObj = new search; $srchObj = new search_front;
$search_info = $srchObj->getConfig(); $search_info = $srchObj->getConfig();
$search_prefs = $srchObj->getPrefs(); $search_prefs = $srchObj->getPrefs();