mirror of
https://github.com/Oreolek/ifhub.club.git
synced 2024-06-28 20:45:00 +03:00
fix закрытых блогов
This commit is contained in:
parent
0cd846b348
commit
991d87553b
|
@ -133,13 +133,13 @@ class ActionRss extends Action {
|
|||
*/
|
||||
protected function RssComments() {
|
||||
/**
|
||||
* Вычисляем топики из закрытых блогов, чтобы исключить их из выдачи
|
||||
* Получаем закрытые блоги, чтобы исключить их из выдачи
|
||||
*/
|
||||
$aCloseTopics = $this->Topic_GetTopicsCloseByUser();
|
||||
$aCloseBlogs = $this->Blog_GetInaccessibleBlogsByUser();
|
||||
/**
|
||||
* Получаем комментарии
|
||||
*/
|
||||
$aResult=$this->Comment_GetCommentsAll('topic',1,Config::Get('module.comment.per_page')*2,$aCloseTopics);
|
||||
$aResult=$this->Comment_GetCommentsAll('topic',1,Config::Get('module.comment.per_page')*2,array(),$aCloseBlogs);
|
||||
$aComments=$aResult['collection'];
|
||||
/**
|
||||
* Формируем данные канала RSS
|
||||
|
|
|
@ -616,7 +616,10 @@ class ModuleBlog extends Module {
|
|||
* @param array $aAllowData Список типов данных, которые нужно подтянуть к списку блогов
|
||||
* @return array('collection'=>array,'count'=>int)
|
||||
*/
|
||||
public function GetBlogsByFilter($aFilter,$aOrder,$iCurrPage,$iPerPage,$aAllowData=array('owner'=>array(),'relation_user')) {
|
||||
public function GetBlogsByFilter($aFilter,$aOrder,$iCurrPage,$iPerPage,$aAllowData=null) {
|
||||
if (is_null($aAllowData)) {
|
||||
$aAllowData=array('owner'=>array(),'relation_user');
|
||||
}
|
||||
$sKey="blog_filter_".serialize($aFilter).serialize($aOrder)."_{$iCurrPage}_{$iPerPage}";
|
||||
if (false === ($data = $this->Cache_Get($sKey))) {
|
||||
$data = array('collection'=>$this->oMapperBlog->GetBlogsByFilter($aFilter,$aOrder,$iCount,$iCurrPage,$iPerPage),'count'=>$iCount);
|
||||
|
@ -725,7 +728,12 @@ class ModuleBlog extends Module {
|
|||
* которые являются откытыми для данного пользователя
|
||||
*/
|
||||
$aOpenBlogs=$this->GetBlogUsersByUserId($oUser->getId(),null,true);
|
||||
$aCloseBlogs=array_diff($aCloseBlogs,$aOpenBlogs);
|
||||
/**
|
||||
* Получаем закрытые блоги, где пользователь является автором
|
||||
*/
|
||||
$aOwnerBlogs=$this->GetBlogsByFilter(array('type'=>'close','user_owner_id'=>$oUser->getId()),array(),1,100,array());
|
||||
$aOwnerBlogs=array_keys($aOwnerBlogs['collection']);
|
||||
$aCloseBlogs=array_diff($aCloseBlogs,$aOpenBlogs,$aOwnerBlogs);
|
||||
}
|
||||
/**
|
||||
* Сохраняем в кеш
|
||||
|
|
|
@ -520,14 +520,9 @@ class ModuleTopic extends Module {
|
|||
public function GetTopicsByFilter($aFilter,$iPage=0,$iPerPage=0,$aAllowData=null) {
|
||||
$s=serialize($aFilter);
|
||||
if (false === ($data = $this->Cache_Get("topic_filter_{$s}_{$iPage}_{$iPerPage}"))) {
|
||||
$data = ($iPage*$iPerPage!=0)
|
||||
? array(
|
||||
$data = array(
|
||||
'collection'=>$this->oMapperTopic->GetTopics($aFilter,$iCount,$iPage,$iPerPage),
|
||||
'count'=>$iCount
|
||||
)
|
||||
: array(
|
||||
'collection'=>$this->oMapperTopic->GetAllTopics($aFilter),
|
||||
'count'=>$this->GetCountTopicsByFilter($aFilter)
|
||||
);
|
||||
$this->Cache_Set($data, "topic_filter_{$s}_{$iPage}_{$iPerPage}", array('topic_update','topic_new'), 60*60*24*3);
|
||||
}
|
||||
|
@ -876,29 +871,6 @@ class ModuleTopic extends Module {
|
|||
}
|
||||
return $data;
|
||||
}
|
||||
/**
|
||||
* Получает список идентификаторов топиков
|
||||
* из закрытых блогов по юзеру
|
||||
*
|
||||
* @param int $sUserId ID пользователя
|
||||
* @return array
|
||||
*/
|
||||
public function GetTopicsCloseByUser($sUserId=null) {
|
||||
if(!is_null($sUserId) && $oUser=$this->User_GetUserById($sUserId)) {
|
||||
$aCloseBlogs=$this->Blog_GetInaccessibleBlogsByUser($oUser);
|
||||
$aFilter=array(
|
||||
'topic_publish' => 1,
|
||||
'blog_id' => $aCloseBlogs,
|
||||
);
|
||||
} else {
|
||||
$aFilter=array(
|
||||
'topic_publish' => 1,
|
||||
'blog_type' => array('close'),
|
||||
);
|
||||
}
|
||||
$aTopics=$this->GetTopicsByFilter($aFilter);
|
||||
return array_keys($aTopics['collection']);
|
||||
}
|
||||
/**
|
||||
* Получает список топиков из указанного блога
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue