* Support for LIST-SUBSCRIBED capability.
[squirrelmail.git] / src / configtest.php
index 2c7cfeabfaa0975e12b0777bd7778e1b2e890b6c..1c0bb7621288b97eb80b91049c828064abffc3cf 100644 (file)
@@ -3,9 +3,8 @@
 /**
  * SquirrelMail configtest script
  *
- * Copyright (c) 2003-2005 The SquirrelMail Project Team
- * Licensed under the GNU GPL. For full terms see the file COPYING.
- *
+ * @copyright © 2003-2005 The SquirrelMail Project Team
+ * @license http://opensource.org/licenses/gpl-license.php GNU Public License
  * @version $Id$
  * @package squirrelmail
  * @subpackage config
@@ -79,7 +78,7 @@ if(!in_array('strings.php', $included)) {
 if (! $allow_remote_configtest) {
     sqGetGlobalVar('REMOTE_ADDR',$client_ip,SQ_SERVER);
     if (! isset($client_ip) || $client_ip!='127.0.0.1') {
-       do_err('Enable "Allow remote configtest" option in squirrelmail configuration in order to use this script.');
+        do_err('Enable "Allow remote configtest" option in squirrelmail configuration in order to use this script.');
     }
 }
 /* checking PHP specs */
@@ -122,6 +121,21 @@ if (function_exists('mb_internal_encoding') &&
     do_err($mb_error);
 }
 
+/**
+ * We code with register_globals = off. SquirrelMail should work in such setup
+ * since 1.2.9 and 1.3.0. Running SquirrelMail with register_globals = on can
+ * cause variable corruption and security issues. Globals can be turned off in
+ * php.ini, webserver config and .htaccess files. Scripts can turn off globals only
+ * in php 4.2.3 or older.
+ */
+if ((bool) ini_get('register_globals')) {
+    $rg_error='You have enabled php register_globals.'
+        .' Running PHP installation with register_globals=on can cause problems.'
+        .' See <a href="http://www.php.net/manual/en/security.registerglobals.php">'
+        .'security information about register_globals</a>.';
+    do_err($rg_error);
+}
+
 /* checking paths */
 
 echo "Checking paths...<br />\n";
@@ -206,12 +220,12 @@ echo $IND . "Themes OK.<br />\n";
 if ( $squirrelmail_default_language != 'en_US' ) {
     $loc_path = SM_PATH .'locale/'.$squirrelmail_default_language.'/LC_MESSAGES/squirrelmail.mo';
     if( ! file_exists( $loc_path ) ) {
-        do_err('You have set <i>' . $squirrelmail_default_language . 
+        do_err('You have set <i>' . $squirrelmail_default_language .
             '</i> as your default language, but I cannot find this translation (should be '.
             'in <tt>' . $loc_path . '</tt>). Please note that you have to download translations '.
             'separately from the main SquirrelMail package.', FALSE);
     } elseif ( ! is_readable( $loc_path ) ) {
-        do_err('You have set <i>' . $squirrelmail_default_language . 
+        do_err('You have set <i>' . $squirrelmail_default_language .
             '</i> as your default language, but I cannot read this translation (file '.
             'in <tt>' . $loc_path . '</tt> unreadable).', FALSE);
     } else {
@@ -351,7 +365,7 @@ if (function_exists('mb_detect_encoding')) {
 echo "$IND recode - ";
 if (function_exists('recode')) {
     echo "Recode functions are available.<br />\n";
-} elseif ($use_php_recode) {
+} elseif (isset($use_php_recode) && $use_php_recode) {
     echo "Recode functions are unavailable.<br />\n";
     do_err('Your configuration requires recode support, but recode support is missing.');
 } else {
@@ -360,7 +374,7 @@ if (function_exists('recode')) {
 echo "$IND iconv - ";
 if (function_exists('iconv')) {
     echo "Iconv functions are available.<br />\n";
-} elseif ($use_php_iconv) {
+} elseif (isset($use_php_iconv) && $use_php_iconv) {
     echo "Iconv functions are unavailable.<br />\n";
     do_err('Your configuration requires iconv support, but iconv support is missing.');
 } else {
@@ -411,7 +425,8 @@ if($addrbook_dsn || $prefs_dsn || $addrbook_global_dsn) {
         }
 
         foreach($dsns as $type => $dsn) {
-            $dbtype = array_shift(explode(':', $dsn));
+            $aDsn = explode(':', $dsn);
+            $dbtype = array_shift($aDsn);
             if(isset($db_functions[$dbtype]) && function_exists($db_functions[$dbtype])) {
                 echo "$IND$dbtype database support present.<br />\n";
 
@@ -426,7 +441,7 @@ if($addrbook_dsn || $prefs_dsn || $addrbook_global_dsn) {
                 echo "$IND$type database connect successful.<br />\n";
 
             } else {
-                do_err($db.' database support not present!');
+                do_err($dbtype.' database support not present!');
             }
         }
     } else {
@@ -479,6 +494,7 @@ if( empty($ldap_server) ) {
         }
     }
 }
+
 ?>
 
 <p>Congratulations, your SquirrelMail setup looks fine to me!</p>
@@ -486,7 +502,4 @@ if( empty($ldap_server) ) {
 <p><a href="login.php">Login now</a></p>
 
 </body>
-</html>
-<?php
-// vim: et ts=4
-?>
+</html>
\ No newline at end of file