public function run() { $autorize = Project::getSecurityManager()->getAutorize(); $controller_class = $autorize->getController()->name; $controller = new $controller_class(); $controller->init($autorize->getController(), $autorize->getAction()); $action_function = $autorize->getAction()->name . 'Action'; setcookie('PHPSESSID', session_id(), null, null, Project::getUser()->getDbUser()->login . '.next24.ru'); $controller->{$action_function}(); $this->_request_complete = true; // Сохраняем время пользователя на серваке $user = Project::getUser()->getDbUser(); if ($user->id) { $userModel = new UserModel(); $userModel->refreshUsersOnline(); if (!$userModel->isUserOnline($user->id)) { $userModel->addUserOnline($user->id); } else { $userModel->updateUserOnline($user->id); } $userModel = new UserModel(); $user = $userModel->getUserById($user->id); $userModel->checkForUserBans($user); } // END Сохраняем время пользователя на серваке return $controller; }
function __construct() { $this->_fm_priority = array(FM::ERROR => 1, FM::WARNING => 2, FM::INFO => 3); $request = Project::getRequest(); $url = $request->getHost(); $parent_url = $request->getParentHost(); $tm = Project::getTemplateManager(); $this->css_url = $url . $tm->getCssPath(); $this->js_url = $url . $tm->getJsPath(); $this->css_path = $_SERVER['DOCUMENT_ROOT'] . '/' . $tm->getCssPath(); $this->js_path = $_SERVER['DOCUMENT_ROOT'] . '/' . $tm->getJsPath(); //$this -> image_url = $url . $tm -> getImagePath(); $this->image_url = $parent_url . $tm->getImagePath(); $this->cj_cache_url = $url . $tm->getCJCachePath(); $this->cj_cache_path = $_SERVER['DOCUMENT_ROOT'] . '/' . $tm->getCJCachePath(); // Setting title $title = array(); $controller = Project::getSecurityManager()->getAutorize()->getController(); $action = Project::getSecurityManager()->getAutorize()->getAction(); if ($action->page_title) { $title[] = $action->page_title; } if ($controller->description) { $title[] = $controller->description; } $title[] = 'Next24.Ru'; $this->page_title = implode(" | ", $title); //print_r($action); $this->helper =& $request; }
public function LogoutAction() { Project::getSecurityManager()->logout(); Project::getResponse()->redirect(Project::getRequest()->createUrl('Index', 'Index', null, false)); }
public function checkForUserBans($user) { $banHistoryModel = new BanHistoryModel(); $paramModel = new ParamModel(); if ($user['banned'] || $banHistoryModel->isBanned($user['id'])) { // если забанен , проверить может уже все $t_ban_time_sec = $paramModel->getParam("UserController", "T_BAN_TIME_SEC"); if (time() > $user['banned_date'] + $t_ban_time_sec) { $this->load($user['id']); $this->banned = 0; $this->save(); $banHistoryModel->unban($user['id'], 1); } else { Project::getSecurityManager()->logout(); Project::getResponse()->redirect(Project::getRequest()->createUrl('User', 'Login', null, false) . "/error:ban/login:" . $user['login']); } } }
public function LogoutAction() { Project::getSecurityManager()->logout(); Project::getResponse()->redirect(Project::getRequest()->createUrl(null, 'LoginForm')); }