summaryrefslogtreecommitdiff
path: root/it.class
diff options
context:
space:
mode:
authorUrban Müller2017-12-07 14:53:39 +0100
committerUrban Müller2017-12-07 14:53:39 +0100
commit243563683270f9dfe04ec937692654881f6df3d0 (patch)
treef2acefa07d1f421038ba4f246a5a53b1eff0dc9d /it.class
parentcb52bbd408b1c1094f063861c02e69ccf3f7db38 (diff)
downloaditools-243563683270f9dfe04ec937692654881f6df3d0.tar.gz
itools-243563683270f9dfe04ec937692654881f6df3d0.tar.bz2
itools-243563683270f9dfe04ec937692654881f6df3d0.zip
use Fatal: in mail title, set response code on devel as well
Diffstat (limited to 'it.class')
-rw-r--r--it.class9
1 files changed, 4 insertions, 5 deletions
diff --git a/it.class b/it.class
index c537ae7..cda7880 100644
--- a/it.class
+++ b/it.class
@@ -225,6 +225,9 @@ static function error($p = array())
}
}
+ if ($p['fatal'] && $_SERVER['REMOTE_ADDR'] && !headers_sent())
+ http_response_code(500);
+
if ($toscreen || $sendmail)
{
$p['body'] = is_string($p['body']) || !array_key_exists('body', $p) ? $p['body'] : var_export($p['body'], true);
@@ -264,7 +267,7 @@ static function error($p = array())
$body = it::replace(array('(pw|passw|password|secret)(\' => |\] => |=)[^&\s]*' => '$1$2********'), $body, array('utf8' => false));
}
- it::mail(array('To' => $p['to'], 'Subject' => "Alert: " . substr($p['title'], 0, 160), 'Body' => $body, 'Cc' => $GLOBALS['it_defaultconfig']['error_cc'], 'forcemail' => !it::is_devel()));
+ it::mail(array('To' => $p['to'], 'Subject' => ($p['fatal'] ? "Fatal: " : "Error: ") . substr($p['title'], 0, 160), 'Body' => $body, 'Cc' => $GLOBALS['it_defaultconfig']['error_cc'], 'forcemail' => !it::is_devel()));
$p['title'] = "Mail: " . $p['title'];
}
else if ($_SERVER['REMOTE_ADDR']) # toscreen mode: web
@@ -280,11 +283,7 @@ static function error($p = array())
@chmod("/tmp/alertdata/alert.log", 0777);
if ($p['fatal'])
- {
- if ($_SERVER['REMOTE_ADDR'] && !headers_sent())
- header("HTTP/1.0 500 Internal Server Error");
exit(99);
- }
return null;
}