+echo "Checking internationalization (i18n) settings...<br />\n";
+echo "$IND gettext - ";
+if (function_exists('gettext')) {
+ echo 'Gettext functions are available.'
+ .' On some systems you must have appropriate system locales compiled.'
+ ."<br />\n";
+
+ /* optional setlocale() tests. Should work only on glibc systems. */
+ if (sqgetGlobalVar('testlocales',$testlocales,SQ_GET)) {
+ include_once(SM_PATH . 'include/languages.php');
+ echo $IND . $IND . 'Testing translations:<br>';
+ foreach ($languages as $lang_code => $lang_data) {
+ /* don't test aliases */
+ if (isset($lang_data['NAME'])) {
+ /* locale can be $lang_code or $lang_data['LOCALE'] */
+ if (isset($lang_data['LOCALE'])) {
+ $setlocale = $lang_data['LOCALE'];
+ } else {
+ $setlocale = $lang_code;
+ }
+ /* prepare information about tested locales */
+ if (is_array($setlocale)) {
+ $display_locale = implode(', ',$setlocale);
+ $locale_count = count($setlocale);
+ } else {
+ $display_locale = $setlocale;
+ $locale_count = 1;
+ }
+ $tested_locales_msg = 'Tested '.htmlspecialchars($display_locale).' '
+ .($locale_count>1 ? 'locales':'locale'). '.';
+
+ echo $IND . $IND .$IND . $lang_data['NAME'].' (' .$lang_code. ') - ';
+ $retlocale = sq_setlocale(LC_ALL,$setlocale);
+ if (is_bool($retlocale)) {
+ echo '<font color="red">unsupported</font>. ';
+ echo $tested_locales_msg;
+ } else {
+ echo 'supported. '
+ .$tested_locales_msg
+ .' setlocale() returned "'.htmlspecialchars($retlocale).'"';
+ }
+ echo "<br />\n";
+ }
+ }
+ echo $IND . $IND . '<a href="configtest.php">Don\'t test translations</a>';
+ } else {
+ echo $IND . $IND . '<a href="configtest.php?testlocales=1">Test translations</a>. '
+ .'This test is not accurate and might work only on some systems.'
+ ."\n";
+ }
+ echo "<br />\n";
+ /* end of translation tests */
+} else {
+ 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 "$IND recode - ";
+if (function_exists('recode')) {
+ echo "Recode functions are available.<br />\n";
+} 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 {
+ echo "Recode functions are unavailable.<br />\n";
+}
+echo "$IND iconv - ";
+if (function_exists('iconv')) {
+ echo "Iconv functions are available.<br />\n";
+} 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 {
+ echo "Iconv functions are unavailable.<br />\n";
+}
+// same test as in include/init.php + date_default_timezone_set check
+echo "$IND timezone - ";
+if ( (!ini_get('safe_mode')) || function_exists('date_default_timezone_set') ||
+ !strcmp(ini_get('safe_mode_allowed_env_vars'),'') ||
+ preg_match('/^([\w_]+,)*TZ/', ini_get('safe_mode_allowed_env_vars')) ) {
+ echo "Webmail users can change their time zone settings. \n";
+} else {
+ echo "Webmail users can't change their time zone settings. \n";
+}
+if (isset($_ENV['TZ'])) {
+ echo 'Default time zone is '.htmlspecialchars($_ENV['TZ']);
+} else {
+ echo 'Current time zone is '.date('T');
+}
+echo ".<br />\n";
+
+// Pear DB tests
+echo "Checking database functions...<br />\n";
+if($addrbook_dsn || $prefs_dsn || $addrbook_global_dsn) {
+ @include_once('DB.php');
+ if (class_exists('DB')) {
+ echo "$IND PHP Pear DB support is present.<br />\n";
+ $db_functions=array(
+ 'dbase' => 'dbase_open',
+ 'fbsql' => 'fbsql_connect',
+ 'interbase' => 'ibase_connect',
+ 'informix' => 'ifx_connect',
+ 'msql' => 'msql_connect',
+ 'mssql' => 'mssql_connect',
+ 'mysql' => 'mysql_connect',
+ 'mysqli' => 'mysqli_connect',
+ 'oci8' => 'ocilogon',
+ 'odbc' => 'odbc_connect',
+ 'pgsql' => 'pg_connect',
+ 'sqlite' => 'sqlite_open',
+ 'sybase' => 'sybase_connect'
+ );
+
+ $dsns = array();
+ if($prefs_dsn) {
+ $dsns['preferences'] = $prefs_dsn;
+ }
+ if($addrbook_dsn) {
+ $dsns['addressbook'] = $addrbook_dsn;
+ }
+ if($addrbook_global_dsn) {
+ $dsns['global addressbook'] = $addrbook_global_dsn;
+ }