Zeile 6 | Zeile 6 |
---|
* Website: http://www.mybboard.net * License: http://www.mybboard.net/about/license *
|
* Website: http://www.mybboard.net * License: http://www.mybboard.net/about/license *
|
* $Id: class_error.php 3790 2008-04-23 22:50:33Z Tikitiki $
| * $Id: class_error.php 4622 2009-12-20 19:36:00Z RyanGordon $
|
*/ // Set to 1 if recieving a blank page (template failure).
| */ // Set to 1 if recieving a blank page (template failure).
|
Zeile 27 | Zeile 27 |
---|
{ // This constant has been defined since PHP 5.2. define("E_RECOVERABLE_ERROR", 4096);
|
{ // This constant has been defined since PHP 5.2. define("E_RECOVERABLE_ERROR", 4096);
|
| }
if(!defined("E_DEPRECATED")) { // This constant has been defined since PHP 5.3. define("E_DEPRECATED", 8192);
|
}
class errorHandler {
| }
class errorHandler {
|
Zeile 45 | Zeile 51 |
---|
E_CORE_WARNING => 'Core Warning', E_COMPILE_ERROR => 'Compile Error', E_COMPILE_WARNING => 'Compile Warning',
|
E_CORE_WARNING => 'Core Warning', E_COMPILE_ERROR => 'Compile Error', E_COMPILE_WARNING => 'Compile Warning',
|
| E_DEPRECATED => 'Deprecated Warning',
|
E_USER_ERROR => 'User Error', E_USER_WARNING => 'User Warning', E_USER_NOTICE => 'User Notice',
| E_USER_ERROR => 'User Error', E_USER_WARNING => 'User Warning', E_USER_NOTICE => 'User Notice',
|
Zeile 61 | Zeile 68 |
---|
* @var array */ var $ignore_types = array(
|
* @var array */ var $ignore_types = array(
|
| E_DEPRECATED,
|
E_NOTICE, E_USER_NOTICE, E_STRICT
| E_NOTICE, E_USER_NOTICE, E_STRICT
|
Zeile 112 | Zeile 120 |
---|
// Error reporting turned off (either globally or by @ before erroring statement) if(error_reporting() == 0)
|
// Error reporting turned off (either globally or by @ before erroring statement) if(error_reporting() == 0)
|
{ return; }
| { return; }
|
if(in_array($type, $this->ignore_types)) { return;
|
if(in_array($type, $this->ignore_types)) { return;
|
}
| }
|
$file = str_replace(MYBB_ROOT, "", $file);
$this->has_errors = true;
|
$file = str_replace(MYBB_ROOT, "", $file);
$this->has_errors = true;
|
if(($mybb->settings['errortypemedium'] == "both" || !$mybb->settings['errortypemedium']) || my_strpos(my_strtolower($this->error_types[$type]), $mybb->settings['errortypemedium'])) { if(defined("IN_TASK")) { global $task; require_once MYBB_ROOT."inc/functions_task.php"; if($file) { $filestr = " - Line: $line - File: $file"; } add_task_log($task['id'], "{$this->error_types[$type]} - [$type] ".var_export($message, true)."{$filestr}"); } // Saving error to log file. if($mybb->settings['errorlogmedium'] == "log" || $mybb->settings['errorlogmedium'] == "both") { $this->log_error($type, $message, $file, $line); }
// Are we emailing the Admin a copy? if($mybb->settings['errorlogmedium'] == "mail" || $mybb->settings['errorlogmedium'] == "both")
| // For some reason in the installer this setting is set to "<" $accepted_error_types = array('both', 'error', 'warning'); if(!in_array($mybb->settings['errortypemedium'], $accepted_error_types)) { $mybb->settings['errortypemedium'] = "both"; } if(defined("IN_TASK")) { global $task; require_once MYBB_ROOT."inc/functions_task.php"; if($file)
|
{
|
{
|
$this->email_error($type, $message, $file, $line);
| $filestr = " - Line: $line - File: $file";
|
}
|
}
|
if($type == MYBB_SQL)
| add_task_log($task, "{$this->error_types[$type]} - [$type] ".var_export($message, true)."{$filestr}"); } // Saving error to log file. if($mybb->settings['errorlogmedium'] == "log" || $mybb->settings['errorlogmedium'] == "both") { $this->log_error($type, $message, $file, $line); }
// Are we emailing the Admin a copy? if($mybb->settings['errorlogmedium'] == "mail" || $mybb->settings['errorlogmedium'] == "both") { $this->email_error($type, $message, $file, $line); } // SQL Error if($type == MYBB_SQL) { $this->output_error($type, $message, $file, $line); } else { // Do we have a PHP error? if(my_strpos(my_strtolower($this->error_types[$type]), 'warning') === false)
|
{ $this->output_error($type, $message, $file, $line); }
|
{ $this->output_error($type, $message, $file, $line); }
|
| // PHP Warning
|
else {
|
else {
|
if(my_strpos(my_strtolower($this->error_types[$type]), 'warning') === false)
| if($mybb->settings['errortypemedium'] == "error")
|
{
|
{
|
$this->output_error($type, $message, $file, $line);
| echo "<div class=\"php_warning\">MyBB Internal: One or more warnings occured. Please contact your administrator for assistance.</div>";
|
} else { global $templates;
|
} else { global $templates;
|
|
|
$warning = "<strong>{$this->error_types[$type]}</strong> [$type] $message - Line: $line - File: $file PHP ".PHP_VERSION." (".PHP_OS.")<br />\n"; if(is_object($templates) && method_exists($templates, "get") && !defined("IN_ADMINCP")) {
| $warning = "<strong>{$this->error_types[$type]}</strong> [$type] $message - Line: $line - File: $file PHP ".PHP_VERSION." (".PHP_OS.")<br />\n"; if(is_object($templates) && method_exists($templates, "get") && !defined("IN_ADMINCP")) {
|
Zeile 175 | Zeile 198 |
---|
else { echo "<div class=\"php_warning\">{$warning}".$this->generate_backtrace()."</div>";
|
else { echo "<div class=\"php_warning\">{$warning}".$this->generate_backtrace()."</div>";
|
}
| }
|
} } }
| } } }
|
Zeile 310 | Zeile 333 |
---|
*/ function email_error($type, $message, $file, $line) {
|
*/ function email_error($type, $message, $file, $line) {
|
| global $mybb;
|
if(!$mybb->settings['adminemail']) { return false;
|
if(!$mybb->settings['adminemail']) { return false;
|
}
| }
|
if($type == MYBB_SQL) {
| if($type == MYBB_SQL) {
|
Zeile 321 | Zeile 346 |
---|
} $message = "Your copy of MyBB running on {$mybb->settings['bbname']} ({$mybb->settings['bburl']}) has experienced an error. Details of the error include:\n---\nType: $type\nFile: $file (Line no. $line)\nMessage\n$message";
|
} $message = "Your copy of MyBB running on {$mybb->settings['bbname']} ({$mybb->settings['bburl']}) has experienced an error. Details of the error include:\n---\nType: $type\nFile: $file (Line no. $line)\nMessage\n$message";
|
$error = @my_mail($mybb->settings['adminemail'], "MyBB error on {$mybb->settings['bbname']}", $message, $mybb->settings['adminemail']); if($error) { $this->output_error(MYBB_GENERAL, $error); }
| @my_mail($mybb->settings['adminemail'], "MyBB error on {$mybb->settings['bbname']}", $message, $mybb->settings['adminemail']);
|
}
function output_error($type, $message, $file, $line)
| }
function output_error($type, $message, $file, $line)
|
Zeile 342 | Zeile 363 |
---|
{ $title = "MyBB SQL Error"; $error_message = "<p>MyBB has experienced an internal SQL error and cannot continue.</p>";
|
{ $title = "MyBB SQL Error"; $error_message = "<p>MyBB has experienced an internal SQL error and cannot continue.</p>";
|
$error_message .= "<dl>\n"; $error_message .= "<dt>SQL Error:</dt>\n<dd>{$message['error_no']} - {$message['error']}</dd>\n"; if($message['query'] != "")
| if($mybb->settings['errortypemedium'] == "both" || $mybb->settings['errortypemedium'] == "error")
|
{
|
{
|
$error_message .= "<dt>Query:</dt>\n<dd>{$message['query']}</dd>\n";
| $error_message .= "<dl>\n"; $error_message .= "<dt>SQL Error:</dt>\n<dd>{$message['error_no']} - {$message['error']}</dd>\n"; if($message['query'] != "") { $error_message .= "<dt>Query:</dt>\n<dd>{$message['query']}</dd>\n"; } $error_message .= "</dl>\n";
|
}
|
}
|
$error_message .= "</dl>\n";
| |
} else { $title = "MyBB Internal Error"; $error_message = "<p>MyBB has experienced an internal error and cannot continue.</p>";
|
} else { $title = "MyBB Internal Error"; $error_message = "<p>MyBB has experienced an internal error and cannot continue.</p>";
|
$error_message .= "<dl>\n"; $error_message .= "<dt>Error Type:</dt>\n<dd>{$this->error_types[$type]} ($type)</dd>\n"; $error_message .= "<dt>Error Message:</dt>\n<dd>{$message}</dd>\n"; if(!empty($file))
| if($mybb->settings['errortypemedium'] == "both" || $mybb->settings['errortypemedium'] == "error")
|
{
|
{
|
$error_message .= "<dt>Location:</dt><dd>File: {$file}<br />Line: {$line}</dd>\n"; if(!@preg_match('#config\.php|settings\.php#', $file) && @file_exists($file))
| $error_message .= "<dl>\n"; $error_message .= "<dt>Error Type:</dt>\n<dd>{$this->error_types[$type]} ($type)</dd>\n"; $error_message .= "<dt>Error Message:</dt>\n<dd>{$message}</dd>\n"; if(!empty($file))
|
{
|
{
|
$code_pre = @file($file);
| $error_message .= "<dt>Location:</dt><dd>File: {$file}<br />Line: {$line}</dd>\n"; if(!@preg_match('#config\.php|settings\.php#', $file) && @file_exists($file)) { $code_pre = @file($file);
$code = "";
if(isset($code_pre[$line-4])) { $code .= $line-3 . ". ".$code_pre[$line-4]; }
if(isset($code_pre[$line-3])) { $code .= $line-2 . ". ".$code_pre[$line-3]; }
if(isset($code_pre[$line-2])) { $code .= $line-1 . ". ".$code_pre[$line-2]; }
$code .= $line . ". ".$code_pre[$line-1]; // The actual line.
|
|
|
$code = "";
if(isset($code_pre[$line-4])) { $code .= $line-3 . ". ".$code_pre[$line-4]; }
if(isset($code_pre[$line-3])) { $code .= $line-2 . ". ".$code_pre[$line-3]; }
if(isset($code_pre[$line-2])) { $code .= $line-1 . ". ".$code_pre[$line-2]; }
$code .= $line . ". ".$code_pre[$line-1]; // The actual line.
if(isset($code_pre[$line])) { $code .= $line+1 . ". ".$code_pre[$line]; }
if(isset($code_pre[$line+1])) { $code .= $line+2 . ". ".$code_pre[$line+1]; }
if(isset($code_pre[$line+2])) { $code .= $line+3 . ". ".$code_pre[$line+2]; }
unset($code_pre);
$parser_exists = false;
if(!is_object($parser) || !method_exists($parser, 'mycode_parse_php')) { if(@file_exists(MYBB_ROOT."inc/class_parser.php"))
| if(isset($code_pre[$line])) { $code .= $line+1 . ". ".$code_pre[$line]; }
if(isset($code_pre[$line+1])) { $code .= $line+2 . ". ".$code_pre[$line+1]; }
if(isset($code_pre[$line+2])) { $code .= $line+3 . ". ".$code_pre[$line+2]; }
unset($code_pre);
$parser_exists = false;
if(!is_object($parser) || !method_exists($parser, 'mycode_parse_php')) { if(@file_exists(MYBB_ROOT."inc/class_parser.php")) { @require_once MYBB_ROOT."inc/class_parser.php"; $parser = new postParser; $parser_exists = true; } } else
|
{
|
{
|
@require_once MYBB_ROOT."inc/class_parser.php"; $parser = new postParser;
| |
$parser_exists = true; }
|
$parser_exists = true; }
|
| if($parser_exists) { $code = $parser->mycode_parse_php($code, true); } else { $code = @nl2br($code); }
$error_message .= "<dt>Code:</dt><dd>{$code}</dd>\n";
|
}
|
}
|
else { $parser_exists = true; }
if($parser_exists) { $code = $parser->mycode_parse_php($code, true); } else { $code = @nl2br($code); }
$error_message .= "<dt>Code:</dt><dd>{$code}</dd>\n";
| |
}
|
}
|
| $backtrace = $this->generate_backtrace(); if($backtrace && $type != MYBB_GENERAL) { $error_message .= "<dt>Backtrace:</dt><dd>{$backtrace}</dd>\n"; } $error_message .= "</dl>\n";
|
}
|
}
|
$backtrace = $this->generate_backtrace(); if($backtrace && $type != MYBB_GENERAL) { $error_message .= "<dt>Backtrace:</dt><dd>{$backtrace}</dd>\n"; } $error_message .= "</dl>\n";
| |
}
| }
|
Zeile 446 | Zeile 473 |
---|
$charset = 'UTF-8'; }
|
$charset = 'UTF-8'; }
|
if(!headers_sent())
| if(!headers_sent() && !defined("IN_INSTALL"))
|
{ @header("Content-type: text/html; charset={$charset}");
|
{ @header("Content-type: text/html; charset={$charset}");
|
| $_SERVER['PHP_SELF'] = htmlspecialchars_uni($_SERVER['PHP_SELF']);
|
echo <<<EOF <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
| echo <<<EOF <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|