"Fossies" - the Fresh Open Source Software Archive

Member "openmailadmin-1.0.1/inc/exception_handler.php" (31 May 2007, 1727 Bytes) of package /linux/privat/old/openmailadmin-1.0.1.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) PHP source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "exception_handler.php" see the Fossies "Dox" file reference documentation.

    1 <?php
    2 if($cfg['show_exceptions_online']) {
    3     set_exception_handler('PrettyBlueScreen');
    4 } else {
    5     set_exception_handler('PrimitiveBlueScreen');
    6 }
    7 
    8 function PrimitiveBlueScreen($e) {
    9     ob_end_clean();
   10     @ob_start('ob_gzhandler');
   11     global $lang, $cfg;
   12     $text = $e->getMessage();
   13     $width = 580;
   14     include('./templates/shadow/common-header.tpl');
   15     include('./templates/shadow/error_box.tpl');
   16     include('./templates/shadow/common-footer_nv.tpl');
   17     ob_end_flush();
   18     trigger_error($e->__toString(), E_USER_ERROR);
   19 }
   20 
   21 /**
   22  * @source  http://www.sitepoint.com/blogs/2006/04/04/pretty-blue-screen/
   23  * @author  Harry Fuecks; http://www.sitepoint.com/articlelist/210
   24  */
   25 function PrettyBlueScreen($e) {
   26     ob_end_clean();
   27     @ob_start('ob_gzhandler');
   28     $o = create_function('$in', 'echo htmlspecialchars($in);');
   29     $sub = create_function('$f', '$loc="";if(isset($f["class"])){
   30         $loc.=$f["class"].$f["type"];}
   31         if(isset($f["function"])){$loc.=$f["function"];}
   32         if(!empty($loc)){$loc=htmlspecialchars($loc);
   33         $loc="<strong>$loc</strong>";}return $loc;');
   34     $parms = create_function('$f', '$params=array();if(isset($f["function"])){
   35         try{if(isset($f["class"])){
   36         $r=new ReflectionMethod($f["class"]."::".$f["function"]);}
   37         else{$r=new ReflectionFunction($f["function"]);}
   38         return $r->getParameters();}catch(Exception $e){}}
   39         return $params;');
   40     $src2lines = create_function('$file', '$src=nl2br(highlight_file($file,TRUE));
   41         return explode("<br />",$src);');
   42     $clean = create_function('$line', 'return trim(strip_tags($line));');
   43     $desc = get_class($e)." making ".$_SERVER['REQUEST_METHOD']." request to ".$_SERVER['REQUEST_URI'];
   44     include('./templates/ExceptionHandler.tpl');
   45     ob_end_flush();
   46     trigger_error($e->__toString(), E_USER_ERROR);
   47 }