Show mis-assigned plugins when a template supports custom sidebars

This commit is contained in:
Garvin Hicking 2006-10-09 09:19:39 +00:00
parent 20dce86770
commit 9c85c0349f
2 changed files with 30 additions and 4 deletions

View File

@ -434,7 +434,7 @@ if (isset($_GET['serendipity']['plugin_to_conf'])) {
/* Load the new plugin */ /* Load the new plugin */
$plugin = &serendipity_plugin_api::load_plugin($inst); $plugin = &serendipity_plugin_api::load_plugin($inst);
if (!is_object($plugin)) { if (!is_object($plugin)) {
echo "DEBUG: Plugin $inst not an object: " . print_r($plugin, true) . ".<br />Input: " . print_r($serendipity['GET'], true) . ".<br /><br />\n\nPlease report this bug. This error can happen if a plugin was not properly downloaded (check your plugins directory if the requested plugin was downloaded) or the inclusion of a file failed (permissions?)<br />\n"; echo "DEBUG: Plugin $inst not an object: " . print_r($plugin, true) . ".<br />Input: " . print_r($serendipity['GET'], true) . ".<br /><br />\n\nThis error can happen if a plugin was not properly downloaded (check your plugins directory if the requested plugin was downloaded) or the inclusion of a file failed (permissions?)<br />\n";
echo "Backtrace:<br />\n" . implode("<br />\n", $serendipity['debug']['pluginload']) . "<br />"; echo "Backtrace:<br />\n" . implode("<br />\n", $serendipity['debug']['pluginload']) . "<br />";
} }
$bag = new serendipity_property_bag; $bag = new serendipity_property_bag;

View File

@ -58,6 +58,7 @@ function show_plugins($event_only = false, $sidebars = null)
global $serendipity; global $serendipity;
$sql_filter = '';
if (is_array($sidebars)) { if (is_array($sidebars)) {
foreach($sidebars AS $sidebar) { foreach($sidebars AS $sidebar) {
$up = strtoupper($sidebar); $up = strtoupper($sidebar);
@ -70,6 +71,19 @@ function show_plugins($event_only = false, $sidebars = null)
} else { } else {
$opts[$sidebar] = $up; $opts[$sidebar] = $up;
} }
$sql_filter .= "AND placement != '" . serendipity_db_escape_string($sidebar) . "' ";
}
}
if (!$event_only) {
$sql = "SELECT * from {$serendipity['dbPrefix']}plugins
WHERE placement != 'event'
AND placement != 'eventh'
" . $sql_filter;
$invisible_plugins = serendipity_db_query($sql);
if (is_array($invisible_plugins)) {
$sidebars[] = 'NONE';
$opts['NONE'] = NONE;
} }
} }
@ -114,10 +128,22 @@ function show_plugins($event_only = false, $sidebars = null)
$total = 0; $total = 0;
foreach ($plugin_placements as $plugin_placement) { foreach ($plugin_placements as $plugin_placement) {
if (!$event_only && $plugin_placement == 'NONE') {
$is_invisible = true;
} else {
$is_invisible = false;
}
$ptitle = $opts[$plugin_placement];
$pid = $plugin_placement;
echo '<td class="pluginmanager_side">'; echo '<td class="pluginmanager_side">';
echo '<div class="heading">' . $opts[$plugin_placement] . '</div>'; echo '<div class="heading">' . $ptitle . '</div>';
echo '<ol id="' . $plugin_placement . '_col" class="pluginmanager_container">'; echo '<ol id="' . $pid . '_col" class="pluginmanager_container">';
$plugins = serendipity_plugin_api::enum_plugins($plugin_placement); if ($is_invisible) {
$plugins = $invisible_plugins;
} else {
$plugins = serendipity_plugin_api::enum_plugins($plugin_placement);
}
if (!is_array($plugins)) { if (!is_array($plugins)) {
continue; continue;