Ignore:
Timestamp:
Feb 22, 2015, 11:20:50 PM (9 years ago)
Author:
chronos
Message:
  • Modified: Tabs converted to spaces.
  • Modified: Remove spaces from end of lines.
  • Added: Code format script.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Modules/Error/Error.php

    r790 r816  
    77  var $UserErrors;
    88  var $OnError;
    9    
     9
    1010  function __construct($System)
    1111  {
     
    2323    $this->OnError = array();
    2424  }
    25  
     25
    2626  function Install()
    2727  {
     
    3232  {
    3333    parent::UnInstall();
    34   } 
    35  
     34  }
     35
    3636  function Start()
    3737  {
     
    4040    set_exception_handler(array($this, 'ExceptionHandler'));
    4141  }
    42  
     42
    4343  function Stop()
    4444  {
    45         restore_error_handler();
    46         restore_exception_handler();
    47         parent::Stop();
     45    restore_error_handler();
     46    restore_exception_handler();
     47    parent::Stop();
    4848  }
    49  
     49
    5050  function ErrorHandler($Number, $Message, $FileName, $LineNumber, $Variables)
    5151  {
     
    6464      1024 => 'User Notice'
    6565    );
    66  
     66
    6767    if(($this->UserErrors & $Number))
    6868    {
     
    7373      $Backtrace[0]['line'] = $LineNumber;
    7474      $this->Report($Backtrace);
    75       //if((E_ERROR | E_PARSE) & $Number) 
    76       die(); 
     75      //if((E_ERROR | E_PARSE) & $Number)
     76      die();
    7777    }
    7878  }
    79  
    80   function ExceptionHandler(Exception $Exception) 
     79
     80  function ExceptionHandler(Exception $Exception)
    8181  {
    82     $Backtrace = $Exception->getTrace();   
     82    $Backtrace = $Exception->getTrace();
    8383    array_unshift($Backtrace, array(
    8484      'function' => $Exception->getMessage(),
     
    8989    die();
    9090  }
    91  
     91
    9292  function Report($Backtrace)
    9393  {
    94     $Date = date('Y-m-d H:i:s');               
     94    $Date = date('Y-m-d H:i:s');
    9595    $Error = '# '.$Date."\n";
    9696    foreach($Backtrace as $Item)
     
    9898      if(!array_key_exists('line', $Item)) $Item['line'] = '';
    9999      if(!array_key_exists('file', $Item)) $Item['file'] = '';
    100    
     100
    101101      $Error .= ' '.$Item['file'].'('.$Item['line'].")\t".$Item['function'];
    102102      $Arguments = '';
     
    112112    }
    113113    $Error .= "\n";
    114        
     114
    115115    // Show error message
    116116    $Output = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head>'."\n".
    117117      '<meta http-equiv="Content-Language" content="cs">'."\n".
    118118      '<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/>';
    120120    if($this->ShowError == true)
    121121      $Output .= '<pre>'.$Error.'</pre><br/>';
     
    125125      $OnError[0]->$OnError[1]($Error);
    126126  }
    127 }         
     127}
Note: See TracChangeset for help on using the changeset viewer.