mirror of
https://github.com/Oreolek/ifhub.club.git
synced 2024-06-17 07:10:48 +03:00
Hooks for Add, Edit, Delete objects Blog, Topic, Comment
This commit is contained in:
parent
8eea346766
commit
9578ffb234
|
@ -201,7 +201,9 @@ class ActionBlog extends Action {
|
|||
/**
|
||||
* Создаём блог
|
||||
*/
|
||||
$this->Hook_Run('blog_add_before', array('oBlog'=>$oBlog));
|
||||
if ($this->Blog_AddBlog($oBlog)) {
|
||||
$this->Hook_Run('blog_add_after', array('oBlog'=>$oBlog));
|
||||
/**
|
||||
* Получаем блог, это для получение полного пути блога, если он в будущем будет зависит от других сущностей(компании, юзер и т.п.)
|
||||
*/
|
||||
|
@ -301,7 +303,9 @@ class ActionBlog extends Action {
|
|||
/**
|
||||
* Обновляем блог
|
||||
*/
|
||||
$this->Hook_Run('blog_edit_before', array('oBlog'=>$oBlog));
|
||||
if ($this->Blog_UpdateBlog($oBlog)) {
|
||||
$this->Hook_Run('blog_edit_after', array('oBlog'=>$oBlog));
|
||||
Router::Location($oBlog->getUrlFull());
|
||||
} else {
|
||||
$this->Message_AddErrorSingle($this->Lang_Get('system_error'),$this->Lang_Get('error'));
|
||||
|
@ -881,7 +885,10 @@ class ActionBlog extends Action {
|
|||
/**
|
||||
* Добавляем коммент
|
||||
*/
|
||||
if ($this->Comment_AddComment($oCommentNew)) {
|
||||
$this->Hook_Run('comment_add_before', array('oCommentNew'=>$oCommentNew,'oCommentParent'=>$oCommentParent,'oTopic'=>$oTopic));
|
||||
if ($this->Comment_AddComment($oCommentNew)) {
|
||||
$this->Hook_Run('comment_add_after', array('oCommentNew'=>$oCommentNew,'oCommentParent'=>$oCommentParent,'oTopic'=>$oTopic));
|
||||
|
||||
$this->Viewer_AssignAjax('sCommentId',$oCommentNew->getId());
|
||||
if ($oTopic->getPublish()) {
|
||||
/**
|
||||
|
@ -1245,7 +1252,9 @@ class ActionBlog extends Action {
|
|||
/**
|
||||
* Удаляяем блог и перенаправляем пользователя к списку блогов
|
||||
*/
|
||||
$this->Hook_Run('blog_delete_before', array('sBlogId'=>$sBlogId));
|
||||
if($this->Blog_DeleteBlog($sBlogId)) {
|
||||
$this->Hook_Run('blog_delete_after', array('sBlogId'=>$sBlogId));
|
||||
$this->Message_AddNoticeSingle($this->Lang_Get('blog_admin_delete_success'),$this->Lang_Get('attention'),true);
|
||||
Router::Location(Router::GetPath('blogs'));
|
||||
} else {
|
||||
|
|
|
@ -161,7 +161,9 @@ class ActionTopic extends Action {
|
|||
/**
|
||||
* Удаляем топик
|
||||
*/
|
||||
$this->Hook_Run('topic_delete_before', array('oTopic'=>$oTopic));
|
||||
$this->Topic_DeleteTopic($oTopic->getId());
|
||||
$this->Hook_Run('topic_delete_after', array('oTopic'=>$oTopic));
|
||||
/**
|
||||
* Перенаправляем на страницу со списком топиков из блога этого топика
|
||||
*/
|
||||
|
@ -326,11 +328,17 @@ class ActionTopic extends Action {
|
|||
$oTopic->setForbidComment(0);
|
||||
if (getRequest('topic_forbid_comment')) {
|
||||
$oTopic->setForbidComment(1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Запускаем выполнение хуков
|
||||
*/
|
||||
$this->Hook_Run('topic_add_before', array('oTopic'=>$oTopic,'oBlog'=>$oBlog));
|
||||
/**
|
||||
* Добавляем топик
|
||||
*/
|
||||
*/
|
||||
if ($this->Topic_AddTopic($oTopic)) {
|
||||
$this->Hook_Run('topic_add_after', array('oTopic'=>$oTopic,'oBlog'=>$oBlog));
|
||||
/**
|
||||
* Получаем топик, чтоб подцепить связанные данные
|
||||
*/
|
||||
|
@ -456,10 +464,12 @@ class ActionTopic extends Action {
|
|||
if (getRequest('topic_forbid_comment')) {
|
||||
$oTopic->setForbidComment(1);
|
||||
}
|
||||
$this->Hook_Run('topic_edit_before', array('oTopic'=>$oTopic,'oBlog'=>$oBlog));
|
||||
/**
|
||||
* Сохраняем топик
|
||||
*/
|
||||
if ($this->Topic_UpdateTopic($oTopic)) {
|
||||
$this->Hook_Run('topic_edit_after', array('oTopic'=>$oTopic,'oBlog'=>$oBlog,'bSendNotify'=>&$bSendNotify));
|
||||
/**
|
||||
* Обновляем данные в комментариях, если топик был перенесен в новый блог
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue