瀏覽代碼

Remove numeric keys from plugin array in config.php

pdontthink 20 年之前
父節點
當前提交
f8d2c5767e
共有 3 個文件被更改,包括 11 次插入6 次删除
  1. 1 0
      ChangeLog
  2. 7 3
      config/conf.pl
  3. 3 3
      config/config_default.php

+ 1 - 0
ChangeLog

@@ -191,6 +191,7 @@ Version 1.5.1 -- CVS
   - Security: Fix possible XSS issues in src/webmail.php. [CAN-2005-0104]
   - Fix undefined variables in src/webmail.php.
   - 24hr clock format should include a leading 0.
+  - Removed numeric keys for plugin array in config.php
 
 Version 1.5.0
 --------------------

+ 7 - 3
config/conf.pl

@@ -188,11 +188,15 @@ while ( $line = <FILE> ) {
             $sub =~ s/\]\[['"]NAME['"]\]//;
             $sub =~ s/.*\[//;
             $theme_name[$sub] = $options[1];
-        } elsif ( $options[0] =~ /^plugins\[[0-9]+\]/ ) {
+        } elsif ( $options[0] =~ /^plugins\[[0-9]*\]/ ) {
             $sub = $options[0];
             $sub =~ s/\]//;
             $sub =~ s/^plugins\[//;
-            $plugins[$sub] = $options[1];
+            if ($sub eq '') {
+               push @plugins, $options[1];
+            } else {
+               $plugins[$sub] = $options[1];
+            }
         } elsif ( $options[0] =~ /^ldap_server\[[0-9]+\]/ ) {
             $sub = $options[0];
             $sub =~ s/\]//;
@@ -3219,7 +3223,7 @@ sub save_data {
 
     # all plugins are strings
         for ( $ct = 0 ; $ct <= $#plugins ; $ct++ ) {
-            print CF "\$plugins[$ct] = '$plugins[$ct]';\n";
+            print CF "\$plugins[] = '$plugins[$ct]';\n";
         }
         print CF "\n";
 

+ 3 - 3
config/config_default.php

@@ -773,8 +773,8 @@ $motd = "";
  * the plugin directory name relative to the /plugins/ directory.
  * For instance, for the 'sqclock' plugin, you'd put a line like
  * the following.
- *    $plugins[0] = 'sqclock';
- *    $plugins[1] = 'attachment_common';
+ *    $plugins[] = 'sqclock';
+ *    $plugins[] = 'attachment_common';
  */
 // Add list of enabled plugins here
 
@@ -969,4 +969,4 @@ $config_use_color = 2;
  * sent and regular output to begin, which will majorly screw
  * things up when we try to send more headers later.
  */
-?>
+?>