X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=setup%2Fclass_setupStep8.inc;h=822940453d043f7fe692f7fd8747538fdfab2050;hb=3536e72afaac8a39178a3927e34c5c47bf979a69;hp=ac59df5b8e5c69b702ddc462693dc0de3763b55b;hpb=e97583bd6aee4dd25fa044f2d8b1d947ede0f7b5;p=gosa.git diff --git a/setup/class_setupStep8.inc b/setup/class_setupStep8.inc index ac59df5b8..822940453 100644 --- a/setup/class_setupStep8.inc +++ b/setup/class_setupStep8.inc @@ -28,6 +28,12 @@ class setup_step_8 extends setup_step var $last_backup_name = ""; function setup_step_8() + { + $this->update_strings(); + } + + + function update_strings() { $this->s_title = _("Configuration file"); $this->s_info = _("In this step the configuration file will be created."); @@ -37,13 +43,19 @@ class setup_step_8 extends setup_step function get_conf_data() { - return("currently not implemented."); - } + $smarty = get_smarty(); + $smarty->assign("cv",$this->parent->captured_values); + $str = $smarty->fetch(CONFIG_TEMPLATE_DIR.$this->gosa_conf_name); + return($str); + } function execute() { + $info= posix_getgrgid(posix_getgid()); + $webgroup = $info['name']; + /* Check if there is currently an active gosa.conf */ @@ -58,13 +70,24 @@ class setup_step_8 extends setup_step /* Downlaod config */ if(isset($_POST['getconf'])){ + header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); header("Cache-Control: no-cache"); header("Pragma: no-cache"); header("Cache-Control: post-check=0, pre-check=0"); header("Content-type: text/plain"); - header('Content-Disposition: attachment; filename="gosa.conf"'); + + if (preg_match('/MSIE 5.5/', $_SERVER['HTTP_USER_AGENT']) || + preg_match('/MSIE 6.0/', $_SERVER['HTTP_USER_AGENT'])){ + header('Content-Disposition: filename="gosa.conf"'); + } else { + header('Content-Disposition: attachment; filename="gosa.conf"'); + } + + $str = $this->get_conf_data(); + $str = preg_replace("/\n[ ]*\n/","",$str); + echo $this->get_conf_data(); exit(); } @@ -92,9 +115,14 @@ class setup_step_8 extends setup_step }else{ $data = $this->get_conf_data(); - if(!fwrite($fp,strlen($data))){ + if(!fwrite($fp,$data)){ $err_msg = sprintf(_("Can not write file '%s'. Please check folder permission and try again. Or use the manual method if this can not be fixed anyway."),CONFIG_DIR.$this->gosa_conf_name); $abort =TRUE; + }else{ + + @chgrp(CONFIG_DIR.$this->gosa_conf_name,$webgroup); + @chown(CONFIG_DIR.$this->gosa_conf_name,"root"); + @chmod(CONFIG_DIR.$this->gosa_conf_name,0640); } } } @@ -102,15 +130,14 @@ class setup_step_8 extends setup_step if($exists && $this->is_world_readable(CONFIG_DIR.$this->gosa_conf_name)){ - $err_msg = _("Your configuration file is currently world readable. This is a big security issue. Please updated the file permissions as shown in the manual configuration part below."); + $err_msg = _("Your configuration file is currently world readable. This is a big security risk. Please updated the file permissions as shown in the manual configuration part below."); } - $info= posix_getgrgid(posix_getgid()); $smarty = get_smarty(); $smarty->assign("save_requested", isset($_POST['saveconf'])); $smarty->assign("err_msg",$err_msg); - $smarty->assign("webgroup", $info['name']); + $smarty->assign("webgroup", $webgroup); $smarty->assign("gosa_conf_name" , $this->gosa_conf_name); $smarty->assign("create_backup" , $this->create_backup); $smarty->assign("CONFIG_DIR",CONFIG_DIR); @@ -138,6 +165,8 @@ class setup_step_8 extends setup_step */ function create_backup() { + $info= posix_getgrgid(posix_getgid()); + $webgroup = $info['name']; if(is_writeable(CONFIG_DIR) && is_writeable(CONFIG_DIR.$this->gosa_conf_name)){ $src = CONFIG_DIR.$this->gosa_conf_name; $dst = CONFIG_DIR.$this->gosa_conf_name."_".date("Ymd"); @@ -147,9 +176,11 @@ class setup_step_8 extends setup_step $dst = $dst_backup."-".$i; $i ++; } -# if(rename($src,$dst)){ if(copy($src,$dst)){ $this->last_backup_name = $dst; + @chgrp($dst,$webgroup); + @chown($dst,"root"); + @chmod($dst,0640); return(TRUE); }else{ return(FALSE);