当前位置: 首页>>代码示例>>PHP>>正文


PHP AF::setUser方法代码示例

本文整理汇总了PHP中AF::setUser方法的典型用法代码示例。如果您正苦于以下问题:PHP AF::setUser方法的具体用法?PHP AF::setUser怎么用?PHP AF::setUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AF的用法示例。


在下文中一共展示了AF::setUser方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: configuration

 private function configuration()
 {
     Assets::$test = TRUE;
     // Delete in real
     $this->fc = FrontController::getInstance();
     $this->controller = strtolower(str_replace('Controller', '', $this->fc->getController()));
     $this->action = strtolower(str_replace('Action', '', $this->fc->getAction()));
     $this->view = new View();
     $this->params = $this->fc->getParams();
     if ($this->controller == 'error') {
         return;
     }
     // Users and Access
     $this->mu = M_Users::Instance();
     $this->user = $this->mu->GetUser();
     $accessByIp = IpAccess::isAccess($_SERVER['REMOTE_ADDR']);
     if ((!$accessByIp || $this->user->locked) && $this->controller != 'authorization') {
         $expire = time() + 3600 * 24 * 100;
         setcookie('rUrl', $_SERVER['REQUEST_URI'], $expire, "/");
         $this->redirect(array('authorization', 'login'));
         exit;
     }
     $access = new Access();
     $access->fillFromUser($this->user);
     $access->setAccessParams($this->controller, $this->action);
     $sectionAccess = $access->sectionAccess();
     $actionAccess = $access->actionAccess();
     if (!$sectionAccess || !$actionAccess) {
         if ($this->user->isGuest) {
             $expire = time() + 3600 * 24 * 100;
             setcookie('rUrl', $_SERVER['REQUEST_URI'], $expire, "/");
             $this->redirect(array('authorization', 'login'));
         }
         $pageArr = $access->UserAccessPage;
         $redirectArray = $pageArr ? $pageArr : array('error', '');
         $this->redirect($redirectArray);
     }
     $this->access = $access;
     $sInfo = $access->actionAccess(array('service', 'info')) ? true : false;
     $this->fc->setSInfo($sInfo);
     unset($access);
     $this->pageTitle = __('pageTitle');
     $array = array('access' => $this->access, 'controller' => $this->controller, 'action' => $this->action, 'user' => $this->user);
     $this->setMainVars($array);
     if (!empty($_POST)) {
         $_POST = AF::clearDataArray($_POST);
     }
     // Set user
     AF::setUser($this->user);
     AF::setUserAccess($this->access);
     //$sectionID = ( isset($this->params['id']) && is_numeric($this->params['id']) ) ? $this->params['id'] : '';
     //Log::createLog($this->user->user_id, $this->action."Action", $this->controller, $sectionID);
 }
开发者ID:,项目名称:,代码行数:53,代码来源:


注:本文中的AF::setUser方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。