From: garvinhicking Date: Tue, 20 Jun 2006 09:37:08 +0000 (+0000) Subject: Fix category fetch function for specific "current author" case X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=63da241755e53907ca267d81380257d67e55fd45;p=s9y.git Fix category fetch function for specific "current author" case --- diff --git a/docs/NEWS b/docs/NEWS index 8d23c07..078ee17 100644 --- 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) diff --git a/include/functions_entries.inc.php b/include/functions_entries.inc.php index 9bd9df4..1203459 100644 --- a/include/functions_entries.inc.php +++ b/include/functions_entries.inc.php @@ -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)) { diff --git a/include/plugin_internal.inc.php b/include/plugin_internal.inc.php index aaa2b5e..4dc4a32 100644 --- a/include/plugin_internal.inc.php +++ b/include/plugin_internal.inc.php @@ -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'))) {