From 505012d2c22a87ceabfaf43256b01daf94393d32 Mon Sep 17 00:00:00 2001 From: Mzhelskiy Maxim Date: Sat, 6 Feb 2010 16:56:01 +0000 Subject: [PATCH] =?UTF-8?q?fix=20=D0=BE=D1=82=D0=BE=D0=B1=D1=80=D0=B0?= =?UTF-8?q?=D0=B6=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=BA=D0=BE=D0=BC=D0=BC=D0=B5?= =?UTF-8?q?=D0=BD=D1=82=D0=BE=D0=B2=20=D0=B2=20=D0=B7=D0=B0=D0=BA=D1=80?= =?UTF-8?q?=D1=8B=D1=82=D1=8B=D1=85=20=D0=B1=D0=BB=D0=BE=D0=B3=D0=B0=D1=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- classes/actions/ActionComments.class.php | 15 ++++++++++++++- classes/modules/comment/Comment.class.php | 8 ++++---- 2 files changed, 18 insertions(+), 5 deletions(-) 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; } /**