better error handling
This commit is contained in:
parent
5ad9b1629f
commit
2840779c23
|
@ -82,6 +82,11 @@ if ($_POST['submit']) {
|
||||||
if (preg_match("/^[a-z0-9_-]+$/i", $_POST['addprofile']) && !in_array($_POST['addprofile'], getConfigProfiles())) {
|
if (preg_match("/^[a-z0-9_-]+$/i", $_POST['addprofile']) && !in_array($_POST['addprofile'], getConfigProfiles())) {
|
||||||
// check profile password
|
// check profile password
|
||||||
if ($_POST['addpassword'] && $_POST['addpassword2'] && ($_POST['addpassword'] == $_POST['addpassword2'])) {
|
if ($_POST['addpassword'] && $_POST['addpassword2'] && ($_POST['addpassword'] == $_POST['addpassword2'])) {
|
||||||
|
// check if lam.conf_sample exists
|
||||||
|
if (!is_file("../../config/lam.conf_sample")) {
|
||||||
|
$error = _("The file config/lam.conf_sample was not found. Please restore it.");
|
||||||
|
}
|
||||||
|
else {
|
||||||
// create new profile file
|
// create new profile file
|
||||||
@copy("../../config/lam.conf_sample", "../../config/" . $_POST['addprofile'] . ".conf");
|
@copy("../../config/lam.conf_sample", "../../config/" . $_POST['addprofile'] . ".conf");
|
||||||
@chmod ("../../config/" . $_POST['addprofile'] . ".conf", 0600);
|
@chmod ("../../config/" . $_POST['addprofile'] . ".conf", 0600);
|
||||||
|
@ -93,7 +98,10 @@ if ($_POST['submit']) {
|
||||||
$conf->save();
|
$conf->save();
|
||||||
$msg = _("Created new profile.");
|
$msg = _("Created new profile.");
|
||||||
}
|
}
|
||||||
else $error = _("Unable to create new profile!");
|
else {
|
||||||
|
$error = _("Unable to create new profile!");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else $error = _("Profile passwords are different or empty!");
|
else $error = _("Profile passwords are different or empty!");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue