Code

Added comments
[gosa.git] / gosa-core / html / setup.php
index bdd606229ed1b999aaced1eb9b8c6dc7b915e37d..4b692e02639a45e2ea2bda33de2afc8496408e68 100644 (file)
@@ -60,26 +60,19 @@ session::set('errors',"");
 session::set('errorsAlreadyPosted',array());
 session::set('LastError',"");
 
-/* Set template compile directory */
-if(!session::is_set("SETUP_COMPILE_DIR")){
-    session::set('SETUP_COMPILE_DIR', '/var/spool/gosa/');
-}
-if(isset($_POST['compile_dir']) && isset($_POST['useCompileDir'])){
-    session::set('SETUP_COMPILE_DIR', get_post('compile_dir'));
-}
+$smarty->compile_dir= "/var/spool/gosa/";
+if (!(is_dir($smarty->compile_dir) && is_writable($smarty->compile_dir))){
 
-$smarty->compile_dir= session::get('SETUP_COMPILE_DIR');
+    if(isset($_SERVER['SCRIPT_FILENAME'])){
+        $smarty->compile_dir= preg_replace("#/html/.*$#","",$_SERVER['SCRIPT_FILENAME']);
+    }
+}
 
 /* Check for compile directory */
 if (!(is_dir($smarty->compile_dir) && is_writable($smarty->compile_dir))){
-    echo "<form action='?' method='POST'>".
-         "   <h2>".
-         "       "._("Please specify a writeable directory for GOsa to create temporary files.").
-         "   </h2>".
-         "   ".sprintf(_("GOsa requires a writeable directory temporary store generated templates."), $smarty->compile_dir).
-         "<input name='compile_dir' type='text' value=\"".htmlentities(session::get('SETUP_COMPILE_DIR'), ENT_QUOTES, 'UTF-8')."\"> ".
-         "<button name='useCompileDir'>".msgPool::okButton()."</button></form>";
-  exit();
+    msg_dialog::display(_("Smarty"),sprintf( _("Compile directory %s is not accessible!"),
+                bold('/var/spool/gosa/')),FATAL_ERROR_DIALOG);
+    exit();
 }
 
 /* Get posted language */