mirror of
https://github.com/Oreolek/ifhub.club.git
synced 2024-06-30 21:45:01 +03:00
фикс: теперь коммент не появляется в прямом эфире, если топик в черновиках + админ может при любом рейтинге создавать блог
This commit is contained in:
parent
60c7ff3937
commit
654ee7b647
|
@ -159,7 +159,7 @@ class ActionBlog extends Action {
|
||||||
/**
|
/**
|
||||||
* Проверяем хватает ли рейтинга юзеру чтоб создать блог
|
* Проверяем хватает ли рейтинга юзеру чтоб создать блог
|
||||||
*/
|
*/
|
||||||
if (!$this->ACL_CanCreateBlog($this->User_GetUserCurrent())) {
|
if (!$this->ACL_CanCreateBlog($this->oUserCurrent) and !$this->oUserCurrent->isAdministrator()) {
|
||||||
$this->Message_AddErrorSingle('Вы еще не достаточно окрепли чтобы создавать свой блог','Ошибка');
|
$this->Message_AddErrorSingle('Вы еще не достаточно окрепли чтобы создавать свой блог','Ошибка');
|
||||||
return Router::Action('error');
|
return Router::Action('error');
|
||||||
}
|
}
|
||||||
|
@ -1092,14 +1092,14 @@ class ActionBlog extends Action {
|
||||||
/**
|
/**
|
||||||
* Проверяем разрешено ли постить комменты
|
* Проверяем разрешено ли постить комменты
|
||||||
*/
|
*/
|
||||||
if (!$this->ACL_CanPostComment($this->oUserCurrent)) {
|
if (!$this->ACL_CanPostComment($this->oUserCurrent) and !$this->oUserCurrent->isAdministrator()) {
|
||||||
$this->Message_AddError('Ваш рейтинг слишком мал для написания комментариев','Ошибка');
|
$this->Message_AddError('Ваш рейтинг слишком мал для написания комментариев','Ошибка');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Проверяем разрешено ли постить комменты по времени
|
* Проверяем разрешено ли постить комменты по времени
|
||||||
*/
|
*/
|
||||||
if (!$this->ACL_CanPostCommentTime($this->oUserCurrent)) {
|
if (!$this->ACL_CanPostCommentTime($this->oUserCurrent) and !$this->oUserCurrent->isAdministrator()) {
|
||||||
$this->Message_AddError('Вам нельзя писать комментарии слишком часто','Ошибка');
|
$this->Message_AddError('Вам нельзя писать комментарии слишком часто','Ошибка');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1173,6 +1173,16 @@ class ActionBlog extends Action {
|
||||||
* Добавляем коммент
|
* Добавляем коммент
|
||||||
*/
|
*/
|
||||||
if ($this->Comment_AddComment($oCommentNew)) {
|
if ($this->Comment_AddComment($oCommentNew)) {
|
||||||
|
if ($oTopic->getPublish()) {
|
||||||
|
/**
|
||||||
|
* Добавляем коммент в прямой эфир если топик не в черновиках
|
||||||
|
*/
|
||||||
|
$this->Comment_DeleteTopicCommentOnline($oCommentNew->getTopicId());
|
||||||
|
$oTopicCommentOnline=new CommentEntity_TopicCommentOnline();
|
||||||
|
$oTopicCommentOnline->setTopicId($oCommentNew->getTopicId());
|
||||||
|
$oTopicCommentOnline->setCommentId($oCommentNew->getId());
|
||||||
|
$this->Comment_AddTopicCommentOnline($oTopicCommentOnline);
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Сохраняем дату последнего коммента для юзера
|
* Сохраняем дату последнего коммента для юзера
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -160,14 +160,6 @@ class Comment extends Module {
|
||||||
public function AddComment(CommentEntity_TopicComment $oComment) {
|
public function AddComment(CommentEntity_TopicComment $oComment) {
|
||||||
if ($sId=$this->oMapperTopicComment->AddComment($oComment)) {
|
if ($sId=$this->oMapperTopicComment->AddComment($oComment)) {
|
||||||
$this->Topic_increaseTopicCountComment($oComment->getTopicId());
|
$this->Topic_increaseTopicCountComment($oComment->getTopicId());
|
||||||
/**
|
|
||||||
* Добавляем коммент в прямой эфир
|
|
||||||
*/
|
|
||||||
$this->oMapperTopicComment->deleteTopicCommentOnline($oComment->getTopicId());
|
|
||||||
$oTopicCommentOnline=new CommentEntity_TopicCommentOnline();
|
|
||||||
$oTopicCommentOnline->setTopicId($oComment->getTopicId());
|
|
||||||
$oTopicCommentOnline->setCommentId($sId);
|
|
||||||
$this->oMapperTopicComment->AddTopicCommentOnline($oTopicCommentOnline);
|
|
||||||
//чистим зависимые кеши
|
//чистим зависимые кеши
|
||||||
$this->Cache_Clean(Zend_Cache::CLEANING_MODE_MATCHING_TAG,array('comment_new',"comment_new_user_{$oComment->getUserId()}","comment_new_topic_{$oComment->getTopicId()}"));
|
$this->Cache_Clean(Zend_Cache::CLEANING_MODE_MATCHING_TAG,array('comment_new',"comment_new_user_{$oComment->getUserId()}","comment_new_topic_{$oComment->getTopicId()}"));
|
||||||
$oComment->setId($sId);
|
$oComment->setId($sId);
|
||||||
|
@ -207,8 +199,16 @@ class Comment extends Module {
|
||||||
* @param unknown_type $sTopicId
|
* @param unknown_type $sTopicId
|
||||||
* @return unknown
|
* @return unknown
|
||||||
*/
|
*/
|
||||||
public function deleteTopicCommentOnline($sTopicId) {
|
public function DeleteTopicCommentOnline($sTopicId) {
|
||||||
return $this->oMapperTopicComment->deleteTopicCommentOnline($sTopicId);
|
return $this->oMapperTopicComment->DeleteTopicCommentOnline($sTopicId);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Добавляет новый коммент в прямой эфир
|
||||||
|
*
|
||||||
|
* @param CommentEntity_TopicCommentOnline $oTopicCommentOnline
|
||||||
|
*/
|
||||||
|
public function AddTopicCommentOnline(CommentEntity_TopicCommentOnline $oTopicCommentOnline) {
|
||||||
|
return $this->oMapperTopicComment->AddTopicCommentOnline($oTopicCommentOnline);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Строит дерево комментариев
|
* Строит дерево комментариев
|
||||||
|
|
|
@ -444,7 +444,7 @@ class Mapper_TopicComment extends Mapper {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function deleteTopicCommentOnline($sTopicId) {
|
public function DeleteTopicCommentOnline($sTopicId) {
|
||||||
$sql = "DELETE FROM ".DB_TABLE_TOPIC_COMMENT_ONLINE." WHERE topic_id = ?d ";
|
$sql = "DELETE FROM ".DB_TABLE_TOPIC_COMMENT_ONLINE." WHERE topic_id = ?d ";
|
||||||
if ($this->oDb->query($sql,$sTopicId))
|
if ($this->oDb->query($sql,$sTopicId))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue