data_dir doesn't need to be readable. It has to executable, but that's
[squirrelmail.git] / src / configtest.php
index b0d24747eed5bfeeaefad783c6390eafc4a1eecc..e65c147c5707fda2c217349780a0aa75d1e140f8 100644 (file)
@@ -96,6 +96,21 @@ if(count($diff)) {
 
 echo $IND . "PHP extensions OK.<br />\n";
 
+/* dangerous php settings */
+/**
+ * mbstring.func_overload allows to replace original string and regexp functions
+ * with their equivalents from php mbstring extension. It causes problems when
+ * scripts analyse 8bit strings byte after byte or use 8bit strings in regexp tests.
+ * Setting can be controlled in php.ini (php 4.2.0), webserver config (php 4.2.0)
+ * and .htaccess files (php 4.3.5).
+ */
+if (function_exists('mb_internal_encoding') &&
+    check_php_version(4,2,0) &&
+    (int)ini_get('mbstring.func_overload')!=0) {
+    $mb_error='You have enabled mbstring overloading.'
+        .' It can cause problems with SquirrelMail scripts that rely on single byte string functions.';
+    do_err($mb_error);
+}
 
 /* checking paths */
 
@@ -107,9 +122,7 @@ if(!file_exists($data_dir)) {
 if(!is_dir($data_dir)) {
     do_err("Data dir ($data_dir) is not a directory!");
 }
-if(!is_readable($data_dir)) {
-    do_err("I cannot read from data dir ($data_dir)!");
-}
+// datadir should be executable - but no clean way to test on that
 if(!is_writable($data_dir)) {
     do_err("I cannot write to data dir ($data_dir)!");
 }
@@ -157,6 +170,24 @@ foreach($theme as $thm) {
 
 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 . 
+            '</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 . 
+            '</i> as your default language, but I cannot read this translation (file '.
+            'in <tt>' . $loc_path . '</tt> unreadable).', FALSE);
+    } else {
+        echo $IND . "Default language OK.<br />\n";
+    }
+} else {
+    echo $IND . "Default language OK.<br />\n";
+}
+
 echo $IND . "Base URL detected as: <tt>" . htmlspecialchars(get_location()) . "</tt><br />\n";
 
 
@@ -269,15 +300,20 @@ fclose($stream);
 echo "Checking internationalization (i18n) settings...<br />\n";
 echo "$IND gettext - ";
 if (function_exists('gettext')) {
-    echo "Gettext functions are available. You must have appropriate system locales compiled.<br />\n";
+    echo 'Gettext functions are available.'
+        .' On some systems you must have appropriate system locales compiled.'
+        ."<br />\n";
 } else {
-    echo "Gettext functions are unavailable. SquirrelMail will use slower internal gettext functions.<br />\n";
+    echo 'Gettext functions are unavailable.'
+        .' SquirrelMail will use slower internal gettext functions.'
+        ."<br />\n";
 }
 echo "$IND mbstring - ";
 if (function_exists('mb_detect_encoding')) {
     echo "Mbstring functions are available.<br />\n";
 } else {
-    echo "Mbstring functions are unavailable. Japanese translation won't work.<br />\n";
+    echo 'Mbstring functions are unavailable.'
+        ." Japanese translation won't work.<br />\n";
 }
 echo "$IND recode - ";
 if (function_exists('recode')) {
@@ -361,9 +397,10 @@ if($addrbook_dsn || $prefs_dsn || $addrbook_global_dsn) {
             }
         }
     } else {
-        do_err('Required PHP PEAR DB support is not available. Is PEAR installed and is the
-            include path set correctly to find <tt>DB.php</tt>? The include path is now:
-            "<tt>' . ini_get('include_path') . '</tt>".');
+        $db_error='Required PHP PEAR DB support is not available.'
+            .' Is PEAR installed and is the include path set correctly to find <tt>DB.php</tt>?'
+            .' The include path is now:<tt>' . ini_get('include_path') . '</tt>.';
+        do_err($db_error);
     }
 } else {
     echo $IND."not using database functionality.<br />\n";