From 561961d6383d903dd7570349834580c0b138aef8 Mon Sep 17 00:00:00 2001 From: hickert Date: Thu, 8 Jul 2010 08:12:10 +0000 Subject: [PATCH] Updated fallback in setup.php if smarty compile dir is not writeable. -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 | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/gosa-core/html/setup.php b/gosa-core/html/setup.php index bdd606229..4b692e026 100644 --- a/gosa-core/html/setup.php +++ b/gosa-core/html/setup.php @@ -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 "
". - "

". - " "._("Please specify a writeable directory for GOsa to create temporary files."). - "

". - " ".sprintf(_("GOsa requires a writeable directory temporary store generated templates."), $smarty->compile_dir). - " ". - "
"; - exit(); + msg_dialog::display(_("Smarty"),sprintf( _("Compile directory %s is not accessible!"), + bold('/var/spool/gosa/')),FATAL_ERROR_DIALOG); + exit(); } /* Get posted language */ -- 2.30.2