summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ccb83be)
raw | patch | inline | side by side (parent: ccb83be)
author | cajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 19 Apr 2007 16:06:24 +0000 (16:06 +0000) | ||
committer | cajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 19 Apr 2007 16:06:24 +0000 (16:06 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@6142 594d385d-05f5-0310-b6e9-bd551577e9d8
setup/class_setupStep_Finish.inc | patch | blob | history | |
setup/setup_finish.tpl | patch | blob | history |
index 2e29ccddae9cef471e66d1ed5af82e34e0c4a150..b37ba728bd16310eeed1cfb5f8094cd0c1ed248f 100644 (file)
class Step_Finish extends setup_step
{
- var $create_backup = TRUE;
var $gosa_conf_contrib = "/gosa.conf";
var $cfg_file_written = FALSE;
- var $last_backup_name = "";
+ var $header_image= 'images/ldapserver.png';
function Step_Finish()
{
function update_strings()
{
- $this->s_title = _("Configuration file");
- $this->s_info = _("In this step the configuration file will be created.");
- $this->s_title_long = _("Saving configuration file");
+ $this->s_title = _("Finish");
+ $this->s_info = _("Write configuration file");
+ $this->s_title_long = _("Finish - write the configuration file");
}
*/
$exists = file_exists(CONFIG_DIR."/".CONFIG_FILE);
- /* Check if existing config file is writeable */
- if($exists){
- $writeable = is_writeable(CONFIG_DIR."/".CONFIG_FILE);
- }else{
- $writeable = is_writeable(CONFIG_DIR);
- }
-
/* Redirect to GOsa login */
if(isset($_POST['use_gosa'])){
session_destroy();
exit();
}
+ $err_msg= "";
- /* Try to save configuration */
- $abort = FALSE;
- $err_msg = "";
- if(isset($_POST['saveconf'])){
- if($exists && $this->create_backup){
- if(!$this->create_backup()){
- $abort = TRUE;
- $err_msg = _("Could not create requested configuration file backup. Aborted writing config file. Please check folder permission and try again. Or use the manual method if this can not be fixed anyway.");
- }
- }
-
- if(!$abort){
-
- /* Try to create file handle */
- $fp = @fopen(CONFIG_DIR."/".CONFIG_FILE, "w");
-
- if(!$fp){
- $err_msg = sprintf(_("Can not create handle on file '%s', the configuration could not be written. Please check folder permission and try again. Or use the manual method if this can not be fixed anyway."),CONFIG_DIR."/".CONFIG_FILE);
- $abort =TRUE;
- }else{
-
- $data = $this->get_conf_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."/".CONFIG_FILE);
- $abort =TRUE;
- }else{
-
- @chgrp(CONFIG_DIR."/".CONFIG_FILE,$webgroup);
- @chown(CONFIG_DIR."/".CONFIG_FILE,"root");
- @chmod(CONFIG_DIR."/".CONFIG_FILE,0640);
- }
- }
- }
- }
-
-
if($exists && $this->is_world_readable(CONFIG_DIR."/".CONFIG_FILE)){
- $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.");
+ $err_msg = _("Your configuration file is currently world readable. This is a big security risk. Please updated the file permissions!");
}
$smarty = get_smarty();
- $smarty->assign("save_requested", isset($_POST['saveconf']));
$smarty->assign("err_msg",$err_msg);
$smarty->assign("webgroup", $webgroup);
- $smarty->assign("create_backup" , $this->create_backup);
$smarty->assign("CONFIG_DIR",CONFIG_DIR);
$smarty->assign("CONFIG_FILE" , CONFIG_FILE);
- $smarty->assign("exists",$exists);
-
- $smarty->assign("msg1", sprintf(_("If you want the setup routine to write the configuration file, use the 'Save configuration' button below. If you prefer to copy the '%s' manually to '%s' you can download the configuration file by using the 'Download configuration' button."), CONFIG_FILE,CONFIG_DIR));
- $smarty->assign("msg2", sprintf(_("After placing the file under %s, place make sure that the webserver user is able to read %s, while other users shouldn't. You may want to execute these commands to achieve this requirement"),CONFIG_DIR,CONFIG_FILE));
+ $smarty->assign("msg2", sprintf(_("After downloading and placing the file under %s, please make sure that the user the webserver is running with is able to read %s, while other users shouldn't. You may want to execute these commands to achieve this requirement:"),CONFIG_DIR,CONFIG_FILE));
- $smarty->assign("last_backup_name",$this->last_backup_name);
- $smarty->assign("writeable",$writeable);
$smarty->assign("cv",$this->parent->captured_values);
- $smarty->assign("msg_permissions",
- sprintf(_("The following file(s), folders(s) must be writeable for the web-user '%s'."),$info['name']));
return($smarty -> fetch (get_template_path("../setup/setup_finish.tpl")));
}
}
- /* Create a backup of the currently existing configuration file.
- */
- function create_backup()
- {
- $info= posix_getgrgid(posix_getgid());
- $webgroup = $info['name'];
- if(is_writeable(CONFIG_DIR) && is_writeable(CONFIG_DIR."/".CONFIG_FILE)){
- $src = CONFIG_DIR."/".CONFIG_FILE;
- $dst = CONFIG_DIR."/".CONFIG_FILE."_".date("Ymd");
- $dst_backup= $dst;
- $i = 1;
- while(file_exists($dst)){
- $dst = $dst_backup."-".$i;
- $i ++;
- }
- if(copy($src,$dst)){
- $this->last_backup_name = $dst;
- @chgrp($dst,$webgroup);
- @chown($dst,"root");
- @chmod($dst,0640);
- return(TRUE);
- }else{
- return(FALSE);
- }
- }else{
- return(FALSE);
- }
- }
-
-
function save_object()
{
if(isset($_POST['step8_posted'])){
$this->$attr = validate($_POST[$attr]);
}
}
-
- /* Backup toggle */
- if(isset($_POST['create_backup_visible'])){
- if(isset($_POST['create_backup'])){
- $this->create_backup = TRUE;
- }else{
- $this->create_backup = FALSE;
- }
- }
}
}
}
diff --git a/setup/setup_finish.tpl b/setup/setup_finish.tpl
index 571f8a85732378b0f78efe52126c9c04ef073d71..681505e9e70f9512ed9505d4b77ee2783e6bbf01 100644 (file)
--- a/setup/setup_finish.tpl
+++ b/setup/setup_finish.tpl
-<div class='default' style='margin:12px;' >
-<div style='float:left;'>
-
-<h2>{t}Configuration File{/t}</h2>
- <p>
- {t}GOsa setup has collected all data needed to create an initial configuration file.{/t}
- </p>
+<div class='default'>
<p>
- {$msg1}
- </p>
- <p>
- <b>{t}Automatically write configuration{/t}</b>
+ <b>{t}Create your configuration file{/t}</b>
</p>
<p>
- {if $writeable}
- {t}Write configuration file{/t}
- <input type='submit' name='saveconf' value='{t}Save configuration{/t}'>
-
- {if $exists}
- <br>
- <input type='hidden' name='create_backup_visible' value='1'>
- <input {if $create_backup} checked {/if} type='checkbox' value='1' name='create_backup'>
- {t}Create a backup from existing configuration file{/t}
- {/if}
-
- {if $err_msg != ""}
- <div style='color:red ; font-weight:bold '>{$err_msg}</div>
- {else}
- {if $save_requested}
- <div style='color:green ; font-weight:bold '>{t}Configuration succesfully written.{/t}</div>
- {/if}
- {/if}
-
- {if $last_backup_name}
- <br>
- <div style='padding-left:20px;'>{t}Last created backup{/t}: <i>{$last_backup_name}</i></div>
- <br>
- {/if}
-
-
-
- {if $exists}
- <br>
- <br>
- <b>{t}Use GOsa with current configuration file{/t}</b>
- <br>
- <input type='submit' name='use_gosa' value='{t}Use GOsa now{/t}'>
- {/if}
- {else}
- <div style='font-weight: bold; color: red;'>{t}Can't write configuration file, please check permissions.{/t}</div>
- <pre>
-{$msg_permissions}
- {$CONFIG_DIR}
- {$CONFIG_DIR}/{$CONFIG_FILE}
- </pre>
- {/if}
- <br>
- <p>
- <b>{t}Manually create configuration file{/t}</b>
+ {$msg2}
</p>
+ <tt>
+ # chown root.{$webgroup} {$CONFIG_DIR}/{$CONFIG_FILE}<br>
+ # chmod 640 {$CONFIG_DIR}/{$CONFIG_FILE}
+ </tt>
<p>
- {t}Download the configuration file{/t}
<input type='submit' name='getconf' value='{t}Download configuration{/t}'>
</p>
- <p>
- {$msg2}
- </p>
- <pre>
- # chown root.{$webgroup} {$CONFIG_DIR}/{$CONFIG_FILE}
- # chmod 640 {$CONFIG_DIR}/{$CONFIG_FILE}
- </pre>
-
-
+ {if $err_msg != ""}
+ <p class="seperator"> </p>
+ <br>
+ {t}Status: {/t}
+ <a style='color:red ; font-weight:bold '>{$err_msg}</a>
+ {/if}
-</div>
</div>
<input type='hidden' value='1' name='step8_posted'>