[geeklog-cvs] geeklog: Fixed duplicate plugin entries when a plugin has more t...

geeklog-cvs at lists.geeklog.net geeklog-cvs at lists.geeklog.net
Sun Mar 1 05:05:31 EST 2009


details:   http://project.geeklog.net/cgi-bin/hgweb.cgi/rev/d1a4cbb036ee
changeset: 6811:d1a4cbb036ee
user:      Dirk Haun <dirk at haun-online.de>
date:      Sun Mar 01 11:05:21 2009 +0100
description:
Fixed duplicate plugin entries when a plugin has more than one entry for the admin or user menu (bug #0000820)

diffstat:

2 files changed, 14 insertions(+), 13 deletions(-)
public_html/docs/history |    2 ++
system/lib-plugins.php   |   25 ++++++++++++-------------

diffs (67 lines):

diff -r a488a2867ab6 -r d1a4cbb036ee public_html/docs/history
--- a/public_html/docs/history	Sun Mar 01 10:19:16 2009 +0100
+++ b/public_html/docs/history	Sun Mar 01 11:05:21 2009 +0100
@@ -11,6 +11,8 @@
 + (TBD) Comment moderation and editable comments, by Jared Wenerd
 
 Other changes:
+- Fixed duplicate plugin entries when a plugin has more than one entry for the
+  admin or user menu (bug #0000820)
 - {contributedby_user} and {contributedby_fullname} weren't set in the story
   templates (bug #0000821) [Dirk]
 - Reinstated old definitions of the {start_contributedby_anchortag},
diff -r a488a2867ab6 -r d1a4cbb036ee system/lib-plugins.php
--- a/system/lib-plugins.php	Sun Mar 01 10:19:16 2009 +0100
+++ b/system/lib-plugins.php	Sun Mar 01 11:05:21 2009 +0100
@@ -825,19 +825,18 @@
 {
     global $_PLUGINS;
 
-    $plgresults = array ();
+    $plgresults = array();
 
-    $counter = 0;
+    $num_var_names = count($var_names);
     foreach ($_PLUGINS as $pi_name) {
         $function = $function_name . $pi_name;
-        if (function_exists ($function)) {
+        if (function_exists($function)) {
             $plg_array = $function();
-            if (($plg_array !== false) && (count ($plg_array) > 0)) {
+            if (($plg_array !== false) && (count($plg_array) > 0)) {
                 // Check if plugin is returning a single record array or multiple records
-                $entries = count ($plg_array[0]);
-                if ($entries == 0) {
-                    $sets_array = array ();
-                } else if ($entries == 1) {
+                $sets_array = array();
+                $entries = count($plg_array[0]);
+                if ($entries == 1) {
                     // Single record - so we need to prepare the sets_array;
                     $sets_array[0] = $plg_array;
                 } else {
@@ -847,19 +846,19 @@
                 foreach ($sets_array as $val) {
                     $plugin = new Plugin();
                     $good_array = true;
-                    for ($n = 0; $n < count($var_names); $n++) {
-                        if (isset ($val[$n])) {
+                    for ($n = 0; $n < $num_var_names; $n++) {
+                        if (isset($val[$n])) {
                             $plugin->$var_names[$n] = $val[$n];
                         } else {
                             $plugin->$var_names[$n] = '';
                         }
-                        if (empty ($plugin->$var_names[$n]) && $required_names[$n]) {
+                        if (empty($plugin->$var_names[$n]) && $required_names[$n]) {
                             $good_array = false;
                         }
                     }
-                    $counter++;
+
                     if ($good_array) {
-                        $plgresults[$counter] = $plugin;
+                        $plgresults[] = $plugin;
                     }
                 }
             }



More information about the geeklog-cvs mailing list