Ejemplo n.º 1
0
 /**
  * Generic exception handler
  *
  * Handles uncaught exceptions, such as database errors
  * @param Exception $e Any type of exception
  */
 public static function handle_exception($e)
 {
     switch (get_class($e)) {
         case 'NumbatDBError':
         case 'PDOException':
             $type = 'db';
             break;
         default:
             $type = 'uncaught';
             break;
     }
     $config = array();
     if ($type == 'db' && get_class($e) == 'NumbatDBError') {
         $config = $e->getConfig();
     }
     numbat_primative_die($e->getMessage(), $type, $config);
 }
Ejemplo n.º 2
0
    ?>
		</dl>
	</div>
</body>
</html>
<?php 
    die;
}
function numbat_session_stats()
{
    $time = microtime(true) - $GLOBALS['numbat_start_time'];
    return 'Rendered in ' . round($time, 3) . ' seconds, with ' . Database::instance()->get_count() . ' queries';
}
/** Load app configuration if it exists */
if (file_exists(NUMBAT_APPPATH . '/config.php')) {
    include NUMBAT_APPPATH . '/config.php';
} else {
    numbat_primative_die("Couldn't load configuration", 'config');
}
/** Make sure constant is defined */
if (!defined('NUMBAT_SHOW_DB_ERRORS')) {
    define('NUMBAT_SHOW_DB_ERRORS', false);
}
/** Undo magic quotes **/
if (get_magic_quotes_gpc()) {
    list($_GET, $_POST, $_COOKIE, $_REQUEST) = stripslashes_deep(array($_GET, $_POST, $_COOKIE, $_REQUEST));
}
// Connect to database
Database::instance(Config::instance()->get('db'));
Controller::parse();
Controller::handle();