"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "Upload/inc/class_error.php" between
mybb_1822.zip and mybb_1823.zip

About: MyBB is a multilingual, standards-compliant and free forum (discussion board) software.

class_error.php  (mybb_1822):class_error.php  (mybb_1823)
skipping to change at line 168 skipping to change at line 168
} }
$file = str_replace(MYBB_ROOT, "", $file); $file = str_replace(MYBB_ROOT, "", $file);
$this->has_errors = true; $this->has_errors = true;
// For some reason in the installer this setting is set to "<" // For some reason in the installer this setting is set to "<"
$accepted_error_types = array('both', 'error', 'warning', 'none') ; $accepted_error_types = array('both', 'error', 'warning', 'none') ;
if(!in_array($mybb->settings['errortypemedium'], $accepted_error_ types)) 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"))
{ {
global $task; global $task;
require_once MYBB_ROOT."inc/functions_task.php"; require_once MYBB_ROOT."inc/functions_task.php";
$filestr = ''; $filestr = '';
if($file) if($file)
skipping to change at line 334 skipping to change at line 334
global $mybb; global $mybb;
if($type == MYBB_SQL) if($type == MYBB_SQL)
{ {
$message = "SQL Error: {$message['error_no']} - {$message ['error']}\nQuery: {$message['query']}"; $message = "SQL Error: {$message['error_no']} - {$message ['error']}\nQuery: {$message['query']}";
} }
// Do not log something that might be executable // Do not log something that might be executable
$message = str_replace('<?', '< ?', $message); $message = str_replace('<?', '< ?', $message);
if(function_exists('debug_backtrace')) $back_trace = $this->generate_backtrace(false, 2);
{
ob_start();
debug_print_backtrace();
$trace = ob_get_contents();
ob_end_clean();
$back_trace = "\t<back_trace>{$trace}</back_trace>\n"; if($back_trace)
}
else
{ {
$back_trace = ''; $back_trace = "\t<back_trace>{$back_trace}</back_trace>\n ";
} }
$error_data = "<error>\n"; $error_data = "<error>\n";
$error_data .= "\t<dateline>".TIME_NOW."</dateline>\n"; $error_data .= "\t<dateline>".TIME_NOW."</dateline>\n";
$error_data .= "\t<script>".$file."</script>\n"; $error_data .= "\t<script>".$file."</script>\n";
$error_data .= "\t<line>".$line."</line>\n"; $error_data .= "\t<line>".$line."</line>\n";
$error_data .= "\t<type>".$type."</type>\n"; $error_data .= "\t<type>".$type."</type>\n";
$error_data .= "\t<friendly_type>".$this->error_types[$type]."</f riendly_type>\n"; $error_data .= "\t<friendly_type>".$this->error_types[$type]."</f riendly_type>\n";
$error_data .= "\t<message>".$message."</message>\n"; $error_data .= "\t<message>".$message."</message>\n";
$error_data .= $back_trace; $error_data .= $back_trace;
skipping to change at line 542 skipping to change at line 535
if(isset($lang->settings['charset'])) if(isset($lang->settings['charset']))
{ {
$charset = $lang->settings['charset']; $charset = $lang->settings['charset'];
} }
else else
{ {
$charset = 'UTF-8'; $charset = 'UTF-8';
} }
$contact_site_owner = '';
$is_in_contact = defined('THIS_SCRIPT') && THIS_SCRIPT === 'conta
ct.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['c
ontactlink'] != "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']}">con
tact the site owner</a>.
HTML;
}
$contact = <<<HTML
<p>
<strong>If you're a visitor of this website</strong>, please wait a few m
inutes and try again.{$contact_site_owner}
</p>
<p>
<strong>If you are the site owner</strong>, please check the <a href="htt
ps://docs.mybb.com">MyBB Documentation</a> for help resolving <a href="https://d
ocs.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_UPGR ADE")) if(!headers_sent() && !defined("IN_INSTALL") && !defined("IN_UPGR ADE"))
{ {
@header('HTTP/1.1 503 Service Temporarily Unavailable'); @header('HTTP/1.1 503 Service Temporarily Unavailable');
@header('Status: 503 Service Temporarily Unavailable'); @header('Status: 503 Service Temporarily Unavailable');
@header('Retry-After: 1800'); @header('Retry-After: 1800');
@header("Content-type: text/html; charset={$charset}"); @header("Content-type: text/html; charset={$charset}");
$file_name = htmlspecialchars_uni(basename($_SERVER['SCRI PT_FILENAME'])); $file_name = htmlspecialchars_uni(basename($_SERVER['SCRI PT_FILENAME']));
echo <<<EOF echo <<<EOF
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/ DTD/xhtml11.dtd"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/ DTD/xhtml11.dtd">
skipping to change at line 582 skipping to change at line 599
<div id="container"> <div id="container">
<div id="logo"> <div id="logo">
<h1><a href="https://mybb.com/" title="MyBB"><span class= "invisible">MyBB</span></a></h1> <h1><a href="https://mybb.com/" title="MyBB"><span class= "invisible">MyBB</span></a></h1>
</div> </div>
<div id="content"> <div id="content">
<h2>{$title}</h2> <h2>{$title}</h2>
<div id="error"> <div id="error">
{$error_message} {$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>
</body> </body>
</html> </html>
EOF; EOF;
} }
else else
{ {
echo <<<EOF echo <<<EOF
skipping to change at line 607 skipping to change at line 624
#mybb_error_content a:hover, a:active { color: #000; text-decorat ion: underline; } #mybb_error_content a:hover, a:active { color: #000; text-decorat ion: underline; }
#mybb_error_content h2 { font-size: 12px; padding: 4px; backgroun d: #026CB1; color: #fff; margin: 0; border-bottom: none; } #mybb_error_content h2 { font-size: 12px; padding: 4px; backgroun d: #026CB1; color: #fff; margin: 0; border-bottom: none; }
#mybb_error_error { padding: 6px; } #mybb_error_error { padding: 6px; }
#mybb_error_footer { font-size: 12px; border-top: 1px dotted #DDD DDD; padding-top: 10px; } #mybb_error_footer { font-size: 12px; border-top: 1px dotted #DDD DDD; padding-top: 10px; }
#mybb_error_content dt { font-weight: bold; } #mybb_error_content dt { font-weight: bold; }
</style> </style>
<div id="mybb_error_content"> <div id="mybb_error_content">
<h2>{$title}</h2> <h2>{$title}</h2>
<div id="mybb_error_error"> <div id="mybb_error_error">
{$error_message} {$error_message}
<p id="mybb_error_footer">Please contact the <a href="htt ps://mybb.com">MyBB Group</a> for technical support.</p> <p id="mybb_error_footer">{$contact}</p>
</div> </div>
</div> </div>
EOF; EOF;
} }
exit(1); exit(1);
} }
/** /**
* Generates a backtrace if the server supports it. * Generates a backtrace if the server supports it.
* *
* @return string The generated backtrace * @return string The generated backtrace
*/ */
function generate_backtrace() function generate_backtrace($html=true, $strip=1)
{ {
$backtrace = ''; $backtrace = '';
if(function_exists("debug_backtrace")) if(function_exists("debug_backtrace"))
{ {
$trace = debug_backtrace(); $trace = debug_backtrace(1<<1 /* DEBUG_BACKTRACE_IGNORE_A
$backtrace = "<table style=\"width: 100%; margin: 10px 0; RGS */);
border: 1px solid #aaa; border-collapse: collapse; border-bottom: 0;\" cellspac
ing=\"0\" cellpadding=\"0\" border=\"0\">\n"; if($html)
$backtrace .= "<thead><tr>\n"; {
$backtrace .= "<th style=\"border-bottom: 1px solid #aaa; $backtrace = "<table style=\"width: 100%; margin:
background: #ccc; padding: 4px; text-align: left; font-size: 11px;\">File</th>\ 10px 0; border: 1px solid #aaa; border-collapse: collapse; border-bottom: 0;\"
n"; cellspacing=\"0\" cellpadding=\"0\" border=\"0\">\n";
$backtrace .= "<th style=\"border-bottom: 1px solid #aaa; $backtrace .= "<thead><tr>\n";
background: #ccc; padding: 4px; text-align: left; font-size: 11px;\">Line</th>\ $backtrace .= "<th style=\"border-bottom: 1px sol
n"; id #aaa; background: #ccc; padding: 4px; text-align: left; font-size: 11px;\">Fi
$backtrace .= "<th style=\"border-bottom: 1px solid #aaa; le</th>\n";
background: #ccc; padding: 4px; text-align: left; font-size: 11px;\">Function</ $backtrace .= "<th style=\"border-bottom: 1px sol
th>\n"; id #aaa; background: #ccc; padding: 4px; text-align: left; font-size: 11px;\">Li
$backtrace .= "</tr></thead>\n<tbody>\n"; ne</th>\n";
$backtrace .= "<th style=\"border-bottom: 1px sol
id #aaa; background: #ccc; padding: 4px; text-align: left; font-size: 11px;\">Fu
nction</th>\n";
$backtrace .= "</tr></thead>\n<tbody>\n";
}
// Strip off this function from trace // Strip off calls from trace
array_shift($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'] = "&nbsp;" ; if(empty($call['line'])) $call['line'] = " ";
if(!empty($call['class'])) $call['function'] = $c all['class'].$call['type'].$call['function']; if(!empty($call['class'])) $call['function'] = $c all['class'].$call['type'].$call['function'];
$call['file'] = str_replace(MYBB_ROOT, "/", $call ['file']); $call['file'] = str_replace(MYBB_ROOT, "/", $call ['file']);
$backtrace .= "<tr>\n";
$backtrace .= "<td style=\"font-size: 11px; paddi if($html)
ng: 4px; border-bottom: 1px solid #ccc;\">{$call['file']}</td>\n"; {
$backtrace .= "<td style=\"font-size: 11px; paddi $backtrace .= "<tr>\n";
ng: 4px; border-bottom: 1px solid #ccc;\">{$call['line']}</td>\n"; $backtrace .= "<td style=\"font-size: 11p
$backtrace .= "<td style=\"font-size: 11px; paddi x; padding: 4px; border-bottom: 1px solid #ccc;\">{$call['file']}</td>\n";
ng: 4px; border-bottom: 1px solid #ccc;\">{$call['function']}</td>\n"; $backtrace .= "<td style=\"font-size: 11p
$backtrace .= "</tr>\n"; x; padding: 4px; border-bottom: 1px solid #ccc;\">{$call['line']}</td>\n";
$backtrace .= "<td style=\"font-size: 11p
x; 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;
} }
} }
 End of changes. 13 change blocks. 
41 lines changed or deleted 91 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)