[geeklog-cvs] geeklog: Fixed handling of $_CONF['comment_close_rec_stories'] (...

geeklog-cvs at lists.geeklog.net geeklog-cvs at lists.geeklog.net
Sat Jun 13 09:41:19 EDT 2009


details:   http://project.geeklog.net/cgi-bin/hgweb.cgi/rev/a5fd4b122d3c
changeset: 7111:a5fd4b122d3c
user:      Dirk Haun <dirk at haun-online.de>
date:      Sat Jun 13 15:39:45 2009 +0200
description:
Fixed handling of $_CONF['comment_close_rec_stories'] (bug #0000899)

diffstat:

 public_html/docs/history |  12 +++++++++---
 system/lib-comment.php   |  23 +++++++++++++----------
 system/lib-story.php     |  10 ++++++++--
 3 files changed, 30 insertions(+), 15 deletions(-)

diffs (127 lines):

diff -r 711f03b24fef -r a5fd4b122d3c public_html/docs/history
--- a/public_html/docs/history	Sat Jun 13 10:35:33 2009 +0200
+++ b/public_html/docs/history	Sat Jun 13 15:39:45 2009 +0200
@@ -1,6 +1,6 @@
 Geeklog History/Changes:
 
-Jun ??, 2009 (1.6.0b3)
+Jun 1?, 2009 (1.6.0b3)
 ------------
 
 Geeklog 1.6.0 incorporates the following projects implemented during
@@ -11,20 +11,26 @@
 + Comment moderation and editable comments, by Jared Wenerd
 
 Changes since 1.6.0b2:
+- Fixed handling of $_CONF['comment_close_rec_stories'] (bug #0000899) [Dirk]
+- Improved selection of text portion displayed in search results [Dirk]
 - Fixed an error that occured after deleting a trackback [Dirk]
 - Replace autotags in search results (bug #0000887) [Dirk]
-- Don't insist on an email adress when editing a Remote User (bug #0000885)
+- Don't insist on an email address when editing a Remote User (bug #0000885)
   [Dirk]
 - Added a config option to send an X-FRAME-OPTIONS HTTP header to prevent
   "clickjacking" (requires browser support) [Dirk]
 - Prevent XSS in the install script (reported independently by Nemesis and MaXe)
   [Dirk]
 - Removed old plugin API function plugin_commentsupport from the Calendar,
-  Polls, and Static Pages plugins.
+  Polls, and Static Pages plugins [Dirk]
 
 - Updated Japanese language files and Japanese documentation,
   provided by the Geeklog.jp group
 
+Calendar plugin
+---------------
+- Fixed leap year check [Sean Clark]
+
 Polls plugin
 ------------
 - Update polls comments when changing a poll's ID so the comments don't become
diff -r 711f03b24fef -r a5fd4b122d3c system/lib-comment.php
--- a/system/lib-comment.php	Sat Jun 13 10:35:33 2009 +0200
+++ b/system/lib-comment.php	Sat Jun 13 15:39:45 2009 +0200
@@ -1635,8 +1635,8 @@
 }
 
 /**
- * Disables comments for all stories where current time is past comment expire time and 
- * enables comments for certain number of most recent stories.
+ * Disables comments for all stories where current time is past comment expire
+ * time and enables comments for certain number of most recent stories.
  *
  * @copyright Jared Wenerd 2008
  * @author Jared Wenerd, wenerd87 AT gmail DOT com
@@ -1644,20 +1644,23 @@
 function CMT_updateCommentcodes()
 {
     global $_CONF, $_TABLES;
-    
+
     if ($_CONF['comment_close_rec_stories'] > 0) {
-        $results = DB_query("SELECT sid FROM {$_TABLES['stories']} ORDER BY date DESC LIMIT {$_CONF['comment_close_rec_stories']}");
-        while($A = DB_fetchArray($results))  {
+        $results = DB_query("SELECT sid FROM {$_TABLES['stories']} WHERE (date <= NOW()) AND (draft_flag = 0) ORDER BY date DESC LIMIT {$_CONF['comment_close_rec_stories']}");
+        while ($A = DB_fetchArray($results)) {
             $allowedcomments[] = $A['sid'];
         }
-        //update comment codes. 
-        $sql = '';
-        foreach ($allowedcomments as $sid) {
-            $sql .= "AND sid <> '$sid' ";
+        // update comment codes
+        $sql = ' AND ';
+        if (count($allowedcomments) > 1) {
+            $sql .= "sid NOT IN ('" . implode("','", $allowedcomments) . "')";
+        } else {
+            $sql .= "sid <> '$sid'";
         }
-        $sql = "UPDATE {$_TABLES['stories']} SET commentcode = 1 WHERE commentcode = 0 " . $sql;
+        $sql = "UPDATE {$_TABLES['stories']} SET commentcode = 1 WHERE (commentcode = 0) AND (date < NOW()) AND (draft_flag = 0)" . $sql;
         DB_query($sql);
     }
+
     $sql = "UPDATE {$_TABLES['stories']} SET commentcode = 1 WHERE UNIX_TIMESTAMP(comment_expire) < UNIX_TIMESTAMP() AND UNIX_TIMESTAMP(comment_expire) <> 0";
     DB_query($sql);
 }
diff -r 711f03b24fef -r a5fd4b122d3c system/lib-story.php
--- a/system/lib-story.php	Sat Jun 13 10:35:33 2009 +0200
+++ b/system/lib-story.php	Sat Jun 13 15:39:45 2009 +0200
@@ -876,7 +876,9 @@
 */
 function STORY_doDeleteThisStoryNow($sid)
 {
-    global $_TABLES;
+    global $_CONF, $_TABLES;
+
+    require_once $_CONF['path_system'] . 'lib-comment.php';
 
     STORY_deleteImages($sid);
     DB_delete($_TABLES['comments'], array('sid', 'type'),
@@ -891,6 +893,7 @@
     // update RSS feed and Older Stories block
     COM_rdfUpToDateCheck();
     COM_olderStuff();
+    CMT_updateCommentcodes();
 }
 
 /**
@@ -928,6 +931,8 @@
         return PLG_RET_AUTH_FAILED;
     }
 
+    require_once $_CONF['path_system'] . 'lib-comment.php';
+
     $gl_edit = false;
     if (isset($args['gl_edit'])) {
         $gl_edit = $args['gl_edit'];
@@ -1287,7 +1292,8 @@
 
         // update feed(s) and Older Stories block
         COM_rdfUpToDateCheck('article', $story->DisplayElements('tid'), $sid);
-        COM_olderStuff ();
+        COM_olderStuff();
+        CMT_updateCommentcodes();
 
         if ($story->type == 'submission') {
             $output = COM_refresh ($_CONF['site_admin_url'] . '/moderation.php?msg=9');



More information about the geeklog-cvs mailing list