Blame | Letzte Änderung | Log anzeigen | RSS feed
<?php/* $Id: Error_Object.class.php 8 2007-04-24 14:17:50Z markus $ *//*** This Class builds an Error Object and could* be verrified with Error::isError.** PHP versions 4 and 5** LICENSE: This source file is subject to version 3.0 of the PHP license* that is available through the world-wide-web at the following URI:* http://www.php.net/license/3_0.txt. If you did not receive a copy of* the PHP License and are unable to obtain it through the web, please* send a note to license@php.net so we can mail you a copy immediately.** @category Shop* @package Error_Object* @author Markus Niewerth <markus@weban.de>* @copyright 1997-2005 The PHP Group* @license http://www.php.net/license/3_0.txt PHP License 3.0* @since File available since Release 1.0.1*/// {{{ constants// }}}// {{{ GLOBALS// -------------------// IF any put in here!// -------------------// }}}// {{{ Error_Object/*** Diese Klasse bildet ein Error_Object und kann* mit dem Methoden aufruf $Error->isError($obj)* geprüft werden.** @category CMS* @package Error_Object* @author Markus Niewerth <markus@weban.de>* @author Lars Tiefland <tiefland@weban.de>* @copyright 1997-2007 Webagentur Niewerth* @license http://www.php.net/license/3_0.txt PHP License 3.0* @link http://server2/intranet/3_0.txt* @see Functions* @since Class available since Release 1.1*/class Error_Object {// {{{ properties/*** The Shops ID number.** Its a very important ID, cause the* ID is saved in any userdefined data-* base entry like articles a.s.o.** @var int*/var $_timestamp;var $_logdate;/*** The Shop language.** The Base language is DE. Note that this* value could be mixed! But stadard is DE** @var array*/var $_line;var $_etype;var $_admin;var $_sysinfos;// }}}// {{{ Error_Object()/*** Base Constructor** @param object* @param object* @return Weban_Shop*/function Error_Object ($errno, $errmsg, $filename, $linenum, $vars, $adminmail, $logfile="/var/log/php/weban_shop_error.log"){// timestamp for the error entry$this->_logdate = date("Y-m-d H:i:s (T)");// define an assoc array of error string// in reality the only entries we should// consider are E_WARNING, E_NOTICE, E_USER_ERROR,// E_USER_WARNING and E_USER_NOTICE$this->_etype = 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');$user_errors = array(E_USER_ERROR, E_USER_WARNING, E_USER_NOTICE);$err = "<errorentry>\n";$err .= "\t<datetime>" . $this->_logdate . "</datetime>\n";$err .= "\t<errornum>" . $errno . "</errornum>\n";$err .= "\t<errortype>" . $this->_etype[$errno] . "</errortype>\n";$err .= "\t<errormsg>" . $errmsg . "</errormsg>\n";$err .= "\t<scriptname>" . $filename . "</scriptname>\n";$err .= "\t<scriptlinenum>" . $linenum . "</scriptlinenum>\n";if (in_array($errno, $user_errors)){$this->_sysinfos = wddx_serialize_value ($vars, "Variables");$err .= "\t<vartrace>" . wddx_serialize_value ($vars, "Variables") . "</vartrace>\n";}$err .= "</errorentry>\n\n";// for testing// echo $err;// save to the error log, and e-mail me if there is a critical user errorerror_log($err, 3, $logfile);if ($errno == E_USER_ERROR){mail($adminmail, $_SESSION['INI']['userError'], $err);}}// }}}}// }}}/** Local variables:* tab-width: 4* c-basic-offset: 4* c-hanging-comment-ender-p: nil* End:*/?>