copyright update
[squirrelmail.git] / functions / plugin.php
index 0b50ce39e50075a62bfcbb14d5594b5569f63357..5be3a953b8bd85f7ff7ebb419175e8c7a8d24a45 100644 (file)
@@ -7,7 +7,7 @@
  *
  * Documentation on how to write plugins might show up some time.
  *
- * @copyright © 1999-2005 The SquirrelMail Project Team
+ * @copyright © 1999-2006 The SquirrelMail Project Team
  * @license http://opensource.org/licenses/gpl-license.php GNU Public License
  * @version $Id$
  * @package squirrelmail
@@ -198,7 +198,13 @@ function soupNazi(){
 function is_plugin_enabled($plugin_name) {
   global $plugins;
 
-  if (! isset($plugins) || ! is_array($plugins) || empty($plugins))
+  /**
+   * check if variable is empty. if var is not set, php empty 
+   * returns true without error notice.
+   *
+   * then check if it is an array
+   */
+  if (empty($plugins) || ! is_array($plugins))
     return false;
 
   if ( in_array($plugin_name,$plugins) ) {
@@ -214,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