00001 <?php 00022 class KumbiaException extends Exception { 00026 protected $error_code = 0; 00032 protected $_show_trace = true; 00037 public function __construct($message, $error_code = 0, $show_trace = true) { 00038 $this->show_trace = $show_trace; 00039 if (is_numeric($error_code)) { 00040 parent::__construct($message, $error_code); 00041 } else { 00042 $this->error_code = $error_code; 00043 parent::__construct($message, 0); 00044 } 00045 } 00046 00051 public static function handle_exception($e) 00052 { 00056 require_once CORE_PATH . 'extensions/messages/flash.php'; 00057 00058 header('HTTP/1.1 404 Not Found'); 00059 $config = Config::read('config.ini'); 00060 extract(Router::get(), EXTR_OVERWRITE); 00061 00062 ob_start(); 00063 if(!$config['application']['production']) { 00064 $show_trace = $e->_show_trace; 00065 $boot = Config::read('boot.ini'); 00066 include CORE_PATH . 'views/errors/exception.phtml'; 00067 } else { 00068 include APP_PATH . 'views/errors/404.phtml'; 00069 } 00070 $content = ob_get_clean(); 00071 00076 if(ob_get_level()) { 00077 ob_end_clean(); 00078 } 00079 require_once CORE_PATH . 'kumbia/view.php'; 00083 if(class_exists('Dispatcher')) { 00084 $controller = Dispatcher::get_controller(); 00085 if(!$controller || $controller->response != 'view') { 00086 echo $content; 00087 include CORE_PATH . 'views/templates/default.phtml'; 00088 } else { 00089 echo $content; 00090 } 00091 } else { 00092 echo $content; 00093 include CORE_PATH . 'views/templates/default.phtml'; 00094 } 00095 } 00096 }