clean up some files to make enchanced inbox run for first time
This commit is contained in:
@@ -12,8 +12,10 @@ require_once __DIR__ . '/../../gulliver/system/class.g.php';
|
||||
require_once __DIR__ . '/../../bootstrap/autoload.php';
|
||||
require_once __DIR__ . '/../../bootstrap/app.php';
|
||||
|
||||
//Initialize application event
|
||||
AppEvent::getAppEvent();
|
||||
|
||||
// Register shutdown function to close Propel if it exists
|
||||
register_shutdown_function(
|
||||
function () {
|
||||
if (class_exists('Propel')) {
|
||||
@@ -22,19 +24,21 @@ register_shutdown_function(
|
||||
}
|
||||
);
|
||||
|
||||
// Set session cookie settings
|
||||
ini_set("session.cookie_httponly", 1);
|
||||
|
||||
// Handle unencoded URL
|
||||
if (isset($_SERVER['UNENCODED_URL'])) {
|
||||
$_SERVER['REQUEST_URI'] = $_SERVER['UNENCODED_URL'];
|
||||
}
|
||||
|
||||
try {
|
||||
$rootDir = realpath(__DIR__ . "/../../") . DIRECTORY_SEPARATOR;
|
||||
|
||||
$app = new WebApplication();
|
||||
|
||||
$app->setRootDir($rootDir);
|
||||
$app->setRequestUri($_SERVER['REQUEST_URI']);
|
||||
|
||||
// Route the application
|
||||
$stat = $app->route();
|
||||
|
||||
switch ($stat) {
|
||||
@@ -63,8 +67,43 @@ try {
|
||||
break;
|
||||
}
|
||||
} catch (RBACException $e) {
|
||||
G::header('location: ' . $e->getPath());
|
||||
handleRBACException($e);
|
||||
} catch (Exception $e) {
|
||||
//handleGeneralException($e, $rootDir);
|
||||
$view = new PhtmlView($rootDir . "framework/src/templates/Exception.phtml");
|
||||
$view->set("message", $e->getMessage());
|
||||
$view->set("exception", $e);
|
||||
|
||||
$response = new Response($view->getOutput(), 503);
|
||||
$response->send();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the application state based on routing status.
|
||||
*
|
||||
* @param int $stat
|
||||
* @param WebApplication $app
|
||||
*/
|
||||
function handleApplicationState(int $stat, WebApplication $app): void {
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle RBAC exceptions by redirecting to the specified path.
|
||||
*
|
||||
* @param RBACException $e
|
||||
*/
|
||||
function handleRBACException(RBACException $e): void {
|
||||
G::header('location: ' . $e->getPath());
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle general exceptions by rendering an error view.
|
||||
*
|
||||
* @param Exception $e
|
||||
* @param string $rootDir
|
||||
*/
|
||||
function handleGeneralException(Exception $e, string $rootDir): void {
|
||||
$view = new PhtmlView($rootDir . "framework/src/templates/Exception.phtml");
|
||||
$view->set("message", $e->getMessage());
|
||||
$view->set("exception", $e);
|
||||
@@ -72,4 +111,3 @@ try {
|
||||
$response = new Response($view->getOutput(), 503);
|
||||
$response->send();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user