Code

Updated acl_definitions
[gosa.git] / html / setup.php
index 297e073165f041e18282faf9d89b3de35680406c..61a18045f83b75de8eeea190b49872f440dceed9 100644 (file)
@@ -54,17 +54,6 @@ ini_set("session.gc_maxlifetime",24*60*60);
 session_start ();
 $_SESSION['DEBUGLEVEL']= 1;
 
-/* Check for js */
-if (!isset($_GET['js']) && !isset($_SESSION['js'])){
-  echo '<script language="JavaScript" type="text/javascript">';
-  echo '  location = "setup.php?js=true";';
-  echo '</script>';
-
-  $_SESSION['js']= FALSE;
-} elseif(isset($_GET['js'])) {
-  $_SESSION['js']= TRUE;
-}
-
 /* Attribute initialization, reset errors */
 $_SESSION['errors']             = "";
 $_SESSION['errorsAlreadyPosted']= array();
@@ -73,6 +62,12 @@ $_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();
@@ -85,7 +80,22 @@ if(isset($_POST['lang_selected'])){
   }
 }
 
+/* Check for js */
+if (!isset($_GET['js']) && !isset($_SESSION['js'])){
+  echo '<script language="JavaScript" type="text/javascript">';
+  echo '  location = "setup.php?js=true";';
+  echo '</script>';
+
+  $_SESSION['js']= FALSE;
+} elseif(isset($_GET['js'])) {
+  $_SESSION['js']= TRUE;
+}
+
 $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);