= 5.2.0 */ ($error = error_get_last()) && in_array($error['type'], array(E_ERROR, E_CORE_ERROR, E_COMPILE_ERROR, E_USER_ERROR))) { $error_handled = true; $error = "(" . $error['type'] . ") " . $error['message'] . " at line " . $error['line'] . " of " . $error['file']; send_errormail($error); $errtitle = "PHP-Fehler"; if (display_error()) $errmsg = $error; else $errmsg = ""; require(dirname(__FILE__) . "/../html/error.php"); } } function display_error() { global $opt, $debug_page; return (isset($opt['db']['error']['display']) && $opt['db']['error']['display']) || (isset($debug_page) && $debug_page); } function send_errormail($errmsg) { global $opt, $sql_errormail, $absolute_server_URI; if (isset($opt['db']['error']['mail']) && $opt['db']['error']['mail'] != '') { @mb_send_mail($opt['db']['error']['mail'], $opt['mail']['subject'] . " PHP error", $errmsg); } else if (isset($sql_errormail) && $sql_errormail != '') { $url = parse_url($absolute_server_URI); @mb_send_mail($sql_errormail, "[" . $url['host'] . "] PHP error", $errmsg); } } // throttle admin error mails; // currently used only for SQL errors and warnings function admin_errormail($to, $errortype, $message, $headers) { global $opt; $errorlog_dir = $opt['rootpath'] . 'var/errorlog'; $errorlog_path = $errorlog_dir . "/errorlog-" . date("Y-m-d"); $error_mail_limit = 32768; // send max 32 KB = ca. 5-20 errors per day/logfile // All errors which may happen here are ignored, to avoid error recursions. if (!is_dir($errorlog_dir)) @mkdir($errorlog_dir); $old_logsize = @filesize($errorlog_path) + 0; $msg = date("Y-m-d H:i:s.u")." ".$errortype."\n" . $message."\n" . "-------------------------------------------------------------------------\n\n"; @error_log($msg, 3, // log to file $errorlog_path); // @filesize() may still return the old size here, because logging takes place // asynchronously. Instead we calculate the new size: $new_logsize = $old_logsize + strlen($msg); if ($old_logsize < $error_mail_limit && $new_logsize >= $error_mail_limit) { mb_send_mail($to, "too many ".$errortype, "Errors/Warnings are recorded in ".$errorlog_path.".\n" . "Email Reporting is DISABLED for today now. Please check the logfile\n" . "and RENAME or delete it when done, so that logging is re-enabled.", $headers); return false; } else return ($old_logsize < $error_mail_limit); } ?>