本文整理汇总了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);
}