From b3f432813b5c154bf3d2adb3029b280d172957c2 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Thu, 21 Apr 2011 16:08:34 +0200 Subject: [PATCH] Fixing bug when clickin in the "read more" link in the blog tool see #2131 --- main/inc/lib/blog.lib.php | 76 ++++++++++++++++----------------------- 1 file changed, 30 insertions(+), 46 deletions(-) diff --git a/main/inc/lib/blog.lib.php b/main/inc/lib/blog.lib.php index 3498ac3e60..08c9e41791 100755 --- a/main/inc/lib/blog.lib.php +++ b/main/inc/lib/blog.lib.php @@ -1,4 +1,4 @@ - 0) - { - while($blog_post = Database::fetch_array($result)) - { + if(Database::num_rows($result) > 0) { + $limit = api_get_setting('read_more_limit'); //nmbr of words in introduction text + if (empty($limit)) { + $limit = 200; + } + while($blog_post = Database::fetch_array($result)) { // Get number of comments $sql = "SELECT COUNT(1) as number_of_comments FROM $tbl_blogs_comments WHERE blog_id = '".(int)$blog_id."' AND post_id = '" . (int)$blog_post['post_id']."'"; $tmp = Database::query($sql); @@ -730,44 +732,32 @@ class Blog { $blog_post_date = api_convert_and_format_date($blog_post['date_creation'], null, date_default_timezone_get()); // Create an introduction text (but keep FULL sentences) - $limit = api_get_setting('read_more_limit'); //nmbr of words in introduction text + $introduction_text = ""; $words = 0; - $tok = strtok(make_clickable(stripslashes($blog_post['full_text'])), " "); - //original - //$tok = strtok(make_clickable(stripslashes(strip_tags($blog_post['full_text'],"