Ejemplo n.º 1
0
 protected function access_init()
 {
     if ($this->needLogin) {
         if ($this->user === null) {
             $this->redirect(M_Link::ToAuth('login'));
             exit;
         }
         $priv = $this->getInfoAction();
         // Проверка привелегия для доступа
         if ($this->check_priv($priv) == false) {
             die('Отказано в доступе');
         }
     }
 }
Ejemplo n.º 2
0
 protected function before()
 {
     if ($this->needLogin && $this->user === null) {
         $this->redirect(M_Link::ToAuth('login'));
     }
     $this->title = SITE_NAME;
     $this->content = "";
     // Получает данные о шаблоне
     $this->template_name = M_Templates::Instance()->getCurrentTemplate();
     $this->templateDir = BASE_URL . TEMPLATE_DIR . $this->template_name;
     $this->template = $this->getTemplate('v_main.php');
     $this->getMediaTemplate(substr($this->templateDir, iconv_strlen(BASE_URL)) . '/media_main.info');
     $this->enableBlocks = M_Templates::Instance()->getBlocksTemplate($this->template_name);
     // Получаем данные главного меню
     $this->mainMenu = M_MenuLink::Instance()->getTopItemsByMenu(1);
 }
Ejemplo n.º 3
0
 public function action_account()
 {
     $this->title = 'Настройки профиля';
     $this->breadCrambsActive = $this->title;
     $mUsers = M_Users::Instance();
     $user = $mUsers->Get();
     if (empty($user)) {
         $this->redirect(M_Link::ToAuth('login'));
     }
     $this->success = '';
     $this->fields['user_name'] = $user['user_name'];
     $this->fields['mimemail'] = $user['mimemail'];
     if ($this->isPost()) {
         // Если меняем пароль
         if (isset($_POST['changepass'])) {
             if ($mUsers->change_pass($user, $_POST)) {
                 $_SESSION['suc_account'] = "Пароль успешно изменен";
                 $this->redirect(M_Link::ToAuth('account'));
             }
             $this->messages = $mUsers->errors();
         }
         // Смена других настроек
         if (isset($_POST['profile'])) {
             if ($mUsers->edit($user['user_id'], $_POST)) {
                 $_SESSION['suc_account'] = "Изменения сохранены";
                 $this->redirect(M_Link::ToAuth('account'));
             }
             $this->messages = $mUsers->errors();
         }
     }
     //Флаг вывода при успешном изменении настроек
     if (isset($_SESSION['suc_account'])) {
         $this->success = $_SESSION['suc_account'];
         unset($_SESSION['suc_account']);
     }
     // Получение пути к шаблону
     $templateName = $this->getTemplate('components/auth/v_account.php');
     $this->blocks['_content_page'] = $this->Template($templateName, $this);
 }
Ejemplo n.º 4
0
 public function action_subscriptions()
 {
     $user = $this->user;
     if (!$user) {
         $this->redirect(M_Link::ToAuth('login'));
     }
     $this->title = 'Списки подписки';
     $this->breadCrambsActive = $this->title;
     $this->pageUrl = rtrim(M_Link::ToPage('subscriptions'), '/');
     if ($this->isPost()) {
         foreach ($_POST as $key => $value) {
             // Если нажата кнопка отправки ...
             if (substr($key, 0, 6) == 'listid') {
                 $action = explode('_', $key);
                 if (count($action == 3) && !empty($user)) {
                     $fields['listid'] = $action[2];
                     $fields['email'] = $user['login'];
                     if ($action[1] == 'subsc') {
                         M_Mailinglists::Instance()->subscribe($fields);
                     } else {
                         if ($action[1] == 'unsubsc') {
                             M_Mailinglists::Instance()->unsubscribe($fields);
                         }
                     }
                     $this->redirect(M_Link::ToPage('subscriptions'));
                 }
             }
         }
     }
     $this->user_subscr = M_Mailinglists::Instance()->get_user_subscr($user['login']);
     //получение номера страницы
     $page_num = isset($_GET['param']) ? (int) $_GET['param'] : 1;
     if ($page_num < 1) {
         $page_num = 1;
     }
     //cоздание объекта постраничной навигации(обязательные параметры)
     $mPagination = new M_Pagination('mailinglists', M_Link::ToPage('subscriptions'));
     //задание свойств объекта
     $this->pages = $mPagination->on_page(5)->page_num($page_num)->where('is_show = 1')->page();
     // Получение пути к шаблону
     $templateName = $this->getTemplate('v_navbar.php');
     // Получение hmlt-кода панели навигации
     $this->navBar = $this->Template($templateName, $mPagination);
     //формирование контента страницы
     $this->navParams = $mPagination->navparams();
     // Получение пути к шаблону
     $templateName = $this->getTemplate('components/page/v_subscriptions.php');
     $this->blocks['_content_page'] = $this->Template($templateName, $this);
 }
Ejemplo n.º 5
0
<div class="well well-sm">
	<span>Вы успешно зарегистрировались, <a href="<?php 
echo M_Link::ToAuth('login');
?>
">Войти</a></span>
</div>
Ejemplo n.º 6
0
			<a href="<?php 
    echo M_Link::ToAuth('registr');
    ?>
">Зарегистрироваться</a><br>
			<a href="<?php 
    echo M_Link::ToAuth('forgetpass');
    ?>
">Забыл пароль</a>
		</div>
		<button class="btn btn-sm btn-primary btn-block" type="submit">Войти</button>
	</form>
</div>

<?php 
} else {
    ?>
<div class="well well-sm">
	<p>Вы вошли как <?php 
    echo $user['user_name'];
    ?>
, <a href="<?php 
    echo M_Link::ToAuth('logout');
    ?>
">Выйти</a></p>
	<p><a href="<?php 
    echo M_Link::ToAuth('account');
    ?>
">Настройки профиля</a></p>
</div>
<?php 
}
Ejemplo n.º 7
0
"><?php 
echo SITE_NAME;
?>
</a>
			</div>
			<div id="login-collapse" class="navbar-collapse collapse">
				<ul class="nav navbar-nav navbar-right">
					<li><a href="<?php 
echo M_Link::ToAuth('account');
?>
"><?php 
echo $object->getUserName();
?>
</a></li>
					<li><a href="<?php 
echo M_Link::ToAuth('logout');
?>
"> Выйти</a></li>
				</ul>
			</div>
		</div>
	</div>
	
	
	<div class="container-fluid">
		<div class="row">
			<div class="col-md-2 sidebar">
			
				<div class="navbar navbar-default">
				
					<div class="navbar-header">