[geeklog-cvs] geeklog: Fixed bug where article would not display if it had com...

geeklog-cvs at lists.geeklog.net geeklog-cvs at lists.geeklog.net
Mon Apr 30 14:54:29 EDT 2012


changeset 8659:fea041a43c2f
url:  http://project.geeklog.net/cgi-bin/hgwebdir.cgi/geeklog/rev/fea041a43c2f
user: Tom <websitemaster at cogeco.net>
date: Mon Apr 30 14:31:25 2012 -0400
description:
Fixed bug where article would not display if it had comments and the user did not have access to all the topics the articles belonged to.
Fixed bug when viewing a single comment that the user had access to the article but not all the topics the article belonged to.

diffstat:

 system/lib-comment.php |  11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diffs (42 lines):

diff -r b84ee697c701 -r fea041a43c2f system/lib-comment.php
--- a/system/lib-comment.php	Mon Apr 30 18:50:21 2012 +0900
+++ b/system/lib-comment.php	Mon Apr 30 14:31:25 2012 -0400
@@ -2073,7 +2073,7 @@
     if ($cid <= 0) {
         return COM_refresh($_CONF['site_url'] . '/index.php');
     }
-    
+
     $sql = "SELECT sid, title, type FROM {$_TABLES['comments']} WHERE cid = $cid";
     $A = DB_fetchArray( DB_query($sql) );
     $sid   = $A['sid'];
@@ -2085,7 +2085,7 @@
     if (!$display) {
         return COM_refresh($_CONF['site_url'] . '/index.php');
     }
-
+    
     $display = COM_showMessageFromParameter() . $display;
     $display = COM_createHTMLDocument($display, 'menu', $title);
 
@@ -2407,7 +2407,10 @@
                 $dbTitle = DB_getItem($_TABLES['stories'], 'title',
                             "(sid = '$sid') AND (draft_flag = 0) AND (date <= NOW()) AND (commentcode = 0)"
                             . COM_getPermSQL('AND'));
-                if ($dbTitle === null || TOPIC_hasMultiTopicAccess('article', $sid) < 2) { // Make sure have at least read access to topics to post comment
+                global $topic;
+
+                // if ($dbTitle === null || TOPIC_hasMultiTopicAccess('article', $sid) < 2) { // Make sure have at least read access to topics to post comment
+                if ($dbTitle === null || TOPIC_hasMultiTopicAccess('article', $sid, $topic) < 2) { // Make sure have at least read access to current topic of article to post comment
                     // no permissions, or no story of that title
                     $abort = true;
                 }
@@ -2588,7 +2591,7 @@
     $A = DB_fetchArray ($result);
     $allowed = $A['count'];
 
-    if ($allowed == 1) {
+    if ($allowed > 0) { // Was equal 1 but when multiple topics in play the comment could belong to more than onetopic creating a higher count
         $delete_option = (SEC_hasRights('story.edit') &&
             (SEC_hasAccess($A['owner_id'], $A['group_id'],
                 $A['perm_owner'], $A['perm_group'], $A['perm_members'],



More information about the geeklog-cvs mailing list