From: <ch...@us...> - 2009-08-31 06:31:42
|
Revision: 21166 http://tikiwiki.svn.sourceforge.net/tikiwiki/?rev=21166&view=rev Author: chealer Date: 2009-08-31 06:31:35 +0000 (Mon, 31 Aug 2009) Log Message: ----------- [FIX] list_blog_post_comments() check for admin_comment Modified Paths: -------------- trunk/lib/blogs/bloglib.php Modified: trunk/lib/blogs/bloglib.php =================================================================== --- trunk/lib/blogs/bloglib.php 2009-08-31 06:12:28 UTC (rev 21165) +++ trunk/lib/blogs/bloglib.php 2009-08-31 06:31:35 UTC (rev 21166) @@ -165,7 +165,8 @@ $query = "SELECT b.`title`, b.`postId`, c.`threadId`, c.`title` as commentTitle, `commentDate`, `userName` FROM `tiki_comments` c, `tiki_blog_posts` b WHERE `objectType`='post' AND b.`postId`=c.`object`"; $bindvars = array(); - if ( $tiki_p_admin_comments != 'y' ) { + $globalperms = Perms::get(); + if ( !$globalperms->admin_comment ) { $query .= ' AND `approved`=?'; $bindvars[] = $approved; } else { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pk...@us...> - 2009-10-18 08:32:44
|
Revision: 22402 http://tikiwiki.svn.sourceforge.net/tikiwiki/?rev=22402&view=rev Author: pkdille Date: 2009-10-18 08:32:35 +0000 (Sun, 18 Oct 2009) Log Message: ----------- [MOD] bloglib: no changes. Commenting the methods, some code cleaning and removing an old commented code Modified Paths: -------------- trunk/lib/blogs/bloglib.php Modified: trunk/lib/blogs/bloglib.php =================================================================== --- trunk/lib/blogs/bloglib.php 2009-10-17 05:28:39 UTC (rev 22401) +++ trunk/lib/blogs/bloglib.php 2009-10-18 08:32:35 UTC (rev 22402) @@ -1,23 +1,44 @@ <?php -// $Id: /cvsroot/tikiwiki/tiki/lib/blogs/bloglib.php,v 1.62.2.1 2007-12-07 05:56:40 mose Exp $ -//this script may only be included - so its better to die if called directly. -if (strpos($_SERVER["SCRIPT_NAME"],basename(__FILE__)) !== false) { - header("location: index.php"); - exit; + +// This script may only be included - so its better to die if called directly. +if (strpos($_SERVER["SCRIPT_NAME"], basename(__FILE__)) !== false) { + header("location: index.php"); + exit; } include_once('lib/reportslib.php'); +/** + * Class that handles all blog operations + * + * @uses TikiLib + * @package + * @version + * @license LGPL. See licence.txt for more details + */ class BlogLib extends TikiLib { - //Special parsing for multipage articles + /** + * get_number_of_pages Returns the number of pages + * + * @param string $data + * @access public + * @return int number of pages + */ function get_number_of_pages($data) { $parts = explode("...page...", $data); return count($parts); } + /** + * get_page Returns a spcific page of a post + * + * @param string $data + * @param int $i + * @access public + * @return string the page $i of the post + */ function get_page($data, $i) { - // Get slides $parts = explode("...page...", $data); $ret = $parts[$i - 1]; @@ -27,38 +48,68 @@ return $ret; } + /** + * add_blog_hit Add a hit for the blog $blogId + * + * @param int $blogId + * @access public + * @return boolean unconditionnal true + */ function add_blog_hit($blogId) { global $prefs, $user; if ($prefs['count_admin_pvs'] == 'y' || $user != 'admin') { $query = "update `tiki_blogs` set `hits` = `hits`+1 where `blogId`=?"; - $result = $this->query($query,array((int) $blogId)); + $result = $this->query($query, array((int) $blogId)); } return true; } + /** + * insert_post_image Add an image to a post + * + * @param int $postId + * @param string $filename + * @param int $filesize + * @param string $filetype + * @param blob $data + * @access public + * @return void + */ function insert_post_image($postId, $filename, $filesize, $filetype, $data) { - $query = "insert into `tiki_blog_posts_images`(`postId`,`filename`,`filesize`,`filetype`,`data`) - values(?,?,?,?,?)"; - $this->query($query,array($postId,$filename,$filesize,$filetype,$data)); + $query = "insert into `tiki_blog_posts_images`(`postId`,`filename`,`filesize`,`filetype`,`data`) values(?,?,?,?,?)"; + $this->query($query, array($postId, $filename, $filesize, $filetype, $data)); } + /** + * get_post_image Returns the image $imgId + * + * @param mixed $imgId + * @access public + * @return array all fields that are associated with an image in tiki_blog_post_images database table + */ function get_post_image($imgId) { $query = "select * from `tiki_blog_posts_images` where `imgId`=?"; - $result = $this->query($query,array($imgId)); + $result = $this->query($query, array($imgId)); $res = $result->fetchRow(); return $res; } + /** + * get_post_images Returns all the images joined to a post + * + * @param int $postId + * @access public + * @return array with the permalink and the absolute link for each image + */ function get_post_images($postId) { - global $tikilib; + global $tikilib; $query = "select `postId`,`filename`,`filesize`,`imgId` from `tiki_blog_posts_images` where `postId`=?"; - $result = $this->query($query,array((int) $postId)); + $result = $this->query($query, array((int) $postId)); $ret = array(); while ($res = $result->fetchRow()) { $imgId = $res['imgId']; - $res['link'] = "<img src='tiki-view_blog_post_image.php?imgId=$imgId' border='0' alt='image' />"; $parts = parse_url($_SERVER['REQUEST_URI']); $path = str_replace('tiki-blog_post.php', 'tiki-view_blog_post_image.php', $parts['path']); @@ -69,28 +120,51 @@ return $ret; } + /** + * remove_post_image Removes an image + * + * @param int $imgId + * @access public + * @return void + */ function remove_post_image($imgId) { $query = "delete from `tiki_blog_posts_images` where `imgId`=?"; - $this->query($query,array($imgId)); + $this->query($query, array($imgId)); } + /** + * replace_blog Change the attributes of a blog + * + * @param string $title + * @param swtring $description + * @param string $user + * @param char[1] $public + * @param int $maxPosts + * @param int $blogId + * @param string $heading + * @param char[1] $use_title + * @param char[1] $use_find + * @param char[1] $allow_comments + * @param char[1] $show_avatar + * @access public + * @return int blogId + */ function replace_blog($title, $description, $user, $public, $maxPosts, $blogId, $heading, $use_title, $use_find, $allow_comments, $show_avatar) { global $prefs; if ($blogId) { $query = "update `tiki_blogs` set `title`=? ,`description`=?,`user`=?,`public`=?,`lastModif`=?,`maxPosts`=?,`heading`=?,`use_title`=?,`use_find`=?,`allow_comments`=?,`show_avatar`=? where `blogId`=?"; - $result = $this->query($query,array($title,$description,$user,$public,$this->now,$maxPosts,$heading,$use_title,$use_find,$allow_comments,$show_avatar,$blogId)); + $result = $this->query($query, array($title, $description, $user, $public, $this->now, $maxPosts, $heading, $use_title, $use_find, $allow_comments, $show_avatar, $blogId)); } else { - $query = "insert into `tiki_blogs`(`created`,`lastModif`,`title`,`description`,`user`,`public`,`posts`,`maxPosts`,`hits`,`heading`,`use_title`,`use_find`,`allow_comments`,`show_avatar`) - values(?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; + $query = "insert into `tiki_blogs`(`created`,`lastModif`,`title`,`description`,`user`,`public`,`posts`,`maxPosts`,`hits`,`heading`,`use_title`,`use_find`,`allow_comments`,`show_avatar`) values(?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; - $result = $this->query($query,array((int) $this->now,(int) $this->now,$title,$description,$user,$public,0,(int) $maxPosts,0,$heading,$use_title,$use_find,$allow_comments,$show_avatar)); + $result = $this->query($query, array((int) $this->now, (int) $this->now, $title, $description, $user, $public, 0, (int) $maxPosts, 0, $heading, $use_title, $use_find, $allow_comments, $show_avatar)); $query2 = "select max(`blogId`) from `tiki_blogs` where `lastModif`=?"; - $blogId = $this->getOne($query2,array((int) $this->now)); + $blogId = $this->getOne($query2, array((int) $this->now)); if ($prefs['feature_score'] == 'y') { - $this->score_event($user, 'blog_new'); + $this->score_event($user, 'blog_new'); } } @@ -101,6 +175,20 @@ return $blogId; } + /** + * list_blog_posts Returns al the posts for the blog $blogId + * + * @param int $blogId + * @param int $offset + * @param int $maxRecords + * @param string $sort_mode + * @param string $find + * @param string $date_min + * @param string $date_max + * @param string $approved + * @access public + * @return array posts + */ function list_blog_posts($blogId = 0, $offset = 0, $maxRecords = -1, $sort_mode = 'created_desc', $find = '', $date_min = '', $date_max = '', $approved = 'y') { global $tiki_p_admin_comments; @@ -159,6 +247,14 @@ return $retval; } + /** + * list_blog_post_comments List all the comments for a post + * + * @param string $approved + * @param int $maxRecords + * @access public + * @return void + */ function list_blog_post_comments($approved = 'y', $maxRecords = -1) { global $user; @@ -192,22 +288,33 @@ return array('data' => $ret, 'cant' => count($ret)); } + /** + * list_all_blog_posts Returns all the posts filtered by $date and $find + * + * @param int $offset + * @param int $maxRecords + * @param string $sort_mode + * @param string $find + * @param string $date + * @access public + * @return void + */ function list_all_blog_posts($offset = 0, $maxRecords = -1, $sort_mode = 'created_desc', $find = '', $date = '') { if ($find) { $findesc = '%' . $find . '%'; $mid = " where (`data` like ?) "; - $bindvars=array($findesc); + $bindvars = array($findesc); } else { $mid = ""; - $bindvars=array(); + $bindvars = array(); } if ($date) { - $bindvars[]=$date; + $bindvars[] = $date; if ($mid) { - $mid .= " and `created`<=? "; + $mid .= " and `created`<=? "; } else { $mid .= " where `created`<=? "; } @@ -215,8 +322,8 @@ $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); + $result = $this->fetchAll($query, $bindvars, $maxRecords, $offset); + $cant = $this->getOne($query_cant, $bindvars); $ret = array(); $result = Perms::filter( array( 'type' => 'blog' ), 'object', $result, array( 'object' => 'blogId' ), 'read_blog' ); @@ -224,7 +331,7 @@ global $prefs; foreach( $result as $res ) { $query2 = "select `title` from `tiki_blogs` where `blogId`=?"; - $title = $this->getOne($query2,array($res["blogId"])); + $title = $this->getOne($query2, array($res["blogId"])); $res["blogtitle"] = $title; $ret[] = $res; } @@ -235,17 +342,29 @@ return $retval; } - function blog_post($blogId, $data, $user, $title = '', $contributions='', $priv='n') { + /** + * blog_post Stores a blog post + * + * @param int $blogId + * @param string $data + * @param string $user + * @param string $title + * @param string $contributions + * @param string $priv + * @access public + * @return int postId + */ + function blog_post($blogId, $data, $user, $title = '', $contributions = '', $priv = 'n') { // update tiki_blogs and call activity functions global $smarty, $tikilib, $prefs, $reportslib; $data = strip_tags($data, '<a><b><i><h1><h2><h3><h4><h5><h6><ul><li><ol><br><p><table><tr><td><img><pre>'); $query = "insert into `tiki_blog_posts`(`blogId`,`data`,`created`,`user`,`title`,`priv`) values(?,?,?,?,?,?)"; - $result = $this->query($query,array((int) $blogId,$data,(int) $this->now,$user,$title,$priv)); + $result = $this->query($query, array((int) $blogId, $data, (int) $this->now, $user, $title, $priv)); $query = "select max(`postId`) from `tiki_blog_posts` where `created`=? and `user`=?"; - $id = $this->getOne($query,array((int) $this->now,$user)); + $id = $this->getOne($query, array((int) $this->now, $user)); $query = "update `tiki_blogs` set `lastModif`=?,`posts`=`posts`+1 where `blogId`=?"; - $result = $this->query($query,array((int) $this->now,(int) $blogId)); + $result = $this->query($query, array((int) $this->now, (int) $blogId)); $this->add_blog_activity($blogId); if ($prefs['feature_user_watches'] == 'y') { @@ -289,12 +408,12 @@ } if ($prefs['feature_score'] == 'y') { - $this->score_event($user, 'blog_post'); + $this->score_event($user, 'blog_post'); } if ($prefs['feature_actionlog'] == 'y') { global $logslib; include_once('lib/logs/logslib.php'); - $logslib->add_action('Posted', $blogId, 'blog', "blogId=$blogId&postId=$id&add=".strlen($data)."#postId$id", '', '', '', '', $contributions); + $logslib->add_action('Posted', $blogId, 'blog', "blogId=$blogId&postId=$id&add=" . strlen($data) . "#postId$id", '', '', '', '', $contributions); } if ( $prefs['feature_search'] == 'y' && $prefs['feature_search_fulltext'] != 'y' && $prefs['search_refresh_index_mode'] == 'normal' ) { @@ -305,20 +424,34 @@ return $id; } + /** + * remove_blog Removes a blog and all the posts of a blog + * + * @param int $blogId + * @access public + * @return boolean unconditionnal true + */ function remove_blog($blogId) { $query = "delete from `tiki_blogs` where `blogId`=?"; - $result = $this->query($query,array((int) $blogId)); + $result = $this->query($query, array((int) $blogId)); $query = "delete from `tiki_blog_posts` where `blogId`=?"; - $result = $this->query($query,array((int) $blogId)); + $result = $this->query($query, array((int) $blogId)); $this->remove_object('blog', $blogId); return true; } + /** + * remove_post Removes a post identified by $postId + * + * @param int $postId + * @access public + * @return boolean inconditionnal true + */ function remove_post($postId) { $query = "select `blogId`, `data` from `tiki_blog_posts` where `postId`=?"; - $result = $this->query($query,array((int) $postId)); + $result = $this->query($query, array((int) $postId)); if ($res = $result->fetchRow()) { $blogId = $res['blogId']; } else { @@ -330,28 +463,36 @@ global $logslib; include_once('lib/logs/logslib.php'); $param = "blogId=$blogId&postId=$postId"; if ($blogId) - $param .= "&del=".strlen($res['data']); + $param .= "&del=" . strlen($res['data']); $logslib->add_action('Removed', $blogId, 'blog', $param); } if ($blogId) { $query = "delete from `tiki_blog_posts` where `postId`=?"; - $result = $this->query($query,array((int) $postId)); + $result = $this->query($query, array((int) $postId)); $query = "update `tiki_blogs` set `posts`=`posts`-1 where `blogId`=?"; - $result = $this->query($query,array((int) $blogId)); + $result = $this->query($query, array((int) $blogId)); } $query = "delete from `tiki_blog_posts_images` where `postId`=?"; - $this->query($query,array((int) $postId)); + $this->query($query, array((int) $postId)); $this->remove_object('blog post', $postId); return true; } + /** + * get_post Returns the post identfied by $postId + * Returns false if the post does not exist + * + * @param mixed $postId + * @access public + * @return The post + */ function get_post($postId) { $query = "select * from `tiki_blog_posts` where `postId`=?"; - $result = $this->query($query,array((int) $postId)); + $result = $this->query($query, array((int) $postId)); if ($result->numRows()) { $res = $result->fetchRow(); } else { @@ -360,10 +501,24 @@ return $res; } - function update_post($postId, $blogId, $data, $user, $title = '', $contributions='', $old_data='', $priv='n') { + /** + * Updates a blog post + * + * @param int $postId + * @param int $blogId + * @param string $data + * @param string $user + * @param string $title + * @param string $contributions + * @param string $old_data + * @param string $priv + * @access public + * @return void + */ + function update_post($postId, $blogId, $data, $user, $title = '', $contributions = '', $old_data = '', $priv='n') { global $prefs; $query = "update `tiki_blog_posts` set `blogId`=?,`data`=?,`user`=?,`title`=?, `priv`=? where `postId`=?"; - $result = $this->query($query,array($blogId,$data,$user,$title,$priv,$postId)); + $result = $this->query($query, array($blogId, $data, $user, $title, $priv, $postId)); if ($prefs['feature_actionlog'] == 'y') { global $logslib; include_once('lib/logs/logslib.php'); $logslib->add_action('Updated', $blogId, 'blog', "blogId=$blogId&postId=$postId#postId$postId", '', '', '', '', $contributions); @@ -374,22 +529,33 @@ } } + /** + * list_user_posts Returns all the posts from a user + * + * @param string $user login name of the user + * @param int $offset + * @param int $maxRecords + * @param string $sort_mode + * @param string $find + * @access public + * @return void + */ function list_user_posts($user, $offset = 0, $maxRecords = -1, $sort_mode = 'created_desc', $find = '') { if ($find) { $findesc = '%' . $find . '%'; $mid = " where `user`=? and (`data` like ?) "; - $bindvars=array($user,$findesc); + $bindvars = array($user, $findesc); } else { $mid = ' where `user`=? '; - $bindvars=array($user); + $bindvars = array($user); } $query = "select * from `tiki_blog_posts` $mid order by ".$this->convertSortMode($sort_mode); $query_cant = "select count(*) from `tiki_blog_posts` $mid"; - $result = $this->query($query,$bindvars,$maxRecords,$offset); - $cant = $this->getOne($query_cant,$bindvars); + $result = $this->query($query, $bindvars, $maxRecords, $offset); + $cant = $this->getOne($query_cant, $bindvars); $ret = array(); while ($res = $result->fetchRow()) { @@ -402,6 +568,13 @@ return $retval; } + /** + * add_blog_activity + * + * @param mixed $blogId + * @access public + * @return void + */ function add_blog_activity($blogId) { //Caclulate activity, update tiki_blogs and purge activity table @@ -412,24 +585,11 @@ $day2 = $today - (3 * 24 * 60 * 60); // Purge old activity $query = "delete from `tiki_blog_activity` where `day`<?"; - $result = $this->query($query,array((int) $day2)); -/* this code enables you to reset blog activity if activity too old at each blog post - $query = "select b.`blogId` from `tiki_blogs` b left join `tiki_blog_activity`a on a.`blogId`= b.`blogId` where b.`activity` > 0 and a.`blogId` is null"; - $result = $this->query($query); - $dead = ''; - while ($res = $result->fetchRow()) { - if ($dead) - $dead .= ','; - $dead .= $res['blogId']; - } - if ($dead) { - $query = "update `tiki_blogs` set `activity`=NULL where `blogId` in (?)"; - $result = $this->query($query, array($dead)); - } -*/ + $result = $this->query($query, array((int) $day2)); + // Register new activity $query = "select count(*) from `tiki_blog_activity` where `blogId`=? and `day`=?"; - $result = $this->getOne($query,array((int) $blogId,(int)$today)); + $result = $this->getOne($query, array((int) $blogId, (int)$today)); if ($result) { $query = "update `tiki_blog_activity` set `posts`=`posts`+1 where `blogId`=? and `day`=?"; @@ -437,18 +597,26 @@ $query = "insert into `tiki_blog_activity`(`blogId`,`day`,`posts`) values(?,?,1)"; } - $result = $this->query($query,array((int) $blogId,(int) $today)); + $result = $this->query($query, array((int) $blogId, (int) $today)); // Calculate activity $query = "select `posts` from `tiki_blog_activity` where `blogId`=? and `day`=?"; - $vtoday = $this->getOne($query,array((int) $blogId,(int) $today)); - $day0 = $this->getOne($query,array((int) $blogId,(int) $day0)); - $day1 = $this->getOne($query,array((int) $blogId,(int) $day1)); - $day2 = $this->getOne($query,array((int) $blogId,(int) $day2)); + $vtoday = $this->getOne($query, array((int) $blogId, (int) $today)); + $day0 = $this->getOne($query, array((int) $blogId, (int) $day0)); + $day1 = $this->getOne($query, array((int) $blogId, (int) $day1)); + $day2 = $this->getOne($query, array((int) $blogId, (int) $day2)); $activity = (2 * $vtoday) + ($day0)+(0.5 * $day1) + (0.25 * $day2); // Update tiki_blogs with activity information $query = "update `tiki_blogs` set `activity`=? where `blogId`=?"; - $result = $this->query($query,array($activity,(int) $blogId)); + $result = $this->query($query, array($activity, (int) $blogId)); } + + /** + * Returns the title of the blog "blogId" + * + * @param int $blogId + * @access public + * @return string the title of the blog + */ function get_title($blogId) { $query = 'select `title` from `tiki_blogs` where `blogId`=?'; return $this->getOne($query, array((int)$blogId)); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pas...@us...> - 2009-12-07 04:24:22
|
Revision: 23711 http://tikiwiki.svn.sourceforge.net/tikiwiki/?rev=23711&view=rev Author: pascalstjean Date: 2009-12-07 04:24:15 +0000 (Mon, 07 Dec 2009) Log Message: ----------- [FIX] added fetch user Avatar in get_post funtion. Previously only worked with viewing all posts Modified Paths: -------------- trunk/lib/blogs/bloglib.php Modified: trunk/lib/blogs/bloglib.php =================================================================== --- trunk/lib/blogs/bloglib.php 2009-12-07 02:19:43 UTC (rev 23710) +++ trunk/lib/blogs/bloglib.php 2009-12-07 04:24:15 UTC (rev 23711) @@ -499,6 +499,7 @@ $result = $this->query($query, array((int) $postId)); if ($result->numRows()) { $res = $result->fetchRow(); + $res['avatar'] = $this->get_user_avatar($res['user']); } else { return false; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pas...@us...> - 2010-01-18 21:22:31
|
Revision: 24511 http://tikiwiki.svn.sourceforge.net/tikiwiki/?rev=24511&view=rev Author: pascalstjean Date: 2010-01-18 21:22:25 +0000 (Mon, 18 Jan 2010) Log Message: ----------- [MOD] Added use_author and add_date to Replace_Blog function. Modified Paths: -------------- trunk/lib/blogs/bloglib.php Modified: trunk/lib/blogs/bloglib.php =================================================================== --- trunk/lib/blogs/bloglib.php 2010-01-18 21:18:27 UTC (rev 24510) +++ trunk/lib/blogs/bloglib.php 2010-01-18 21:22:25 UTC (rev 24511) @@ -151,17 +151,17 @@ * @access public * @return int blogId */ - function replace_blog($title, $description, $user, $public, $maxPosts, $blogId, $heading, $use_title, $use_find, $allow_comments, $show_avatar) { + function replace_blog($title, $description, $user, $public, $maxPosts, $blogId, $heading, $use_title, $use_author, $add_date, $use_find, $allow_comments, $show_avatar) { global $prefs; if ($blogId) { - $query = "update `tiki_blogs` set `title`=? ,`description`=?,`user`=?,`public`=?,`lastModif`=?,`maxPosts`=?,`heading`=?,`use_title`=?,`use_find`=?,`allow_comments`=?,`show_avatar`=? where `blogId`=?"; + $query = "update `tiki_blogs` set `title`=? ,`description`=?,`user`=?,`public`=?,`lastModif`=?,`maxPosts`=?,`heading`=?,`use_title`=?,`use_author`=?,`add_date`=?,`use_find`=?,`allow_comments`=?,`show_avatar`=? where `blogId`=?"; - $result = $this->query($query, array($title, $description, $user, $public, $this->now, $maxPosts, $heading, $use_title, $use_find, $allow_comments, $show_avatar, $blogId)); + $result = $this->query($query, array($title, $description, $user, $public, $this->now, $maxPosts, $heading, $use_title, $use_author, $add_date, $use_find, $allow_comments, $show_avatar, $blogId)); $this->syncParsedText($heading, array('type'=>'blog', 'object'=>$blogId)); } else { - $query = "insert into `tiki_blogs`(`created`,`lastModif`,`title`,`description`,`user`,`public`,`posts`,`maxPosts`,`hits`,`heading`,`use_title`,`use_find`,`allow_comments`,`show_avatar`) values(?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; + $query = "insert into `tiki_blogs`(`created`,`lastModif`,`title`,`description`,`user`,`public`,`posts`,`maxPosts`,`hits`,`heading`,`use_title`,`use_author`,`add_date`,`use_find`,`allow_comments`,`show_avatar`) values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; - $result = $this->query($query, array((int) $this->now, (int) $this->now, $title, $description, $user, $public, 0, (int) $maxPosts, 0, $heading, $use_title, $use_find, $allow_comments, $show_avatar)); + $result = $this->query($query, array((int) $this->now, (int) $this->now, $title, $description, $user, $public, 0, (int) $maxPosts, 0, $heading, $use_title, $use_author, $add_date, $use_find, $allow_comments, $show_avatar)); $query2 = "select max(`blogId`) from `tiki_blogs` where `lastModif`=?"; $blogId = $this->getOne($query2, array((int) $this->now)); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pas...@us...> - 2010-01-19 04:55:08
|
Revision: 24534 http://tikiwiki.svn.sourceforge.net/tikiwiki/?rev=24534&view=rev Author: pascalstjean Date: 2010-01-19 04:55:02 +0000 (Tue, 19 Jan 2010) Log Message: ----------- [ENH] Added ability to return Published Only or All blog posts associated to a particular blog Modified Paths: -------------- trunk/lib/blogs/bloglib.php Modified: trunk/lib/blogs/bloglib.php =================================================================== --- trunk/lib/blogs/bloglib.php 2010-01-19 04:48:08 UTC (rev 24533) +++ trunk/lib/blogs/bloglib.php 2010-01-19 04:55:02 UTC (rev 24534) @@ -188,7 +188,7 @@ * @access public * @return array posts */ - function list_blog_posts($blogId = 0, $offset = 0, $maxRecords = -1, $sort_mode = 'created_desc', $find = '', $date_min = '', $date_max = '', $approved = 'y') { + function list_blog_posts($blogId = 0, $allowDrafts = false, $offset = 0, $maxRecords = -1, $sort_mode = 'created_desc', $find = '', $date_min = '', $date_max = '', $approved = 'y') { global $tiki_p_admin_comments; $mid = array(); @@ -214,6 +214,11 @@ $mid[] = "`created`<=?"; $bindvars[] = (int)$date_max; } + if ( !$allowDrafts ){ + $mid[] = "`priv`='n'"; + } + + $mid = empty($mid) ? '' : 'where ' . implode(' and ', $mid); $query = "select * from `tiki_blog_posts` $mid order by ".$this->convertSortMode($sort_mode); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Jy...@us...> - 2010-02-18 18:10:55
|
Revision: 25354 http://tikiwiki.svn.sourceforge.net/tikiwiki/?rev=25354&view=rev Author: Jyhem Date: 2010-02-18 18:10:49 +0000 (Thu, 18 Feb 2010) Log Message: ----------- [FIX] Provide blogTitle for module last_blog_posts when last_blog_posts is called for no perticular blog Modified Paths: -------------- trunk/lib/blogs/bloglib.php Modified: trunk/lib/blogs/bloglib.php =================================================================== --- trunk/lib/blogs/bloglib.php 2010-02-18 17:26:52 UTC (rev 25353) +++ trunk/lib/blogs/bloglib.php 2010-02-18 18:10:49 UTC (rev 25354) @@ -205,7 +205,7 @@ $bindvars = array(); if ( $blogId > 0 ) { - $mid[] = "`blogId`=?"; + $mid[] = "tbp.`blogId`=?"; $bindvars[] = (int)$blogId; $blog_data = $this->get_blog($blogId); @@ -213,6 +213,7 @@ $ownsblog = 'y'; } } + $mid[] = "tbp.blogId = tb.blogId"; if ( !$allowDrafts ){ $mid[] = "`priv`!='y'"; @@ -225,34 +226,34 @@ and ($blog_data["public"] != 'y' || $tiki_p_blog_post != 'y') and ($blog_data["public"] != 'y' || $ownsblog != 'y') ) { if ( isset($user) ) { - $mid[] = "(`priv`!='y' or `user`=?)"; + $mid[] = "(tbp.`priv`!='y' or tbp.`user`=?)"; $bindvars[] = "$user"; } else { - $mid[] = "`priv`!='y'"; + $mid[] = "tbp.`priv`!='y'"; } } } if ( $find ) { $findesc = '%' . $find . '%'; - $mid[] = "(`data` like ? or `title` like ?)"; + $mid[] = "(tbp.`data` like ? or tbp.`title` like ?)"; $bindvars[] = $findesc; $bindvars[] = $findesc; } if ( $date_min ) { - $mid[] = "`created`>=?"; + $mid[] = "tbp.`created`>=?"; $bindvars[] = (int)$date_min; } if ( $date_max ) { - $mid[] = "`created`<=?"; + $mid[] = "tbp.`created`<=?"; $bindvars[] = (int)$date_max; } $mid = empty($mid) ? '' : 'where ' . implode(' and ', $mid); - $query = "select * from `tiki_blog_posts` $mid order by ".$this->convertSortMode($sort_mode); - $query_cant = "select count(*) from `tiki_blog_posts` $mid"; + $query = "select tbp.*,tb.title as blogTitle from `tiki_blog_posts` as tbp, `tiki_blogs` as tb $mid order by ".$this->convert_sortmode($sort_mode); + $query_cant = "select count(*) from `tiki_blog_posts` as tbp, `tiki_blogs` as tb $mid"; $result = $this->query($query, $bindvars, $maxRecords, $offset); $cant = $this->getOne($query_cant, $bindvars); $ret = array(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pas...@us...> - 2010-02-18 18:43:56
|
Revision: 25360 http://tikiwiki.svn.sourceforge.net/tikiwiki/?rev=25360&view=rev Author: pascalstjean Date: 2010-02-18 18:43:42 +0000 (Thu, 18 Feb 2010) Log Message: ----------- [NEW] - Added Ability to choose published date for Blog post Modified Paths: -------------- trunk/lib/blogs/bloglib.php Modified: trunk/lib/blogs/bloglib.php =================================================================== --- trunk/lib/blogs/bloglib.php 2010-02-18 18:27:29 UTC (rev 25359) +++ trunk/lib/blogs/bloglib.php 2010-02-18 18:43:42 UTC (rev 25360) @@ -389,15 +389,15 @@ * @access public * @return int postId */ - function blog_post($blogId, $data, $user, $title = '', $contributions = '', $priv = 'n') { + function blog_post($blogId, $data, $user, $title = '', $contributions = '', $priv = 'n', $created) { // update tiki_blogs and call activity functions global $smarty, $tikilib, $prefs, $reportslib; $data = strip_tags($data, '<a><b><i><h1><h2><h3><h4><h5><h6><ul><li><ol><br><p><table><tr><td><img><pre>'); $query = "insert into `tiki_blog_posts`(`blogId`,`data`,`created`,`user`,`title`,`priv`) values(?,?,?,?,?,?)"; - $result = $this->query($query, array((int) $blogId, $data, (int) $this->now, $user, $title, $priv)); + $result = $this->query($query, array((int) $blogId, $data, (int) $created, $user, $title, $priv)); $query = "select max(`postId`) from `tiki_blog_posts` where `created`=? and `user`=?"; - $id = $this->getOne($query, array((int) $this->now, $user)); + $id = $this->getOne($query, array((int) $created, $user)); $query = "update `tiki_blogs` set `lastModif`=?,`posts`=`posts`+1 where `blogId`=?"; $result = $this->query($query, array((int) $this->now, (int) $blogId)); $this->add_blog_activity($blogId); @@ -456,7 +456,6 @@ refresh_index('blog_posts', $id); } $this->syncParsedText($data, array('type'=>'blog post', 'object'=>$id, 'description'=>substr($edit_data, 0, 200), 'name'=>$title, 'href'=>"tiki-view_blog_post.php?postId=$id")); - return $id; } @@ -552,10 +551,10 @@ * @access public * @return void */ - function update_post($postId, $blogId, $data, $user, $title = '', $contributions = '', $old_data = '', $priv='n') { + function update_post($postId, $blogId, $data, $user, $title = '', $contributions = '', $old_data = '', $priv='n', $created) { global $prefs; - $query = "update `tiki_blog_posts` set `blogId`=?,`data`=?,`user`=?,`title`=?, `priv`=? where `postId`=?"; - $result = $this->query($query, array($blogId, $data, $user, $title, $priv, $postId)); + $query = "update `tiki_blog_posts` set `blogId`=?,`data`=?,`created`=?,`user`=?,`title`=?, `priv`=? where `postId`=?"; + $result = $this->query($query, array($blogId, $data, $created,$user, $title, $priv, $postId)); if ($prefs['feature_actionlog'] == 'y') { global $logslib; include_once('lib/logs/logslib.php'); $logslib->add_action('Updated', $blogId, 'blog', "blogId=$blogId&postId=$postId#postId$postId", '', '', '', '', $contributions); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pas...@us...> - 2010-02-18 19:10:31
|
Revision: 25363 http://tikiwiki.svn.sourceforge.net/tikiwiki/?rev=25363&view=rev Author: pascalstjean Date: 2010-02-18 19:10:25 +0000 (Thu, 18 Feb 2010) Log Message: ----------- [MOD] - Added Default value to published Date variable & assign current Date if not set. Modified Paths: -------------- trunk/lib/blogs/bloglib.php Modified: trunk/lib/blogs/bloglib.php =================================================================== --- trunk/lib/blogs/bloglib.php 2010-02-18 19:00:25 UTC (rev 25362) +++ trunk/lib/blogs/bloglib.php 2010-02-18 19:10:25 UTC (rev 25363) @@ -389,17 +389,21 @@ * @access public * @return int postId */ - function blog_post($blogId, $data, $user, $title = '', $contributions = '', $priv = 'n', $created) { + function blog_post($blogId, $data, $user, $title = '', $contributions = '', $priv = 'n', $created = 0) { // update tiki_blogs and call activity functions global $smarty, $tikilib, $prefs, $reportslib; - + + if(!$created) { + $created = $this->now; + } + $data = strip_tags($data, '<a><b><i><h1><h2><h3><h4><h5><h6><ul><li><ol><br><p><table><tr><td><img><pre>'); $query = "insert into `tiki_blog_posts`(`blogId`,`data`,`created`,`user`,`title`,`priv`) values(?,?,?,?,?,?)"; $result = $this->query($query, array((int) $blogId, $data, (int) $created, $user, $title, $priv)); $query = "select max(`postId`) from `tiki_blog_posts` where `created`=? and `user`=?"; $id = $this->getOne($query, array((int) $created, $user)); $query = "update `tiki_blogs` set `lastModif`=?,`posts`=`posts`+1 where `blogId`=?"; - $result = $this->query($query, array((int) $this->now, (int) $blogId)); + $result = $this->query($query, array((int) $created, (int) $blogId)); $this->add_blog_activity($blogId); if ($prefs['feature_user_watches'] == 'y') { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pas...@us...> - 2010-02-18 19:28:02
|
Revision: 25365 http://tikiwiki.svn.sourceforge.net/tikiwiki/?rev=25365&view=rev Author: pascalstjean Date: 2010-02-18 19:27:52 +0000 (Thu, 18 Feb 2010) Log Message: ----------- [FIX] - changed convert_sortmode call to convertSortMode Modified Paths: -------------- trunk/lib/blogs/bloglib.php Modified: trunk/lib/blogs/bloglib.php =================================================================== --- trunk/lib/blogs/bloglib.php 2010-02-18 19:12:46 UTC (rev 25364) +++ trunk/lib/blogs/bloglib.php 2010-02-18 19:27:52 UTC (rev 25365) @@ -251,8 +251,7 @@ } $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->convert_sortmode($sort_mode); + $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"; $result = $this->query($query, $bindvars, $maxRecords, $offset); $cant = $this->getOne($query_cant, $bindvars); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pas...@us...> - 2010-02-18 19:29:25
|
Revision: 25366 http://tikiwiki.svn.sourceforge.net/tikiwiki/?rev=25366&view=rev Author: pascalstjean Date: 2010-02-18 19:29:18 +0000 (Thu, 18 Feb 2010) Log Message: ----------- [MOD] - Added Default value to published Date variable & assign current Date if not set. Modified Paths: -------------- trunk/lib/blogs/bloglib.php Modified: trunk/lib/blogs/bloglib.php =================================================================== --- trunk/lib/blogs/bloglib.php 2010-02-18 19:27:52 UTC (rev 25365) +++ trunk/lib/blogs/bloglib.php 2010-02-18 19:29:18 UTC (rev 25366) @@ -554,8 +554,12 @@ * @access public * @return void */ - function update_post($postId, $blogId, $data, $user, $title = '', $contributions = '', $old_data = '', $priv='n', $created) { + function update_post($postId, $blogId, $data, $user, $title = '', $contributions = '', $old_data = '', $priv='n', $created = 0) { global $prefs; + + if(!$created) { + $created = $this->now; + } $query = "update `tiki_blog_posts` set `blogId`=?,`data`=?,`created`=?,`user`=?,`title`=?, `priv`=? where `postId`=?"; $result = $this->query($query, array($blogId, $data, $created,$user, $title, $priv, $postId)); if ($prefs['feature_actionlog'] == 'y') { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pas...@us...> - 2010-02-23 21:26:51
|
Revision: 25565 http://tikiwiki.svn.sourceforge.net/tikiwiki/?rev=25565&view=rev Author: pascalstjean Date: 2010-02-23 21:26:45 +0000 (Tue, 23 Feb 2010) Log Message: ----------- [NEW] - Added parameter 'alwaysOwner' in order to support new feature in Blogs Modified Paths: -------------- trunk/lib/blogs/bloglib.php Modified: trunk/lib/blogs/bloglib.php =================================================================== --- trunk/lib/blogs/bloglib.php 2010-02-23 21:25:09 UTC (rev 25564) +++ trunk/lib/blogs/bloglib.php 2010-02-23 21:26:45 UTC (rev 25565) @@ -156,17 +156,17 @@ * @access public * @return int blogId */ - function replace_blog($title, $description, $user, $public, $maxPosts, $blogId, $heading, $use_title, $use_author, $add_date, $use_find, $allow_comments, $show_avatar) { + function replace_blog($title, $description, $user, $public, $maxPosts, $blogId, $heading, $use_title, $use_author, $add_date, $use_find, $allow_comments, $show_avatar, $alwaysOwner) { global $prefs; if ($blogId) { - $query = "update `tiki_blogs` set `title`=? ,`description`=?,`user`=?,`public`=?,`lastModif`=?,`maxPosts`=?,`heading`=?,`use_title`=?,`use_author`=?,`add_date`=?,`use_find`=?,`allow_comments`=?,`show_avatar`=? where `blogId`=?"; + $query = "update `tiki_blogs` set `title`=? ,`description`=?,`user`=?,`public`=?,`lastModif`=?,`maxPosts`=?,`heading`=?,`use_title`=?,`use_author`=?,`add_date`=?,`use_find`=?,`allow_comments`=?,`show_avatar`=?,`always_owner`=? where `blogId`=?"; - $result = $this->query($query, array($title, $description, $user, $public, $this->now, $maxPosts, $heading, $use_title, $use_author, $add_date, $use_find, $allow_comments, $show_avatar, $blogId)); + $result = $this->query($query, array($title, $description, $user, $public, $this->now, $maxPosts, $heading, $use_title, $use_author, $add_date, $use_find, $allow_comments, $show_avatar, $alwaysOwner, $blogId)); $this->syncParsedText($heading, array('type'=>'blog', 'object'=>$blogId)); } else { - $query = "insert into `tiki_blogs`(`created`,`lastModif`,`title`,`description`,`user`,`public`,`posts`,`maxPosts`,`hits`,`heading`,`use_title`,`use_author`,`add_date`,`use_find`,`allow_comments`,`show_avatar`) values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; + $query = "insert into `tiki_blogs`(`created`,`lastModif`,`title`,`description`,`user`,`public`,`posts`,`maxPosts`,`hits`,`heading`,`use_title`,`use_author`,`add_date`,`use_find`,`allow_comments`,`show_avatar`,`always_owner`) values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; - $result = $this->query($query, array((int) $this->now, (int) $this->now, $title, $description, $user, $public, 0, (int) $maxPosts, 0, $heading, $use_title, $use_author, $add_date, $use_find, $allow_comments, $show_avatar)); + $result = $this->query($query, array((int) $this->now, (int) $this->now, $title, $description, $user, $public, 0, (int) $maxPosts, 0, $heading, $use_title, $use_author, $add_date, $use_find, $allow_comments, $show_avatar, $alwaysOwner)); $query2 = "select max(`blogId`) from `tiki_blogs` where `lastModif`=?"; $blogId = $this->getOne($query2, array((int) $this->now)); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sam...@us...> - 2010-06-27 23:58:46
|
Revision: 27784 http://tikiwiki.svn.sourceforge.net/tikiwiki/?rev=27784&view=rev Author: sampaioprimo Date: 2010-06-27 23:58:39 +0000 (Sun, 27 Jun 2010) Log Message: ----------- library scope Modified Paths: -------------- trunk/lib/blogs/bloglib.php Modified: trunk/lib/blogs/bloglib.php =================================================================== --- trunk/lib/blogs/bloglib.php 2010-06-27 06:43:26 UTC (rev 27783) +++ trunk/lib/blogs/bloglib.php 2010-06-27 23:58:39 UTC (rev 27784) @@ -666,4 +666,6 @@ return $this->getOne($query, array((int)$blogId)); } } + +global $bloglib; $bloglib = new BlogLib; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sam...@us...> - 2010-06-29 18:41:09
|
Revision: 27807 http://tikiwiki.svn.sourceforge.net/tikiwiki/?rev=27807&view=rev Author: sampaioprimo Date: 2010-06-29 18:40:56 +0000 (Tue, 29 Jun 2010) Log Message: ----------- [MOD] bloglib now extends TikiDb_Bridge (and not TikiLib) to improve performance Modified Paths: -------------- trunk/lib/blogs/bloglib.php Modified: trunk/lib/blogs/bloglib.php =================================================================== --- trunk/lib/blogs/bloglib.php 2010-06-29 18:15:25 UTC (rev 27806) +++ trunk/lib/blogs/bloglib.php 2010-06-29 18:40:56 UTC (rev 27807) @@ -16,12 +16,12 @@ /** * Class that handles all blog operations * - * @uses TikiLib + * @uses TikiDb_Bridge * @package * @version * @license LGPL. See licence.txt for more details */ -class BlogLib extends TikiLib +class BlogLib extends TikiDb_Bridge { /** * List all blogs @@ -36,7 +36,8 @@ * @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'; + global $tikilib, $categlib; + if (!$categlib) require_once 'lib/categories/categlib.php'; $bindvars = array(); $join = ''; $where = ''; @@ -64,7 +65,7 @@ //FIXME Perm:filter ? foreach ( $result as $res ) { global $user; - if ($objperm = $this->get_perm_object($res['blogId'], 'blog', '', false)) { + if ($objperm = $tikilib->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)) { @@ -89,7 +90,7 @@ * @return array */ function get_blog($blogId) { - global $prefs, $user, $categlib; if (!$categlib) require_once 'lib/categories/categlib.php'; + global $tikilib, $prefs, $user, $categlib; if (!$categlib) require_once 'lib/categories/categlib.php'; $bindvars = array(); @@ -110,8 +111,8 @@ } 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"); + $tikilib->score_event($user, 'blog_read', $blogId); + $tikilib->score_event($res['user'], 'blog_is_read', "$user:$blogId"); } return $res; @@ -150,6 +151,8 @@ * @return array */ function list_user_blogs($user, $include_public = false) { + global $tikilib; + $query = "select * from `tiki_blogs` where `user`=? "; $bindvars=array($user); if ($include_public) { @@ -162,7 +165,7 @@ //FIXME Perm::filter ? foreach ( $result as $res ) { - if ($this->user_has_perm_on_object($user, $res['blogId'], 'blog', 'tiki_p_read_blog')) { + if ($tikilib->user_has_perm_on_object($user, $res['blogId'], 'blog', 'tiki_p_read_blog')) { $ret[] = $res; } } @@ -175,14 +178,14 @@ * @return array */ function list_blogs_user_can_post() { - global $tiki_p_blog_admin, $user; + global $tikilib, $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'))) + if( (!empty($user) and $user == $res['user']) || $tiki_p_blog_admin == 'y' || ($res['public'] == 'y' && $tikilib->user_has_perm_on_object($user, $res['blogId'], 'blog', 'tiki_p_blog_post'))) $ret[] = $res; } return $ret; @@ -233,7 +236,7 @@ if ($date_min !== 0 || $date_max !== 0) { if ( $date_max <= 0 ) { // show articles published today - $date_max = $this->now; + $date_max = time(); } if ($mid == '') { $mid = ' where '; @@ -414,23 +417,23 @@ * @return int blogId */ function replace_blog($title, $description, $user, $public, $maxPosts, $blogId, $heading, $use_title, $use_author, $add_date, $use_find, $allow_comments, $show_avatar, $alwaysOwner) { - global $prefs; + global $tikilib, $prefs; if ($blogId) { $query = "update `tiki_blogs` set `title`=? ,`description`=?,`user`=?,`public`=?,`lastModif`=?,`maxPosts`=?,`heading`=?,`use_title`=?,`use_author`=?,`add_date`=?,`use_find`=?,`allow_comments`=?,`show_avatar`=?,`always_owner`=? where `blogId`=?"; - $result = $this->query($query, array($title, $description, $user, $public, $this->now, $maxPosts, $heading, $use_title, $use_author, $add_date, $use_find, $allow_comments, $show_avatar, $alwaysOwner, $blogId)); - $this->object_post_save( array('type'=>'blog', 'object'=>$blogId), array('content'=>$heading) ); + $result = $this->query($query, array($title, $description, $user, $public, time(), $maxPosts, $heading, $use_title, $use_author, $add_date, $use_find, $allow_comments, $show_avatar, $alwaysOwner, $blogId)); + $tikilib->object_post_save( array('type'=>'blog', 'object'=>$blogId), array('content'=>$heading) ); } else { $query = "insert into `tiki_blogs`(`created`,`lastModif`,`title`,`description`,`user`,`public`,`posts`,`maxPosts`,`hits`,`heading`,`use_title`,`use_author`,`add_date`,`use_find`,`allow_comments`,`show_avatar`,`always_owner`) values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; - $result = $this->query($query, array((int) $this->now, (int) $this->now, $title, $description, $user, $public, 0, (int) $maxPosts, 0, $heading, $use_title, $use_author, $add_date, $use_find, $allow_comments, $show_avatar, $alwaysOwner)); + $result = $this->query($query, array((int) time(), (int) time(), $title, $description, $user, $public, 0, (int) $maxPosts, 0, $heading, $use_title, $use_author, $add_date, $use_find, $allow_comments, $show_avatar, $alwaysOwner)); $query2 = "select max(`blogId`) from `tiki_blogs` where `lastModif`=?"; - $blogId = $this->getOne($query2, array((int) $this->now)); + $blogId = $this->getOne($query2, array((int) time())); if ($prefs['feature_score'] == 'y') { - $this->score_event($user, 'blog_new'); + $tikilib->score_event($user, 'blog_new'); } - $this->object_post_save(array('type'=>'blog', 'object'=>$blogId, 'description'=>$description, 'name'=>$title, 'href'=>"tiki-view_blog.php?blogId=$blogId"), array( 'content' => $heading )); + $tikilib->object_post_save(array('type'=>'blog', 'object'=>$blogId, 'description'=>$description, 'name'=>$title, 'href'=>"tiki-view_blog.php?blogId=$blogId"), array( 'content' => $heading )); } if ( $prefs['feature_search'] == 'y' && $prefs['feature_search_fulltext'] != 'y' && $prefs['search_refresh_index_mode'] == 'normal' ) { @@ -456,7 +459,7 @@ * @return array posts */ function list_blog_posts($blogId = 0, $allowDrafts = false, $offset = 0, $maxRecords = -1, $sort_mode = 'created_desc', $find = '', $date_min = '', $date_max = '', $approved = 'y') { - global $tiki_p_admin_comments, $tiki_p_admin, $tiki_p_blog_admin, $tiki_p_blog_post, $user; + global $tikilib, $tiki_p_admin_comments, $tiki_p_admin, $tiki_p_blog_admin, $tiki_p_blog_post, $user; $mid = array(); $bindvars = array(); @@ -527,7 +530,7 @@ $cant_com = $this->getOne($cant_com_query, $cant_com_vars); $res["comments"] = $cant_com; $res['pages'] = $this->get_number_of_pages($res['data']); - $res['avatar'] = $this->get_user_avatar($res['user']); + $res['avatar'] = $tikilib->get_user_avatar($res['user']); $ret[] = $res; } @@ -547,7 +550,7 @@ * @return void */ function list_blog_post_comments($approved = 'y', $maxRecords = -1, $ref='') { - global $user; + global $user, $tikilib; $query = "SELECT b.`title`, b.`postId`, c.`threadId`, c.`title` as commentTitle, `commentDate`, `userName` FROM `tiki_comments` c, `tiki_blog_posts` b WHERE `objectType`='post' AND b.`postId`=c.`object`"; @@ -565,7 +568,7 @@ $ret = array(); while ( $res = $result->fetchRow() ) { - if ( $this->user_has_perm_on_object($user, $res['postId'], 'post', 'tiki_p_read_blog') || ($ref == 'post' && $this->user_has_perm_on_object($user, $res['postId'], 'post', 'tiki_p_blog_post_view_ref'))) { + if ( $tikilib->user_has_perm_on_object($user, $res['postId'], 'post', 'tiki_p_read_blog') || ($ref == 'post' && $tikilib->user_has_perm_on_object($user, $res['postId'], 'post', 'tiki_p_blog_post_view_ref'))) { /// check if the blog post is marked private $priv = ( $res2 = $this->get_post($res['postId']) ) ? $res2['priv'] : ''; @@ -650,7 +653,7 @@ global $smarty, $tikilib, $prefs, $reportslib; if(!$created) { - $created = $this->now; + $created = time(); } $data = strip_tags($data, '<a><b><i><h1><h2><h3><h4><h5><h6><ul><li><ol><br><p><table><tr><td><img><pre>'); @@ -663,7 +666,7 @@ $this->add_blog_activity($blogId); if ($prefs['feature_user_watches'] == 'y') { - $nots = $this->get_event_watches('blog_post', $blogId); + $nots = $tikilib->get_event_watches('blog_post', $blogId); if (!isset($_SERVER["SERVER_NAME"])) { $_SERVER["SERVER_NAME"] = $_SERVER["HTTP_HOST"]; } @@ -683,7 +686,7 @@ $smarty->assign('mail_post_title', $title); $smarty->assign('mail_blogid', $blogId); $smarty->assign('mail_postid', $id); - $smarty->assign('mail_date', $this->now); + $smarty->assign('mail_date', time()); $smarty->assign('mail_user', $user); $smarty->assign('mail_data', $data); @@ -703,7 +706,7 @@ } if ($prefs['feature_score'] == 'y') { - $this->score_event($user, 'blog_post'); + $tikilib->score_event($user, 'blog_post'); } if ($prefs['feature_actionlog'] == 'y') { @@ -715,7 +718,7 @@ require_once('lib/search/refresh-functions.php'); refresh_index('blog_posts', $id); } - $this->object_post_save(array('type'=>'blog post', 'object'=>$id, 'description'=>substr($data, 0, 200), 'name'=>$title, 'href'=>"tiki-view_blog_post.php?postId=$id"), array('content' => $data)); + $tikilib->object_post_save(array('type'=>'blog post', 'object'=>$id, 'description'=>substr($data, 0, 200), 'name'=>$title, 'href'=>"tiki-view_blog_post.php?postId=$id"), array('content' => $data)); return $id; } @@ -727,12 +730,14 @@ * @return boolean unconditionnal true */ function remove_blog($blogId) { + global $tikilib; + $query = "delete from `tiki_blogs` where `blogId`=?"; $result = $this->query($query, array((int) $blogId)); $query = "delete from `tiki_blog_posts` where `blogId`=?"; $result = $this->query($query, array((int) $blogId)); - $this->remove_object('blog', $blogId); + $tikilib->remove_object('blog', $blogId); return true; } @@ -745,6 +750,8 @@ * @return boolean inconditionnal true */ function remove_post($postId) { + global $tikilib; + $query = "select `blogId`, `data` from `tiki_blog_posts` where `postId`=?"; $result = $this->query($query, array((int) $postId)); if ($res = $result->fetchRow()) { @@ -772,7 +779,7 @@ $query = "delete from `tiki_blog_posts_images` where `postId`=?"; $this->query($query, array((int) $postId)); - $this->remove_object('blog post', $postId); + $tikilib->remove_object('blog post', $postId); return true; } @@ -786,11 +793,13 @@ * @return The post */ function get_post($postId) { + global $tikilib; + $query = "select * from `tiki_blog_posts` where `postId`=?"; $result = $this->query($query, array((int) $postId)); if ($result->numRows()) { $res = $result->fetchRow(); - $res['avatar'] = $this->get_user_avatar($res['user']); + $res['avatar'] = $tikilib->get_user_avatar($res['user']); } else { return false; } @@ -812,10 +821,10 @@ * @return void */ function update_post($postId, $blogId, $data, $user, $title = '', $contributions = '', $old_data = '', $priv='n', $created = 0) { - global $prefs; + global $tikilib, $prefs; if(!$created) { - $created = $this->now; + $created = time(); } $query = "update `tiki_blog_posts` set `blogId`=?,`data`=?,`created`=?,`user`=?,`title`=?, `priv`=? where `postId`=?"; $result = $this->query($query, array($blogId, $data, $created,$user, $title, $priv, $postId)); @@ -827,7 +836,7 @@ require_once('lib/search/refresh-functions.php'); refresh_index('blog_posts', $postId); } - $this->syncParsedText($data, array('type'=>'blog post', 'object'=>$postId)); + $tikilib->object_post_save(array('type' => 'blog post', 'object' => $postId), array('content' => $data)); } /** @@ -877,9 +886,10 @@ * @return void */ function add_blog_activity($blogId) { + global $tikilib; //Caclulate activity, update tiki_blogs and purge activity table - $today = $this->make_time(0, 0, 0, $this->date_format("%m"), $this->date_format("%d"), $this->date_format("%Y")); + $today = $tikilib->make_time(0, 0, 0, $tikilib->date_format("%m"), $tikilib->date_format("%d"), $tikilib->date_format("%Y")); $day0 = $today - (24 * 60 * 60); $day1 = $today - (2 * 24 * 60 * 60); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: Stephane C. <se...@lo...> - 2010-06-30 09:56:55
|
Le Tue, Jun 29, 2010 at 06:40:56PM +0000, sam...@us... écrivait : > Revision: 27807 > http://tikiwiki.svn.sourceforge.net/tikiwiki/?rev=27807&view=rev > Author: sampaioprimo > Date: 2010-06-29 18:40:56 +0000 (Tue, 29 Jun 2010) > > Log Message: > ----------- > [MOD] bloglib now extends TikiDb_Bridge (and not TikiLib) to improve > performance Nice job but I have one objection, you cannot replace $tikilib->now by successive call to time() because if the script takes more than 1 second to execute you will (may) have incoherent time in the DB... So for more safety we should move $tikilib->now to TikiDb_Bridge->now and move the initialization in the constuctor of TikiDb_Bridge and use $this->now instead of time() (which is more time consumming). More on putting tikilib to diet could'nt we move all the perm checks in a TikiPerm object which is of TikiDb_Bridge class ? and use TikiPerm as a base object for BlogLib ? and other Tiki Class ? More generally, can't we get methods out of tikilib like list_quizzes get_quizz and other of "shared" methods in their proper file ? that would reduce the footprint of $tikilib which is for now rather large ? ie do what you have done for blogs method from tikilib ? What do you think ? A+ -- Stéphane Casset LOGIDÉE sàrl Se faire plaisir d'apprendre 1a, rue Pasteur Tel : +33 388 23 69 77 ca...@lo... F-67540 OSTWALD Fax : +33 388 23 69 77 http://logidee.com |
From: Rodrigo S. P. <rod...@gm...> - 2010-07-02 21:16:16
|
Hi Stephane, thank you for your suggestions. My comments below. On Wed, Jun 30, 2010 at 5:52 AM, Stephane Casset <se...@lo...> wrote: > Le Tue, Jun 29, 2010 at 06:40:56PM +0000, > sam...@us... écrivait : > > Revision: 27807 > > > http://tikiwiki.svn.sourceforge.net/tikiwiki/?rev=27807&view=rev > > Author: sampaioprimo > > Date: 2010-06-29 18:40:56 +0000 (Tue, 29 Jun 2010) > > > > Log Message: > > ----------- > > [MOD] bloglib now extends TikiDb_Bridge (and not TikiLib) to improve > > performance > > Nice job but I have one objection, you cannot replace $tikilib->now by > successive call to time() because if the script takes more than 1 second > to execute you will (may) have incoherent time in the DB... > > So for more safety we should move $tikilib->now to TikiDb_Bridge->now > and move the initialization in the constuctor of TikiDb_Bridge and use > $this->now instead of time() (which is more time consumming). > I don't think it is a good idea to create a TikiDb_Bridge->now property, since we should have only database related stuff in TikiDb_Bridge. But I agree with you that it was a bad idea to use time() instead of $tikilib->now. So I have reverted this change ( http://tikiwiki.svn.sourceforge.net/tikiwiki/?rev=27841&view=rev) and all the methods in bloglib now use $tikilib->now again instead of time(). > > More on putting tikilib to diet could'nt we move all the perm checks in > a TikiPerm object which is of TikiDb_Bridge class ? and use TikiPerm as > a base object for BlogLib ? and other Tiki Class ? > > More generally, can't we get methods out of tikilib like list_quizzes > get_quizz and other of "shared" methods in their proper file ? that would > reduce the footprint of $tikilib which is for now rather large ? > ie do what you have done for blogs method from tikilib ? > > What do you think ? > To be honest I don't know enough the permission system to comment on the idea of a TikiPerm class. But the general idea of removing like list_quizzes and get_quizz to proper files is definitely good. Rodrigo > > A+ > -- > Stéphane Casset LOGIDÉE sàrl Se faire plaisir d'apprendre > 1a, rue Pasteur Tel : +33 388 23 69 77 ca...@lo... > F-67540 OSTWALD Fax : +33 388 23 69 77 http://logidee.com > > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by Sprint > What will you do first with EVO, the first 4G phone? > Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first > _______________________________________________ > Tikiwiki-cvs mailing list > Tik...@li... > https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs > |
From: <sam...@us...> - 2010-07-02 21:09:04
|
Revision: 27841 http://tikiwiki.svn.sourceforge.net/tikiwiki/?rev=27841&view=rev Author: sampaioprimo Date: 2010-07-02 21:08:57 +0000 (Fri, 02 Jul 2010) Log Message: ----------- [ENH] using $tikilib->now instead of time() Modified Paths: -------------- trunk/lib/blogs/bloglib.php Modified: trunk/lib/blogs/bloglib.php =================================================================== --- trunk/lib/blogs/bloglib.php 2010-07-02 20:03:43 UTC (rev 27840) +++ trunk/lib/blogs/bloglib.php 2010-07-02 21:08:57 UTC (rev 27841) @@ -205,6 +205,7 @@ * @return array */ function list_posts($offset = 0, $maxRecords = -1, $sort_mode = 'created_desc', $find = '', $filterByBlogId = -1, $author='', $ref='', $date_min = 0, $date_max = 0) { + global $tikilib; $authorized_blogs = $this->list_blogs(0, -1, 'created_desc', '', $ref); $permit_blogs = array(); @@ -235,7 +236,7 @@ if ($date_min !== 0 || $date_max !== 0) { if ( $date_max <= 0 ) { // show articles published today - $date_max = time(); + $date_max = $tikilib->now; } if ($mid == '') { $mid = ' where '; @@ -420,14 +421,14 @@ if ($blogId) { $query = "update `tiki_blogs` set `title`=? ,`description`=?,`user`=?,`public`=?,`lastModif`=?,`maxPosts`=?,`heading`=?,`use_title`=?,`use_author`=?,`add_date`=?,`use_find`=?,`allow_comments`=?,`show_avatar`=?,`always_owner`=? where `blogId`=?"; - $result = $this->query($query, array($title, $description, $user, $public, time(), $maxPosts, $heading, $use_title, $use_author, $add_date, $use_find, $allow_comments, $show_avatar, $alwaysOwner, $blogId)); + $result = $this->query($query, array($title, $description, $user, $public, $tikilib->now, $maxPosts, $heading, $use_title, $use_author, $add_date, $use_find, $allow_comments, $show_avatar, $alwaysOwner, $blogId)); $tikilib->object_post_save( array('type'=>'blog', 'object'=>$blogId), array('content'=>$heading) ); } else { $query = "insert into `tiki_blogs`(`created`,`lastModif`,`title`,`description`,`user`,`public`,`posts`,`maxPosts`,`hits`,`heading`,`use_title`,`use_author`,`add_date`,`use_find`,`allow_comments`,`show_avatar`,`always_owner`) values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; - $result = $this->query($query, array((int) time(), (int) time(), $title, $description, $user, $public, 0, (int) $maxPosts, 0, $heading, $use_title, $use_author, $add_date, $use_find, $allow_comments, $show_avatar, $alwaysOwner)); + $result = $this->query($query, array((int) $tikilib->now, (int) $tikilib->now, $title, $description, $user, $public, 0, (int) $maxPosts, 0, $heading, $use_title, $use_author, $add_date, $use_find, $allow_comments, $show_avatar, $alwaysOwner)); $query2 = "select max(`blogId`) from `tiki_blogs` where `lastModif`=?"; - $blogId = $this->getOne($query2, array((int) time())); + $blogId = $this->getOne($query2, array((int) $tikilib->now)); if ($prefs['feature_score'] == 'y') { $tikilib->score_event($user, 'blog_new'); @@ -652,7 +653,7 @@ global $smarty, $tikilib, $prefs, $reportslib; if(!$created) { - $created = time(); + $created = $tikilib->now; } $data = strip_tags($data, '<a><b><i><h1><h2><h3><h4><h5><h6><ul><li><ol><br><p><table><tr><td><img><pre>'); @@ -685,7 +686,7 @@ $smarty->assign('mail_post_title', $title); $smarty->assign('mail_blogid', $blogId); $smarty->assign('mail_postid', $id); - $smarty->assign('mail_date', time()); + $smarty->assign('mail_date', $tikilib->now); $smarty->assign('mail_user', $user); $smarty->assign('mail_data', $data); @@ -823,7 +824,7 @@ global $tikilib, $prefs; if(!$created) { - $created = time(); + $created = $tikilib->now; } $query = "update `tiki_blog_posts` set `blogId`=?,`data`=?,`created`=?,`user`=?,`title`=?, `priv`=? where `postId`=?"; $result = $this->query($query, array($blogId, $data, $created,$user, $title, $priv, $postId)); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sam...@us...> - 2010-08-26 22:30:27
|
Revision: 28732 http://tikiwiki.svn.sourceforge.net/tikiwiki/?rev=28732&view=rev Author: sampaioprimo Date: 2010-08-26 22:30:21 +0000 (Thu, 26 Aug 2010) Log Message: ----------- ops, fixing broken queries from a previous commit Modified Paths: -------------- trunk/lib/blogs/bloglib.php Modified: trunk/lib/blogs/bloglib.php =================================================================== --- trunk/lib/blogs/bloglib.php 2010-08-26 22:05:26 UTC (rev 28731) +++ trunk/lib/blogs/bloglib.php 2010-08-26 22:30:21 UTC (rev 28732) @@ -411,7 +411,7 @@ $result = $this->query($query, array($title, $description, $user, $public, $tikilib->now, $maxPosts, $heading, $use_author, $add_date, $use_find, $allow_comments, $show_avatar, $alwaysOwner, $post_heading, $show_related, $related_max, $use_excerpt, $blogId)); $tikilib->object_post_save( array('type'=>'blog', 'object'=>$blogId), array('content'=>$heading) ); } else { - $query = "insert into `tiki_blogs`(`created`,`lastModif`,`title`,`description`,`user`,`public`,`posts`,`maxPosts`,`hits`,`heading`,`use_author`,`add_date`,`use_find`,`allow_comments`,`show_avatar`,`always_owner`,`post_heading`, `show_related`, `related_max`, `use_excerpt`) values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; + $query = "insert into `tiki_blogs`(`created`,`lastModif`,`title`,`description`,`user`,`public`,`posts`,`maxPosts`,`hits`,`heading`,`use_author`,`add_date`,`use_find`,`allow_comments`,`show_avatar`,`always_owner`,`post_heading`, `show_related`, `related_max`, `use_excerpt`) values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; $result = $this->query($query, array((int) $tikilib->now, (int) $tikilib->now, $title, $description, $user, $public, 0, (int) $maxPosts, 0, $heading, $use_author, $add_date, $use_find, $allow_comments, $show_avatar, $alwaysOwner, $post_heading, $show_related, $related_max, $use_excerpt)); $query2 = "select max(`blogId`) from `tiki_blogs` where `lastModif`=?"; @@ -659,7 +659,7 @@ } $data = strip_tags($data, '<a><b><i><h1><h2><h3><h4><h5><h6><ul><li><ol><br><p><table><tr><td><img><pre>'); - $query = "insert into `tiki_blog_posts`(`blogId`,`data`,`excerpt`,`created`,`user`,`title`,`priv`,`wysiwyg`) values(?,?,?,?,?,?,?)"; + $query = "insert into `tiki_blog_posts`(`blogId`,`data`,`excerpt`,`created`,`user`,`title`,`priv`,`wysiwyg`) values(?,?,?,?,?,?,?,?)"; $result = $this->query($query, array((int) $blogId, $data, $excerpt, (int) $created, $user, $title, $priv, $wysiwyg)); $query = "select max(`postId`) from `tiki_blog_posts` where `created`=? and `user`=?"; $id = $this->getOne($query, array((int) $created, $user)); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sd...@us...> - 2010-08-31 15:21:42
|
Revision: 28807 http://tikiwiki.svn.sourceforge.net/tikiwiki/?rev=28807&view=rev Author: sdoh Date: 2010-08-31 14:41:54 +0000 (Tue, 31 Aug 2010) Log Message: ----------- [FIX] Corrige les freetags orphelins apr?\195?\168s suppression du post parent. Modified Paths: -------------- trunk/lib/blogs/bloglib.php Modified: trunk/lib/blogs/bloglib.php =================================================================== --- trunk/lib/blogs/bloglib.php 2010-08-31 14:37:33 UTC (rev 28806) +++ trunk/lib/blogs/bloglib.php 2010-08-31 14:41:54 UTC (rev 28807) @@ -778,6 +778,11 @@ $result = $this->query($query, array((int) $blogId)); } + // When a post is deleted, all freetags asociated must also be deleted + $objectId = $objectlib->get_object_id('blog post', $postId); + $query = "DELETE FROM `tiki_freetagged_objects` WHERE `objectId` = ?"; + $this->query($query,array((int) $objectId)); + $query = "delete from `tiki_blog_posts_images` where `postId`=?"; $this->query($query, array((int) $postId)); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sd...@us...> - 2010-09-08 12:45:52
|
Revision: 29023 http://tikiwiki.svn.sourceforge.net/tikiwiki/?rev=29023&view=rev Author: sdoh Date: 2010-09-08 12:45:45 +0000 (Wed, 08 Sep 2010) Log Message: ----------- [FIX] Corrected vanishing bold chars bug Modified Paths: -------------- trunk/lib/blogs/bloglib.php Modified: trunk/lib/blogs/bloglib.php =================================================================== --- trunk/lib/blogs/bloglib.php 2010-09-08 11:48:48 UTC (rev 29022) +++ trunk/lib/blogs/bloglib.php 2010-09-08 12:45:45 UTC (rev 29023) @@ -658,7 +658,7 @@ $created = $tikilib->now; } - $data = strip_tags($data, '<a><b><i><h1><h2><h3><h4><h5><h6><ul><li><ol><br><p><table><tr><td><img><pre>'); + $data = strip_tags($data, '<a><b><i><h1><h2><h3><h4><h5><h6><ul><li><ol><br><p><table><tr><td><img><pre><strong>'); $query = "insert into `tiki_blog_posts`(`blogId`,`data`,`excerpt`,`created`,`user`,`title`,`priv`,`wysiwyg`) values(?,?,?,?,?,?,?,?)"; $result = $this->query($query, array((int) $blogId, $data, $excerpt, (int) $created, $user, $title, $priv, $wysiwyg)); $query = "select max(`postId`) from `tiki_blog_posts` where `created`=? and `user`=?"; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sam...@us...> - 2010-09-09 14:09:26
|
Revision: 29061 http://tikiwiki.svn.sourceforge.net/tikiwiki/?rev=29061&view=rev Author: sampaioprimo Date: 2010-09-09 14:09:15 +0000 (Thu, 09 Sep 2010) Log Message: ----------- [ENH] parse wiki syntax for blog post excerpt Modified Paths: -------------- trunk/lib/blogs/bloglib.php Modified: trunk/lib/blogs/bloglib.php =================================================================== --- trunk/lib/blogs/bloglib.php 2010-09-09 14:07:54 UTC (rev 29060) +++ trunk/lib/blogs/bloglib.php 2010-09-09 14:09:15 UTC (rev 29061) @@ -517,7 +517,12 @@ $cant_com = $this->getOne($cant_com_query, $cant_com_vars); $res["comments"] = $cant_com; $res['pages'] = $this->get_number_of_pages($res['data']); - $res['avatar'] = $tikilib->get_user_avatar($res['user']); + $res['avatar'] = $tikilib->get_user_avatar($res['user']); + + if (isset($res['excerpt'])) { + $res['excerpt'] = $tikilib->parse_data($res['excerpt']); + } + $ret[] = $res; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Jy...@us...> - 2010-09-09 15:43:50
|
Revision: 29065 http://tikiwiki.svn.sourceforge.net/tikiwiki/?rev=29065&view=rev Author: Jyhem Date: 2010-09-09 15:43:44 +0000 (Thu, 09 Sep 2010) Log Message: ----------- [FIX] Avoid warnings when variables are unset Modified Paths: -------------- trunk/lib/blogs/bloglib.php Modified: trunk/lib/blogs/bloglib.php =================================================================== --- trunk/lib/blogs/bloglib.php 2010-09-09 15:43:43 UTC (rev 29064) +++ trunk/lib/blogs/bloglib.php 2010-09-09 15:43:44 UTC (rev 29065) @@ -451,6 +451,7 @@ $mid = array(); $bindvars = array(); + $ownsblog = 'n'; if ( $blogId > 0 ) { $mid[] = "tbp.`blogId`=?"; $bindvars[] = (int)$blogId; @@ -471,7 +472,7 @@ 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 ( !isset($blog_data["public"]) || $blog_data["public"] != 'y' || $ownsblog != 'y') ) { if ( isset($user) ) { $mid[] = "(tbp.`priv`!='y' or tbp.`user`=?)"; $bindvars[] = "$user"; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sy...@us...> - 2010-09-14 19:30:41
|
Revision: 29227 http://tikiwiki.svn.sourceforge.net/tikiwiki/?rev=29227&view=rev Author: sylvieg Date: 2010-09-14 19:30:35 +0000 (Tue, 14 Sep 2010) Log Message: ----------- [FIX]blog: a blog admin can post even if the blog is not public Modified Paths: -------------- trunk/lib/blogs/bloglib.php Modified: trunk/lib/blogs/bloglib.php =================================================================== --- trunk/lib/blogs/bloglib.php 2010-09-14 19:02:20 UTC (rev 29226) +++ trunk/lib/blogs/bloglib.php 2010-09-14 19:30:35 UTC (rev 29227) @@ -184,7 +184,7 @@ //FIXME Perm:filter ? foreach ( $result as $res ) { - if( (!empty($user) and $user == $res['user']) || $tiki_p_blog_admin == 'y' || ($res['public'] == 'y' && $tikilib->user_has_perm_on_object($user, $res['blogId'], 'blog', 'tiki_p_blog_post'))) + if( (!empty($user) and $user == $res['user']) || $tiki_p_blog_admin == 'y' || $tikilib->user_has_perm_on_object($user, $res['blogId'], 'blog', 'tiki_p_blog_admin') || ($res['public'] == 'y' && $tikilib->user_has_perm_on_object($user, $res['blogId'], 'blog', 'tiki_p_blog_post'))) $ret[] = $res; } return $ret; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sam...@us...> - 2010-09-20 15:16:17
|
Revision: 29389 http://tikiwiki.svn.sourceforge.net/tikiwiki/?rev=29389&view=rev Author: sampaioprimo Date: 2010-09-20 15:16:06 +0000 (Mon, 20 Sep 2010) Log Message: ----------- [FIX] r28807 $objectlib was not defined Modified Paths: -------------- trunk/lib/blogs/bloglib.php Modified: trunk/lib/blogs/bloglib.php =================================================================== --- trunk/lib/blogs/bloglib.php 2010-09-20 15:01:12 UTC (rev 29388) +++ trunk/lib/blogs/bloglib.php 2010-09-20 15:16:06 UTC (rev 29389) @@ -765,6 +765,7 @@ */ function remove_post($postId) { global $tikilib; + global $objectlib; require_once('lib/objectlib.php'); $query = "select `blogId`, `data` from `tiki_blog_posts` where `postId`=?"; $result = $this->query($query, array((int) $postId)); @@ -790,6 +791,10 @@ $result = $this->query($query, array((int) $blogId)); } + /* + * TODO: this should be a method in freetaglib or maybe even better $tikilib->remove_object() should + * remove the relation between the object and the tags, no? + */ // When a post is deleted, all freetags asociated must also be deleted $objectId = $objectlib->get_object_id('blog post', $postId); $query = "DELETE FROM `tiki_freetagged_objects` WHERE `objectId` = ?"; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Jy...@us...> - 2010-09-20 21:44:13
|
Revision: 29458 http://tikiwiki.svn.sourceforge.net/tikiwiki/?rev=29458&view=rev Author: Jyhem Date: 2010-09-20 21:44:07 +0000 (Mon, 20 Sep 2010) Log Message: ----------- [FIX] feature_group_watches should work even when feature_user_watches is disabled Modified Paths: -------------- trunk/lib/blogs/bloglib.php Modified: trunk/lib/blogs/bloglib.php =================================================================== --- trunk/lib/blogs/bloglib.php 2010-09-20 21:39:39 UTC (rev 29457) +++ trunk/lib/blogs/bloglib.php 2010-09-20 21:44:07 UTC (rev 29458) @@ -679,7 +679,7 @@ $result = $this->query($query, array((int) $created, (int) $blogId)); $this->add_blog_activity($blogId); - if ($prefs['feature_user_watches'] == 'y') { + if ($prefs['feature_user_watches'] == 'y' or $prefs['feature_group_watches'] == 'y' ) { $nots = $tikilib->get_event_watches('blog_post', $blogId); if (!isset($_SERVER["SERVER_NAME"])) { $_SERVER["SERVER_NAME"] = $_SERVER["HTTP_HOST"]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sam...@us...> - 2011-02-18 18:34:05
|
Revision: 32906 http://tikiwiki.svn.sourceforge.net/tikiwiki/?rev=32906&view=rev Author: sampaioprimo Date: 2011-02-18 18:33:59 +0000 (Fri, 18 Feb 2011) Log Message: ----------- replace direct call to strip_tags with TikiFilter_HtmlPurifier on BlogLib::blog_post() Modified Paths: -------------- trunk/lib/blogs/bloglib.php Modified: trunk/lib/blogs/bloglib.php =================================================================== --- trunk/lib/blogs/bloglib.php 2011-02-18 18:33:18 UTC (rev 32905) +++ trunk/lib/blogs/bloglib.php 2011-02-18 18:33:59 UTC (rev 32906) @@ -697,7 +697,7 @@ $created = $tikilib->now; } - $data = strip_tags($data, '<a><b><i><h1><h2><h3><h4><h5><h6><ul><li><ol><br><p><table><tr><td><img><pre><strong>'); + $data = TikiFilter::get('purifier')->filter($data); $query = "insert into `tiki_blog_posts`(`blogId`,`data`,`excerpt`,`created`,`user`,`title`,`priv`,`wysiwyg`) values(?,?,?,?,?,?,?,?)"; $result = $this->query($query, array((int) $blogId, $data, $excerpt, (int) $created, $user, $title, $priv, $wysiwyg)); $query = "select max(`postId`) from `tiki_blog_posts` where `created`=? and `user`=?"; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |