From: garvinhicking Date: Tue, 13 Feb 2007 08:35:56 +0000 (+0000) Subject: Fix showing proper plugin permissionship plugin X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=d3473f62ba703b9c6cb523373d0b9801a3f44189;p=s9y.git Fix showing proper plugin permissionship plugin --- diff --git a/docs/NEWS b/docs/NEWS index cf8ff8c..175c88f 100644 --- a/docs/NEWS +++ b/docs/NEWS @@ -3,6 +3,11 @@ 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 7277c9c..4b6d2a5 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 2e64a53..77e1dbb 100644 --- a/include/functions_comments.inc.php +++ b/include/functions_comments.inc.php @@ -182,6 +182,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 5e69e48..1a3ba4c 100644 --- a/include/functions_config.inc.php +++ b/include/functions_config.inc.php @@ -1862,7 +1862,7 @@ function &serendipity_loadThemeOptions(&$template_config) { return $template_vars; } -function serendipity_hasPluginPermissions($plugin) { +function serendipity_hasPluginPermissions($plugin, $groupid = null) { static $forbidden = null; global $serendipity; @@ -1870,22 +1870,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;