diff options
-rw-r--r-- | it.class | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -189,16 +189,17 @@ function error($p = array(), $body = null, $to = null) # $body and $to deprecate if ($sendmail) # we're mailing: send maximum info { - $p['title'] .= " (on " . getenv('HOSTNAME') . ")"; - $body .= $p['locals'] ? "Locals: " . print_r($p['locals'], true) . "\n\n" : ""; + $p['title'] = "Alert: " . $p['title'] . " (on " . getenv('HOSTNAME') . ")"; + unset ($p['locals']['_GLOBALS'], $p['locals']['_GET'], $p['locals']['_POST'], $p['locals']['_COOKIE']); + $locals = print_r($p['locals'], true); + $body .= $p['locals'] && strlen($locals) < 100000 ? "Locals: $locals\n\n" : ""; $body .= $_GET ? "\$_GET: " . print_r($_GET, true) . "\n\n" : ""; $body .= $_POST ? "\$_POST: " . print_r($_POST, true) . "\n\n" : ""; $body .= $_COOKIE ? "\$_COOKIE: " . print_r($_COOKIE, true) . "\n\n" : ""; $body .= $_SERVER ? "\$_SERVER: " . print_r($_SERVER, true) . "\n\n" : ""; $body .= $trace ? "Stack: " . print_r(debug_backtrace(), true) . "\n\n" : ""; - $pwentry = posix_getpwuid(posix_getuid()); - mail($p['to'], $p['title'], $body, "From: " . $pwentry['name'] ? $pwentry['name'] : posix_getuid()); + mail($p['to'], $p['title'], $body); } else if ($_SERVER['REMOTE_ADDR']) # in shell mode we rely on error_log below echo "<pre>{$p['title']}\n$body</pre>"; |