Example #1
0
 require BASE_DIR . 'include' . DIRECTORY_SEPARATOR . 'bootstrap.php';
 $isAllowed = false;
 Session::start();
 $login = Session::getLogin();
 if ($login) {
     $isAllowed = true;
 } else {
     if (Session::hasValidToken()) {
         $isAllowed = true;
     } else {
         $token = isset($_REQUEST['tkn']) ? $_REQUEST['tkn'] : null;
         if ($token) {
             $res = \Member::getByHash($token);
             if ($res != null && $res instanceof \Member && $res->isExtended()) {
                 $isAllowed = true;
                 Session::setValidToken($token);
             }
         }
     }
 }
 if ($isAllowed !== true) {
     die('<h1>Permission Denied</h1>');
 }
 /* Dispatch controller
   ---------------------------------------------*/
 list($controllerName, $controllerAction) = Arr::initList($_REQUEST, [Router::KEY_MODULE => [\Tbmt\TYPE_STRING, 'projects'], Router::KEY_ACTION => [\Tbmt\TYPE_STRING, 'index']]);
 define('CURRENT_MODULE', $controllerName);
 define('CURRENT_MODULE_ACTION', $controllerAction);
 $actionResult = ControllerDispatcher::dispatchAction($controllerName, $controllerAction);
 Session::commit();
 if ($actionResult instanceof ControllerActionResult) {