copy lam.conf_sample when creating a new profile
This commit is contained in:
parent
5acdeedb5d
commit
b2448de10a
|
@ -67,14 +67,14 @@ if ($_POST['submit']) {
|
||||||
// check profile password
|
// check profile password
|
||||||
if ($_POST['addpassword'] && $_POST['addpassword2'] && ($_POST['addpassword'] == $_POST['addpassword2'])) {
|
if ($_POST['addpassword'] && $_POST['addpassword2'] && ($_POST['addpassword'] == $_POST['addpassword2'])) {
|
||||||
// create new profile file
|
// create new profile file
|
||||||
@touch("../../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);
|
||||||
$file = fopen("../../config/" . $_POST['addprofile'] . ".conf", "w");
|
$file = is_file("../../config/" . $_POST['addprofile'] . ".conf");
|
||||||
if ($file) {
|
if ($file) {
|
||||||
$input = "# password to change these preferences via webfrontend\n";
|
// load as config and write new password
|
||||||
$input = $input . "passwd: " . $_POST['addpassword'] . "\n\n";
|
$conf = new Config($_POST['addprofile']);
|
||||||
fwrite ($file, $input);
|
$conf->Passwd = $_POST['addpassword'];
|
||||||
fclose($file);
|
$conf->save();
|
||||||
$msg = _("Created new profile.");
|
$msg = _("Created new profile.");
|
||||||
}
|
}
|
||||||
else $error = _("Unable to create new profile!");
|
else $error = _("Unable to create new profile!");
|
||||||
|
|
Loading…
Reference in New Issue