From 9c85c0349fad675c65fae30b901d11bd56ad667f Mon Sep 17 00:00:00 2001 From: Garvin Hicking Date: Mon, 9 Oct 2006 09:19:39 +0000 Subject: [PATCH] Show mis-assigned plugins when a template supports custom sidebars --- include/admin/plugins.inc.php | 2 +- include/functions_plugins_admin.inc.php | 32 ++++++++++++++++++++++--- 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/include/admin/plugins.inc.php b/include/admin/plugins.inc.php index 9ca17b79..beab2c8d 100644 --- a/include/admin/plugins.inc.php +++ b/include/admin/plugins.inc.php @@ -434,7 +434,7 @@ if (isset($_GET['serendipity']['plugin_to_conf'])) { /* Load the new plugin */ $plugin = &serendipity_plugin_api::load_plugin($inst); if (!is_object($plugin)) { - echo "DEBUG: Plugin $inst not an object: " . print_r($plugin, true) . ".
Input: " . print_r($serendipity['GET'], true) . ".

\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?)
\n"; + echo "DEBUG: Plugin $inst not an object: " . print_r($plugin, true) . ".
Input: " . print_r($serendipity['GET'], true) . ".

\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?)
\n"; echo "Backtrace:
\n" . implode("
\n", $serendipity['debug']['pluginload']) . "
"; } $bag = new serendipity_property_bag; diff --git a/include/functions_plugins_admin.inc.php b/include/functions_plugins_admin.inc.php index 18885b4e..5ed42b4d 100644 --- a/include/functions_plugins_admin.inc.php +++ b/include/functions_plugins_admin.inc.php @@ -58,6 +58,7 @@ function show_plugins($event_only = false, $sidebars = null) global $serendipity; + $sql_filter = ''; if (is_array($sidebars)) { foreach($sidebars AS $sidebar) { $up = strtoupper($sidebar); @@ -70,6 +71,19 @@ function show_plugins($event_only = false, $sidebars = null) } else { $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; 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 ''; - echo '
' . $opts[$plugin_placement] . '
'; - echo '
    '; - $plugins = serendipity_plugin_api::enum_plugins($plugin_placement); + echo '
    ' . $ptitle . '
    '; + echo '
      '; + if ($is_invisible) { + $plugins = $invisible_plugins; + } else { + $plugins = serendipity_plugin_api::enum_plugins($plugin_placement); + } if (!is_array($plugins)) { continue;