Code

Updated fallback in setup.php if smarty compile dir is not writeable.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 8 Jul 2010 08:12:10 +0000 (08:12 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 8 Jul 2010 08:12:10 +0000 (08:12 +0000)
-Fall back to the current installation directory.

git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@18955 594d385d-05f5-0310-b6e9-bd551577e9d8

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 */