Fixing error reporting (for real)

This commit is contained in:
xkeeper
2011-11-13 15:21:12 -08:00
parent 94ae4609e1
commit 4fede2de23
2 changed files with 18 additions and 10 deletions

View File

@@ -349,11 +349,13 @@ function calclvl($exp){
}
function printtimedif($timestart){
global $x_hacks;
$timenow=gettimeofday();
$timedif=number_format(microtime(true) - $timestart, 3); /* sprintf('%01.3f',$timenow[sec]+$timenow[usec]/1000000-$timestart); */
print "<br>$smallfont Page rendered in $timedif seconds.";
errorprinter();
print "<div id='errors' style='width: 100%; margin: 0; text-align: left;'>". errorprinter(true) ."</div>";
if (!$x_hacks['host']) {
$pages = array(
@@ -367,6 +369,9 @@ function printtimedif($timestart){
mysql_query("DELETE FROM `rendertimes` WHERE `time` < '". (ctime() - 86400 * 14) ."'");
}
}
print "</body></html>";
}
function generatenumbergfx($num,$minlen=0,$double=false){
global $numdir;
@@ -1313,7 +1318,7 @@ pw_d.projectwonderful_background_color = \"#$bgcolor\";
if ($type == -1) {
$output = "";
foreach ($elog as $out) {
$output .= "$out<br>";
$output .= "$out<br>\n";
}
return $output;
}
@@ -1334,7 +1339,7 @@ pw_d.projectwonderful_background_color = \"#$bgcolor\";
E_RECOVERABLE_ERROR => "Recoverable Error",
);
$elog[] = $errortypes[$type] ."<small> ($file : $line)</small> $msg";
$elog[] = $errortypes[$type] ."<small> (". str_replace($_SERVER['DOCUMENT_ROOT'], "", $file) ." #$line)</small> ". htmlspecialchars($msg);
}
@@ -1342,7 +1347,7 @@ pw_d.projectwonderful_background_color = \"#$bgcolor\";
// Function runs twice, once when called by printtimedif and once at the end of a script
// If it's called in printtimedif, it doesn't print the errors twice (that way they always get out even if printtimedif isn't called)
// Also tries to not break gd-images or other things
function errorprinter() {
function errorprinter($return = false) {
static $done = false;
global $displayerrors;
@@ -1350,21 +1355,25 @@ pw_d.projectwonderful_background_color = \"#$bgcolor\";
if ($displayerrors && !$done) {
$done = true;
$headers = headers_list();
$silence = false;
// Half-heartedly check to see if this is a PHP-generated image or some other fun thing.
// If so, try to silence error reporting so that they don't break.
foreach ($headers as $header) {
if (strpos("Content-type:") !== false && strpos("image/") !== false) {
if (strpos($header, "Content-type:") !== false && strpos($header, "image/") !== false) {
$silence = true;
}
}
if (!$silence) {
if ($return) {
return errorhandler(-1);
} else {
print errorhandler(-1);
}
$done = true;
}
}

View File

@@ -446,8 +446,8 @@ pageTracker._trackPageview();
<br><small>&copy;2000-2010 Acmlm, Emuz, Blades, Xkeeper</small> <!--
<br><img src=\"images/4funin1.png\" title=\"totally!\" width=448 height=48> -->
$honeypotl
". ($x_hacks['mmdeath'] >= 0 ? "<div style='position: absolute; top: -100px; left: -100px;'>Hidden preloader for doom numbers:
<img src='numgfx/death/0.png'> <img src='numgfx/death/1.png'> <img src='numgfx/death/2.png'> <img src='numgfx/death/3.png'> <img src='numgfx/death/4.png'> <img src='numgfx/death/5.png'> <img src='numgfx/death/6.png'> <img src='numgfx/death/7.png'> <img src='numgfx/death/8.png'> <img src='numgfx/death/9.png'>" : "") ."
". ($x_hacks['mmdeath'] > 0 ? "<div style='position: absolute; top: -100px; left: -100px;'>Hidden preloader for doom numbers:
<img src='numgfx/death/0.png'> <img src='numgfx/death/1.png'> <img src='numgfx/death/2.png'> <img src='numgfx/death/3.png'> <img src='numgfx/death/4.png'> <img src='numgfx/death/5.png'> <img src='numgfx/death/6.png'> <img src='numgfx/death/7.png'> <img src='numgfx/death/8.png'> <img src='numgfx/death/9.png'></div>" : "") ."
<!-- Piwik -->
<script type=\"text/javascript\">
var pkBaseURL = ((\"https:\" == document.location.protocol) ? \"https://stats.rustedlogic.net/\" : \"http://stats.rustedlogic.net/\");
@@ -463,7 +463,6 @@ piwikTracker.enableLinkTracking();
<!--<script type=\"text/javascript\" src=\"http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.6.min.js\"></script>
<script type=\"text/javascript\" src=\"js/useful.js\"></script> -->
</body></html>
";
if($ipbanned) {
if ($loguser['title'] == "Banned; account hijacked. Contact admin via PM to change it.") {