Ejemplo n.º 1
0
 /**
  * Parses a error for processing.
  *
  * @param string The error type (i.e. E_ERROR, E_FATAL)
  * @param string The error message
  * @param string The error file
  * @param integer The error line
  * @return boolean True if parsing was a success, otherwise assume a error
  */
 function error($type, $message, $file = null, $line = 0)
 {
     global $mybb;
     // Error reporting turned off (either globally or by @ before erroring statement)
     if (error_reporting() == 0) {
         return true;
     }
     if (in_array($type, $this->ignore_types)) {
         return true;
     }
     $file = str_replace(MYBB_ROOT, "", $file);
     // Do we have a PHP error?
     if (my_strpos(my_strtolower($this->error_types[$type]), 'warning') === false) {
         $this->debug->log->error("\$type: {$type} \$message: {$message} \$file: {$file} \$line: {$line}");
     } else {
         $this->debug->log->warning("\$type: {$type} \$message: {$message} \$file: {$file} \$line: {$line}");
     }
     return parent::error($type, $message, $file, $line);
 }
Ejemplo n.º 2
0
 /**
  * Output a database error.
  *
  * @param string The string to present as an error.
  */
 function error($string = "")
 {
     if ($this->error_reporting) {
         if (class_exists("errorHandler")) {
             global $error_handler;
             if (!is_object($error_handler)) {
                 require_once MYBB_ROOT . "inc/class_error.php";
                 $error_handler = new errorHandler();
             }
             $error = array("error_no" => $this->error_number(), "error" => $this->error_string(), "query" => $string);
             $error_handler->error(MYBB_SQL, $error);
         } else {
             trigger_error("<strong>[SQL] [" . $this->error_number() . "] " . $this->error_string() . "</strong><br />{$string}", E_USER_ERROR);
         }
     } else {
         return false;
     }
 }
Ejemplo n.º 3
0
 /**
  * Output a database error.
  *
  * @param string The string to present as an error.
  */
 function error($string = "", $query = "", $error = "", $error_no = "")
 {
     $this->db->roll_back();
     if ($this->error_reporting) {
         if (!$query) {
             $query = $this->db->last_query;
         }
         if ($error_no == "") {
             $error_no = $this->error_number($query);
         }
         if ($error == "") {
             $error = $this->error_string($query);
         }
         if (class_exists("errorHandler")) {
             global $error_handler;
             if (!is_object($error_handler)) {
                 require_once MYBB_ROOT . "inc/class_error.php";
                 $error_handler = new errorHandler();
             }
             $error = array("error_no" => $error_no, "error" => $error, "query" => $string);
             $error_handler->error(MYBB_SQL, $error);
         } else {
             trigger_error("<strong>[SQL] [{$error_no}] {$error}</strong><br />{$string}", E_USER_ERROR);
         }
     }
 }
Ejemplo n.º 4
0
<?php

//import all the necessary classes and set up the error handler
function exception_error_handler($errno, $errstr, $errfile, $errline)
{
    throw new ErrorException($errstr, 0, $errno, $errfile, $errline);
}
set_error_handler("exception_error_handler");
try {
    //set up variables
    include 'config.php';
    include 'classes/template_variables.php';
    include 'classes/class_xml.php';
    $xmlstuff = new xmlStuff(array('path' => $xmlpath));
    include 'classes/class_error.php';
    $errorhandler = new errorHandler(array('templatepath' => $templatepath));
    include 'classes/class_url.php';
    $urlhandler = new urlHandler(array('urlsfile' => $urlsfile, 'templatepath' => $templatepath));
    $command = $urlhandler->getURL();
    include 'classes/class_snapd.php';
    //extends class xml
    $cd = new cdHandler(array('command' => $command, 'path' => $templatepath, 'xmlpath' => $xmlpath, 'showall' => $showall, 'itemsperpage' => $itemsperpage));
    include 'classes/class_templating.php';
    $templateHandler = new templateHandler(array('path' => $templatepath, 'relatedfunctions' => $cd, 'matchtemplates' => $matchtemplates));
    $templateHandler->openFile($command);
} catch (Exception $e) {
    $errorhandler->error($e);
}