1
0
Fork 0
mirror of https://github.com/Oreolek/ifhub.club.git synced 2024-06-17 07:10:48 +03:00

fix отображения комментов в закрытых блогах

This commit is contained in:
Mzhelskiy Maxim 2010-02-06 16:56:01 +00:00
parent 7a5b54406e
commit 505012d2c2
2 changed files with 18 additions and 5 deletions

View file

@ -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'];
/**
* Формируем постраничность

View file

@ -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;
}
/**