2012-02-05 18:49:28 +02:00
|
|
|
<?php
|
2014-10-08 08:20:29 +03:00
|
|
|
/*
|
|
|
|
* LiveStreet CMS
|
|
|
|
* Copyright © 2013 OOO "ЛС-СОФТ"
|
|
|
|
*
|
|
|
|
* ------------------------------------------------------
|
|
|
|
*
|
|
|
|
* Official site: www.livestreetcms.com
|
|
|
|
* Contact e-mail: office@livestreetcms.com
|
|
|
|
*
|
|
|
|
* GNU General Public License, version 2:
|
|
|
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
|
|
*
|
|
|
|
* ------------------------------------------------------
|
|
|
|
*
|
|
|
|
* @link http://www.livestreetcms.com
|
|
|
|
* @copyright 2013 OOO "ЛС-СОФТ"
|
|
|
|
* @author Maxim Mzhelskiy <rus.engine@gmail.com>
|
|
|
|
*
|
|
|
|
*/
|
2012-02-05 18:49:28 +02:00
|
|
|
|
|
|
|
/**
|
2012-05-04 13:45:34 +03:00
|
|
|
* Регистрация основных хуков
|
2012-02-05 18:49:28 +02:00
|
|
|
*
|
2014-10-08 08:20:29 +03:00
|
|
|
* @package application.hooks
|
2012-05-04 13:45:34 +03:00
|
|
|
* @since 1.0
|
2012-02-05 18:49:28 +02:00
|
|
|
*/
|
2014-10-08 11:49:34 +03:00
|
|
|
class HookMain extends Hook
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Регистрируем хуки
|
|
|
|
*/
|
|
|
|
public function RegisterHook()
|
|
|
|
{
|
|
|
|
$this->AddHook('init_action', 'InitAction', __CLASS__, 1000);
|
2015-03-21 06:42:26 +02:00
|
|
|
$this->AddHook('start_action', 'StartAction', __CLASS__, 1000);
|
2014-10-08 11:49:34 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Обработка хука инициализации экшенов
|
2015-03-21 06:42:26 +02:00
|
|
|
* Может выполняться несколько раз, например, при использовании внутренних реврайтов
|
2014-10-08 11:49:34 +03:00
|
|
|
*/
|
|
|
|
public function InitAction()
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Проверка на закрытый режим
|
|
|
|
*/
|
|
|
|
$oUserCurrent = $this->User_GetUserCurrent();
|
2014-10-20 14:40:04 +03:00
|
|
|
if (!$oUserCurrent and Config::Get('general.close') and !Router::CheckIsCurrentAction((array)Config::Get('general.close_exceptions'))) {
|
2015-02-18 10:04:34 +02:00
|
|
|
Router::Action('auth/login');
|
2014-10-08 11:49:34 +03:00
|
|
|
}
|
2015-03-21 06:42:26 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Обработка запуска экшена
|
|
|
|
* Выполняется всегда только один раз
|
|
|
|
*/
|
|
|
|
public function StartAction()
|
|
|
|
{
|
|
|
|
$this->LoadDefaultJsVarAndLang();
|
2014-10-08 11:49:34 +03:00
|
|
|
/**
|
|
|
|
* Запуск обработки сборщика
|
|
|
|
*/
|
|
|
|
$this->Ls_SenderRun();
|
|
|
|
}
|
2015-02-02 18:58:48 +02:00
|
|
|
|
2015-03-21 06:42:26 +02:00
|
|
|
/**
|
|
|
|
* Загрузка необходимых переменных и текстовок в шаблон
|
|
|
|
*/
|
|
|
|
public function LoadDefaultJsVarAndLang()
|
2015-02-02 18:58:48 +02:00
|
|
|
{
|
2015-03-21 06:42:26 +02:00
|
|
|
/**
|
|
|
|
* Загружаем JS переменные
|
|
|
|
*/
|
|
|
|
$this->Viewer_AssignJs(
|
|
|
|
array(
|
|
|
|
'recaptcha.site_key' => Config::Get('module.validate.recaptcha.site_key'),
|
|
|
|
'comment_max_tree' => Config::Get('module.comment.max_tree'),
|
|
|
|
'comment_show_form' => Config::Get('module.comment.show_form'),
|
|
|
|
'topic_max_blog_count' => Config::Get('module.topic.max_blog_count'),
|
|
|
|
'block_stream_show_tip' => Config::Get('block.stream.show_tip'),
|
|
|
|
'poll_max_answers' => Config::Get('module.poll.max_answers'),
|
|
|
|
)
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Загрузка языковых текстовок
|
|
|
|
*/
|
|
|
|
$this->Lang_AddLangJs(array(
|
|
|
|
'comments.comments_declension',
|
|
|
|
'comments.unsubscribe',
|
|
|
|
'comments.subscribe',
|
|
|
|
'comments.folding.unfold',
|
|
|
|
'comments.folding.fold',
|
|
|
|
'comments.folding.unfold_all',
|
|
|
|
'comments.folding.fold_all',
|
|
|
|
'poll.notices.error_answers_max',
|
|
|
|
'blog.blog',
|
|
|
|
'favourite.add',
|
|
|
|
'favourite.remove',
|
|
|
|
'field.geo.select_city',
|
|
|
|
'field.geo.select_region',
|
|
|
|
'blog.add.fields.type.note_open',
|
|
|
|
'blog.add.fields.type.note_close',
|
|
|
|
'common.success.add',
|
|
|
|
'common.success.remove',
|
|
|
|
'pagination.notices.first',
|
|
|
|
'pagination.notices.last',
|
|
|
|
'user.actions.unfollow',
|
|
|
|
'user.actions.follow',
|
|
|
|
'user.friends.status.added',
|
|
|
|
'user.friends.status.notfriends',
|
|
|
|
'user.friends.status.pending',
|
|
|
|
'user.friends.status.rejected',
|
|
|
|
'user.friends.status.sent',
|
|
|
|
'user.friends.status.linked',
|
|
|
|
'blog.blocks.navigator.blog',
|
|
|
|
'user.settings.profile.notices.error_max_userfields',
|
|
|
|
'common.remove_confirm',
|
|
|
|
'more.empty',
|
|
|
|
'validate.tags.count'
|
|
|
|
));
|
2015-02-02 18:58:48 +02:00
|
|
|
}
|
2014-05-28 08:37:30 +03:00
|
|
|
}
|