Code

Updated language detection
[gosa.git] / html / setup.php
index 5adc78a6d1c500e551b33a84c7405af8f0ebf49a..623394b1a5587758ba7df906583d0860e1ade9ec 100644 (file)
@@ -24,6 +24,7 @@
 /* Get standard functions */
 require_once ("../include/php_setup.inc");
 require_once ("functions.inc");
+require_once ("class_timezones.inc");
 
 require_once("../setup/class_setup.inc");
 require_once("../setup/class_setupStep.inc");
@@ -70,13 +71,14 @@ $_SESSION['errorsAlreadyPosted']= array();
 $_SESSION['LastError']          = "";
 
 /* Set template compile directory */
-if (isset ($config->data['MAIN']['COMPILE'])){
-  $smarty->compile_dir= $config->data['MAIN']['COMPILE'];
-} else {
-  $smarty->compile_dir= '/var/spool/gosa/';
-}
-
+$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'])){
@@ -91,7 +93,10 @@ if(isset($_POST['lang_selected'])){
 }
 
 $lang = $_SESSION['lang'];
-$lang.=".UTF-8";
+/* 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);
@@ -120,7 +125,7 @@ $smarty->assign("header", $_SESSION['setup']->get_header_html());
 $smarty->assign("bottom", $_SESSION['setup']->get_bottom_html());
 
 if ($error_collector != ""){
-  $smarty->assign("php_errors", $error_collector."</div>");
+  $smarty->assign("php_errors", preg_replace("/%BUGBODY%/",$error_collector_mailto,$error_collector)."</div>");
 } else {
   $smarty->assign("php_errors", "");
 }