Zeile 165 | Zeile 165 |
---|
$accepted_error_types = array('both', 'error', 'warning', 'none'); if(!in_array($mybb->settings['errortypemedium'], $accepted_error_types)) {
|
$accepted_error_types = array('both', 'error', 'warning', 'none'); if(!in_array($mybb->settings['errortypemedium'], $accepted_error_types)) {
|
$mybb->settings['errortypemedium'] = "both";
| $mybb->settings['errortypemedium'] = "none";
|
}
if(defined("IN_TASK"))
| }
if(defined("IN_TASK"))
|
Zeile 330 | Zeile 330 |
---|
// Do not log something that might be executable $message = str_replace('<?', '< ?', $message);
|
// Do not log something that might be executable $message = str_replace('<?', '< ?', $message);
|
| $back_trace = $this->generate_backtrace(false, 2);
if($back_trace) { $back_trace = "\t<back_trace>{$back_trace}</back_trace>\n"; }
|
$error_data = "<error>\n"; $error_data .= "\t<dateline>".TIME_NOW."</dateline>\n";
| $error_data = "<error>\n"; $error_data .= "\t<dateline>".TIME_NOW."</dateline>\n";
|
Zeile 338 | Zeile 345 |
---|
$error_data .= "\t<type>".$type."</type>\n"; $error_data .= "\t<friendly_type>".$this->error_types[$type]."</friendly_type>\n"; $error_data .= "\t<message>".$message."</message>\n";
|
$error_data .= "\t<type>".$type."</type>\n"; $error_data .= "\t<friendly_type>".$this->error_types[$type]."</friendly_type>\n"; $error_data .= "\t<message>".$message."</message>\n";
|
| $error_data .= $back_trace;
|
$error_data .= "</error>\n\n";
|
$error_data .= "</error>\n\n";
|
|
|
if(trim($mybb->settings['errorloglocation']) != "") { @error_log($error_data, 3, $mybb->settings['errorloglocation']);
|
if(trim($mybb->settings['errorloglocation']) != "") { @error_log($error_data, 3, $mybb->settings['errorloglocation']);
|
}
| }
|
else { @error_log($error_data, 0);
| else { @error_log($error_data, 0);
|
Zeile 364 | Zeile 372 |
---|
global $mybb;
if(!$mybb->settings['adminemail'])
|
global $mybb;
if(!$mybb->settings['adminemail'])
|
{
| {
|
return false; }
if($type == MYBB_SQL) { $message = "SQL Error: {$message['error_no']} - {$message['error']}\nQuery: {$message['query']}";
|
return false; }
if($type == MYBB_SQL) { $message = "SQL Error: {$message['error_no']} - {$message['error']}\nQuery: {$message['query']}";
|
}
$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";
| }
if(function_exists('debug_backtrace')) { ob_start(); debug_print_backtrace(); $trace = ob_get_contents(); ob_end_clean();
$back_trace = "\nBack Trace: {$trace}"; } else { $back_trace = ''; }
$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{$back_trace}";
|
@my_mail($mybb->settings['adminemail'], "MyBB error on {$mybb->settings['bbname']}", $message, $mybb->settings['adminemail']);
|
@my_mail($mybb->settings['adminemail'], "MyBB error on {$mybb->settings['bbname']}", $message, $mybb->settings['adminemail']);
|
|
|
return true; }
| return true; }
|
Zeile 394 | Zeile 416 |
---|
{ $mybb->settings['bbname'] = "MyBB"; }
|
{ $mybb->settings['bbname'] = "MyBB"; }
|
|
|
if($type == MYBB_SQL) { $title = "MyBB SQL Error";
| if($type == MYBB_SQL) { $title = "MyBB SQL Error";
|
Zeile 431 | Zeile 453 |
---|
$code = "";
if(isset($code_pre[$line-4]))
|
$code = "";
if(isset($code_pre[$line-4]))
|
{
| {
|
$code .= $line-3 . ". ".$code_pre[$line-4]; }
| $code .= $line-3 . ". ".$code_pre[$line-4]; }
|
Zeile 509 | Zeile 531 |
---|
{ $charset = 'UTF-8'; }
|
{ $charset = 'UTF-8'; }
|
| $contact_site_owner = ''; $is_in_contact = defined('THIS_SCRIPT') && THIS_SCRIPT === 'contact.php'; if(!$is_in_contact && ($mybb->settings['contactlink'] == "contact.php" && $mybb->settings['contact'] == 1 && ($mybb->settings['contact_guests'] != 1 && $mybb->user['uid'] == 0 || $mybb->user['uid'] > 0)) || $mybb->settings['contactlink'] != "contact.php") { if(!my_validate_url($mybb->settings['contactlink'], true, true) && my_substr($mybb->settings['contactlink'], 0, 7) != 'mailto:') { $mybb->settings['contactlink'] = $mybb->settings['bburl'].'/'.$mybb->settings['contactlink']; }
$contact_site_owner = <<<HTML If this problem persists, please <a href="{$mybb->settings['contactlink']}">contact the site owner</a>. HTML; }
$contact = <<<HTML <p> <strong>If you're a visitor of this website</strong>, please wait a few minutes and try again.{$contact_site_owner} </p>
<p> <strong>If you are the site owner</strong>, please check the <a href="https://docs.mybb.com">MyBB Documentation</a> for help resolving <a href="https://docs.mybb.com/1.8/faq/">common issues</a>, or get technical help on the <a href="https://community.mybb.com/">MyBB Community Forums</a>. </p> HTML;
|
if(!headers_sent() && !defined("IN_INSTALL") && !defined("IN_UPGRADE")) {
| if(!headers_sent() && !defined("IN_INSTALL") && !defined("IN_UPGRADE")) {
|
Zeile 550 | Zeile 596 |
---|
<div id="error"> {$error_message}
|
<div id="error"> {$error_message}
|
<p id="footer">Please contact the <a href="https://mybb.com">MyBB Group</a> for technical support.</p>
| <p id="footer">{$contact}</p>
|
</div> </div> </div>
| </div> </div> </div>
|
Zeile 575 | Zeile 621 |
---|
<h2>{$title}</h2> <div id="mybb_error_error"> {$error_message}
|
<h2>{$title}</h2> <div id="mybb_error_error"> {$error_message}
|
<p id="mybb_error_footer">Please contact the <a href="https://mybb.com">MyBB Group</a> for technical support.</p>
| <p id="mybb_error_footer">{$contact}</p>
|
</div> </div> EOF;
| </div> </div> EOF;
|
Zeile 588 | Zeile 634 |
---|
* * @return string The generated backtrace */
|
* * @return string The generated backtrace */
|
function generate_backtrace()
| function generate_backtrace($html=true, $strip=1)
|
{ $backtrace = ''; if(function_exists("debug_backtrace")) {
|
{ $backtrace = ''; if(function_exists("debug_backtrace")) {
|
$trace = debug_backtrace(); $backtrace = "<table style=\"width: 100%; margin: 10px 0; border: 1px solid #aaa; border-collapse: collapse; border-bottom: 0;\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\">\n"; $backtrace .= "<thead><tr>\n"; $backtrace .= "<th style=\"border-bottom: 1px solid #aaa; background: #ccc; padding: 4px; text-align: left; font-size: 11px;\">File</th>\n"; $backtrace .= "<th style=\"border-bottom: 1px solid #aaa; background: #ccc; padding: 4px; text-align: left; font-size: 11px;\">Line</th>\n"; $backtrace .= "<th style=\"border-bottom: 1px solid #aaa; background: #ccc; padding: 4px; text-align: left; font-size: 11px;\">Function</th>\n"; $backtrace .= "</tr></thead>\n<tbody>\n";
// Strip off this function from trace array_shift($trace);
| $trace = debug_backtrace(1<<1 /* DEBUG_BACKTRACE_IGNORE_ARGS */);
if($html) { $backtrace = "<table style=\"width: 100%; margin: 10px 0; border: 1px solid #aaa; border-collapse: collapse; border-bottom: 0;\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\">\n"; $backtrace .= "<thead><tr>\n"; $backtrace .= "<th style=\"border-bottom: 1px solid #aaa; background: #ccc; padding: 4px; text-align: left; font-size: 11px;\">File</th>\n"; $backtrace .= "<th style=\"border-bottom: 1px solid #aaa; background: #ccc; padding: 4px; text-align: left; font-size: 11px;\">Line</th>\n"; $backtrace .= "<th style=\"border-bottom: 1px solid #aaa; background: #ccc; padding: 4px; text-align: left; font-size: 11px;\">Function</th>\n"; $backtrace .= "</tr></thead>\n<tbody>\n"; }
// Strip off calls from trace $trace = array_slice($trace, $strip);
$i = 0;
|
foreach($trace as $call)
|
foreach($trace as $call)
|
{
| {
|
if(empty($call['file'])) $call['file'] = "[PHP]";
|
if(empty($call['file'])) $call['file'] = "[PHP]";
|
if(empty($call['line'])) $call['line'] = " ";
| if(empty($call['line'])) $call['line'] = " ";
|
if(!empty($call['class'])) $call['function'] = $call['class'].$call['type'].$call['function']; $call['file'] = str_replace(MYBB_ROOT, "/", $call['file']);
|
if(!empty($call['class'])) $call['function'] = $call['class'].$call['type'].$call['function']; $call['file'] = str_replace(MYBB_ROOT, "/", $call['file']);
|
$backtrace .= "<tr>\n"; $backtrace .= "<td style=\"font-size: 11px; padding: 4px; border-bottom: 1px solid #ccc;\">{$call['file']}</td>\n"; $backtrace .= "<td style=\"font-size: 11px; padding: 4px; border-bottom: 1px solid #ccc;\">{$call['line']}</td>\n"; $backtrace .= "<td style=\"font-size: 11px; padding: 4px; border-bottom: 1px solid #ccc;\">{$call['function']}</td>\n"; $backtrace .= "</tr>\n";
| if($html) { $backtrace .= "<tr>\n"; $backtrace .= "<td style=\"font-size: 11px; padding: 4px; border-bottom: 1px solid #ccc;\">{$call['file']}</td>\n"; $backtrace .= "<td style=\"font-size: 11px; padding: 4px; border-bottom: 1px solid #ccc;\">{$call['line']}</td>\n"; $backtrace .= "<td style=\"font-size: 11px; padding: 4px; border-bottom: 1px solid #ccc;\">{$call['function']}</td>\n"; $backtrace .= "</tr>\n"; } else { $backtrace .= "#{$i} {$call['function']}() called at [{$call['file']}:{$call['line']}]\n"; }
$i++; }
if($html) { $backtrace .= "</tbody></table>\n";
|
}
|
}
|
$backtrace .= "</tbody></table>\n";
| |
} return $backtrace; }
| } return $backtrace; }
|