[ Index ] |
|
Code source de eGroupWare 1.2.106-2 |
1 <?php 2 /**************************************************************************\ 3 * eGroupWare - eventlog * 4 * http://www.egroupware.org * 5 * This application written by jerry westrick <jerry@westrick.com> * 6 * -------------------------------------------- * 7 * This program is free software; you can redistribute it and/or modify it * 8 * under the terms of the GNU General Public License as published by the * 9 * Free Software Foundation; either version 2 of the License, or (at your * 10 * option) any later version. * 11 \**************************************************************************/ 12 13 /* $Id: class.error.inc.php 15134 2004-05-05 12:06:13Z reinerj $ */ 14 15 class error 16 { 17 /***************************\ 18 * Instance Variables... * 19 \***************************/ 20 var $severity = 'E'; 21 var $code = 'Unknown'; 22 var $msg = 'Unknown error'; 23 var $parms = array(); 24 var $ismsg = 0; 25 var $timestamp; 26 var $fname; 27 var $line; 28 var $app; 29 30 var $public_functions = array(); 31 32 // Translate Message into Language 33 function langmsg() 34 { 35 return lang($this->msg,$this->parms); 36 } 37 38 function error($parms) 39 { 40 if ($parms == '') 41 { 42 return; 43 } 44 $etext = $parms['text']; 45 $parray = Array(); 46 for($counter=1;$counter<=10;$counter++) 47 { 48 $str = 'p_'.$counter; 49 if(isset($parms[$str]) && !empty($parms[$str])) 50 { 51 $parray[$counter] = $parms[$str]; 52 } 53 else 54 { 55 $str = 'p'.$counter; 56 if(isset($parms[$str]) && !empty($parms[$str])) 57 { 58 $parray[$counter] = $parms[$str]; 59 } 60 } 61 } 62 $fname = $parms['file']; 63 $line = $parms['line']; 64 if (eregi('([DIWEF])-([[:alnum:]]*)\, (.*)',$etext,$match)) 65 { 66 $this->severity = strtoupper($match[1]); 67 $this->code = $match[2]; 68 $this->msg = trim($match[3]); 69 } 70 else 71 { 72 $this->msg = trim($etext); 73 } 74 75 @reset($parray); 76 while( list($key,$val) = each( $parray ) ) 77 { 78 $this->msg = preg_replace( "/%$key/", "'".$val."'", $this->msg ); 79 } 80 @reset($parray); 81 82 $this->timestamp = time(); 83 $this->parms = $parray; 84 $this->ismsg = $parms['ismsg']; 85 $this->fname = $fname; 86 $this->line = $line; 87 $this->app = $GLOBALS['phpgw_info']['flags']['currentapp']; 88 89 if (!$this->fname or !$this->line) 90 { 91 $GLOBALS['phpgw']->log->error(array( 92 'text'=>'W-PGMERR, Programmer failed to pass __FILE__ and/or __LINE__ in next log message', 93 'file'=>__FILE__,'line'=>__LINE__ 94 )); 95 } 96 97 $GLOBALS['phpgw']->log->errorstack[] = $this; 98 if ($this->severity == 'F') 99 { 100 // This is it... Don't return 101 // do rollback! 102 // Hmmm this only works if UI!!!! 103 // What Do we do if it's a SOAP/XML? 104 echo "<Center>"; 105 echo "<h1>Fatal Error</h1>"; 106 echo "<h2>Error Stack</h2>"; 107 echo $GLOBALS['phpgw']->log->astable(); 108 echo "</center>"; 109 // Commit stack to log 110 $GLOBALS['phpgw']->log->commit(); 111 $GLOBALS['phpgw']->common->phpgw_exit(True); 112 } 113 } 114 }
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Feb 25 17:20:01 2007 | par Balluche grâce à PHPXref 0.7 |