Changeset 816 for trunk/Modules/Error
- Timestamp:
- Feb 22, 2015, 11:20:50 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/Error/Error.php
r790 r816 7 7 var $UserErrors; 8 8 var $OnError; 9 9 10 10 function __construct($System) 11 11 { … … 23 23 $this->OnError = array(); 24 24 } 25 25 26 26 function Install() 27 27 { … … 32 32 { 33 33 parent::UnInstall(); 34 } 35 34 } 35 36 36 function Start() 37 37 { … … 40 40 set_exception_handler(array($this, 'ExceptionHandler')); 41 41 } 42 42 43 43 function Stop() 44 44 { 45 46 47 45 restore_error_handler(); 46 restore_exception_handler(); 47 parent::Stop(); 48 48 } 49 49 50 50 function ErrorHandler($Number, $Message, $FileName, $LineNumber, $Variables) 51 51 { … … 64 64 1024 => 'User Notice' 65 65 ); 66 66 67 67 if(($this->UserErrors & $Number)) 68 68 { … … 73 73 $Backtrace[0]['line'] = $LineNumber; 74 74 $this->Report($Backtrace); 75 //if((E_ERROR | E_PARSE) & $Number) 76 die(); 75 //if((E_ERROR | E_PARSE) & $Number) 76 die(); 77 77 } 78 78 } 79 80 function ExceptionHandler(Exception $Exception) 79 80 function ExceptionHandler(Exception $Exception) 81 81 { 82 $Backtrace = $Exception->getTrace(); 82 $Backtrace = $Exception->getTrace(); 83 83 array_unshift($Backtrace, array( 84 84 'function' => $Exception->getMessage(), … … 89 89 die(); 90 90 } 91 91 92 92 function Report($Backtrace) 93 93 { 94 $Date = date('Y-m-d H:i:s'); 94 $Date = date('Y-m-d H:i:s'); 95 95 $Error = '# '.$Date."\n"; 96 96 foreach($Backtrace as $Item) … … 98 98 if(!array_key_exists('line', $Item)) $Item['line'] = ''; 99 99 if(!array_key_exists('file', $Item)) $Item['file'] = ''; 100 100 101 101 $Error .= ' '.$Item['file'].'('.$Item['line'].")\t".$Item['function']; 102 102 $Arguments = ''; … … 112 112 } 113 113 $Error .= "\n"; 114 114 115 115 // Show error message 116 116 $Output = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head>'."\n". 117 117 '<meta http-equiv="Content-Language" content="cs">'."\n". 118 118 '<meta http-equiv="Content-Type" content="text/html; charset='.$this->Encoding.'"></head><body>'."\n". 119 T('An internal error occurred! <br /> Administrator has been made aware of it and the error soon will be removed.').'<br/><br/>'; 119 T('An internal error occurred! <br /> Administrator has been made aware of it and the error soon will be removed.').'<br/><br/>'; 120 120 if($this->ShowError == true) 121 121 $Output .= '<pre>'.$Error.'</pre><br/>'; … … 125 125 $OnError[0]->$OnError[1]($Error); 126 126 } 127 } 127 }
Note:
See TracChangeset
for help on using the changeset viewer.