function EditAction() { $request = Project::getRequest(); $this->BaseAdminData(); $model = new UserModel(); $data = $model->load($request->id); $info = array(); $info['edit_data'] = $data; $info['save_controller'] = null; $info['save_action'] = 'Save'; $type_model = new UserTypeModel(); $info['user_group_list'] = $type_model->loadAll(); $ban_model = new BanHistoryModel(); $info['banned'] = $ban_model->isBanned($request->id); if ($info['banned']) { $info['banned_date'] = $ban_model->banned_till; } $info['history_link'] = $request->createUrl('AdminUser', 'BanHistory', array($request->id)); $this->_view->AjaxEdit($info); $this->_view->ajax(); }
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']); } } }