Fix showing proper plugin permissionship plugin
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -193,7 +193,7 @@ foreach($allusers AS $user) {
|
||||
foreach($currentplugin['b']->properties['event_hooks'] AS $hook => $set) {
|
||||
$allhooks[$hook] = true;
|
||||
}
|
||||
echo '<option value="' . urlencode($plugid) . '" ' . (serendipity_hasPluginPermissions($plugid) ? '' : 'selected="selected"') . '>' . htmlspecialchars($currentplugin['b']->properties['name']) . '</option>' . "\n";
|
||||
echo '<option value="' . urlencode($plugid) . '" ' . (serendipity_hasPluginPermissions($plugid, $from['id']) ? '' : 'selected="selected"') . '>' . htmlspecialchars($currentplugin['b']->properties['name']) . '</option>' . "\n";
|
||||
}
|
||||
ksort($allhooks);
|
||||
?>
|
||||
@@ -210,7 +210,7 @@ foreach($allusers AS $user) {
|
||||
<select name="serendipity[forbidden_hooks][]" multiple="multiple" size="5">
|
||||
<?php
|
||||
foreach($allhooks AS $hook => $set) {
|
||||
echo '<option value="' . urlencode($hook) . '" ' . (serendipity_hasPluginPermissions($hook) ? '' : 'selected="selected"') . '>' . htmlspecialchars($hook) . '</option>' . "\n";
|
||||
echo '<option value="' . urlencode($hook) . '" ' . (serendipity_hasPluginPermissions($hook, $from['id']) ? '' : 'selected="selected"') . '>' . htmlspecialchars($hook) . '</option>' . "\n";
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
|
||||
@@ -183,6 +183,7 @@ function serendipity_fetchComments($id, $limit = null, $order = '', $showAll = f
|
||||
}
|
||||
|
||||
serendipity_plugin_api::hook_event('fetchcomments', $comments);
|
||||
|
||||
return $comments;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user