mirror of
https://github.com/e107inc/e107.git
synced 2025-02-19 22:14:45 +01:00
Removed old deprecated global $e107_debug. Cleaned up debug_handler.php (e107_debug class)
This commit is contained in:
parent
406f74e3a5
commit
326305f5f2
38
class2.php
38
class2.php
@ -363,12 +363,14 @@ $tp = e107::getParser(); //TODO - find & replace $tp, $e107->tp
|
|||||||
// All debug objects and constants are defined in the debug handler
|
// All debug objects and constants are defined in the debug handler
|
||||||
// i.e. from here on you can use E107_DEBUG_LEVEL or any
|
// i.e. from here on you can use E107_DEBUG_LEVEL or any
|
||||||
// E107_DBG_* constant for debug testing.
|
// E107_DBG_* constant for debug testing.
|
||||||
// TODO - rewrite the debug init phase, add e107 class getters
|
|
||||||
//
|
//
|
||||||
require_once(e_HANDLER.'debug_handler.php');
|
require_once(e_HANDLER.'debug_handler.php');
|
||||||
|
e107_debug::init(); // defines E107_DEBUG_LEVEL
|
||||||
|
|
||||||
if(E107_DEBUG_LEVEL && isset($db_debug) && is_object($db_debug))
|
if(E107_DEBUG_LEVEL)
|
||||||
{
|
{
|
||||||
|
// $e107_debug = true; // BC
|
||||||
|
$db_debug = e107::getDebug();
|
||||||
$db_debug->Mark_Time('Init ErrHandler');
|
$db_debug->Mark_Time('Init ErrHandler');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -598,8 +600,8 @@ if(!empty($pref['redirectsiteurl']) && !empty($pref['siteurl'])) {
|
|||||||
// header("Location: {$location}", true, 301); // send 301 header, not 302
|
// header("Location: {$location}", true, 301); // send 301 header, not 302
|
||||||
if(defined('e_DEBUG') && e_DEBUG === true)
|
if(defined('e_DEBUG') && e_DEBUG === true)
|
||||||
{
|
{
|
||||||
echo "DEBUG INFO: site-redirect preference enabled.<br />Redirecting to: <a hre='".$location."'>".$location."</a>";;
|
echo "DEBUG INFO: site-redirect preference enabled.<br />Redirecting to: <a hre='".$location."'>".$location."</a>";
|
||||||
echo "<br />e_DOMAIN: ".e_DOMAIN;
|
echo "<br />e_DOMAIN: ".e_DOMAIN;
|
||||||
echo "<br />e_SUBDOMAIN: ".e_SUBDOMAIN;
|
echo "<br />e_SUBDOMAIN: ".e_SUBDOMAIN;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -977,7 +979,7 @@ if (!class_exists('e107table', false))
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the first caption rendered with {SETSTYLE=default} or {SETSTYLE=main}
|
* Return the first caption rendered with {SETSTYLE=default} or {SETSTYLE=main}
|
||||||
* @return |null
|
* @return string|null
|
||||||
*/
|
*/
|
||||||
public function getMainCaption()
|
public function getMainCaption()
|
||||||
{
|
{
|
||||||
@ -1191,7 +1193,7 @@ if (!class_exists('e107table', false))
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Automatic list detection .
|
// Automatic list detection .
|
||||||
$isList = (strpos(ltrim($text), '<ul') === 0 ) ? true : false;
|
$isList = (strpos(ltrim($text), '<ul') === 0 );
|
||||||
$this->setContent('list', $isList);
|
$this->setContent('list', $isList);
|
||||||
|
|
||||||
$options = $this->getContent();
|
$options = $this->getContent();
|
||||||
@ -1790,10 +1792,10 @@ function getperms($arg, $ap = ADMINPERMS)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1842,6 +1844,7 @@ function get_user_data($uid, $extra = '')
|
|||||||
function save_prefs($table = 'core', $uid = USERID, $row_val = '')
|
function save_prefs($table = 'core', $uid = USERID, $row_val = '')
|
||||||
{
|
{
|
||||||
global $pref, $user_pref, $tp, $PrefCache, $sql, $eArrayStorage, $theme_pref;
|
global $pref, $user_pref, $tp, $PrefCache, $sql, $eArrayStorage, $theme_pref;
|
||||||
|
unset($row_val);
|
||||||
|
|
||||||
if(e107::getPref('developer'))
|
if(e107::getPref('developer'))
|
||||||
{
|
{
|
||||||
@ -1897,6 +1900,7 @@ function save_prefs($table = 'core', $uid = USERID, $row_val = '')
|
|||||||
return $tmp;
|
return $tmp;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1940,7 +1944,7 @@ class floodprotect
|
|||||||
# - return boolean
|
# - return boolean
|
||||||
# - scope public
|
# - scope public
|
||||||
*/
|
*/
|
||||||
$sql=new db;
|
$sql= e107::getDb('flood');
|
||||||
|
|
||||||
if (FLOODPROTECT == true)
|
if (FLOODPROTECT == true)
|
||||||
{
|
{
|
||||||
@ -2559,6 +2563,9 @@ class error_handler
|
|||||||
return true;
|
return true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unset($context);
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2679,7 +2686,7 @@ class e_http_header
|
|||||||
|
|
||||||
if($this->compression_server_support == true && $this->compression_browser_support == true)
|
if($this->compression_server_support == true && $this->compression_browser_support == true)
|
||||||
{
|
{
|
||||||
$this->compress_output = (bool) varset(e107::getPref('compress_output'),false);
|
$this->compress_output = (bool) e107::getPref('compress_output', false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -2780,13 +2787,6 @@ class e_http_header
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param $header
|
|
||||||
*/
|
|
||||||
private function unsetHeader($header)
|
|
||||||
{
|
|
||||||
header_remove($header);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -305,8 +305,7 @@ if (is_array($pref['e_footer_list']))
|
|||||||
|
|
||||||
if(is_readable($fname))
|
if(is_readable($fname))
|
||||||
{
|
{
|
||||||
|
$ret = (deftrue('e_DEBUG') || isset($_E107['debug'])) ? include_once($fname) : @include_once($fname);
|
||||||
$ret = (!empty($e107_debug) || isset($_E107['debug'])) ? include_once($fname) : @include_once($fname);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -303,8 +303,7 @@ if (!empty($pref['e_footer_list']) && is_array($pref['e_footer_list']))
|
|||||||
|
|
||||||
if(is_readable($fname))
|
if(is_readable($fname))
|
||||||
{
|
{
|
||||||
|
$ret = (deftrue('e_DEBUG') || isset($_E107['debug'])) ? include_once($fname) : @include_once($fname);
|
||||||
$ret = (!empty($e107_debug) || isset($_E107['debug'])) ? include_once($fname) : @include_once($fname);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -399,8 +398,7 @@ if (!empty($pref['e_output_list']) && is_array($pref['e_output_list']))
|
|||||||
|
|
||||||
if(is_readable($fname))
|
if(is_readable($fname))
|
||||||
{
|
{
|
||||||
|
$ret = (deftrue('e_DEBUG') || isset($_E107['debug'])) ? include_once($fname) : @include_once($fname);
|
||||||
$ret = (!empty($e107_debug) || isset($_E107['debug'])) ? include_once($fname) : @include_once($fname);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
unset($ret);
|
unset($ret);
|
||||||
|
@ -231,7 +231,7 @@ if (is_array($pref['e_meta_list']))
|
|||||||
|
|
||||||
if(is_readable($fname))
|
if(is_readable($fname))
|
||||||
{
|
{
|
||||||
$ret = (!empty($e107_debug) || isset($_E107['debug'])) ? include_once($fname) : @include_once($fname);
|
$ret = (deftrue('e_DEBUG') || isset($_E107['debug'])) ? include_once($fname) : @include_once($fname);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// content will be added later
|
// content will be added later
|
||||||
|
@ -368,8 +368,6 @@ class e_bbcode
|
|||||||
e107::getDebug()->logCode(1, $code, $parm, print_a($info,true));
|
e107::getDebug()->logCode(1, $code, $parm, print_a($info,true));
|
||||||
}
|
}
|
||||||
|
|
||||||
global $e107_debug;
|
|
||||||
|
|
||||||
if (is_object($this->bbList[$code]))
|
if (is_object($this->bbList[$code]))
|
||||||
{
|
{
|
||||||
if ($this->preProcess == 'toDB')
|
if ($this->preProcess == 'toDB')
|
||||||
|
@ -113,34 +113,34 @@ function deftrue($str, $default='')
|
|||||||
|
|
||||||
function e107_include($fname)
|
function e107_include($fname)
|
||||||
{
|
{
|
||||||
global $e107_debug, $_E107;
|
global $_E107;
|
||||||
$ret = (($e107_debug || isset($_E107['debug']) || deftrue('e_DEBUG')) ? include($fname) : @include($fname));
|
$ret = (isset($_E107['debug']) || deftrue('e_DEBUG')) ? include($fname) : @include($fname);
|
||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
function e107_include_once($fname)
|
function e107_include_once($fname)
|
||||||
{
|
{
|
||||||
global $e107_debug, $_E107;
|
global $_E107;
|
||||||
if(is_readable($fname))
|
if(is_readable($fname))
|
||||||
{
|
{
|
||||||
$ret = ($e107_debug || isset($_E107['debug']) || deftrue('e_DEBUG')) ? include_once($fname) : @include_once($fname);
|
$ret = (isset($_E107['debug']) || deftrue('e_DEBUG')) ? include_once($fname) : @include_once($fname);
|
||||||
}
|
}
|
||||||
return (isset($ret)) ? $ret : '';
|
return (isset($ret)) ? $ret : '';
|
||||||
}
|
}
|
||||||
|
|
||||||
function e107_require_once($fname)
|
function e107_require_once($fname)
|
||||||
{
|
{
|
||||||
global $e107_debug, $_E107;
|
global $_E107;
|
||||||
|
|
||||||
$ret = (($e107_debug || isset($_E107['debug']) || deftrue('e_DEBUG')) ? require_once($fname) : @require_once($fname));
|
$ret = ((isset($_E107['debug']) || deftrue('e_DEBUG')) ? require_once($fname) : @require_once($fname));
|
||||||
|
|
||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
function e107_require($fname)
|
function e107_require($fname)
|
||||||
{
|
{
|
||||||
global $e107_debug, $_E107;
|
global $_E107;
|
||||||
$ret = (($e107_debug || isset($_E107['debug']) || deftrue('e_DEBUG')) ? require($fname) : @require($fname));
|
$ret = ((isset($_E107['debug']) || deftrue('e_DEBUG')) ? require($fname) : @require($fname));
|
||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -539,14 +539,13 @@ class e_array {
|
|||||||
@eval($ArrayData);
|
@eval($ArrayData);
|
||||||
if (!isset($data) || !is_array($data))
|
if (!isset($data) || !is_array($data))
|
||||||
{
|
{
|
||||||
trigger_error("Bad stored array data - <br /><br />".htmlentities($ArrayData), E_USER_ERROR);
|
|
||||||
|
|
||||||
if(e_DEBUG === true)
|
if(e_DEBUG === true)
|
||||||
{
|
{
|
||||||
file_put_contents(e_LOG.'unserializeError_'.time().'.log', $sourceArrayData);
|
file_put_contents(e_LOG.'unserializeError_'.time().'.log', $sourceArrayData);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
trigger_error("Bad stored array data - <br /><br />".htmlentities($ArrayData), E_USER_ERROR);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -654,15 +653,16 @@ class e_array {
|
|||||||
return $this->read($content);
|
return $this->read($content);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Serialize and store data to a local file inside SYSTEM folder
|
* Serialize and store data to a local file inside SYSTEM folder
|
||||||
* @example e107::getArrayStorage()->store($arrayData, 'import/somefile'); // -> e_SYSTEM/import/somefile.php
|
* @example e107::getArrayStorage()->store($arrayData, 'import/somefile'); // -> e_SYSTEM/import/somefile.php
|
||||||
* @example e107::getArrayStorage()->store($arrayData, 'somefile', 'weird'); // -> e_SYSTEM/somefile.weird
|
* @example e107::getArrayStorage()->store($arrayData, 'somefile', 'weird'); // -> e_SYSTEM/somefile.weird
|
||||||
*
|
*
|
||||||
* @param string $systemLocationFile relative to e_SYSTEM file path (without the extension)
|
* @param array $array
|
||||||
* @param string $extension [optional] file extension, default is 'php'
|
* @param string $systemLocationFile relative to e_SYSTEM file path (without the extension)
|
||||||
* @return array|false when file not found (or on error)
|
* @param string $extension [optional] file extension, default is 'php'
|
||||||
*/
|
* @return array|false when file not found (or on error)
|
||||||
|
*/
|
||||||
public function store($array, $systemLocationFile, $extension = 'php')
|
public function store($array, $systemLocationFile, $extension = 'php')
|
||||||
{
|
{
|
||||||
if($extension) $extension = '.'.$extension;
|
if($extension) $extension = '.'.$extension;
|
||||||
|
@ -30,81 +30,18 @@
|
|||||||
// - In either case, create one or more shortcut/abbreviations in $aDebugShortcuts
|
// - In either case, create one or more shortcut/abbreviations in $aDebugShortcuts
|
||||||
// to make it easy for dev's to specify the new display item.
|
// to make it easy for dev's to specify the new display item.
|
||||||
//
|
//
|
||||||
// USING DEBUG DEFINITIONS
|
|
||||||
// Since these are Bit Values, **never** test using < or > comparisons. Always
|
|
||||||
// test using boolean operations, such as
|
|
||||||
// if (E107_DBG_PATH)
|
|
||||||
// if (E107_DBG_SQLQUERIES | E107_DBG_SQLDETAILS)
|
|
||||||
// Since constants are defined for all possible bits, you should never need to use a number value like
|
|
||||||
// if (E107_DEBUG_LEVEL & 256)
|
|
||||||
// And there's never a reason to use
|
|
||||||
// if (E107_DEBUG_LEVEL > 254)
|
|
||||||
|
|
||||||
if (!defined('e107_INIT')) { exit; }
|
if (!defined('e107_INIT')) { exit; }
|
||||||
|
|
||||||
//
|
|
||||||
// If debugging enabled, set it all up
|
|
||||||
// If no debugging, then E107_DEBUG_LEVEL will be zero
|
|
||||||
//
|
|
||||||
if (strstr(e_MENU, "debug") || isset($_COOKIE['e107_debug_level']))
|
|
||||||
{
|
|
||||||
$e107_debug = new e107_debug;
|
|
||||||
// require_once(e_HANDLER.'db_debug_class.php');
|
|
||||||
//$db_debug = new e107_db_debug;
|
|
||||||
|
|
||||||
$db_debug = e107::getDebug();
|
|
||||||
$e107_debug->set_error_reporting();
|
|
||||||
$e107_debug_level = $e107_debug->debug_level;
|
|
||||||
if(!defined('E107_DEBUG_LEVEL'))
|
|
||||||
{
|
|
||||||
define('E107_DEBUG_LEVEL', $e107_debug_level);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
elseif (!defined('E107_DEBUG_LEVEL'))
|
|
||||||
{
|
|
||||||
define('E107_DEBUG_LEVEL', 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!defined('e_DEBUG'))
|
|
||||||
{
|
|
||||||
$e_DEBUG = (E107_DEBUG_LEVEL > 0) ? true: false;
|
|
||||||
define('e_DEBUG', $e_DEBUG);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Define all debug constants -- each one will be zero or a value
|
|
||||||
// They all have different values and can be 'or'ed together
|
|
||||||
//
|
|
||||||
|
|
||||||
// Basic levels
|
|
||||||
define('E107_DBG_BASIC', (E107_DEBUG_LEVEL & 1)); // basics: worst php errors, sql errors, log, etc
|
|
||||||
define('E107_DBG_SQLQUERIES', (E107_DEBUG_LEVEL & 2)); // display all sql queries
|
|
||||||
define('E107_DBG_TRAFFIC', (E107_DEBUG_LEVEL & 4)); // display traffic counters
|
|
||||||
define('E107_DBG_FILLIN8', (E107_DEBUG_LEVEL & 8)); // fill in what it is
|
|
||||||
define('E107_DBG_FILLIN16', (E107_DEBUG_LEVEL & 16)); // fill in what it is
|
|
||||||
define('E107_DBG_FILLIN32', (E107_DEBUG_LEVEL & 32)); // fill in what it is
|
|
||||||
define('E107_DBG_FILLIN64', (E107_DEBUG_LEVEL & 64)); // fill in what it is
|
|
||||||
define('E107_DBG_FILLIN128', (E107_DEBUG_LEVEL & 128)); // fill in what it is
|
|
||||||
|
|
||||||
// Gory detail levels
|
|
||||||
define('E107_DBG_TIMEDETAILS',(E107_DEBUG_LEVEL & 256)); // detailed time profile
|
|
||||||
define('E107_DBG_SQLDETAILS', (E107_DEBUG_LEVEL & 512)); // detailed sql analysis
|
|
||||||
define('E107_DBG_PATH', (E107_DEBUG_LEVEL & 1024)); // show e107 predefined paths
|
|
||||||
define('E107_DBG_BBSC', (E107_DEBUG_LEVEL & 2048)); // Show BBCode/ Shortcode usage in postings
|
|
||||||
define('E107_DBG_SC', (E107_DEBUG_LEVEL & 4096)); // Dump (inline) SC filenames as used
|
|
||||||
define('E107_DBG_ERRBACKTRACE', (E107_DEBUG_LEVEL & 8192)); // show backtrace for php errors
|
|
||||||
define('E107_DBG_DEPRECATED', (E107_DEBUG_LEVEL & 16384)); // Show use of deprecated functions
|
|
||||||
define('E107_DBG_ALLERRORS', (E107_DEBUG_LEVEL & 32768)); // show ALL php errors (including notices), not just fatal issues
|
|
||||||
define('E107_DBG_INCLUDES', (E107_DEBUG_LEVEL & 65536)); // show included file list
|
|
||||||
define('E107_DBG_NOTICES', (E107_DEBUG_LEVEL & 32768)); // show included file list
|
|
||||||
|
|
||||||
class e107_debug {
|
class e107_debug {
|
||||||
|
|
||||||
var $debug_level = 1;
|
private static $debug_level = 0;
|
||||||
//
|
|
||||||
// DEBUG SHORTCUTS
|
/* DEBUG shortcuts */
|
||||||
//
|
private static $aDebugShortcuts = array(
|
||||||
var $aDebugShortcuts = array(
|
|
||||||
'all' => 255, // all basics
|
'all' => 255, // all basics
|
||||||
'basic' => 255, // all basics
|
'basic' => 255, // all basics
|
||||||
'b' => 255, // all basics
|
'b' => 255, // all basics
|
||||||
@ -129,52 +66,141 @@ class e107_debug {
|
|||||||
|
|
||||||
function __construct()
|
function __construct()
|
||||||
{
|
{
|
||||||
if (preg_match('/debug(=?)(.*?),?(\+|stick|-|unstick|$)/', e_MENU, $debug_param) || isset($_COOKIE['e107_debug_level']))
|
|
||||||
{
|
|
||||||
$dVals='';
|
|
||||||
if (!isset($debug_param[1]) || ($debug_param[1]=='')) $debug_param[1] = '=';
|
|
||||||
if (isset($_COOKIE['e107_debug_level']))
|
|
||||||
{
|
|
||||||
$dVals = substr($_COOKIE['e107_debug_level'],6);
|
|
||||||
}
|
|
||||||
if (preg_match('/debug(=?)(.*?),?(\+|stick|-|unstick|$)/', e_MENU))
|
|
||||||
{
|
|
||||||
$dVals = $debug_param[1] == '=' ? $debug_param[2] : 'everything';
|
|
||||||
}
|
|
||||||
|
|
||||||
$aDVal = explode('.',$dVals); // support multiple values, OR'd together
|
|
||||||
$dVal = 0;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
foreach ($aDVal as $curDVal)
|
|
||||||
{
|
|
||||||
if (isset($this->aDebugShortcuts[$curDVal]))
|
|
||||||
{
|
|
||||||
$dVal |= $this->aDebugShortcuts[$curDVal];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$dVal |= intval($curDVal);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isset($debug_param[3]))
|
|
||||||
{
|
|
||||||
if ($debug_param[3] == '+' || $debug_param[3] == 'stick')
|
|
||||||
{
|
|
||||||
cookie('e107_debug_level', 'level='.$dVal, time() + 86400);
|
|
||||||
}
|
|
||||||
if ($debug_param[3] == '-' || $debug_param[3] == 'unstick')
|
|
||||||
{
|
|
||||||
cookie('e107_debug_level', '', time() - 3600);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->debug_level = $dVal;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function activated()
|
||||||
|
{
|
||||||
|
if ((strstr(e_MENU, "debug") || isset($_COOKIE['e107_debug_level'])) || deftrue('e_DEBUG')) // ADMIN and getperms('0') are not available at this point.
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public static function init()
|
||||||
|
{
|
||||||
|
if(!self::activated())
|
||||||
|
{
|
||||||
|
self::setConstants();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (preg_match('/debug(=?)(.*?),?(\+|stick|-|unstick|$)/', e_MENU, $debug_param) || isset($_COOKIE['e107_debug_level']))
|
||||||
|
{
|
||||||
|
$dVals = '';
|
||||||
|
if (!isset($debug_param[1]) || ($debug_param[1] == '')) $debug_param[1] = '=';
|
||||||
|
if (isset($_COOKIE['e107_debug_level']))
|
||||||
|
{
|
||||||
|
$dVals = substr($_COOKIE['e107_debug_level'], 6);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (preg_match('/debug(=?)(.*?),?(\+|stick|-|unstick|$)/', e_MENU))
|
||||||
|
{
|
||||||
|
$dVals = $debug_param[1] == '=' ? $debug_param[2] : 'everything';
|
||||||
|
}
|
||||||
|
|
||||||
|
$aDVal = explode('.', $dVals); // support multiple values, OR'd together
|
||||||
|
$dVal = 0;
|
||||||
|
|
||||||
|
|
||||||
|
foreach ($aDVal as $curDVal)
|
||||||
|
{
|
||||||
|
if (isset(self::$aDebugShortcuts[$curDVal]))
|
||||||
|
{
|
||||||
|
$dVal |= self::$aDebugShortcuts[$curDVal];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$dVal |= intval($curDVal);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($debug_param[3]))
|
||||||
|
{
|
||||||
|
if ($debug_param[3] == '+' || $debug_param[3] == 'stick')
|
||||||
|
{
|
||||||
|
cookie('e107_debug_level', 'level=' . $dVal, time() + 86400);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($debug_param[3] == '-' || $debug_param[3] == 'unstick')
|
||||||
|
{
|
||||||
|
cookie('e107_debug_level', '', time() - 3600);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
self::$debug_level = $dVal;
|
||||||
|
}
|
||||||
|
|
||||||
|
self::setConstants();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define all debug constants -- each one will be zero or a value
|
||||||
|
* USING DEBUG DEFINITIONS
|
||||||
|
* Since these are Bit Values, **never** test using < or > comparisons. Always
|
||||||
|
* test using boolean operations, such as
|
||||||
|
* @example if (E107_DBG_PATH)
|
||||||
|
* @example if (E107_DBG_SQLQUERIES | E107_DBG_SQLDETAILS)
|
||||||
|
* Since constants are defined for all possible bits, you should never need to use a number value like
|
||||||
|
* @example if (E107_DEBUG_LEVEL & 256)
|
||||||
|
* And there's never a reason to use
|
||||||
|
* if (E107_DEBUG_LEVEL > 254)
|
||||||
|
*/
|
||||||
|
private static function setConstants()
|
||||||
|
{
|
||||||
|
|
||||||
|
if(!defined('E107_DEBUG_LEVEL'))
|
||||||
|
{
|
||||||
|
define('E107_DEBUG_LEVEL', self::getLevel());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Basic levels
|
||||||
|
define('E107_DBG_BASIC', (E107_DEBUG_LEVEL & 1)); // basics: worst php errors, sql errors, log, etc
|
||||||
|
define('E107_DBG_SQLQUERIES', (E107_DEBUG_LEVEL & 2)); // display all sql queries
|
||||||
|
define('E107_DBG_TRAFFIC', (E107_DEBUG_LEVEL & 4)); // display traffic counters
|
||||||
|
define('E107_DBG_FILLIN8', (E107_DEBUG_LEVEL & 8)); // fill in what it is
|
||||||
|
define('E107_DBG_FILLIN16', (E107_DEBUG_LEVEL & 16)); // fill in what it is
|
||||||
|
define('E107_DBG_FILLIN32', (E107_DEBUG_LEVEL & 32)); // fill in what it is
|
||||||
|
define('E107_DBG_FILLIN64', (E107_DEBUG_LEVEL & 64)); // fill in what it is
|
||||||
|
define('E107_DBG_FILLIN128', (E107_DEBUG_LEVEL & 128)); // fill in what it is
|
||||||
|
|
||||||
|
// Gory detail levels
|
||||||
|
define('E107_DBG_TIMEDETAILS',(E107_DEBUG_LEVEL & 256)); // detailed time profile
|
||||||
|
define('E107_DBG_SQLDETAILS', (E107_DEBUG_LEVEL & 512)); // detailed sql analysis
|
||||||
|
define('E107_DBG_PATH', (E107_DEBUG_LEVEL & 1024)); // show e107 predefined paths
|
||||||
|
define('E107_DBG_BBSC', (E107_DEBUG_LEVEL & 2048)); // Show BBCode/ Shortcode usage in postings
|
||||||
|
define('E107_DBG_SC', (E107_DEBUG_LEVEL & 4096)); // Dump (inline) SC filenames as used
|
||||||
|
define('E107_DBG_ERRBACKTRACE', (E107_DEBUG_LEVEL & 8192)); // show backtrace for php errors
|
||||||
|
define('E107_DBG_DEPRECATED', (E107_DEBUG_LEVEL & 16384)); // Show use of deprecated functions
|
||||||
|
define('E107_DBG_ALLERRORS', (E107_DEBUG_LEVEL & 32768)); // show ALL php errors (including notices), not just fatal issues
|
||||||
|
define('E107_DBG_INCLUDES', (E107_DEBUG_LEVEL & 65536)); // show included file list
|
||||||
|
define('E107_DBG_NOTICES', (E107_DEBUG_LEVEL & 32768)); // show included file list
|
||||||
|
|
||||||
|
if(!defined('e_DEBUG'))
|
||||||
|
{
|
||||||
|
$e_DEBUG = (E107_DEBUG_LEVEL > 0);
|
||||||
|
define('e_DEBUG', $e_DEBUG);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getLevel()
|
||||||
|
{
|
||||||
|
return self::$debug_level;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function setLevel($level = 0)
|
||||||
|
{
|
||||||
|
self::$debug_level = $level;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function set_error_reporting()
|
function set_error_reporting()
|
||||||
{
|
{
|
||||||
@ -183,6 +209,7 @@ class e107_debug {
|
|||||||
|
|
||||||
// Quick debug message logger
|
// Quick debug message logger
|
||||||
// Example: e7debug(__FILE__.__LINE__.": myVar is ".print_r($myVar,TRUE));
|
// Example: e7debug(__FILE__.__LINE__.": myVar is ".print_r($myVar,TRUE));
|
||||||
|
/*
|
||||||
function e7debug($message,$TraceLev=1)
|
function e7debug($message,$TraceLev=1)
|
||||||
{
|
{
|
||||||
if (!E107_DEBUG_LEVEL) return;
|
if (!E107_DEBUG_LEVEL) return;
|
||||||
@ -192,5 +219,4 @@ function e7debug($message,$TraceLev=1)
|
|||||||
$db_debug->log($message,$TraceLev);
|
$db_debug->log($message,$TraceLev);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
?>
|
|
||||||
|
@ -939,9 +939,9 @@ class e107
|
|||||||
|
|
||||||
if($path && is_string($path) && !class_exists($class_name, false))
|
if($path && is_string($path) && !class_exists($class_name, false))
|
||||||
{
|
{
|
||||||
global $e107_debug, $_E107;
|
global $_E107;
|
||||||
|
|
||||||
if(($e107_debug || !empty($_E107['debug']) || (defined('e_DEBUG') && e_DEBUG === true) ))
|
if((!empty($_E107['debug']) || (defined('e_DEBUG') && e_DEBUG === true) ))
|
||||||
{
|
{
|
||||||
require_once($path);
|
require_once($path);
|
||||||
}
|
}
|
||||||
|
@ -600,7 +600,7 @@ class e_menu
|
|||||||
// global $sql; // required at the moment.
|
// global $sql; // required at the moment.
|
||||||
|
|
||||||
|
|
||||||
global $sc_style, $e107_debug;
|
global $sc_style;
|
||||||
|
|
||||||
|
|
||||||
$sql = e107::getDb();
|
$sql = e107::getDb();
|
||||||
@ -627,7 +627,7 @@ class e_menu
|
|||||||
{
|
{
|
||||||
echo "\n<!-- Menu Start: ".$mname." -->\n";
|
echo "\n<!-- Menu Start: ".$mname." -->\n";
|
||||||
}
|
}
|
||||||
e107::getDB()->db_Mark_Time($mname);
|
e107::getDb()->db_Mark_Time($mname);
|
||||||
|
|
||||||
if(is_numeric($mpath) || ($mname === false)) // Custom Page/Menu
|
if(is_numeric($mpath) || ($mname === false)) // Custom Page/Menu
|
||||||
{
|
{
|
||||||
@ -639,7 +639,7 @@ class e_menu
|
|||||||
if(!empty($page['menu_class']) && !check_class($page['menu_class']))
|
if(!empty($page['menu_class']) && !check_class($page['menu_class']))
|
||||||
{
|
{
|
||||||
echo "\n<!-- Menu not rendered due to userclass settings -->\n";
|
echo "\n<!-- Menu not rendered due to userclass settings -->\n";
|
||||||
return;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$caption = (vartrue($page['menu_icon'])) ? $tp->toIcon($page['menu_icon']) : '';
|
$caption = (vartrue($page['menu_icon'])) ? $tp->toIcon($page['menu_icon']) : '';
|
||||||
@ -694,9 +694,9 @@ class e_menu
|
|||||||
$pref = e107::getPref(); // possibly used by plugin menu.
|
$pref = e107::getPref(); // possibly used by plugin menu.
|
||||||
|
|
||||||
|
|
||||||
$e107_debug ? include(e_PLUGIN.$mpath.$mname.'.php') : @include(e_PLUGIN.$mpath.$mname.'.php');
|
deftrue('e_DEBUG') ? include(e_PLUGIN.$mpath.$mname.'.php') : @include(e_PLUGIN.$mpath.$mname.'.php');
|
||||||
}
|
}
|
||||||
e107::getDB()->db_Mark_Time("(After ".$mname.")");
|
e107::getDb()->db_Mark_Time("(After ".$mname.")");
|
||||||
|
|
||||||
if(e_DEBUG === true)
|
if(e_DEBUG === true)
|
||||||
{
|
{
|
||||||
@ -709,5 +709,8 @@ class e_menu
|
|||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unset($pref);
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -540,7 +540,7 @@ class eMessage
|
|||||||
|
|
||||||
foreach ($typesArray as $type)
|
foreach ($typesArray as $type)
|
||||||
{
|
{
|
||||||
if(E_MESSAGE_DEBUG === $type && !deftrue('E107_DEBUG_LEVEL'))
|
if(E_MESSAGE_DEBUG === $type && (!deftrue('E107_DEBUG_LEVEL') || !ADMIN))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -1069,7 +1069,7 @@ class e_parse_shortcode
|
|||||||
$sql->db_Mark_Time("SC ".$code);
|
$sql->db_Mark_Time("SC ".$code);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (E107_DBG_SC)
|
if (E107_DBG_SC && ADMIN)
|
||||||
{
|
{
|
||||||
|
|
||||||
$dbg = "<strong>";
|
$dbg = "<strong>";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user