summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--it.class16
1 files changed, 11 insertions, 5 deletions
diff --git a/it.class b/it.class
index 056300a..a4231bb 100644
--- a/it.class
+++ b/it.class
@@ -150,12 +150,12 @@ function error($p = array(), $body = null, $to = null) # $body and $to deprecate
'blockmail' => 3600,
);
+ @mkdir("/tmp/alertdata");
+ @chmod("/tmp/alertdata", 0777);
+
$toscreen = ini_get('display_errors') || (defined("STDOUT") && posix_isatty(STDOUT)) || EDC('astwin') || EDC('asdevel');
if (!$toscreen) # this error can only be sent by mail: find out if we want to suppress it
{
- @mkdir("/tmp/alertdata");
- @chmod("/tmp/alertdata", 0777);
-
if (!$p['id'])
$sendmail = true;
else
@@ -209,11 +209,17 @@ function error($p = array(), $body = null, $to = null) # $body and $to deprecate
mail($p['to'], $p['title'], $body, ($cc = $GLOBALS['it_defaultconfig']['error_cc']) ? "Cc: $cc" : null);
}
- else if ($_SERVER['REMOTE_ADDR']) # in shell mode we rely on error_log below
+ else if ($_SERVER['REMOTE_ADDR']) # toscreen mode: web
echo "<pre>{$p['title']}\n$body</pre>";
+ else # toscreen mode: shell (outputs to stderr)
+ error_log("it::error: " . $p['title'] . " in " . ($trace ? $trace : "{$p['file']}:{$p['line']}") . " Url: $url " . (EDC('verbose') ? D($p['locals']) : ""));
}
- error_log("it::error: " . $p['title'] . " in " . ($trace ? $trace : "{$p['file']}:{$p['line']}") . " Url: $url " . (EDC('verbose') ? D($p['locals']) : ""));
+ if (($fh = fopen("/tmp/alertdata/alert.log", "a"))) {
+ fputs($fh, $p['title'] . " in " . ($trace ? $trace : "{$p['file']}:{$p['line']}") . " Url: $url\n");
+ fclose($fh);
+ @chmod("/tmp/alertdata/alert.log", 0777);
+ }
}