]> git.mjollnir.org Git - s9y.git/commitdiff
Fix category fetch function for specific "current author" case
authorgarvinhicking <garvinhicking>
Tue, 20 Jun 2006 09:37:08 +0000 (09:37 +0000)
committergarvinhicking <garvinhicking>
Tue, 20 Jun 2006 09:37:08 +0000 (09:37 +0000)
docs/NEWS
include/functions_entries.inc.php
include/plugin_internal.inc.php

index 8d23c07c5d990e913da7680692027f18d7377d30..078ee175a1f8dbedc50040a18338204c6627cb19 100644 (file)
--- a/docs/NEWS
+++ b/docs/NEWS
@@ -3,6 +3,10 @@
 Version 1.1-alpha7()
 ------------------------------------------------------------------------
 
+    * Fixed sidebar category plugin to show proper category listing
+      for permission-based restrictions, when "current autho" mode
+      is selected (garvinhicking)
+
     * Added experimental XML-engine, for XSLT templating support
       (garvinhicking)
 
index 9bd9df43ab8eec585b97abb3eb83b2e59a201c13..120345900f25fcf509fe00039390d9e54d63aa26 100644 (file)
@@ -562,10 +562,17 @@ function serendipity_fetchCategories($authorid = null, $name = null, $order = nu
     }
 
     $where = '';
+
+    if ($authorid === -1 OR $authorid === 0) {
+        $sql_groupid = '0';
+    } else {
+        $sql_groupid = 'ag.groupid';
+    }
+
     if ($authorid != 'all' && is_numeric($authorid)) {
         $sql_authorid = $authorid;
         if (!serendipity_checkPermission('adminCategoriesMaintainOthers', $authorid)) {
-            $where = " WHERE (c.authorid = $authorid OR c.authorid = 0)";
+            $where = " WHERE (c.authorid = $authorid OR c.authorid = 0) ";
             $where .= "OR (
                           acl.artifact_type = 'category'
                           AND acl.artifact_mode = '" . serendipity_db_escape_string($artifact_mode) . "'
@@ -612,7 +619,7 @@ function serendipity_fetchCategories($authorid = null, $name = null, $order = nu
            LEFT OUTER JOIN {$serendipity['dbPrefix']}authorgroups AS ag
                         ON ag.authorid = $sql_authorid
            LEFT OUTER JOIN {$serendipity['dbPrefix']}access AS acl
-                        ON (ag.groupid = acl.groupid AND acl.artifact_id = c.categoryid)
+                        ON ($sql_groupid = acl.groupid AND acl.artifact_id = c.categoryid)
                            $where
                            $group";
     if (!empty($order)) {
index aaa2b5e23a55b4378791042a8f1277ccbdd8c614..4dc4a32c866a8a0c62f48bfd996cb4430f3e7874 100644 (file)
@@ -1415,7 +1415,7 @@ class serendipity_categories_plugin extends serendipity_plugin {
             }
         }
 
-        $categories = serendipity_fetchCategories(empty($which_category) ? 'all' : $which_category, '', $sort);
+        $categories = serendipity_fetchCategories(empty($which_category) ? 'all' : $which_category, '', $sort, 'read');
 
         $cat_count = array();
         if (serendipity_db_bool($this->get_config('show_count'))) {