function change_group() { SiteRead::me()->access('change-group'); if (!isset($this->args[0])) { $this->error('Не верная ссылка'); } $user_id = (int) $this->args[0]; if ($this->user['id'] == $user_id) { $this->error('Свою группу изменить нельзя'); } $Anketa = new User($user_id); $info = $Anketa->get_info(); //Обработка формы---- if (isset($_POST['group'])) { try { SiteWrite::me()->change_user_group($user_id, $_POST['group']); $this->loc($this->back_url); } catch (Exception $e) { $this->error($e->getMessage(), false); } } //------------------- $this->des->set('user', $info); $this->des->set('change_group', true); $this->des->set('title', 'Панель - Пользователи - Смена группы'); $this->des->set('title_html', '<a href="' . H . '/panel">Панель</a> - <a href="' . H . '/panel/users">Пользователи</a> - ' . $info['login']); $this->des->display('user'); $this->des->display('panel/users'); }
function memcache_table_off() { if ($this->user['group'] != 'root') { $this->error('Доступ закрыт'); } SiteWrite::me()->save_conf('developer', 'memcache_table', 0); $this->loc($this->back_url); }
public function index() { //Обработка формы------- if (isset($_POST['save'])) { foreach ($this->groups as $gr) { foreach ($this->actions as $act) { try { SiteWrite::me()->save_access($gr['name'], $act['name'], isset($_POST[$gr['name']][$act['name']])); } catch (Exception $e) { $this->error($e->getMessage()); } } } $this->loc(H . '/panel/access'); } //---------------------- $this->des->set('title', 'Настройки доступа'); $this->des->set('title_html', '<a href="' . H . '/panel">Панель</a> - Настройки доступа'); $this->des->display('panel/access'); }
public function index() { if ($this->user['id']) { $this->error('Вы уже авторизированы!'); } //Авторизация через логин-пароль--- if (isset($_POST['login'])) { //Закрываем авторизацию по логину-паролю $this->error('Авторизация возможна только через Steam'); $this->des->set('title', 'Авторизация'); try { if ($arr = SiteRead::me()->auth($_POST['login'], $_POST['pas'])) { //Авторизируем пользователя $_SESSION['user_id'] = $arr['id']; //Пишем куки----- if (isset($_POST['remember'])) { setcookie('id', $arr['id'], time() + 3600 * 24 * 30, '/'); setcookie('p', $arr['pas'], time() + 3600 * 24 * 30, '/'); } //-------------- $this->loc($this->back_url); } } catch (Exception $e) { $this->error($e->getMessage(), false); } } //-------------- //Авторизация через OpenID $openid = new LightOpenID(H); if (!$openid->mode) { $openid->identity = 'http://steamcommunity.com/openid'; $this->loc($openid->authUrl()); } elseif ($openid->mode == 'cancel') { echo 'Авторизация отменена'; } else { if (!$openid->validate()) { $this->error('Ошибка авторизации'); } $id = $openid->identity; $ptn = "/^http:\\/\\/steamcommunity\\.com\\/openid\\/id\\/(7[0-9]{15,25}+)\$/"; preg_match($ptn, $id, $matches); $_SESSION['steamid'] = $matches[1]; $_SESSION['steam'] = Dota::me()->get_user_profile($_SESSION['steamid']); $_SESSION['user_id'] = SiteWrite::me()->steamRegistrationUser($_SESSION['steamid'], $_SESSION['steam']['personaname']); $this->loc(H); } //$this->des->display('login'); $this->des->display('_auth_form_steam'); }