strings.php should be loaded before output starts. forearch cycle produced
authortokul <tokul@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Mon, 17 Nov 2003 17:30:02 +0000 (17:30 +0000)
committertokul <tokul@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Mon, 17 Nov 2003 17:30:02 +0000 (17:30 +0000)
errors if no plugins were installed.

git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@6170 7612ce4b-ef26-0410-bec9-ea0150e637f0

config/configtest.php

index 39c1e53be290babae847cf91c98961a6925e5a64..0d8af8a183979ba10a6bd5cc5e3953610655792c 100644 (file)
@@ -5,7 +5,7 @@
  * Copyright (c) 2003 The SquirrelMail Project Team
  * Licensed under the GNU GPL. For full terms see the file COPYING.
  *
  * Copyright (c) 2003 The SquirrelMail Project Team
  * Licensed under the GNU GPL. For full terms see the file COPYING.
  *
- * $Id $
+ * $Id$
  */
 
 /************************************************************
  */
 
 /************************************************************
  * If it throws errors you need to adjust your config.      *
  ************************************************************/
 
  * If it throws errors you need to adjust your config.      *
  ************************************************************/
 
+function do_err($str, $exit = TRUE) {
+    echo '<p><font color="red"><b>ERROR:</b></font> ' .$str. "</p>\n";
+    if($exit) {
+         echo '</body></html>';
+         exit;
+    }
+}
+
+$IND = str_repeat('&nbsp;',4);
+
+ob_implicit_flush();
+define('SM_PATH', '../');
+
+/*
+ * Load config before output begins. functions/strings.php depends on 
+ * functions/globals.php. functions/global.php needs to be run before
+ * any html output starts. If config.php is missing, error will be displayed 
+ * later.
+ */
+if (file_exists(SM_PATH . 'config/config.php')) {
+    include(SM_PATH . 'config/config.php');
+    include(SM_PATH . 'functions/strings.php');
+}
 ?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
 <html>
 <head>
 ?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
 <html>
 <head>
@@ -27,21 +50,6 @@ in this directory first before you run this script.</p>
 
 <?php
 
 
 <?php
 
-function do_err($str, $exit = TRUE) {
-    echo '<p><font color="red"><b>ERROR:</b></font> ' .$str. "</p>\n";
-    if($exit) {
-         echo '</body></html>';
-         exit;
-    }
-}
-
-$IND = str_repeat('&nbsp;',4);
-
-ob_implicit_flush();
-define('SM_PATH', '../');
-
-include(SM_PATH . 'config/config.php');
-include(SM_PATH . 'functions/strings.php');
 
 $included = array_map('basename', get_included_files() );
 if(!in_array('config.php', $included)) {
 
 $included = array_map('basename', get_included_files() );
 if(!in_array('config.php', $included)) {
@@ -120,17 +128,18 @@ if($data_dir == $attachment_dir) {
 
 
 /* check plugins and themes */
 
 
 /* check plugins and themes */
-
-foreach($plugins as $plugin) {
-    if(!file_exists(SM_PATH .'plugins/'.$plugin)) {
-        do_err('You have enabled the <i>'.$plugin.'</i> plugin but I cannot find it.', FALSE);
-    } elseif (!is_readable(SM_PATH .'plugins/'.$plugin.'/setup.php')) {
-        do_err('You have enabled the <i>'.$plugin.'</i> plugin but I cannot read its setup.php file.', FALSE);
+if (isset($plugins[0])) {
+    foreach($plugins as $plugin) {
+        if(!file_exists(SM_PATH .'plugins/'.$plugin)) {
+            do_err('You have enabled the <i>'.$plugin.'</i> plugin but I cannot find it.', FALSE);
+        } elseif (!is_readable(SM_PATH .'plugins/'.$plugin.'/setup.php')) {
+            do_err('You have enabled the <i>'.$plugin.'</i> plugin but I cannot read its setup.php file.', FALSE);
+        }
     }
     }
+    echo $IND . "Plugins OK.<br />\n";
+} else {
+    echo $IND . "Plugins are not enabled in config.<br />\n";
 }
 }
-
-echo $IND . "Plugins OK.<br />\n";
-
 foreach($theme as $thm) {
     if(!file_exists($thm['PATH'])) {
         do_err('You have enabled the <i>'.$thm['NAME'].'</i> theme but I cannot find it ('.$thm['PATH'].').', FALSE);
 foreach($theme as $thm) {
     if(!file_exists($thm['PATH'])) {
         do_err('You have enabled the <i>'.$thm['NAME'].'</i> theme but I cannot find it ('.$thm['PATH'].').', FALSE);