Browse Source

prevent output in plugins/*/setup.php files.

tokul 19 years ago
parent
commit
d20ef12ab2
2 changed files with 11 additions and 0 deletions
  1. 2 0
      ChangeLog
  2. 9 0
      functions/plugin.php

+ 2 - 0
ChangeLog

@@ -515,6 +515,8 @@ Version 1.5.1 -- CVS
   - Added 'mail' and 'sn' attributes to address book LDAP backend search
   - Added 'mail' and 'sn' attributes to address book LDAP backend search
     expression (#1368154).
     expression (#1368154).
   - Added mailbox caching code by Michael Long.
   - Added mailbox caching code by Michael Long.
+  - Prevent output of whitespace during plugin activation. Fixes possible 
+    attachment corruption by incorrectly coded plugins.
 
 
 Version 1.5.0 - 2 February 2004
 Version 1.5.0 - 2 February 2004
 -------------------------------
 -------------------------------

+ 9 - 0
functions/plugin.php

@@ -220,9 +220,18 @@ function is_plugin_enabled($plugin_name) {
 
 
 /* On startup, register all plugins configured for use. */
 /* On startup, register all plugins configured for use. */
 if (isset($plugins) && is_array($plugins)) {
 if (isset($plugins) && is_array($plugins)) {
+    // turn on output buffering in order to prevent output of new lines
+    ob_start();
     foreach ($plugins as $name) {
     foreach ($plugins as $name) {
         use_plugin($name);
         use_plugin($name);
     }
     }
+    // get output and remove whitespace
+    $output = trim(ob_get_contents());
+    ob_end_clean();
+    // if plugins output more than newlines and spacing, stop script execution.
+    if (!empty($output)) {
+        die($output);
+    }
 }
 }
 
 
 ?>
 ?>