diff --git a/classes/actions/ActionComments.class.php b/classes/actions/ActionComments.class.php index 52695425..258aca87 100644 --- a/classes/actions/ActionComments.class.php +++ b/classes/actions/ActionComments.class.php @@ -21,6 +21,12 @@ */ class ActionComments extends Action { + /** + * Текущий юзер + * + * @var unknown_type + */ + protected $oUserCurrent=null; /** * Главное меню * @@ -29,6 +35,7 @@ class ActionComments extends Action { protected $sMenuHeadItemSelect='blog'; public function Init() { + $this->oUserCurrent=$this->User_GetUserCurrent(); } protected function RegisterEvent() { @@ -50,10 +57,16 @@ class ActionComments extends Action { * Передан ли номер страницы */ $iPage=$this->GetEventMatch(2) ? $this->GetEventMatch(2) : 1; + /** + * Исключаем из выборки идентификаторы закрытых блогов (target_parent_id) + */ + $aCloseBlogs = ($this->oUserCurrent) + ? $this->Blog_GetInaccessibleBlogsByUser($this->oUserCurrent) + : $this->Blog_GetInaccessibleBlogsByUser(); /** * Получаем список комментов */ - $aResult=$this->Comment_GetCommentsAll('topic',$iPage,Config::Get('module.comment.per_page')); + $aResult=$this->Comment_GetCommentsAll('topic',$iPage,Config::Get('module.comment.per_page'),array(),$aCloseBlogs); $aComments=$aResult['collection']; /** * Формируем постраничность diff --git a/classes/modules/comment/Comment.class.php b/classes/modules/comment/Comment.class.php index 32a7bc15..7f85a90d 100644 --- a/classes/modules/comment/Comment.class.php +++ b/classes/modules/comment/Comment.class.php @@ -68,13 +68,13 @@ class LsComment extends Module { * @param unknown_type $iPerPage * @return unknown */ - public function GetCommentsAll($sTargetType,$iPage,$iPerPage,$aExcludeTarget=array()) { - $s=serialize($aExcludeTarget); + public function GetCommentsAll($sTargetType,$iPage,$iPerPage,$aExcludeTarget=array(),$aExcludeParentTarget=array()) { + $s=serialize($aExcludeTarget).serialize($aExcludeParentTarget); if (false === ($data = $this->Cache_Get("comment_all_{$sTargetType}_{$iPage}_{$iPerPage}_{$s}"))) { - $data = array('collection'=>$this->oMapper->GetCommentsAll($sTargetType,$iCount,$iPage,$iPerPage,$aExcludeTarget),'count'=>$iCount); + $data = array('collection'=>$this->oMapper->GetCommentsAll($sTargetType,$iCount,$iPage,$iPerPage,$aExcludeTarget,$aExcludeParentTarget),'count'=>$iCount); $this->Cache_Set($data, "comment_all_{$sTargetType}_{$iPage}_{$iPerPage}_{$s}", array("comment_new_{$sTargetType}","comment_update_status_{$sTargetType}"), 60*60*24*1); } - $data['collection']=$this->GetCommentsAdditionalData($data['collection']); + $data['collection']=$this->GetCommentsAdditionalData($data['collection'],array('target','favourite','user'=>array())); return $data; } /**