1
0
Fork 0
mirror of https://github.com/Oreolek/ifhub.club.git synced 2024-06-17 07:10:48 +03:00
This commit is contained in:
Alexey Kachayev 2010-02-06 09:04:36 +00:00
parent ef584642d5
commit d13b6a2115
25 changed files with 26 additions and 111 deletions

View file

@ -29,13 +29,11 @@ class ActionAdmin extends Action {
protected $sMenuHeadItemSelect='admin';
public function Init() {
$this->Hook_Run('action_init_admin_before');
if(!$this->User_IsAuthorization() or !$oUserCurrent=$this->User_GetUserCurrent() or !$oUserCurrent->isAdministrator()) {
return parent::EventNotFound();
}
$this->oUserCurrent=$oUserCurrent;
$this->Hook_Run('action_init_admin_after');
}
protected function RegisterEvent() {
@ -121,7 +119,6 @@ class ActionAdmin extends Action {
* Загружаем в шаблон необходимые переменные
*/
$this->Viewer_Assign('sMenuHeadItemSelect',$this->sMenuHeadItemSelect);
$this->Hook_Run('action_shutdown_admin');
}
}
?>

View file

@ -87,7 +87,6 @@ class ActionBlog extends Action {
*
*/
public function Init() {
$this->Hook_Run('action_init_blog_before');
/**
* Устанавливаем евент по дефолту, т.е. будем показывать хорошие топики из коллективных блогов
*/
@ -105,8 +104,6 @@ class ActionBlog extends Action {
$this->iCountTopicsPersonalNew=$this->Topic_GetCountTopicsPersonalNew();
$this->iCountTopicsBlogNew=$this->iCountTopicsCollectiveNew;
$this->iCountTopicsNew=$this->iCountTopicsCollectiveNew+$this->iCountTopicsPersonalNew;
$this->Hook_Run('action_init_blog_after');
}
/**
@ -1274,8 +1271,6 @@ class ActionBlog extends Action {
$this->Viewer_Assign('BLOG_USER_ROLE_INVITE', LsBlog::BLOG_USER_ROLE_INVITE);
$this->Viewer_Assign('BLOG_USER_ROLE_REJECT', LsBlog::BLOG_USER_ROLE_REJECT);
$this->Viewer_Assign('BLOG_USER_ROLE_BAN', LsBlog::BLOG_USER_ROLE_BAN);
$this->Hook_Run('action_shutdown_blog');
}
}
?>

View file

@ -29,7 +29,6 @@ class ActionBlogs extends Action {
protected $sMenuHeadItemSelect='blog';
public function Init() {
$this->Hook_Run('action_init_blogs');
}
protected function RegisterEvent() {
@ -78,7 +77,6 @@ class ActionBlogs extends Action {
* Загружаем в шаблон необходимые переменные
*/
$this->Viewer_Assign('sMenuHeadItemSelect',$this->sMenuHeadItemSelect);
$this->Hook_Run('action_shutdown_blogs');
}
}
?>

View file

@ -28,8 +28,7 @@ class ActionComments extends Action {
*/
protected $sMenuHeadItemSelect='blog';
public function Init() {
$this->Hook_Run('action_init_comments');
public function Init() {
}
protected function RegisterEvent() {
@ -81,8 +80,7 @@ class ActionComments extends Action {
/**
* Загружаем в шаблон необходимые переменные
*/
$this->Viewer_Assign('sMenuHeadItemSelect',$this->sMenuHeadItemSelect);
$this->Hook_Run('action_shutdown_comments');
$this->Viewer_Assign('sMenuHeadItemSelect',$this->sMenuHeadItemSelect);
}
}
?>

View file

@ -27,8 +27,6 @@ class ActionError extends Action {
public function Init() {
$this->SetDefaultEvent('index');
Router::SetIsShowStats(false);
$this->Hook_Run('action_init_error');
}
/**
* Регистрируем евент

View file

@ -62,15 +62,12 @@ class ActionIndex extends Action {
*
*/
public function Init() {
$this->Hook_Run('action_init_index_before');
/**
* Подсчитываем новые топики
*/
$this->iCountTopicsCollectiveNew=$this->Topic_GetCountTopicsCollectiveNew();
$this->iCountTopicsPersonalNew=$this->Topic_GetCountTopicsPersonalNew();
$this->iCountTopicsNew=$this->iCountTopicsCollectiveNew+$this->iCountTopicsPersonalNew;
$this->Hook_Run('action_init_index_after');
}
/**
* Регистрация евентов
@ -130,8 +127,6 @@ class ActionIndex extends Action {
$this->Viewer_Assign('iCountTopicsNew',$this->iCountTopicsNew);
$this->Viewer_Assign('iCountTopicsCollectiveNew',$this->iCountTopicsCollectiveNew);
$this->Viewer_Assign('iCountTopicsPersonalNew',$this->iCountTopicsPersonalNew);
$this->Hook_Run('action_shutdown_index');
}
}
?>

View file

@ -50,14 +50,10 @@ class ActionLink extends Action {
*
* @return unknown
*/
public function Init() {
$this->Hook_Run('action_init_link_before');
public function Init() {
$this->oUserCurrent=$this->User_GetUserCurrent();
$this->SetDefaultEvent('add');
$this->Viewer_AddHtmlTitle($this->Lang_Get('topic_link_title'));
$this->Hook_Run('action_init_link_after');
}
/**
* Регистрируем евенты
@ -501,8 +497,6 @@ class ActionLink extends Action {
$this->Viewer_Assign('sMenuHeadItemSelect',$this->sMenuHeadItemSelect);
$this->Viewer_Assign('sMenuItemSelect',$this->sMenuItemSelect);
$this->Viewer_Assign('sMenuSubItemSelect',$this->sMenuSubItemSelect);
$this->Hook_Run('action_shutdown_link');
}
}
?>

View file

@ -27,8 +27,6 @@ class ActionLogin extends Action {
public function Init() {
$this->SetDefaultEvent('index');
Router::SetIsShowStats(false);
$this->Hook_Run('action_init_login');
}
/**
* Регистрируем евенты

View file

@ -33,8 +33,7 @@ class ActionMy extends Action {
*/
protected $oUserProfile=null;
public function Init() {
$this->Hook_Run('action_init_my');
public function Init() {
}
protected function RegisterEvent() {
@ -139,9 +138,7 @@ class ActionMy extends Action {
* Выполняется при завершении работы экшена
*
*/
public function EventShutdown() {
$this->Hook_Run('action_shutdown_my_before');
public function EventShutdown() {
if (!$this->oUserProfile) {
return ;
}
@ -153,8 +150,6 @@ class ActionMy extends Action {
$this->Viewer_Assign('oUserProfile',$this->oUserProfile);
$this->Viewer_Assign('iCountTopicUser',$iCountTopicUser);
$this->Viewer_Assign('iCountCommentUser',$iCountCommentUser);
$this->Hook_Run('action_shutdown_my_after');
}
}
?>

View file

@ -61,16 +61,13 @@ class ActionNew extends Action {
* Инициализация
*
*/
public function Init() {
$this->Hook_Run('action_init_new_before');
public function Init() {
/**
* Подсчитываем новые топики
*/
$this->iCountTopicsCollectiveNew=$this->Topic_GetCountTopicsCollectiveNew();
$this->iCountTopicsPersonalNew=$this->Topic_GetCountTopicsPersonalNew();
$this->iCountTopicsNew=$this->iCountTopicsCollectiveNew+$this->iCountTopicsPersonalNew;
$this->Hook_Run('action_init_new_after');
}
/**
* Регистрация евентов
@ -130,8 +127,6 @@ class ActionNew extends Action {
$this->Viewer_Assign('iCountTopicsNew',$this->iCountTopicsNew);
$this->Viewer_Assign('iCountTopicsCollectiveNew',$this->iCountTopicsCollectiveNew);
$this->Viewer_Assign('iCountTopicsPersonalNew',$this->iCountTopicsPersonalNew);
$this->Hook_Run('action_shutdown_new');
}
}
?>

View file

@ -24,7 +24,6 @@ class ActionPage extends Action {
protected $aBadPageUrl=array('admin');
public function Init() {
$this->Hook_Run('action_init_page');
}
/**
* Регистрируем евенты

View file

@ -32,12 +32,8 @@ class ActionPeople extends Action {
*
*/
public function Init() {
$this->Hook_Run('action_init_people_before');
$this->SetDefaultEvent('good');
$this->Viewer_AddHtmlTitle($this->Lang_Get('people'));
$this->Hook_Run('action_init_people_after');
}
/**
* Регистрируем евенты
@ -243,8 +239,7 @@ class ActionPeople extends Action {
/**
* Загружаем в шаблон необходимые переменные
*/
$this->Viewer_Assign('sMenuHeadItemSelect',$this->sMenuHeadItemSelect);
$this->Hook_Run('action_shutdown_people');
$this->Viewer_Assign('sMenuHeadItemSelect',$this->sMenuHeadItemSelect);
}
}
?>

View file

@ -45,7 +45,6 @@ class ActionPersonalBlog extends Action {
*/
public function Init() {
$this->SetDefaultEvent('good');
$this->Hook_Run('action_init_personal_blog');
}
/**
@ -106,7 +105,6 @@ class ActionPersonalBlog extends Action {
*
*/
public function EventShutdown() {
$this->Hook_Run('action_shutdown_personal_blog_before');
/**
* Подсчитываем новые топики
*/
@ -122,8 +120,6 @@ class ActionPersonalBlog extends Action {
$this->Viewer_Assign('iCountTopicsCollectiveNew',$iCountTopicsCollectiveNew);
$this->Viewer_Assign('iCountTopicsPersonalNew',$iCountTopicsPersonalNew);
$this->Viewer_Assign('iCountTopicsNew',$iCountTopicsNew);
$this->Hook_Run('action_shutdown_personal_blog_after');
}
}
?>

View file

@ -29,14 +29,11 @@ class ActionPlugins extends Action {
protected $sMenuHeadItemSelect='plugins';
public function Init() {
$this->Hook_Run('action_init_plugins_before');
if(!$this->User_IsAuthorization() or !$oUserCurrent=$this->User_GetUserCurrent() or !$oUserCurrent->isAdministrator()) {
return parent::EventNotFound();
}
$this->oUserCurrent=$oUserCurrent;
$this->Hook_Run('action_init_plugins_after');
}
protected function RegisterEvent() {
@ -118,8 +115,7 @@ class ActionPlugins extends Action {
/**
* Загружаем в шаблон необходимые переменные
*/
$this->Viewer_Assign('sMenuHeadItemSelect',$this->sMenuHeadItemSelect);
$this->Hook_Run('action_shutdown_plugins');
$this->Viewer_Assign('sMenuHeadItemSelect',$this->sMenuHeadItemSelect);
}
}
?>

View file

@ -33,8 +33,7 @@ class ActionProfile extends Action {
*/
protected $oUserProfile;
public function Init() {
$this->Hook_Run('action_init_profile');
public function Init() {
}
protected function RegisterEvent() {
@ -670,8 +669,6 @@ class ActionProfile extends Action {
* Выполняется при завершении работы экшена
*/
public function EventShutdown() {
$this->Hook_Run('action_shutdown_profile_before');
if (!$this->oUserProfile) {
return ;
}
@ -693,8 +690,6 @@ class ActionProfile extends Action {
$this->Viewer_Assign('USER_FRIEND_ACCEPT',LsUser::USER_FRIEND_ACCEPT);
$this->Viewer_Assign('USER_FRIEND_REJECT',LsUser::USER_FRIEND_REJECT);
$this->Viewer_Assign('USER_FRIEND_DELETE',LsUser::USER_FRIEND_DELETE);
$this->Hook_Run('action_shutdown_profile_after');
}
}
?>

View file

@ -51,8 +51,6 @@ class ActionQuestion extends Action {
* @return unknown
*/
public function Init() {
$this->Hook_Run('action_init_question_before');
/**
* Проверяем авторизован ли юзер
*/
@ -63,8 +61,6 @@ class ActionQuestion extends Action {
$this->oUserCurrent=$this->User_GetUserCurrent();
$this->SetDefaultEvent('add');
$this->Viewer_AddHtmlTitle($this->Lang_Get('topic_question_title'));
$this->Hook_Run('action_init_question_after');
}
/**
* Регистрируем евенты
@ -511,8 +507,6 @@ class ActionQuestion extends Action {
$this->Viewer_Assign('sMenuHeadItemSelect',$this->sMenuHeadItemSelect);
$this->Viewer_Assign('sMenuItemSelect',$this->sMenuItemSelect);
$this->Viewer_Assign('sMenuSubItemSelect',$this->sMenuSubItemSelect);
$this->Hook_Run('action_shutdown_question');
}
}
?>

View file

@ -26,7 +26,6 @@ class ActionRegistration extends Action {
* @return unknown
*/
public function Init() {
$this->Hook_Run('action_init_registration_before');
/**
* Проверяем аторизован ли юзер
*/
@ -43,8 +42,6 @@ class ActionRegistration extends Action {
$this->SetDefaultEvent('index');
$this->Viewer_AddHtmlTitle($this->Lang_Get('registration'));
$this->Hook_Run('action_init_registration_after');
}
/**
* Регистрируем евенты

View file

@ -32,7 +32,6 @@ class ActionRss extends Action {
*/
protected function InitRss() {
header('Content-Type: application/rss+xml; charset=utf-8');
$this->Hook_Run('action_init_rss_after');
}
protected function RegisterEvent() {

View file

@ -5,12 +5,8 @@ class ActionSearch extends Action {
private $bIsResults = FALSE;
public function Init() {
$this->Hook_Run('action_init_search_before');
$this->SetDefaultEvent('index');
$this->Viewer_AddHtmlTitle($this->Lang_Get('search'));
$this->Hook_Run('action_init_search_after');
}
protected function RegisterEvent() {

View file

@ -44,8 +44,7 @@ class ActionSettings extends Action {
*
* @return unknown
*/
public function Init() {
$this->Hook_Run('action_init_settings_before');
public function Init() {
/**
* Проверяем авторизован ли юзер
*/
@ -59,8 +58,6 @@ class ActionSettings extends Action {
$this->oUserCurrent=$this->User_GetUserCurrent();
$this->SetDefaultEvent('profile');
$this->Viewer_AddHtmlTitle($this->Lang_Get('settings_menu'));
$this->Hook_Run('action_init_settings_after');
}
protected function RegisterEvent() {

View file

@ -31,7 +31,6 @@ class ActionTag extends Action {
*
*/
public function Init() {
$this->Hook_Run('action_init_tag');
}
protected function RegisterEvent() {
@ -90,7 +89,6 @@ class ActionTag extends Action {
* Загружаем в шаблон необходимые переменные
*/
$this->Viewer_Assign('sMenuHeadItemSelect',$this->sMenuHeadItemSelect);
$this->Hook_Run('action_shutdown_tag');
}
}
?>

View file

@ -38,8 +38,7 @@ class ActionTalk extends Action {
*
* @return unknown
*/
public function Init() {
$this->Hook_Run('action_init_talk_before');
public function Init() {
/**
* Проверяем авторизован ли юзер
*/
@ -53,8 +52,6 @@ class ActionTalk extends Action {
$this->oUserCurrent=$this->User_GetUserCurrent();
$this->SetDefaultEvent('inbox');
$this->Viewer_AddHtmlTitle($this->Lang_Get('talk_menu_inbox'));
$this->Hook_Run('action_init_talk_after');
}
protected function RegisterEvent() {
@ -972,8 +969,6 @@ class ActionTalk extends Action {
}
public function EventShutdown() {
$this->Hook_Run('action_shutdown_talk_before');
if (!$this->oUserCurrent) {
return ;
}
@ -986,8 +981,6 @@ class ActionTalk extends Action {
$this->Viewer_Assign('TALK_USER_ACTIVE',LsTalk::TALK_USER_ACTIVE);
$this->Viewer_Assign('TALK_USER_DELETE_BY_SELF',LsTalk::TALK_USER_DELETE_BY_SELF);
$this->Viewer_Assign('TALK_USER_DELETE_BY_AUTHOR',LsTalk::TALK_USER_DELETE_BY_AUTHOR);
$this->Hook_Run('action_shutdown_talk_after');
}
}
?>

View file

@ -37,13 +37,9 @@ class ActionTop extends Action {
* Инициализация
*
*/
public function Init() {
$this->Hook_Run('action_init_top_before');
public function Init() {
$this->SetDefaultEvent('topic');
$this->Viewer_AddHtmlTitle($this->Lang_Get('top'));
$this->Hook_Run('action_init_top_after');
}
/**
* Регистрация евентов
@ -167,8 +163,6 @@ class ActionTop extends Action {
*
*/
public function EventShutdown() {
$this->Hook_Run('action_shutdown_top_before');
/**
* Получаем список новых топиков
*/
@ -183,8 +177,6 @@ class ActionTop extends Action {
$this->Viewer_Assign('iCountTopicsCollectiveNew',$iCountTopicsCollectiveNew);
$this->Viewer_Assign('iCountTopicsPersonalNew',$iCountTopicsPersonalNew);
$this->Viewer_Assign('iCountTopicsNew',$iCountTopicsNew);
$this->Hook_Run('action_shutdown_top_after');
}
}
?>

View file

@ -51,8 +51,6 @@ class ActionTopic extends Action {
* @return unknown
*/
public function Init() {
$this->Hook_Run('action_init_topic_before');
/**
* Проверяем авторизован ли юзер
*/
@ -62,8 +60,6 @@ class ActionTopic extends Action {
$this->oUserCurrent=$this->User_GetUserCurrent();
$this->SetDefaultEvent('add');
$this->Viewer_AddHtmlTitle($this->Lang_Get('topic_title'));
$this->Hook_Run('action_init_topic_after');
}
/**
* Регистрируем евенты
@ -553,8 +549,6 @@ class ActionTopic extends Action {
$this->Viewer_Assign('sMenuHeadItemSelect',$this->sMenuHeadItemSelect);
$this->Viewer_Assign('sMenuItemSelect',$this->sMenuItemSelect);
$this->Viewer_Assign('sMenuSubItemSelect',$this->sMenuSubItemSelect);
$this->Hook_Run('action_shutdown_topic');
}
}
?>

View file

@ -177,7 +177,15 @@ class Router extends Object {
$sClassName=$sActionClass.$sPrefixCustom;
$this->oAction=new $sClassName($this->oEngine,self::$sAction);
if ($this->oAction->Init()==='next') {
/**
* Инициализируем экшен
*/
$this->Hook_Run("action_init_".strtolower($sActionClass)."_before");
$sInitResult = $this->oAction->Init();
$this->Hook_Run("action_init_".strtolower($sActionClass)."_after");
if ($sInitResult==='next') {
$this->ExecAction();
} else {
/**
@ -186,11 +194,14 @@ class Router extends Object {
$oProfiler=ProfilerSimple::getInstance();
$iTimeId=$oProfiler->Start('ExecAction',self::$sAction);
$res=$this->oAction->ExecEvent();
$res=$this->oAction->ExecEvent();
$this->Hook_Run("action_shutdown_".strtolower($sActionClass)."_before");
$this->oAction->EventShutdown();
$this->Hook_Run("action_shutdown_".strtolower($sActionClass)."_after");
$oProfiler->Stop($iTimeId);
if ($res==='next') {
$this->ExecAction();
}