Boolean hook call needs priority 1 to error out when any plugin has problems.
[squirrelmail.git] / src / configtest.php
index 677ea77c4337e81fb2b436b39c4c3324dfc3e4ec..4362b32df65eec615918ae18ba4c4d9721918f24 100644 (file)
@@ -3,7 +3,7 @@
 /**
  * SquirrelMail configtest script
  *
- * @copyright © 2003-2006 The SquirrelMail Project Team
+ * @copyright © 2003-2007 The SquirrelMail Project Team
  * @license http://opensource.org/licenses/gpl-license.php GNU Public License
  * @version $Id$
  * @package squirrelmail
@@ -110,6 +110,13 @@ if (file_exists(SM_PATH . 'config/config_local.php')) {
     require(SM_PATH . 'config/config_local.php');
 }
 
+/** Load plugins */
+global $disable_plugins;
+$squirrelmail_plugin_hooks = array();
+if (!$disable_plugins && file_exists(SM_PATH . 'config/plugin_hooks.php')) {
+    require(SM_PATH . 'config/plugin_hooks.php');
+}
+
 /** Warning counter */
 $warnings = 0;
 
@@ -209,6 +216,21 @@ if (function_exists('mb_internal_encoding') &&
     do_err($mb_error);
 }
 
+/**
+ * Do not use SquirrelMail with magic_quotes_* on.
+ */
+if ( get_magic_quotes_runtime() || get_magic_quotes_gpc() ||
+    ( (bool) ini_get('magic_quotes_sybase') && ini_get('magic_quotes_sybase') != 'off' )
+    ) {
+    $magic_quotes_warning='You have enabled any one of <tt>magic_quotes_runtime</tt>, '
+        .'<tt>magic_quotes_gpc</tt> or <tt>magic_quotes_sybase</tt> in your PHP '
+        .'configuration. We recommend all those settings to be off. SquirrelMail '
+        .'may work with them on, but when experiencing stray backslashes in your mail '
+        .'or other strange behaviour, it may be advisable to turn them off.';
+    do_err($magic_quotes_warning,false);
+}
+
+
 /* checking paths */
 
 echo "Checking paths...<br />\n";
@@ -268,6 +290,9 @@ if($data_dir == $attachment_dir) {
 
 
 /* check plugins and themes */
+//FIXME: check requirements given in plugin _info() function, such
+//       as required PHP extensions, Pear packages, other plugins, SM version, etc
+//       see development docs for list of returned info from that function
 $bad_plugins = array(
         'attachment_common',      // Integrated into SquirrelMail 1.2 core
         'auto_prune_sent',        // Obsolete: See Proon Automatic Folder Pruning plugin
@@ -320,15 +345,14 @@ if (isset($plugins[0])) {
     ob_end_clean();
     // if plugins output more than newlines and spacing, stop script execution.
     if (!empty($output)) {
-        $plugin_load_error = 'Some output is produced when plugins are loaded.'
-            .' Usually it means error. Output said: '.htmlspecialchars($output);
+        $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);
     }
     /**
-     * Hook is added in 1.5.2. Plugins should print error message and return true
-     * if there is an error in plugin.
+     * This hook was added in 1.5.2 and 1.4.10. Each plugins should print an error 
+     * message and return TRUE if there are any errors in its setup/configuration.
      */
-    $plugin_err = boolean_hook_function('configtest');
+    $plugin_err = boolean_hook_function('configtest', $null, 1);
     if($plugin_err) {
         do_err('Some plugin tests failed.');
     } else {