Commit 74a194a4 authored by sampaioprimo's avatar sampaioprimo

moving blog functions (list_blogs, get_blog, get_blog_by_title,...

moving blog functions (list_blogs, get_blog, get_blog_by_title, list_user_blogs, list_blogs_user_can_post, list_posts) from tikilib to bloglib
parent 100e7586
......@@ -23,6 +23,263 @@ include_once('lib/reportslib.php');
*/
class BlogLib extends TikiLib
{
/**
* List all blogs
*
* @param int $offset
* @param int $maxRecords
* @param string @sort_mode
* @param string $find
* @param string $ref
* @param string $with
*
* @return array
*/
function list_blogs($offset = 0, $maxRecords = -1, $sort_mode = 'created_desc', $find = '', $ref='', $with = '') {
global $categlib; if (!$categlib) require_once 'lib/categories/categlib.php';
$bindvars = array();
$join = '';
$where = '';
if( $jail = $categlib->get_jail() ) {
$categlib->getSqlJoin($jail, 'blog', '`tiki_blogs`.`blogId`', $join, $where, $bindvars);
}
if ($find) {
$findesc = '%' . $find . '%';
$where .= ' and (`tiki_blogs`.`title` like ? or `tiki_blogs`.`description` like ?) ';
$bindvars = array_merge($bindvars, array($findesc, $findesc));
}
if (isset($with['showlastpost'])) {
$query = "SELECT tb.*, tbp.`postId`, tbp.`created` as postCreated, tbp.`user` as postUser, tbp.`title` as postTitle, tbp.`data` as postData FROM `tiki_blogs` tb, `tiki_blog_posts` tbp $join where tb.`blogId` = tbp.`blogId` and tbp.`created` = (select max(`created`) from `tiki_blog_posts` tbp2 where tbp2.`blogId`=tb.`blogId` order by `created` desc) $where order by tb.".$this->convertSortMode($sort_mode);
} else {
$query = "select * from `tiki_blogs` $join WHERE 1=1 $where order by `tiki_blogs`." . $this->convertSortMode($sort_mode);
}
$result = $this->fetchAll($query, $bindvars);
$ret = array();
$cant = 0;
$nb = 0;
$i = 0;
//FIXME Perm:filter ?
foreach ( $result as $res ) {
global $user;
if ($objperm = $this->get_perm_object($res['blogId'], 'blog', '', false)) {
if ( $objperm['tiki_p_read_blog'] == 'y' || ($ref == 'post' && $objperm['tiki_p_blog_post_view_ref'] == 'y') || ($ref == 'blog' && $objperm['tiki_p_blog_view_ref'] == 'y')) {
++$cant;
if ($maxRecords == - 1 || ($i >= $offset && $nb < $maxRecords)) {
$ret[] = $res;
++$nb;
}
++$i;
}
}
}
$retval = array();
$retval["data"] = $ret;
$retval["cant"] = $cant;
return $retval;
}
/**
* Return all blog information
*
* @param int $blogId
* @return array
*/
function get_blog($blogId) {
global $prefs, $user, $categlib; if (!$categlib) require_once 'lib/categories/categlib.php';
$bindvars = array();
if( $jail = $categlib->get_jail() ) {
$categlib->getSqlJoin($jail, 'blog', '`tiki_blogs`.`blogId`', $join, $where, $bindvars);
} else {
$join = '';
$where = '';
}
array_push( $bindvars, $blogId );
if (!empty($where)) $where = '1=1 '.$where.' AND ';
$query = "SELECT * FROM `tiki_blogs` $join WHERE $where `blogId`=?";
$result = $this->query($query, $bindvars);
if ($result->numRows()) {
$res = $result->fetchRow();
} else {
return false;
}
if ($prefs['feature_score'] == 'y' && $user != $res['user']) {
$this->score_event($user, 'blog_read', $blogId);
$this->score_event($res['user'], 'blog_is_read', "$user:$blogId");
}
return $res;
}
/**
* Return a blog by its title
*
* @param string $blogTitle
* @return array or false if no blog is found
*/
function get_blog_by_title($blogTitle) {
global $prefs, $user;
// Avoiding select by name so as to avoid SQL injection problems.
$query = "select `title`, `blogId` from `tiki_blogs` where `use_title` = 'y' ";
$result = $this->fetchAll($query);
if ( !empty($result) ) {
foreach ( $result as $res ) {
if( strtolower($res['title']) == strtolower($blogTitle) ) {
return $this->get_blog($res['blogId']);
}
}
}
return false;
}
/**
* Returns an array of blogs that belong to the user with the given name,
* or which are public, if $include_public is set to true.
* A blog is represented by an array like a tiki_blogs record.
*
* @param string $user
* @param bool $include_public wheter or include public blogs (that belongs to other users)
* @return array
*/
function list_user_blogs($user, $include_public = false) {
$query = "select * from `tiki_blogs` where `user`=? ";
$bindvars=array($user);
if ($include_public) {
$query .= " or `public`=?";
$bindvars[]='y';
}
$query .= "order by `title` asc";
$result = $this->fetchAll($query,$bindvars);
$ret = array();
//FIXME Perm::filter ?
foreach ( $result as $res ) {
if ($this->user_has_perm_on_object($user, $res['blogId'], 'blog', 'tiki_p_read_blog')) {
$ret[] = $res;
}
}
return $ret;
}
/**
* Return a list of blogs that the user has permission to post
*
* @return array
*/
function list_blogs_user_can_post() {
global $tiki_p_blog_admin, $user;
$query = "select * from `tiki_blogs` order by `title` asc";
$result = $this->fetchAll($query);
$ret = array();
//FIXME Perm:filter ?
foreach ( $result as $res ) {
if( (!empty($user) and $user == $res['user']) || $tiki_p_blog_admin == 'y' || ($res['public'] == 'y' && $this->user_has_perm_on_object($user, $res['blogId'], 'blog', 'tiki_p_blog_post')))
$ret[] = $res;
}
return $ret;
}
/**
* List all posts
*
* @param int $offset
* @param int $maxRecords
* @param string $sort_mode
* @param string $find
* @param int $filterByBlogId
* @param string $author
* @param string $ref
* @param int $date_min
* @param int $data_max
* @return array
*/
function list_posts($offset = 0, $maxRecords = -1, $sort_mode = 'created_desc', $find = '', $filterByBlogId = -1, $author='', $ref='', $date_min = 0, $date_max = 0) {
$authorized_blogs = $this->list_blogs(0, -1, 'created_desc', '', $ref);
$permit_blogs = array();
for ($i = 0; $i < $authorized_blogs["cant"] ; $i++) {
$permit_blogs[] = $authorized_blogs["data"][$i]['blogId'];
}
if ($filterByBlogId >= 0) {
// get posts for a given blogId:
$mid = " where ( `blogId` = ? ) ";
$bindvars = array($filterByBlogId);
} else {
// get posts from all blogs
$mid = '';
$bindvars = array();
}
if ($find) {
$findesc = '%' . $find . '%';
if ($mid == "") {
$mid = " where ";
} else {
$mid .= " and ";
}
$mid .= " ( `data` like ? ) ";
$bindvars[] = $findesc;
}
if ($date_min !== 0 || $date_max !== 0) {
if ( $date_max <= 0 ) {
// show articles published today
$date_max = $this->now;
}
if ($mid == '') {
$mid = ' where ';
} else {
$mid .= ' and ';
}
$mid .= '(`created`>=? and `created`<=?)';
$bindvars[] = $date_min;
$bindvars[] = $date_max;
}
if (!empty($author)) {
if ($mid == '') {
$mid = ' where ';
} else {
$mid .= ' and ';
}
$mid .= 'user =?';
$bindvars[] = $author;
}
$query = "select * from `tiki_blog_posts` $mid order by ".$this->convertSortMode($sort_mode);
$query_cant = "select count(*) from `tiki_blog_posts` $mid";
$result = $this->fetchAll($query,$bindvars,$maxRecords,$offset);
$cant = $this->getOne($query_cant,$bindvars);
$ret = array();
foreach ( $result as $res ) {
$blogId = $res["blogId"];
if ( ! in_array($blogId, $permit_blogs) ) {
continue;
}
$query = "select `title` from `tiki_blogs` where `blogId`=?";
$cant_com = $this->getOne("select count(*) from
`tiki_comments` where `object`=? and `objectType` = ?",
array((string) $res["postId"],'blog'));
$res["comments"] = $cant_com;
$res["blogTitle"] = $this->getOne($query,array((int)$blogId));
$res["size"] = strlen($res["data"]);
$ret[] = $res;
}
$retval = array();
$retval["data"] = $ret;
$retval["cant"] = $cant;
return $retval;
}
/**
* get_number_of_pages Returns the number of pages
......@@ -222,9 +479,9 @@ class BlogLib extends TikiLib
// user has tiki_p_admin or tiki_p_blog_admin or has written the post
// If blog is configured with 'Allow other user to post in this blog', then also if user has tiki_p_blog_post or is owner of this blog
if ( ($tiki_p_admin != 'y')
and ($tiki_p_blog_admin != 'y')
and ( (! isset($blog_data["public"])) || $blog_data["public"] != 'y' || $tiki_p_blog_post != 'y')
and ($blog_data["public"] != 'y' || $ownsblog != 'y') ) {
and ($tiki_p_blog_admin != 'y')
and ( (! isset($blog_data["public"])) || $blog_data["public"] != 'y' || $tiki_p_blog_post != 'y')
and ($blog_data["public"] != 'y' || $ownsblog != 'y') ) {
if ( isset($user) ) {
$mid[] = "(tbp.`priv`!='y' or tbp.`user`=?)";
$bindvars[] = "$user";
......
......@@ -748,8 +748,9 @@ class CategLib extends ObjectLib
$catObjectId = $this->is_categorized('blog', $blogId);
if (!$catObjectId) {
require_once('lib/blogs/bloglib.php');
// The page is not cateorized
$info = $this->get_blog($blogId);
$info = $bloglib->get_blog($blogId);
$href = 'tiki-view_blog.php?blogId=' . $blogId;
$catObjectId = $this->add_categorized_object('blog', $blogId, $info["description"], $info["title"], $href);
......
......@@ -1392,7 +1392,8 @@ class LogsLib extends TikiLib
case 'blog':
if (!isset($blogNames)) {
$objects = $tikilib->list_blogs();
require_once('lib/blogs/bloglib.php');
$objects = $bloglib->list_blogs();
foreach ($objects['data'] as $object) {
$blogNames[$object['blogId']] = $object['title'];
}
......
......@@ -377,7 +377,8 @@ function feature_home_pages()
// Blog
if ($prefs['feature_blogs'] == 'y') {
if ( $prefs['home_blog'] != '0' ) {
$hbloginfo = $tikilib->get_blog($prefs['home_blog']);
require_once('lib/blogs/bloglib.php');
$hbloginfo = $bloglib->get_blog($prefs['home_blog']);
$home_blog_name = substr($hbloginfo['title'], 0, 20);
} else {
$home_blog_name = tra('Set blogs homepage first');
......
......@@ -115,9 +115,9 @@ function listforum_pref()
*/
function listblog_pref()
{
global $tikilib;
require_once('lib/blogs/bloglib.php');
$allblogs = $tikilib->list_blogs(0, -1, 'created_desc', '');
$allblogs = $bloglib->list_blogs(0, -1, 'created_desc', '');
$listblogs = array();
if ($allblogs['cant'] > 0) {
......
......@@ -2896,216 +2896,6 @@ class TikiLib extends TikiDb_Bridge
return array('data' => $ret, 'cant' => $cant);
}
// BLOG METHODS ////
function list_blogs($offset = 0, $maxRecords = -1, $sort_mode = 'created_desc', $find = '', $ref='', $with = '') {
global $categlib; if (!$categlib) require_once 'lib/categories/categlib.php';
$bindvars = array();
$join = '';
$where = '';
if( $jail = $categlib->get_jail() ) {
$categlib->getSqlJoin($jail, 'blog', '`tiki_blogs`.`blogId`', $join, $where, $bindvars);
}
if ($find) {
$findesc = '%' . $find . '%';
$where .= ' and (`tiki_blogs`.`title` like ? or `tiki_blogs`.`description` like ?) ';
$bindvars = array_merge($bindvars, array($findesc, $findesc));
}
if (isset($with['showlastpost'])) {
$query = "SELECT tb.*, tbp.`postId`, tbp.`created` as postCreated, tbp.`user` as postUser, tbp.`title` as postTitle, tbp.`data` as postData FROM `tiki_blogs` tb, `tiki_blog_posts` tbp $join where tb.`blogId` = tbp.`blogId` and tbp.`created` = (select max(`created`) from `tiki_blog_posts` tbp2 where tbp2.`blogId`=tb.`blogId` order by `created` desc) $where order by tb.".$this->convertSortMode($sort_mode);
} else {
$query = "select * from `tiki_blogs` $join WHERE 1=1 $where order by `tiki_blogs`." . $this->convertSortMode($sort_mode);
}
$result = $this->fetchAll($query, $bindvars);
$ret = array();
$cant = 0;
$nb = 0;
$i = 0;
//FIXME Perm:filter ?
foreach ( $result as $res ) {
global $user;
if ($objperm = $this->get_perm_object($res['blogId'], 'blog', '', false)) {
if ( $objperm['tiki_p_read_blog'] == 'y' || ($ref == 'post' && $objperm['tiki_p_blog_post_view_ref'] == 'y') || ($ref == 'blog' && $objperm['tiki_p_blog_view_ref'] == 'y')) {
++$cant;
if ($maxRecords == - 1 || ($i >= $offset && $nb < $maxRecords)) {
$ret[] = $res;
++$nb;
}
++$i;
}
}
}
$retval = array();
$retval["data"] = $ret;
$retval["cant"] = $cant;
return $retval;
}
/*shared*/
function get_blog($blogId) {
global $prefs, $user, $categlib; if (!$categlib) require_once 'lib/categories/categlib.php';
$bindvars = array();
if( $jail = $categlib->get_jail() ) {
$categlib->getSqlJoin($jail, 'blog', '`tiki_blogs`.`blogId`', $join, $where, $bindvars);
} else {
$join = '';
$where = '';
}
array_push( $bindvars, $blogId );
if (!empty($where)) $where = '1=1 '.$where.' AND ';
$query = "SELECT * FROM `tiki_blogs` $join WHERE $where `blogId`=?";
$result = $this->query($query, $bindvars);
if ($result->numRows()) {
$res = $result->fetchRow();
} else {
return false;
}
if ($prefs['feature_score'] == 'y' && $user != $res['user']) {
$this->score_event($user, 'blog_read', $blogId);
$this->score_event($res['user'], 'blog_is_read', "$user:$blogId");
}
return $res;
}
/*shared*/
function get_blog_by_title($blogTitle) {
global $prefs, $user;
// Avoiding select by name so as to avoid SQL injection problems.
$query = "select `title`, `blogId` from `tiki_blogs` where `use_title` = 'y' ";
$result = $this->fetchAll($query);
if ( !empty($result) ) {
foreach ( $result as $res ) {
if( strtolower($res['title']) == strtolower($blogTitle) ) {
return $this->get_blog($res['blogId']);
}
}
}
return false;
}
// Returns an array of blogs that belong to the user with the given name, or which are public, if $include_public is set to true.
// A blog is represented by an array like a tiki_blogs record.
function list_user_blogs($user, $include_public = false) {
$query = "select * from `tiki_blogs` where `user`=? ";
$bindvars=array($user);
if ($include_public) {
$query .= " or `public`=?";
$bindvars[]='y';
}
$query .= "order by `title` asc";
$result = $this->fetchAll($query,$bindvars);
$ret = array();
//FIXME Perm::filter ?
foreach ( $result as $res ) {
if ($this->user_has_perm_on_object($user, $res['blogId'], 'blog', 'tiki_p_read_blog')) {
$ret[] = $res;
}
}
return $ret;
}
function list_blogs_user_can_post() {
global $tiki_p_blog_admin, $user;
$query = "select * from `tiki_blogs` order by `title` asc";
$result = $this->fetchAll($query);
$ret = array();
//FIXME Perm:filter ?
foreach ( $result as $res ) {
if( (!empty($user) and $user == $res['user']) || $tiki_p_blog_admin == 'y' || ($res['public'] == 'y' && $this->user_has_perm_on_object($user, $res['blogId'], 'blog', 'tiki_p_blog_post')))
$ret[] = $res;
}
return $ret;
}
function list_posts($offset = 0, $maxRecords = -1, $sort_mode = 'created_desc', $find = '', $filterByBlogId = -1, $author='', $ref='', $date_min = 0, $date_max = 0) {
$authorized_blogs = $this->list_blogs(0, -1, 'created_desc', '', $ref);
$permit_blogs = array();
for ($i = 0; $i < $authorized_blogs["cant"] ; $i++) {
$permit_blogs[] = $authorized_blogs["data"][$i]['blogId'];
}
if ($filterByBlogId >= 0) {
// get posts for a given blogId:
$mid = " where ( `blogId` = ? ) ";
$bindvars = array($filterByBlogId);
} else {
// get posts from all blogs
$mid = '';
$bindvars = array();
}
if ($find) {
$findesc = '%' . $find . '%';
if ($mid == "") {
$mid = " where ";
} else {
$mid .= " and ";
}
$mid .= " ( `data` like ? ) ";
$bindvars[] = $findesc;
}
if ($date_min !== 0 || $date_max !== 0) {
if ( $date_max <= 0 ) {
// show articles published today
$date_max = $this->now;
}
if ($mid == '') {
$mid = ' where ';
} else {
$mid .= ' and ';
}
$mid .= '(`created`>=? and `created`<=?)';
$bindvars[] = $date_min;
$bindvars[] = $date_max;
}
if (!empty($author)) {
if ($mid == '') {
$mid = ' where ';
} else {
$mid .= ' and ';
}
$mid .= 'user =?';
$bindvars[] = $author;
}
$query = "select * from `tiki_blog_posts` $mid order by ".$this->convertSortMode($sort_mode);
$query_cant = "select count(*) from `tiki_blog_posts` $mid";
$result = $this->fetchAll($query,$bindvars,$maxRecords,$offset);
$cant = $this->getOne($query_cant,$bindvars);
$ret = array();
foreach ( $result as $res ) {
$blogId = $res["blogId"];
if ( ! in_array($blogId, $permit_blogs) ) {
continue;
}
$query = "select `title` from `tiki_blogs` where `blogId`=?";
$cant_com = $this->getOne("select count(*) from
`tiki_comments` where `object`=? and `objectType` = ?",
array((string) $res["postId"],'blog'));
$res["comments"] = $cant_com;
$res["blogTitle"] = $this->getOne($query,array((int)$blogId));
$res["size"] = strlen($res["data"]);
$ret[] = $res;
}
$retval = array();
$retval["data"] = $ret;
$retval["cant"] = $cant;
return $retval;
}
// CMS functions -ARTICLES- & -SUBMISSIONS- ////
/*shared*/
function get_featured_links($max = 10) {
......
......@@ -91,7 +91,8 @@ function wikiplugin_bloglist($data, $params) {
$smarty->assign('container_class', $params['containerClass']);
if ($params['simpleList'] == 'y') {
$blogItems = $tikilib->list_posts($params['offset'], $params['Items'], $params['sort_mode'], $params['find'], $params['Id'], $params['author'], '', $dateStartTS, $dateEndTS);
require_once('lib/blogs/bloglib.php');
$blogItems = $bloglib->list_posts($params['offset'], $params['Items'], $params['sort_mode'], $params['find'], $params['Id'], $params['author'], '', $dateStartTS, $dateEndTS);
$smarty->assign_by_ref('blogItems', $blogItems['data']);
$template = 'wiki-plugins/wikiplugin_bloglist.tpl';
} else {
......
......@@ -22,8 +22,9 @@ function module_last_created_blogs_info() {
}
function module_last_created_blogs( $mod_reference, $module_params ) {
global $tikilib, $smarty;
$ranking = $tikilib->list_blogs(0, $mod_reference["rows"], 'created_desc', '', 'blog');
global $smarty;
require_once('lib/blogs/bloglib.php');
$ranking = $bloglib->list_blogs(0, $mod_reference["rows"], 'created_desc', '', 'blog');
$smarty->assign('modLastCreatedBlogs', $ranking["data"]);
}
......@@ -22,8 +22,11 @@ function module_last_modified_blogs_info() {
}
function module_last_modified_blogs( $mod_reference, $module_params ) {
global $tikilib, $smarty;
$ranking = $tikilib->list_blogs(0, $mod_reference["rows"], 'lastModif_desc', '', 'blog');
global $smarty;
require_once('lib/blogs/bloglib.php');
$ranking = $bloglib->list_blogs(0, $mod_reference["rows"], 'lastModif_desc', '', 'blog');
$smarty->assign('modLastModifiedBlogs', $ranking["data"]);
}
......@@ -22,8 +22,9 @@ function module_top_active_blogs_info() {
}
function module_top_active_blogs( $mod_reference, $module_params ) {
global $tikilib, $smarty;
$ranking = $tikilib->list_blogs(0, $mod_reference["rows"], 'activity_desc', '');
global $smarty;
require_once('lib/blogs/bloglib.php');
$ranking = $bloglib->list_blogs(0, $mod_reference["rows"], 'activity_desc', '');
$smarty->assign('modTopActiveBlogs', $ranking["data"]);
}
......@@ -35,7 +35,8 @@ function module_top_visited_blogs_info() {
}
function module_top_visited_blogs( $mod_reference, $module_params ) {
global $tikilib, $smarty;
global $smarty;
require_once('lib/blogs/bloglib.php');
$with = '';
if (isset($mod_reference['params']['showlastpost']) && $mod_reference['params']['showlastpost'] == 'y') {
$with = array('showlastpost'=>'y');
......@@ -43,7 +44,7 @@ function module_top_visited_blogs( $mod_reference, $module_params ) {
if (empty($mod_reference['sort_mode'])) {
$mod_reference['sort_mode'] = 'hits_desc';
}
$ranking = $tikilib->list_blogs(0, $mod_reference['rows'], $mod_reference['sort_mode'], '', 'blog', $with);
$ranking = $bloglib->list_blogs(0, $mod_reference['rows'], $mod_reference['sort_mode'], '', 'blog', $with);
$smarty->assign('modTopVisitedBlogs', $ranking['data']);
}
......@@ -25,7 +25,8 @@ function module_user_blogs_info() {
function module_user_blogs( $mod_reference, $module_params ) {
global $user, $tikilib, $smarty;
if ($user) {
$ranking = $tikilib->list_user_blogs($user, false);
require_once('lib/blogs/bloglib.php');
$ranking = $bloglib->list_user_blogs($user, false);
$smarty->assign('modUserBlogs', $ranking);
$smarty->assign('tpl_module_title', tra("My blogs"));
......
......@@ -127,7 +127,8 @@ function module_user_bookmarks( $mod_reference, $module_params ) {
// Check if we are bookmarking a weblog
if (strstr($_SERVER["REQUEST_URI"], 'tiki-view_blog')) {
$info = $tikilib->get_blog($setup_query_data["blogId"]);
require_once('lib/blogs/bloglib.php');
$info = $bloglib->get_blog($setup_query_data["blogId"]);
$name = $info["title"];
}
......
......@@ -355,7 +355,8 @@ if( $prefs['feature_polls'] == 'y' ) {
}
if( $prefs['feature_blogs'] == 'y' ) {
$blogs = $tikilib->list_blogs($offset, $maxRecords, 'title_asc', $find_objects);
require_once('lib/blogs/bloglib.php');
$blogs = $bloglib->list_blogs($offset, $maxRecords, 'title_asc', $find_objects);
}
if( $prefs['feature_wiki'] == 'y' ) {
......
......@@ -24,7 +24,7 @@ if ($prefs['feature_freetags'] == 'y') {
}
if (isset($_REQUEST['blogId'])) {
$blogId = $_REQUEST['blogId'];
$blog_data = $tikilib->get_blog($blogId);
$blog_data = $bloglib->get_blog($blogId);
} else {
$blogId = 0;
}
......@@ -196,7 +196,7 @@ if ((isset($_REQUEST["save"]) || isset($_REQUEST['save_exit'])) && !$contributio
if ($_REQUEST["postId"] > 0) {
$data = $bloglib->get_post($_REQUEST["postId"]);
$blog_data = $tikilib->get_blog($data["blogId"]);
$blog_data = $bloglib->get_blog($data["blogId"]);
if (!$user || ($data["user"] != $user && $user != $blog_data["user"] && !($blog_data['public'] == 'y' && $tikilib->user_has_perm_on_object($user, $_REQUEST['blogId'], 'blog', 'tiki_p_blog_post')))) {
if ($tiki_p_blog_admin != 'y') {
$smarty->assign('errortype', 401);
......
......@@ -30,7 +30,7 @@ $id = "blogId";
$uniqueid = "$feed.$id=" . $_REQUEST["$id"];
$output = $rsslib->get_from_cache($uniqueid);
if ($output["data"] == "EMPTY") {
$tmp = $tikilib->get_blog($_REQUEST["$id"]);
$tmp = $bloglib->get_blog($_REQUEST["$id"]);
$title = (!empty($prefs['title_rss_' . $feed])) ? $prefs['title_rss_' . $feed] : tra('Tiki RSS feed for blog: ');
$title.= $tmp['title'];
$desc.= (!empty($prefs['desc_rss_' . $feed])) ? $prefs['desc_rss_' . $feed] : tra('Last modifications to the blog.');
......
......@@ -49,7 +49,7 @@ if (!isset($lastModif)) {
if (isset($_REQUEST["blogId"]) && $_REQUEST["blogId"] > 0) {
// Check permission
$data = $tikilib->get_blog($_REQUEST["blogId"]);
$data = $bloglib->get_blog($_REQUEST["blogId"]);
if ($data["user"] != $user || !$user) {
if ($tiki_p_blog_admin != 'y') {
......
</
......@@ -16,7 +16,7 @@ $access->check_feature('feature_blogs');
$access->check_permission('tiki_p_read_blog');
if (isset($_REQUEST["remove"])) {
// Check if it is the owner
$data = $tikilib->get_blog($_REQUEST["remove"]);
$data = $bloglib->get_blog($_REQUEST["remove"]);
if ($data["user"] != $user) {
if ($tiki_p_blog_admin != 'y') {
$smarty->assign('errortype', 401);
......@@ -54,7 +54,7 @@ if (isset($_REQUEST["find"])) {