diff --git a/docs/NEWS b/docs/NEWS
index 11342121..30a21cdc 100644
--- a/docs/NEWS
+++ b/docs/NEWS
@@ -60,6 +60,11 @@ Version 1.2 ()
Version 1.1.1 ()
------------------------------------------------------------------------
+ * Patch plugin permissionship management to properly indicate
+ forbidden plugins/hooks, even if the admin user is not contained
+ within the configured group. Thanks to ICE!
+ (http://board.s9y.org/viewtopic.php?t=8773) (garvinhicking)
+
* Patch pingback receiving function to use proper Regexp, thanks to
dhaun from the forums
diff --git a/include/admin/groups.inc.php b/include/admin/groups.inc.php
index 7277c9c2..4b6d2a58 100644
--- a/include/admin/groups.inc.php
+++ b/include/admin/groups.inc.php
@@ -193,7 +193,7 @@ foreach($allusers AS $user) {
foreach($currentplugin['b']->properties['event_hooks'] AS $hook => $set) {
$allhooks[$hook] = true;
}
- echo '' . "\n";
+ echo '' . "\n";
}
ksort($allhooks);
?>
@@ -210,7 +210,7 @@ foreach($allusers AS $user) {
diff --git a/include/functions_comments.inc.php b/include/functions_comments.inc.php
index 166a880d..f09e8355 100644
--- a/include/functions_comments.inc.php
+++ b/include/functions_comments.inc.php
@@ -183,6 +183,7 @@ function serendipity_fetchComments($id, $limit = null, $order = '', $showAll = f
}
serendipity_plugin_api::hook_event('fetchcomments', $comments);
+
return $comments;
}
diff --git a/include/functions_config.inc.php b/include/functions_config.inc.php
index 78f96ca7..a49f8cf2 100644
--- a/include/functions_config.inc.php
+++ b/include/functions_config.inc.php
@@ -1879,7 +1879,7 @@ function &serendipity_loadThemeOptions(&$template_config) {
return $template_vars;
}
-function serendipity_hasPluginPermissions($plugin) {
+function serendipity_hasPluginPermissions($plugin, $groupid = null) {
static $forbidden = null;
global $serendipity;
@@ -1887,22 +1887,28 @@ function serendipity_hasPluginPermissions($plugin) {
return true;
}
- if ($forbidden === null) {
+ if ($forbidden === null || ($groupid !== null && !isset($forbidden[$groupid]))) {
$forbidden = array();
- $groups =& serendipity_checkPermission(null, null, 'all');
+
+ if ($groupid === null) {
+ $groups =& serendipity_checkPermission(null, null, 'all');
+ } else {
+ $groups = array($groupid => serendipity_fetchGroup($groupid));
+ }
+
foreach($groups AS $idx => $group) {
if ($idx == 'membership') {
continue;
}
foreach($group AS $key => $val) {
if (substr($key, 0, 2) == 'f_') {
- $forbidden[$key] = true;
+ $forbidden[$groupid][$key] = true;
}
}
}
}
- if (isset($forbidden['f_' . $plugin])) {
+ if (isset($forbidden[$groupid]['f_' . $plugin])) {
return false;
} else {
return true;