*/ require 'config.php'; require __DIR__ . '/../vendor/autoload.php'; // GrandTraining autoloader require PATH_LIBRARIES . 'slaymaster3000/airbase-php/vendor/autoload.php'; // AirBase autoloader use AirBase\AirBase; use AirBase\Session; use AirBase\Bootstrap; use AirBase\PageNotFoundException; use AirBase\NotLoggedInException; use AirBase\NotLoggedOutException; // init the lib library AirBase::init(); AirBase::setIsLoggedInFunction(function () { return Session::get('user_id') > 0; }); try { Session::start(); // start a session $bootstrap = new Bootstrap(NAMESPACE_CONTROLLERS, PATH_CONTROLLERS, 'url'); // process the request } catch (PageNotFoundException $e) { require PATH_ERROR_PAGES . '404.php'; exit; } catch (NotLoggedInException $e) { header('location: ' . URL_LOGIN); // by default, redirect the user to the login page exit; } catch (NotLoggedOutException $e) { header('location: ' . URL);
use AirBase\PageNotFoundException; use AirBase\NotLoggedInException; use AirBase\NotLoggedOutException; use GrandTraining\admin\models\Login as LoginModel; // init the lib library AirBase::init(); AirBase::setIsLoggedInFunction(function () { return LoginModel::isLoggedIn(); }); try { Session::start(); // start a session $bootstrap = new Bootstrap(NAMESPACE_CONTROLLERS, PATH_CONTROLLERS, 'url'); // process the request } catch (PageNotFoundException $e) { if (AirBase::isLoggedIn()) { require PATH_ERROR_PAGES . '404.php'; } header('location: ' . URL); // always redirect to the home page if not logged in exit; } catch (NotLoggedInException $e) { header('location: ' . URL_LOGIN); // by default, redirect the user to the login page exit; } catch (NotLoggedOutException $e) { header('location: ' . URL); // by default, redirect the user to the home page exit; } catch (PDOException $e) { if (ENVIRONMENT === 'development') {