public function userGroupsPostAction($rcid = false) { $views = $this->getView(); $data = $this->getRequest(); $members = MembersManage::instance(); $app = $members->getCurrentSession(); if (!$app) { exit; } $roles = Roles::instance(); $rolegroups = $roles->getAllRoles(); $roleControl = new RolesControl(); $subtitle = '添加'; $role = $permission = $currentRole = array(); $currentRole = ''; if ($rcid > 0) { $subtitle = '编辑'; $currentRole = $roleControl->getUserPermissionForId($rcid); } $views->assign('title', '用户组编辑'); $views->assign('subtitle', $subtitle); $views->assign('rolegroups', $rolegroups); $views->assign('currentRole', $currentRole); $views->display('admin/usergroups/post-modal.html.twig'); }
/** * Login * * @param String ,$email * @param String ,$password * @return Boolean or Array */ public function login($email, $password) { if ($this->getCurrentSession() or empty($email) or empty($password)) { return false; } $email = addslashes($email); $password = addslashes($password); $wherearr = "email='" . $this->members->escapeString($email) . "' AND password='******'"; $row = $this->members->field("id,email,username,role_id,published")->where($wherearr)->fetchRow(); if ($row) { if ($user = $this->getCurrentSession()) { if ($user['uid'] == $row['id']) { return false; } } else { $roles = new RolesControl(); $role = $roles->getRolePermissionForId($row['role_id']); $permission = $role ? $role['permission'] : false; $info_table = $this->memberInfo->table; $info = $this->memberInfo->field("{$info_table}.id, {$info_table}.avatar_id, im.path as cover")->joinQuery("images_member as im", "im.imid={$info_table}.avatar_id")->where("{$info_table}.id='" . $row['id'] . "'")->order("{$info_table}.last_dateline DESC")->limit("1")->fetchList(); $app = array('uid' => $row['id'], 'email' => $row['email'], 'username' => $row['username'], 'cover' => false, 'role_id' => $row['role_id'], 'permission' => $permission); $infoArr = array('last_ip' => Registry::get('common')->ip(), 'last_dateline' => UPDATE_TIME); $this->memberInfo->where("id='" . $row['id'] . "'")->update($infoArr); if (is_array($info)) { foreach ($info as $key => $value) { if (isset($value['avatar_id']) and $value['avatar_id']) { $app['cover_small'] = ImagesManage::getRealCoverSize($value['cover']); $app['cover_medium'] = ImagesManage::getRealCoverSize($value['cover'], "medium"); $app['cover'] = ImagesManage::getRelativeImage($value['cover']); } } } $_SESSION['app'] = $app; return $row['id']; } } return false; }