diff options
Diffstat (limited to 'it.class')
-rw-r--r-- | it.class | 23 |
1 files changed, 12 insertions, 11 deletions
@@ -122,27 +122,26 @@ function error($p = array(), $body = "", $to = "") $sendalert = true; } - if ($sendalert && (!ereg('live', $GLOBALS['ULTRASERVERTYPE']) || (time() - @filemtime($lastsentfn)) > 3600)) + $toscreen = !ereg('live', $GLOBALS['ULTRASERVERTYPE']); + + if ($sendalert && ($toscreen || (time() - @filemtime($lastsentfn)) > 3600)) { @mkdir("/tmp/alertdata"); @chmod("/tmp/alertdata", 0777); touch($lastsentfn); @chmod($lastsentfn, 0666); - $url = ($_SERVER['HTTPS'] ? "https://" : "http://") . $_SERVER['HTTP_HOST'] .$_SERVER['REQUEST_URI']; + if ($_SERVER['REMOTE_ADDR']) + $url = ($_SERVER['HTTPS'] ? "https://" : "http://") . $_SERVER['HTTP_HOST'] .$_SERVER['REQUEST_URI']; if (!$title) - $title="Error in $url"; + $title="Error in " . trim($url); if (!function_exists('memory_get_usage') || (memory_get_usage() < 50000000)) - $trace = "\n\nTrace: " . it_debug::backtrace($p['backtraceskip']); + $trace = it_debug::backtrace($p['backtraceskip']); - $body .= "\nUrl: $url$trace"; + $body .= ($url ? "\nUrl: $url" : "") . ($trace ? "\n\nTrace: " . $trace : ""); - if (!ereg('live', $GLOBALS['ULTRASERVERTYPE'])) - { - echo "<pre>$title\n$body\n</pre>"; - } - else + if (!$toscreen) { $cmd = "alert -l " . escapeshellarg($to) . " 4 " . escapeshellarg($title); @@ -154,9 +153,11 @@ function error($p = array(), $body = "", $to = "") pclose($pipe); } } + else if ($_SERVER['REMOTE_ADDR']) + echo "<pre>$title\n$body\n</pre>"; } - error_log("it::error: ".$title); + error_log("it::error: ".$title . ": " . $trace . (EDC('verbose') ? D($p['locals']) : "")); } |