diff options
-rw-r--r-- | it.class | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -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 "<pre>{$p['title']}\n$body</pre>"; |