Example #1
0
 public function get($mother)
 {
     $mother = (string) $mother;
     $arr = array();
     foreach ($this->full_array as $val) {
         if ($val['mother'] != $mother) {
             continue;
         }
         $access_arr = explode(',', $val['access']);
         if ($access_arr and $this->user['group'] != 'root') {
             foreach ($access_arr as $access) {
                 if (!$access) {
                     continue;
                 } elseif ($access == 'user') {
                     if (!$this->user['id']) {
                         continue 2;
                     }
                 } elseif (!SiteRead::me()->is_access($access)) {
                     continue 2;
                 }
             }
         }
         preg_match_all('|{([a-zA-Z0-9]+)->([a-zA-Z0-9]+)}|', $val['url'], $match);
         if ($match[1]) {
             $m = $this->{$match}[1][0];
             $val['url'] = str_replace($match[0][0], $m[$match[2][0]], $val['url']);
         }
         // $val['url'] = H . '/' . $val['url'];
         $arr[] = $val;
     }
     return $arr;
 }
Example #2
0
 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');
 }
Example #3
0
 public function __construct($args)
 {
     parent::__construct($args);
     SiteRead::me()->access('panel-settings');
 }
Example #4
0
 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');
 }
Example #5
0
 public function __construct($args)
 {
     parent::__construct($args);
     SiteRead::me()->access('menu-editor');
 }
Example #6
0
 public function __construct($args)
 {
     parent::__construct($args);
     SiteRead::me()->access('change-modules');
 }
Example #7
0
 function __destruct()
 {
     if ($this->auto_head) {
         //Кол-во запросов в базу----
         $this->set('sql_count', $this->db->get_query_count());
         $this->set('sql_time', round($this->db->get_exec_time_ms(), 3));
         //--------------------------
         //Конец генерации страницы.-----------------
         $this->set('gentime', round(microtime(true) - $_SESSION['start_gen_time'], 3));
         //-----------------------------------------
         $this->display('_foot');
         if ($this->user['group'] == 'root') {
             //Вывод Контроллера и параметров
             if ($this->conf['developer']['params_table']) {
                 echo '<div style="margin:20px;padding:20px;border:solid 1px #cccccc;">Контроллер: <b>' . $this->registry['controller']['name'] . ' (' . $this->registry['controller']['file'] . ')</b><br />Аргументы: <pre>' . htmlspecialchars(print_r($this->registry['args'], true)) . '</pre></div>';
             }
             //Вывод логов БД
             if ($this->conf['developer']['sql_table']) {
                 echo SiteRead::me()->dbLog2html();
             }
             //Вывод Memcache
             if ($this->conf['developer']['memcache_table']) {
                 echo SiteRead::me()->memCache2html();
             }
         }
     }
 }