Adds check if config file is writable
parent
c40dc747d3
commit
c245bbb3be
|
@ -17,11 +17,16 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
||||||
|
|
||||||
// editing the config file
|
// editing the config file
|
||||||
if (isset($_POST['item']) && $_POST['item'] === 'config_file') {
|
if (isset($_POST['item']) && $_POST['item'] === 'config_file') {
|
||||||
$result = $configObject->editConfigFile($_POST, $config_file);
|
// check if file is writable
|
||||||
if ($result === true) {
|
if (!is_writable($config_file)) {
|
||||||
$_SESSION['notice'] = "The config file is edited.";
|
$_SESSION['error'] = "Configuration file is not writable.";
|
||||||
} else {
|
} else {
|
||||||
$_SESSION['error'] = "Editing the config file failed. Error: $result";
|
$result = $configObject->editConfigFile($_POST, $config_file);
|
||||||
|
if ($result === true) {
|
||||||
|
$_SESSION['notice'] = "The config file is edited.";
|
||||||
|
} else {
|
||||||
|
$_SESSION['error'] = "Editing the config file failed. Error: $result";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// new host adding
|
// new host adding
|
||||||
|
@ -144,14 +149,6 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME - if this is not needed for editing the flat file, remove it
|
|
||||||
// // check if file is writable
|
|
||||||
// if (!is_writable($config_file)) {
|
|
||||||
// $_SESSION['error'] = getError('Configuration file is not writable.');
|
|
||||||
// header("Location: $app_root?platform=$platform_id&page=config");
|
|
||||||
// exit();
|
|
||||||
// }
|
|
||||||
|
|
||||||
// FIXME the new file is not loaded on first page load
|
// FIXME the new file is not loaded on first page load
|
||||||
unset($config);
|
unset($config);
|
||||||
header("Location: $app_root?page=config&item=$item");
|
header("Location: $app_root?page=config&item=$item");
|
||||||
|
|
Loading…
Reference in New Issue