/**
  * Sends the response to the browser and ends the script
  */
 public function send()
 {
     WFEsession::end();
     WFEDb::disconnect();
     header('Content-type: ' . $this->getFormat());
     exit($this->getContent());
 }
 /**
  * End session
  */
 public static function end()
 {
     foreach ($_SESSION['flashdata'] as $name => $data) {
         unset($_SESSION['flashdata'][$name]);
     }
     WFEsession::setFlashdata(array('last_page_uri' => WFERouter::getCurrentRequest()->getURI()));
 }
Beispiel #3
0
// set exception handler
set_exception_handler(function (Exception $e) {
    if (WFEConfig::get('env') == 'dev') {
        exit($e->getMessage());
    } elseif (WFEConfig::get('env') == 'prod') {
        $response = WFERouter::run(new WFERequest('GET', 'WFE500'));
        $response->send();
    }
});
// Register autoload
WFEAutoload::register(__NAMESPACE__);
// Load main config
WFELoader::load('app/config/config.php');
// Load Database
\core\ORM\WFEDb::connect();
// Load smarty
WFELoader::load('core/libs/smarty/Smarty.class.php');
// set environment spec
if (WFEConfig::get('env') == 'dev') {
    error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE | E_ALL);
} elseif (WFEConfig::get('env') == 'prod') {
    error_reporting(0);
} else {
    throw new WFEDefinitionException('Config settings env is not set properly (must be dev or prod)');
}
// init session
WFEsession::init();
// init request data
$request = new WFERequest();
// Routes request and get response
WFERouter::run($request);