summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUrban Müller2007-10-08 18:01:38 +0000
committerUrban Müller2007-10-08 18:01:38 +0000
commit66c4a5297dc1be7329d63c0cc5b53a23201d1c4f (patch)
tree130905f37b86fc59cf4ece3437e7a16f4fea3213
parent900161934f56155c3558496901210ae2ef215d46 (diff)
downloaditools-66c4a5297dc1be7329d63c0cc5b53a23201d1c4f.tar.gz
itools-66c4a5297dc1be7329d63c0cc5b53a23201d1c4f.tar.bz2
itools-66c4a5297dc1be7329d63c0cc5b53a23201d1c4f.zip
first fallback = file owner, correct From:
-rw-r--r--it.class9
1 files changed, 5 insertions, 4 deletions
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 "<pre>{$p['title']}\n$body</pre>";