function error404() { //Failsafe, to prevent an infinite routing loop :) if (strpos($_SERVER['REQUEST_URI'], 'error') !== false) { //An error page 404'ed. This is bad. echo "Critical server error."; BTApp::log("Encountered error 404 while loading an error page: " . $_SERVER['REQUEST_URI'], "router", BT_SYSLOG_CRITICAL); BTApp::end(); } //Let's just "tell" the app/router to try again - this time loading the error controller & 404 page. $_SERVER['REQUEST_URI'] = '/error/error404'; BTApp::routeRequest(); BTApp::end(); }
<?php //BEGIN BALLISTIC ROUTER try { define('BT_IS_ROUTED', true); require_once __DIR__ . '/includes/BTApp.php'; BTApp::routeRequest(); } catch (Exception $e) { var_dump($e); echo "Core system error. Cannot continue."; BTApp::end(); } //END BALLISTIC ROUTER