Commit 51416727 authored by nkoth's avatar nkoth

[FIX] Blog post categorization

parent aefe2e85
......@@ -502,6 +502,7 @@ class BlogLib extends TikiDb_Bridge
global $tikilib, $tiki_p_admin, $tiki_p_blog_admin, $tiki_p_blog_post, $user, $prefs;
$parserlib = TikiLib::lib('parser');
$categlib = TikiLib::lib('categ');
$mid = array();
$bindvars = array();
......@@ -554,8 +555,14 @@ class BlogLib extends TikiDb_Bridge
}
$mid = empty($mid) ? '' : 'where ' . implode(' and ', $mid);
$query = "select tbp.*,tb.title as blogTitle from `tiki_blog_posts` as tbp, `tiki_blogs` as tb $mid order by ".$this->convertSortMode($sort_mode);
$query_cant = "select count(*) from `tiki_blog_posts` as tbp, `tiki_blogs` as tb $mid";
$join = '';
if ( $jail = $categlib->get_jail() ) {
$categlib->getSqlJoin($jail, 'blog post', '`tbp`.`postId`', $join, $mid, $bindvars);
}
$query = "select tbp.*,tb.title as blogTitle from `tiki_blog_posts` as tbp, `tiki_blogs` as tb $join $mid order by ".$this->convertSortMode($sort_mode);
$query_cant = "select count(*) from `tiki_blog_posts` as tbp, `tiki_blogs` as tb $join $mid";
$result = $this->query($query, $bindvars, $maxRecords, $offset);
$cant = $this->getOne($query_cant, $bindvars);
$ret = array();
......@@ -579,6 +586,8 @@ class BlogLib extends TikiDb_Bridge
$ret[] = $res;
}
$ret = Perms::filter(array( 'type' => 'blog post' ), 'object', $ret, array( 'object' => 'postId' ), array('read_blog'));
$retval = array();
$retval['data'] = $ret;
$retval['cant'] = $cant;
......
......@@ -44,6 +44,7 @@ class Search_ContentSource_BlogPostSource implements Search_ContentSource_Interf
'parent_object_type' => $typeFactory->identifier('blog'),
'parent_object_id' => $typeFactory->identifier($post['blogId']),
'view_permission' => $typeFactory->identifier('tiki_p_read_blog'),
'parent_view_permission' => $typeFactory->identifier('tiki_p_read_blog'),
);
......@@ -62,6 +63,7 @@ class Search_ContentSource_BlogPostSource implements Search_ContentSource_Interf
'blog_excerpt',
'blog_content',
'view_permission',
'parent_view_permission',
'parent_object_id',
'parent_object_type',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment