diff --git a/class2.php b/class2.php index 6337af479..92221c703 100644 --- a/class2.php +++ b/class2.php @@ -11,9 +11,9 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/class2.php,v $ -| $Revision: 1.2 $ -| $Date: 2006-12-03 03:26:22 $ -| $Author: mcfly_e107 $ +| $Revision: 1.3 $ +| $Date: 2006-12-05 09:32:15 $ +| $Author: mrpete $ +----------------------------------------------------------------------------+ */ // @@ -83,7 +83,7 @@ $_SERVER['PHP_SELF'] = (($pos = strpos($_SERVER['PHP_SELF'], ".php")) !== false // // D: Setup PHP error handling -// (Now we can see PHP errors) +// (Now we can see PHP errors) -- but note that DEBUG is not yet enabled! // $error_handler = new error_handler(); set_error_handler(array(&$error_handler, "handle_error")); @@ -637,7 +637,7 @@ $ns=new e107table; $e107->ban(); -if($pref['force_userupdate'] && USER) { +if(varset($pref['force_userupdate']) && USER) { if(force_userupdate()) { header("Location: ".e_BASE."usersettings.php?update"); } @@ -845,8 +845,14 @@ if (!class_exists('convert')) //@require_once(e_HANDLER."debug_handler.php"); //------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------// function js_location($qry){ + global $error_handler; + if (count($error_handler->errors)) { + echo $error_handler->return_errors(); + exit; + } else { echo "\n"; exit; } +} function check_email($email) { return preg_match("/^([_a-zA-Z0-9-+]+)(\.[_a-zA-Z0-9-]+)*@([a-zA-Z0-9-]+)(\.[a-zA-Z0-9-]+)*(\.[a-zA-Z]{2,6})$/" , $email) ? $email : FALSE; @@ -1515,6 +1521,9 @@ class error_handler { var $debug = false; function error_handler() { + // + // This is initialized before the current debug level is known + // if ((isset($_SERVER['QUERY_STRING']) && strpos($_SERVER['QUERY_STRING'], 'debug=') !== FALSE) || isset($_COOKIE['e107_debug_level'])) { $this->debug = true; error_reporting(E_ALL); @@ -1524,9 +1533,10 @@ class error_handler { } function handle_error($type, $message, $file, $line, $context) { + $startup_error = (!defined('E107_DEBUG_LEVEL')); // Error before debug system initialized switch($type) { case E_NOTICE: - if ($this->debug == true) { + if ($startup_error || E107_DBG_ALLERRORS) { $error['short'] = "Notice: {$message}, Line {$line} of {$file}
\n"; $trace = debug_backtrace(); $backtrace[0] = (isset($trace[1]) ? $trace[1] : ""); @@ -1536,7 +1546,7 @@ class error_handler { } break; case E_WARNING: - if ($this->debug == true) { + if ($startup_error || E107_DBG_BASIC) { $error['short'] = "Warning: {$message}, Line {$line} of {$file}
\n"; $trace = debug_backtrace(); $backtrace[0] = (isset($trace[1]) ? $trace[1] : ""); @@ -1563,11 +1573,19 @@ class error_handler { function return_errors() { $index = 0; $colours[0] = "#C1C1C1"; $colours[1] = "#B6B6B6"; $ret = "\n"; + if (E107_DBG_ERRBACKTRACE) + { foreach ($this->errors as $key => $value) { $ret .= "\t\n\t\t\n\t\n"; $ret .= "\t\n\n"; if($index == 0) { $index = 1; } else { $index = 0; } } + } else { + foreach ($this->errors as $key => $value) + { + $ret .= "\n"; + } + } $ret .= "
{$value['short']}
{$value['short']}
"; return $ret; } diff --git a/e107_themes/templates/footer_default.php b/e107_themes/templates/footer_default.php index 6c1d1a71f..4e5639a2a 100644 --- a/e107_themes/templates/footer_default.php +++ b/e107_themes/templates/footer_default.php @@ -3,7 +3,7 @@ + ----------------------------------------------------------------------------+ | e107 website system | -| ???Steve Dunstan 2001-2002 +| ©Steve Dunstan 2001-2002 | http://e107.org | jalist@e107.org | @@ -11,12 +11,13 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/e107_themes/templates/footer_default.php,v $ -| $Revision: 1.1.1.1 $ -| $Date: 2006-12-02 04:36:13 $ -| $Author: mcfly_e107 $ +| $Revision: 1.2 $ +| $Date: 2006-12-05 09:33:20 $ +| $Author: mrpete $ +----------------------------------------------------------------------------+ */ if (!defined('e107_INIT')) { exit; } +$In_e107_Footer = TRUE; // For registered shutdown function global $eTraffic, $error_handler, $db_time, $sql, $sql2, $mySQLserver, $mySQLuser, $mySQLpassword, $mySQLdefaultdb, $CUSTOMFOOTER, $FOOTER, $e107; @@ -25,6 +26,7 @@ global $eTraffic, $error_handler, $db_time, $sql, $sql2, $mySQLserver, $mySQLuse // // The following items have been carefully designed so page processing will finish properly // Please DO NOT re-order these items without asking first! You WILL break something ;) +// These letters match the USER footer (that's why there may be B.1,B.2) // // A Ensure sql and traffic objects exist // [Next few ONLY if a regular page; not done for popups] @@ -79,37 +81,9 @@ if(varset($e107_popup)!=1){ if ((ADMIN || $pref['developer']) && E107_DEBUG_LEVEL) { - global $db_debug,$ns; + global $db_debug; echo "\n\n"; - if (!isset($ns)) { - echo "Why did ns go away?
"; - $ns = new e107table; - } - - $tmp = $eTraffic->Display(); - if (strlen($tmp)) { - $ns->tablerender('Traffic Counters', $tmp); - } - $tmp = $db_debug->Show_Performance(); - if (strlen($tmp)) { - $ns->tablerender('Time Analysis', $tmp); - } - $tmp = $db_debug->Show_SQL_Details(); - if (strlen($tmp)) { - $ns->tablerender('SQL Analysis', $tmp); - } - $tmp = $db_debug->Show_SC_BB(); - if (strlen($tmp)) { - $ns->tablerender('Shortcodes / BBCode',$tmp); - } - $tmp = $db_debug->Show_PATH(); - if (strlen($tmp)) { - $ns->tablerender('Paths', $tmp); - } - $tmp = $db_debug->Show_DEPRECATED(); - if (strlen($tmp)) { - $ns->tablerender('Deprecated Function Usage', $tmp); - } + $db_debug->Show_All(); } /* @@ -184,7 +158,8 @@ if((ADMIN == true || $pref['developer']) && $error_handler->debug == true) { // // E Last themed footer code, usually JS // -if (function_exists('theme_foot')) { +if (function_exists('theme_foot')) +{ echo theme_foot(); } @@ -252,4 +227,7 @@ if($pref['compress_output'] == true && $server_support == true && $browser_suppo echo $page; } +unset($In_e107_Footer); +$e107_Clean_Exit=TRUE; // For registered shutdown function -- let it know all is well! + ?> \ No newline at end of file diff --git a/e107_themes/templates/header_default.php b/e107_themes/templates/header_default.php index 16df7eb46..93e67596a 100644 --- a/e107_themes/templates/header_default.php +++ b/e107_themes/templates/header_default.php @@ -6,9 +6,9 @@ | Released under the terms and conditions of the GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/e107_themes/templates/header_default.php,v $ -| $Revision: 1.1.1.1 $ -| $Date: 2006-12-02 04:36:13 $ -| $Author: mcfly_e107 $ +| $Revision: 1.2 $ +| $Date: 2006-12-05 09:33:20 $ +| $Author: mrpete $ +-----------------------------------------------------------------------------------------------+ */ @@ -74,7 +74,7 @@ if (!function_exists("parseheader")) { header("Content-type: text/html; charset=".CHARSET, true); -echo (defined("STANDARDS_MODE") ? "" : "")."\n"; +echo (defined("STANDARDS_MODE") ? "" : "\n")."\n"; // // C: Send start of HTML @@ -188,6 +188,8 @@ echo "\n" : ""; // --- Load plugin Meta files and eplug_ before others -------- +if (is_array($pref['e_meta_list'])) +{ foreach($pref['e_meta_list'] as $val) { if(is_readable(e_PLUGIN.$val."/e_meta.php")) @@ -196,7 +198,7 @@ foreach($pref['e_meta_list'] as $val) require_once(e_PLUGIN.$val."/e_meta.php"); } } - +} $diz_merge = (defined("META_MERGE") && META_MERGE != FALSE && $pref['meta_description'][e_LANGUAGE]) ? $pref['meta_description'][e_LANGUAGE]." " : ""; $key_merge = (defined("META_MERGE") && META_MERGE != FALSE && $pref['meta_keywords'][e_LANGUAGE]) ? $pref['meta_keywords'][e_LANGUAGE]."," : "";