showSourceUri = 'http://'.$_SERVER['HTTP_HOST'].'/lib/errorHandler/showSource.php'; $this->showSourcePrev = 10; $this->showSourceNext = 10; //$this->mailto = "joris@syca.nl"; $this->mailto = "R.P.Jacobs@syca.nl"; $this->enableMail = false; $this->displayErrors = true; $this->displayFatalErrors = true; $this->catchFatalErrors($this->displayFatalErrors); } function setEnableMail($boolean){ $this->enableMail = (bool) $boolean; } function setDisplayErrors($boolean){ $this->displayErrors = (bool) $boolean; } function setDisplayFatalErrors($boolean){ $this->displayFatalErrors = (bool) $boolean; } function setMailto($string){ $this->mailto = $string; } function catchFatalErrors($p_OnOff=true){ if($p_OnOff) $p_OnOff = 'On'; else $p_OnOff = 'Off'; ini_set('display_errors', $p_OnOff); $phperror='

'; ini_set('error_prepend_string',$phperror); $phperror='

'; //$phperror.='
'; ini_set('error_append_string',$phperror); } /** * @param int $errNo * @param string $errMsg * @param string $file * @param int $line * @return void * @access public */ function raiseError($errNo, $errMsg, $file, $line, $vars) { if (! ($errNo & error_reporting())) { return; } //while (ob_get_level()) { // ob_end_clean(); //} // timestamp for the error entry $dt = date("Y-m-d H:i:s (T)"); $errType = array ( E_ERROR => 'Error', E_WARNING => 'Warning', E_PARSE => 'Parsing Error', E_NOTICE => 'Notice', E_CORE_ERROR => 'Core Error', E_CORE_WARNING => 'Core Warning', E_COMPILE_ERROR => 'Compile Error', E_COMPILE_WARNING => 'Compile Warning', E_USER_ERROR => 'User Error', E_USER_WARNING => 'User Warning', E_USER_NOTICE => 'User Notice', E_STRICT => 'Runtime Notice', E_RECOVERABLE_ERROR => 'Catchable Fatal Error' ); $relPath = str_replace ( $_SERVER['DOCUMENT_ROOT'] , '.' , $file ); $errMsg = str_replace ( $_SERVER['DOCUMENT_ROOT'] , '.' , $errMsg ); $err = ''.$errType[$errNo] . ': ' . $errMsg . ' in ' .$relPath. ' on line ' . $line; if($this->displayErrors){ echo ''.$err.'
'; } if ($this->enableMail && $errNo != 8) { //mail($this->mailto, $errType[$errNo]." in ".$_SERVER['HTTP_HOST'], $err); require_once($_SERVER['DOCUMENT_ROOT'].'/modules/email.class.php'); $message = $err; $HTMLmessage = nl2br($message); $mail = new email(); $mail->setFrom("ErrorHandler","no-reply@syca.nl"); $mail->setTo($this->mailto); $mail->setReturn("bounced@syca.nl"); $mail->setSubject($errType[$errNo]." in ".$_SERVER['HTTP_HOST']); $mail->setText($message); $mail->setHTML($HTMLmessage); $mail->send(); } } } ?>