From 5b53b7e0a3c0c4ec211ba369866fb981258579b5 Mon Sep 17 00:00:00 2001 From: tokul Date: Mon, 17 Nov 2003 17:30:02 +0000 Subject: [PATCH] strings.php should be loaded before output starts. forearch cycle produced 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 | 59 +++++++++++++++++++++++++------------------ 1 file changed, 34 insertions(+), 25 deletions(-) diff --git a/config/configtest.php b/config/configtest.php index 39c1e53b..0d8af8a1 100644 --- a/config/configtest.php +++ b/config/configtest.php @@ -5,7 +5,7 @@ * Copyright (c) 2003 The SquirrelMail Project Team * Licensed under the GNU GPL. For full terms see the file COPYING. * - * $Id $ + * $Id$ */ /************************************************************ @@ -13,6 +13,29 @@ * If it throws errors you need to adjust your config. * ************************************************************/ +function do_err($str, $exit = TRUE) { + echo '

ERROR: ' .$str. "

\n"; + if($exit) { + echo ''; + exit; + } +} + +$IND = str_repeat(' ',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'); +} ?> @@ -27,21 +50,6 @@ in this directory first before you run this script.

ERROR: ' .$str. "

\n"; - if($exit) { - echo ''; - exit; - } -} - -$IND = str_repeat(' ',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)) { @@ -120,17 +128,18 @@ if($data_dir == $attachment_dir) { /* check plugins and themes */ - -foreach($plugins as $plugin) { - if(!file_exists(SM_PATH .'plugins/'.$plugin)) { - do_err('You have enabled the '.$plugin.' plugin but I cannot find it.', FALSE); - } elseif (!is_readable(SM_PATH .'plugins/'.$plugin.'/setup.php')) { - do_err('You have enabled the '.$plugin.' 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 '.$plugin.' plugin but I cannot find it.', FALSE); + } elseif (!is_readable(SM_PATH .'plugins/'.$plugin.'/setup.php')) { + do_err('You have enabled the '.$plugin.' plugin but I cannot read its setup.php file.', FALSE); + } } + echo $IND . "Plugins OK.
\n"; +} else { + echo $IND . "Plugins are not enabled in config.
\n"; } - -echo $IND . "Plugins OK.
\n"; - foreach($theme as $thm) { if(!file_exists($thm['PATH'])) { do_err('You have enabled the '.$thm['NAME'].' theme but I cannot find it ('.$thm['PATH'].').', FALSE); -- 2.25.1