From 66c4a5297dc1be7329d63c0cc5b53a23201d1c4f Mon Sep 17 00:00:00 2001 From: Urban Müller Date: Mon, 8 Oct 2007 18:01:38 +0000 Subject: first fallback = file owner, correct From: --- it.class | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'it.class') diff --git a/it.class b/it.class index 8e6bb31..aaae945 100644 --- a/it.class +++ b/it.class @@ -117,7 +117,7 @@ function timerlog($label = '') /** - * Send verbose error report to browser or (if display_errors is off) by email to .diffnotice gods, SERVER_ADMIN or current user + * Send verbose error report to browser or (if display_errors is off) by email to .diffnotice gods, file owner or SERVER_ADMIN * All params optional. Single string parameter means 'title'. * @parma $p['title'] error title, one line * @param $p['body'] error body, multiline @@ -143,14 +143,14 @@ function error($p = array(), $body = null, $to = null) # $body and $to deprecate unset($p['to']); # allow defaults to kick in $p += array( 'title' => "it::error", - 'to' => $gods ? $gods : ($_SERVER['SERVER_ADMIN'] ? $_SERVER['SERVER_ADMIN'] : get_current_user()), + 'to' => $gods ? $gods : (get_current_user() ? get_current_user() : $_SERVER['SERVER_ADMIN']), 'graceperiod' => 60, 'timewindow' => 25*3600, 'backtraceskip' => 0, 'blockmail' => 3600, ); - $toscreen = ini_get('display_errors') || EDC('astwin') || EDC('asdevel'); + $toscreen = (ini_get('display_errors') || EDC('astwin') || EDC('asdevel')) && !EDC('aslive'); if (!$toscreen) # this error can only be sent by mail: find out if we want to suppress it { @mkdir("/tmp/alertdata"); @@ -197,7 +197,8 @@ function error($p = array(), $body = null, $to = null) # $body and $to deprecate $body .= $_SERVER ? "\$_SERVER: " . print_r($_SERVER, true) . "\n\n" : ""; $body .= $trace ? "Stack: " . print_r(debug_backtrace(), true) . "\n\n" : ""; - mail($p['to'], $p['title'], $body, "From: " . get_current_user()); + $pwentry = posix_getpwuid(posix_getuid()); + mail($p['to'], $p['title'], $body, "From: " . $pwentry['name'] ? $pwentry['name'] : posix_getuid()); } else if ($_SERVER['REMOTE_ADDR']) # in shell mode we rely on error_log below echo "
{$p['title']}\n$body
"; -- cgit v1.2.3