From 010d521e89ce5c86f900c7898e8713d2782001db Mon Sep 17 00:00:00 2001 From: hackerESQ Date: Sat, 6 Oct 2018 20:35:57 -0500 Subject: [PATCH] create global force option Created new option to globally force settings to be saved without regard to current settings (i.e. override security feature to avoid malicious settings being saved). --- config/settings.php | 14 ++++++++++++++ src/Settings.php | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/config/settings.php b/config/settings.php index bba1499..8afff84 100644 --- a/config/settings.php +++ b/config/settings.php @@ -16,4 +16,18 @@ 'encrypt' => [], + /* + |-------------------------------------------------------------------------- + | Force save settings + |-------------------------------------------------------------------------- + | + | This option controls whether settings are forced to be saved. If set to + | true, this will save any settings without regard to security (i.e. + | whether the setting has been previously set). + | + */ + + 'force' => false, + + ]; \ No newline at end of file diff --git a/src/Settings.php b/src/Settings.php index 5fa44b5..381a4ff 100644 --- a/src/Settings.php +++ b/src/Settings.php @@ -69,7 +69,7 @@ public function set($changes, bool $force = false) } // ARE WE FORCING? OR SHOULD WE BE SECURE? - if ($force) { + if (config('settings.force') || $force) { foreach ($changes as $key => $value) {