/**
  * 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());
 }
Example #2
0
require_once 'core/WFEAutoload.php';
// 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