1
0
mirror of https://github.com/e107inc/e107.git synced 2025-04-22 13:41:52 +02:00

Removal of PHP Notices and SEF URL debugging improvements.

This commit is contained in:
Cameron 2017-09-23 12:52:23 -07:00
parent 0fe0bf57bf
commit 9606105e24
5 changed files with 49 additions and 13 deletions

@ -196,7 +196,7 @@ class comment_shortcodes extends e_shortcode
// TODO put into a <ul> drop-down format.
e107::getDebug()->log($this->var);
// e107::getDebug()->log($this->var);
$text = "<a href='#' data-target='".e_HTTP."comment.php' id='e-comment-delete-".$this->var['comment_id']."' data-type='".$this->var['comment_type']."' data-itemid='".$this->var['comment_item_id']."' class='e-comment-delete btn btn-default btn-mini btn-xs'>".LAN_DELETE."</a> ";

@ -1756,6 +1756,17 @@ class eRouter
return new eUrlRule($route, $pattern, $cache);
}
private function _debug($label,$val, $line)
{
if(!deftrue('e_DEBUG_SEF'))
{
return false;
}
e107::getDebug()->log("<h3>SEF: ".$label . " <small>".basename(__FILE__)." (".$line.")</small></h3>".print_a($val,true));
}
/**
* Route current request
* @param eRequest $request
@ -1789,7 +1800,9 @@ class eRouter
// max number of parts is actually 4 - module/controller/action/[additional/pathinfo/vars], here for reference only
$parts = $rawPathInfo ? explode('/', $rawPathInfo, 4) : array();
$this->_debug('parts',$parts, __LINE__);
// find module - check aliases
$module = $this->retrieveModule($parts[0]);
$mainSwitch = false;
@ -1804,12 +1817,18 @@ class eRouter
}
$request->routePathInfo = $rawPathInfo;
$this->_debug('module',$module, __LINE__);
$this->_debug('rawPathInfo',$rawPathInfo, __LINE__);
// valid module
if(null !== $module)
{
// we have valid module
$config = $this->getConfig($module);
$config = $this->getConfig($module);
$this->_debug('config',$module, __LINE__);
// set legacy state
eFront::isLegacy(varset($config['legacy']));
@ -1860,18 +1879,29 @@ class eRouter
// rules available - try to match an Url Rule
elseif($rules)
{
// $this->_debug('rules',$rules, __LINE__);
foreach ($rules as $rule)
{
$route = $rule->parseUrl($this, $request, $pathInfo, $rawPathInfo);
if($route !== false)
{
eFront::isLegacy($rule->legacy); // legacy include override
$this->_debug('rule->legacy',$rule->legacy, __LINE__);
$this->_debug('rule->parseCallback',$rule->parseCallback, __LINE__);
if($rule->parseCallback)
{
$this->configCallback($module, $rule->parseCallback, array($request), $config['location']);
}
// parse legacy query string if any
// parse legacy query string if any
$this->_debug('rule->legacyQuery',$rule->legacyQuery, __LINE__);
if(null !== $rule->legacyQuery)
{
$obj = eDispatcher::getConfigObject($module, $config['location']);
@ -1892,6 +1922,8 @@ class eRouter
}
}
$obj->legacyQueryString = e107::getParser()->simpleParse($rule->legacyQuery, $vars, '0');
$this->_debug('obj->legacyQueryString',$obj->legacyQueryString, __LINE__);
unset($vars, $obj);
}
break;
@ -1940,7 +1972,9 @@ class eRouter
}
}
}
$this->_debug('route',$route, __LINE__);
$request->setRoute($route);
$request->addRouteHistory($route);
$request->routed = true;

@ -437,10 +437,9 @@ class e_bbcode
$ret = array();
if(is_array($mtch[1]))
if(!empty($mtch) && is_array($mtch[1]))
{
$tp = e107::getParser();
foreach($mtch[1] as $i)

@ -1149,7 +1149,8 @@ class comment
}
$from = 0;
$modcomment .= $this->nextprev($table,$id,$from);
$modcomment .= "</div>";
}
@ -1175,6 +1176,7 @@ class comment
}
$search = array("{MODERATE}","{COMMENTS}","{COMMENTFORM}","{COMMENTNAV}");
$pagination = '';
$replace = array($modcomment,$text,$comment,$pagination);
$TEMPL = str_replace($search,$replace,$this->template['layout']);
@ -1410,7 +1412,7 @@ class comment
{
unset($e_comment, $key);
include_once (e_PLUGIN.$file."/e_comment.php");
if ($e_comment && is_array($e_comment))
if (!empty($e_comment) && is_array($e_comment))
{
$key = $e_comment['eplug_comment_ids'];
if (isset($key) && $key != '')
@ -1421,9 +1423,10 @@ class comment
else
{
//convert old method variables into the same array method
$key = $e_plug_table;
if (isset($key) && $key != '')
if (isset($e_plug_table) && $e_plug_table != '')
{
$key = $e_plug_table;
$e_comment['eplug_comment_ids'] = $e_plug_table;
$e_comment['plugin_name'] = $plugin_name;
$e_comment['plugin_path'] = $plugin_path;

@ -21,7 +21,7 @@ e107::includeLan(e_LANGUAGEDIR.e_LANGUAGE."/lan_email.php");
class emailprint
{
function render_emailprint($mode, $id, $look = 0,$parm=array())
static function render_emailprint($mode, $id, $look = 0,$parm=array())
{
// $look = 0 --->display all icons
// $look = 1 --->display email icon only