Archived
1
0

Fix showing proper plugin permissionship plugin

This commit is contained in:
Garvin Hicking
2007-02-13 08:35:53 +00:00
parent 075e9ea1d5
commit 50401a7d02
4 changed files with 19 additions and 7 deletions
+2 -2
View File
@@ -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>
+1
View File
@@ -183,6 +183,7 @@ function serendipity_fetchComments($id, $limit = null, $order = '', $showAll = f
}
serendipity_plugin_api::hook_event('fetchcomments', $comments);
return $comments;
}
+11 -5
View File
@@ -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;