Example #1
0
 function required()
 {
     if (!Auth::loggedin()) {
         header('location: ' . Config::get('Auth/path', '/auth') . '?path=' . Application::$fullpath);
         exit;
     }
 }
Example #2
0
 public static function Start()
 {
     self::set_path();
     $glob = glob(MICROSITE_PATH . '/microsite/controllers/*.php');
     $controllers = array();
     foreach ($glob as $controller) {
         $controllers[basename($controller, '.php')] = $controller;
     }
     if (self::$path[0] == '') {
         $controller = 'index';
     } else {
         $controller = self::$path[0];
     }
     // Am I logged in?
     $hasauth = false;
     if (self::$path[0] == 'presence' && self::$path[1] == 'dosmartstatus') {
         $hasauth = true;
     }
     if (Auth::loggedin()) {
         $hasauth = true;
     }
     if (in_array($controller, array('auth', 'botrest'))) {
         $hasauth = true;
     }
     if (!$hasauth) {
         header('location: /auth?path=' . implode('/', self::$path));
         exit;
     }
     if (isset($controllers[$controller])) {
         include $controllers[$controller];
         $class = $controller . 'Controller';
         $obj = new $class(self::$path);
         if (isset(self::$path[1])) {
             if (self::$path[1][0] != '_' && ($obj instanceof AjaxController || method_exists($obj, self::$path[1]))) {
                 $args = array_slice(self::$path, 2);
                 $method = self::$path[1];
                 $obj->{$method}($args);
             } else {
                 if (method_exists($obj, 'index')) {
                     $args = array_slice(self::$path, 1);
                     $obj->index($args);
                 }
             }
         } else {
             if (method_exists($obj, 'index')) {
                 $obj->index(self::$path);
             }
         }
     } else {
         print_r(self::$path);
     }
 }
Example #3
0
 /**
  * Log them out
  */
 public static function LogOut()
 {
     #self::remove_sessions(SessionManager::GetValue('userinfo', 'pilotid'));
     # Mark them as guest
     self::update_session(self::$session_id, 0);
     # "Ghost" entry
     //self::start_session(self::$userinfo->pilotid); // Orphaned?
     SessionManager::Set('loggedin', false);
     SessionManager::Set('userinfo', '');
     SessionManager::Set('usergroups', '');
     # Delete cookie
     $_COOKIE[VMS_AUTH_COOKIE] = '';
     setcookie(VMS_AUTH_COOKIE, false);
     self::$loggedin = false;
 }