]> git.mjollnir.org Git - s9y.git/commitdiff
Show mis-assigned plugins when a template supports custom sidebars
authorgarvinhicking <garvinhicking>
Mon, 9 Oct 2006 09:19:39 +0000 (09:19 +0000)
committergarvinhicking <garvinhicking>
Mon, 9 Oct 2006 09:19:39 +0000 (09:19 +0000)
include/admin/plugins.inc.php
include/functions_plugins_admin.inc.php

index 9ca17b792267b73bd7b10f69e89a64fc5023dcbb..beab2c8d36e57f8fa259fc39e346d2f037737fa7 100644 (file)
@@ -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) . ".<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 />";
             }
             $bag  = new serendipity_property_bag;
index 18885b4e088fb7bf34a7d4f46c8fde2d4c66102e..5ed42b4d8364eb7df21a6d59263b5ebe4a520a56 100644 (file)
@@ -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 '<td class="pluginmanager_side">';
-        echo '<div class="heading">' . $opts[$plugin_placement] . '</div>';
-        echo '<ol id="' . $plugin_placement . '_col" class="pluginmanager_container">';
-        $plugins = serendipity_plugin_api::enum_plugins($plugin_placement);
+        echo '<div class="heading">' . $ptitle . '</div>';
+        echo '<ol id="' . $pid . '_col" class="pluginmanager_container">';
+        if ($is_invisible) {
+            $plugins = $invisible_plugins;
+        } else {
+            $plugins = serendipity_plugin_api::enum_plugins($plugin_placement);
+        }
 
         if (!is_array($plugins)) {
             continue;