Code

Updated language detection
[gosa.git] / html / setup.php
index 297e073165f041e18282faf9d89b3de35680406c..623394b1a5587758ba7df906583d0860e1ade9ec 100644 (file)
@@ -73,6 +73,13 @@ $_SESSION['LastError']          = "";
 /* Set template compile directory */
 $smarty->compile_dir= '/var/spool/gosa/';
 
+/* Check for compile directory */
+if (!(is_dir($smarty->compile_dir) && is_writable($smarty->compile_dir))){
+  echo sprintf(_("Directory '%s' specified as compile directory is not accessible!"),
+        $smarty->compile_dir);
+  exit();
+}
+
 /* Get posted language */
 if(!isset($_SESSION['lang'])){
   $_SESSION['lang'] = get_browser_language();
@@ -86,6 +93,10 @@ if(isset($_POST['lang_selected'])){
 }
 
 $lang = $_SESSION['lang'];
+/* Append .UTF-8 to language string if necessary */
+if(!preg_match("/utf(-)8$/i",$lang)){
+  $lang .= ".UTF-8";
+}
 putenv("LANGUAGE=");
 putenv("LANG=$lang");
 setlocale(LC_ALL, $lang);