fixed renaming of default profile (3183920)

This commit is contained in:
Roland Gruber 2011-02-18 19:15:43 +00:00
parent 60aa501a75
commit d630e1f9b0
3 changed files with 10 additions and 4 deletions

View File

@ -3,6 +3,8 @@ April 2011 3.4.0
- LAM Pro: - LAM Pro:
-> support automount entries -> support automount entries
-> Zarafa groups: allow combination with group of names -> Zarafa groups: allow combination with group of names
- fixed bugs:
-> renaming of default profile (3183920)
12.02.2011 3.3.0 12.02.2011 3.3.0

View File

@ -129,12 +129,16 @@ if (isset($_POST['submit'])) {
} }
// rename profile // rename profile
elseif ($_POST['action'] == "rename") { elseif ($_POST['action'] == "rename") {
if (preg_match("/^[a-z0-9_-]+$/i", $_POST['renfilename']) && !in_array($_POST['renfilename'], getConfigProfiles())) { if (preg_match("/^[a-z0-9_-]+$/i", $_POST['oldfilename']) && preg_match("/^[a-z0-9_-]+$/i", $_POST['renfilename']) && !in_array($_POST['renfilename'], getConfigProfiles())) {
if (rename("../../config/" . $_POST['oldfilename'] . ".conf", if (rename("../../config/" . $_POST['oldfilename'] . ".conf", "../../config/" . $_POST['renfilename'] . ".conf")) {
"../../config/" . $_POST['renfilename'] . ".conf")) {
$msg = _("Renamed profile."); $msg = _("Renamed profile.");
} }
else $error = _("Could not rename file!"); else $error = _("Could not rename file!");
// update default profile setting if needed
if ($cfg->default == $_POST['oldfilename']) {
$cfg->default = $_POST['renfilename'];
$cfg->save();
}
} }
else $error = _("Profile name is invalid!"); else $error = _("Profile name is invalid!");
} }

View File

@ -68,7 +68,7 @@ if(isset($_GET['useProfile'])) {
$default_Config = new LAMCfgMain(); $default_Config = new LAMCfgMain();
$_SESSION["cfgMain"] = $default_Config; $_SESSION["cfgMain"] = $default_Config;
$default_Profile = $default_Config->default; $default_Profile = $default_Config->default;
if(isset($_COOKIE["lam_default_profile"])) { if(isset($_COOKIE["lam_default_profile"]) && in_array($_COOKIE["lam_default_profile"], getConfigProfiles())) {
$default_Profile = $_COOKIE["lam_default_profile"]; $default_Profile = $_COOKIE["lam_default_profile"];
} }
// Reload loginpage after a profile change // Reload loginpage after a profile change