90 lines
4.5 KiB
PHP
90 lines
4.5 KiB
PHP
<?php
|
|
require_once("info.php");
|
|
|
|
/*
|
|
trigger_error("Incorrect input vector, array of values expected", E_USER_WARNING);
|
|
|
|
Value Constant Description
|
|
1 E_ERROR (integer) Fatal run-time errors. These indicate errors that can not be recovered from, such as a memory allocation problem. Execution of the script is halted.
|
|
2 E_WARNING (integer) Run-time warnings (non-fatal errors). Execution of the script is not halted.
|
|
4 E_PARSE (integer) Compile-time parse errors. Parse errors should only be generated by the parser.
|
|
8 E_NOTICE (integer) Run-time notices. Indicate that the script encountered something that could indicate an error, but could also happen in the normal course of running a script.
|
|
16 E_CORE_ERROR (integer) Fatal errors that occur during PHP's initial startup. This is like an E_ERROR, except it is generated by the core of PHP.
|
|
32 E_CORE_WARNING (integer) Warnings (non-fatal errors) that occur during PHP's initial startup. This is like an E_WARNING, except it is generated by the core of PHP.
|
|
64 E_COMPILE_ERROR (integer) Fatal compile-time errors. This is like an E_ERROR, except it is generated by the Zend Scripting Engine.
|
|
128 E_COMPILE_WARNING (integer) Compile-time warnings (non-fatal errors). This is like an E_WARNING, except it is generated by the Zend Scripting Engine.
|
|
|
|
256 E_USER_ERROR (integer) User-generated error message. This is like an E_ERROR, except it is generated in PHP code by using the PHP function trigger_error().
|
|
512 E_USER_WARNING (integer) User-generated warning message. This is like an E_WARNING, except it is generated in PHP code by using the PHP function trigger_error().
|
|
1024 E_USER_NOTICE (integer) User-generated notice message. This is like an E_NOTICE, except it is generated in PHP code by using the PHP function trigger_error().
|
|
2048 E_STRICT (integer) Run-time notices. Enable to have PHP suggest changes to your code which will ensure the best interoperability and forward compatibility of your code.
|
|
4096 E_RECOVERABLE_ERROR (integer) Catchable fatal error. It indicates that a probably dangerous error occured, but did not leave the Engine in an unstable state. If the error is not caught by a user defined handle (see also set_error_handler()), the application aborts as it was an E_ERROR.
|
|
8191 E_ALL (integer) All errors and warnings, as supported, except of level E_STRICT in PHP < 6.
|
|
|
|
HTML
|
|
<div id="info" style="border:2px solid {'message_color_border'}; padding:5px;margin:10px;background:{'message_color'} none repeat scroll 0%;font-size:13px;">
|
|
<center>{'message'}</center>
|
|
</div>
|
|
*/
|
|
|
|
$errors = array();
|
|
set_error_handler("errorHandler");
|
|
register_shutdown_function("printErrors");
|
|
|
|
// error handler function
|
|
function errorHandler($errno, $errstr, $errfile, $errline){
|
|
GLOBAL $language,$errors;
|
|
$info = new Info();
|
|
switch ($errno) {
|
|
case E_ERROR:
|
|
case E_USER_ERROR:
|
|
$err = buildError($language["error"],$errno, $errstr, $errfile, $errline);
|
|
$errors[] = $info->buildMessage($err,"error");
|
|
//dbSaveLog(getURL(),$err,date("Y-m-d H:i:s"));
|
|
break;
|
|
case E_WARNING:
|
|
case E_USER_WARNING:
|
|
$err = buildError($language["warning"],$errno, $errstr, $errfile, $errline);
|
|
$errors[] = $info->buildMessage($err,"warning");
|
|
//dbSaveLog(getURL(),$err,date("Y-m-d H:i:s"));
|
|
break;
|
|
case E_NOTICE:
|
|
case E_USER_NOTICE:
|
|
//$err = buildError($language["error_unknown"],$errno, $errstr, $errfile, $errline);
|
|
//dbSaveLog(getURL(),$err,date("Y-m-d H:i:s"));
|
|
break;
|
|
default:
|
|
$err = buildError($language["error_unknown"],$errno, $errstr, $errfile, $errline);
|
|
$errors[] = $info->buildMessage($err,"error");
|
|
//dbSaveLog(getURL(),$err,date("Y-m-d H:i:s"));
|
|
break;
|
|
}
|
|
/* Don't execute PHP internal error handler */
|
|
return true;
|
|
}
|
|
|
|
function buildError($errhead,$errno, $errstr, $errfile, $errline){
|
|
GLOBAL $config;
|
|
//[$errno]
|
|
if(!isset($config["debug"]) || $config["debug"])
|
|
$error = "<strong>$errhead:</strong> $errfile($errline)<br /><b>$errstr</b>";
|
|
else
|
|
$error = "<strong>$errhead: </strong>$errstr";
|
|
return $error;
|
|
}
|
|
|
|
function getErrors(){
|
|
GLOBAL $errors;
|
|
if(empty($errors)) return "";
|
|
$temp = "";
|
|
foreach($errors as $one){
|
|
$temp .= $one;
|
|
}
|
|
$errors = array();
|
|
return $temp;
|
|
}
|
|
|
|
function printErrors(){
|
|
echo getErrors();
|
|
}
|
|
?>
|