prevent output in plugins/*/setup.php files.
[squirrelmail.git] / functions / plugin.php
index 8cf261b73cb23d3d3d47c77f16b42d4d84ec42a2..7ccc6bc99339923e9c52dcbcef9b6080d15de80c 100644 (file)
@@ -220,9 +220,18 @@ function is_plugin_enabled($plugin_name) {
 
 /* On startup, register all plugins configured for use. */
 if (isset($plugins) && is_array($plugins)) {
+    // turn on output buffering in order to prevent output of new lines
+    ob_start();
     foreach ($plugins as $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);
+    }
 }
 
 ?>
\ No newline at end of file