From 243563683270f9dfe04ec937692654881f6df3d0 Mon Sep 17 00:00:00 2001 From: Urban Müller Date: Thu, 7 Dec 2017 14:53:39 +0100 Subject: use Fatal: in mail title, set response code on devel as well --- it.class | 9 ++++----- 1 file 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; } -- cgit v1.2.3