- // if plugins output more than newlines and spacing, stop script execution.
- if (!empty($output)) {
-//FIXME: if the output buffer is checked INSIDE the foreach loop above, we can tell the user WHICH plugin has the problem - seems like a good idea
- $plugin_load_error = 'Some output is produced when plugins are loaded. Usually this means there is an error in one of the plugin setup or configuration files. The output was: '.htmlspecialchars($output);
- do_err($plugin_load_error);
+
+
+ /**
+ * Check the contents of the static plugin hooks array file against
+ * the plugin setup file, which may have changed in an upgrade, etc.
+ * This helps remind admins to re-run the configuration utility when
+ * a plugin has been changed or upgraded.
+ */
+ $static_squirrelmail_plugin_hooks = $squirrelmail_plugin_hooks;
+ $squirrelmail_plugin_hooks = array();
+ foreach ($plugins as $name) {
+ $function = "squirrelmail_plugin_init_$name";
+ if (function_exists($function)) {
+ $function();
+
+ // now iterate through each hook and make sure the
+ // plugin is registered on the correct ones in the
+ // static plugin configuration file
+ //
+ foreach ($squirrelmail_plugin_hooks as $hook_name => $hooked_plugins)
+ foreach ($hooked_plugins as $hooked_plugin => $hooked_function)
+ if ($hooked_plugin == $name
+ && (empty($static_squirrelmail_plugin_hooks[$hook_name][$hooked_plugin])
+ || $static_squirrelmail_plugin_hooks[$hook_name][$hooked_plugin] != $hooked_function))
+ do_err('The plugin <i>' . $name . '</i> is supposed to be registered on the <i>' . $hook_name . '</i> hook, but it is not. You need to re-run the configuration utility and re-save your configuration file.', FALSE);
+ }