예제 #1
0
 function beforeroute()
 {
     global $upgrade_access_check;
     parent::beforeroute();
     $auth = AuthManager::instance();
     if ($upgrade_access_check) {
         if (!$auth->isLoggedIn() || !$auth->getUser()->isAdministrator()) {
             $this->accessDenied();
         }
     }
     $this->f3->set('upgrade_access_check', $upgrade_access_check);
     $this->f3->set('@import url(' . $this->f3->get('base_path') . 'upgrade/upgrade.css);');
 }
예제 #2
0
파일: MyModule.php 프로젝트: J0s3f/simpleid
 public function beforeroute()
 {
     parent::beforeroute();
     $auth = AuthManager::instance();
     if (!$auth->isLoggedIn()) {
         if ($this->f3->get('AJAX')) {
             $this->f3->status(401);
             header('Content-Type: application/json');
             print json_encode(array('error' => 'unauthorized', 'error_description' => $this->t('Unauthorized')));
             exit;
         } else {
             $route = ltrim($this->f3->get('PARAMS.0'), '/');
             $this->f3->reroute('@auth_login(1=' . $route . ')');
         }
     }
     if (!$this->f3->get('AJAX')) {
         $this->f3->set('user_header', true);
         $this->f3->set('logout_link', true);
         $this->insertNav();
     }
 }