Location: PHPKode > projects > Cronus > cronus-1.2.0rc2/includes/debug.inc.php
<?php
require_once('includes/config.inc.php');

// custom error handler
function e($type, $msg, $file, $line) {
   // ignore "Undefined index:" errors
   if ($type == E_NOTICE && substr($msg, 0, 17) == "Undefined index: ") {
      return;
   }

   // read some environment variables
   global $HTTP_HOST, $HTTP_USER_AGENT, $REMOTE_ADDR, $REQUEST_URI;

   // construct the error string 
   $errorString = "Date: " . date("d-m-Y H:i:s", mktime()) . "\n";
   $errorString .= "Error type: $type\n";
   $errorString .= "Error message: $msg\n";
   $errorString .= "Script: $file($line)\n";
   $errorString .= "Host: $HTTP_HOST\n";
   $errorString .= "Client: $HTTP_USER_AGENT\n";
   $errorString .= "Client IP: $REMOTE_ADDR\n";
   $errorString .= "Request URI: $REQUEST_URI\n\n";

   // discard current buffer contents
   // and turn off output buffering
   ob_end_clean();

   // display error page
   echo "<html><head><basefont face=Arial><title>get some coffee damnit!</title></head><body>";
   echo "<h1>Error!</h1>";
   echo "to turn this detailed error message off, unset the DEBUG global in includes/config.inc.php.<p>";
   echo "<pre>".$errorString."</pre><p>";
   echo "<a href=/>click here to go back to the index</a>";
   echo "</body></html>";

   exit();
}

if($GLOBALS['config']['debug'] == "TRUE") {
   error_reporting(E_ALL ^ E_NOTICE);
   set_error_handler("e");
} else {
   error_reporting(0);
}

?>
Return current item: Cronus