*
* 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
/** Everything needs global.. */
require_once(SM_PATH . 'functions/global.php');
+require_once(SM_PATH . 'config/config.php');
require_once(SM_PATH . 'functions/prefs.php');
global $squirrelmail_plugin_hooks;
global $plugins;
/**
- * check if variable is set. can't do is_array(), if variable is not set
- * check if it is an array
- * there is no need to call in_array() if $plugins array is empty
+ * 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 (! isset($plugins) || ! is_array($plugins) || empty($plugins))
+ if (empty($plugins) || ! is_array($plugins))
return false;
if ( in_array($plugin_name,$plugins) ) {
/* 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
+?>