All pastes #77716 Raw Edit

Miscellany

public php v1 · immutable
·published 2006-07-03 09:50 UTC
rendered paste body
<?phpfunction throwError($errno, $error, $file, $line) {        $data = array(        'level'     => $errno,               'lastevent' => time(),         'message'   => $error,              'user'      => getCurrentUser(),         'hostname'  => $_SERVER['REMOTE_ADDR'],         'location'  => transEntity(getRequestUri())       );                             $types = array(         1 => 'error',          2 => 'warning',          4 => 'parse error',          8 => 'notice',          16 => 'core error',          32 => 'core warning',          64 => 'compile error',          128 => 'compile warning',          256 => 'user error',          512 => 'user warning',          1024 => 'user notice'       );              if (array_key_exists($errno, $types)) {                 $msg = $types[$errno] .': '. $error .' in '. $file .' on line '. $line .'.';         $msg = transEntity($msg);                switch ($errno) {            case E_ERROR:            case E_CORE_ERROR:            case E_COMPILE_ERROR:                case E_USER_ERROR:                echo $msg;                writeLogMessage($data);                exit;                break;            case E_WARNING:            case E_CORE_WARNING:            case E_COMPILE_WARNING:                case E_USER_WARNING:                echo $msg;                writeLogMessage($data);                break;            case E_NOTICE:            case E_USER_NOTICE:                    echo $msg;                writeLogMessage($data);                    break;            }    }        }?>