Ejemplo n.º 1
0
 /**
  * Construct the exception
  *
  * @param  string $msg
  * @param  int $code
  * @param  Exception $previous
  * @return void
  */
 public function __construct($msg = '', $code = 0, Exception $previous = null)
 {
     $debug = KantFactory::getConfig()->get('debug');
     if ($debug == false) {
         header($_SERVER["SERVER_PROTOCOL"] . " 404 Not Found");
         header("Status: 404 Not Found");
         header("X-Powered-By: KantPHP Framework");
         echo '404 File Not Found!';
         exit;
     }
     if (version_compare(PHP_VERSION, '5.3.0', '<')) {
         parent::__construct($msg, (int) $code);
         $this->_previous = $previous;
     } else {
         $error = array();
         $error['message'] = $msg;
         $trace = $this->getTrace();
         if ('E' == $trace[0]['function']) {
             $error['file'] = $trace[0]['file'];
             $error['line'] = $trace[0]['line'];
         } else {
             $error['file'] = $this->getFile();
             $error['line'] = $this->getLine();
         }
         $error['trace'] = $this->getTraceAsString();
         Log::write($error['message'], Log::ERR);
         $exceptionFile = KANT_PATH . 'View/system/exception.php';
         include $exceptionFile;
         exit;
         //            parent::__construct($msg, (int) $code, $previous);
     }
 }
Ejemplo n.º 2
0
 /**
  * Parpare
  */
 protected function parpare()
 {
     //Default timezone
     date_default_timezone_set(KantFactory::getConfig()->get('default_timezone'));
     if (KantFactory::getConfig()->get('debug')) {
         ini_set('display_errors', 1);
         error_reporting(E_ALL);
         Runtime::mark('begin');
     }
     //load common file
     require_once APP_PATH . 'Bootstrap.php';
     //Build Module
     $this->buildModule();
     //Logfile initialization
     Log::init(array('type' => 'File', 'log_path' => LOG_PATH));
 }