diff --git a/app/classes/config.php b/app/classes/config.php index 5db59fd..2c810b1 100644 --- a/app/classes/config.php +++ b/app/classes/config.php @@ -3,7 +3,7 @@ class Config { // edit the config file - public function editConfigFile($updatedConfig) { + public function editConfigFile($updatedConfig, $config_file) { // first we get a fresh config file contents as text $config_contents = file_get_contents($config_file); if (!$config_contents) { @@ -15,7 +15,7 @@ class Config { // we look for 'option' => value // option is always in single quotes // value is without quotes, because it could be true/false - $patterm = "/(['\"]{$key}['\"]\s*=>\s*)([^,]+),/" + $patterm = "/(['\"]{$key}['\"]\s*=>\s*)([^,]+),/"; // prepare the value and replace it $replacementValue = var_export($newValue, true); diff --git a/app/pages/config.php b/app/pages/config.php index f16c577..17e4d2c 100644 --- a/app/pages/config.php +++ b/app/pages/config.php @@ -22,7 +22,7 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') { // editing the config file if (isset($_POST['item']) && $_POST['item'] === 'config_file') { - $result = $configObject->editConfigFile($_POST); + $result = $configObject->editConfigFile($_POST, $config_file); if ($result === true) { $_SESSION['notice'] = "The config file is edited."; } else {