Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Fix #9770
James Cole458a337521ce
diff --git a/app/Http/Controllers/Admin/ConfigurationController.php b/app/Http/Controllers/Admin/ConfigurationController.phpindex 7e7403fb57..33afca23c0 100644--- a/app/Http/Controllers/Admin/ConfigurationController.php+++ b/app/Http/Controllers/Admin/ConfigurationController.php@@ -26,6 +26,7 @@ namespace FireflyIII\Http\Controllers\Admin;use FireflyIII\Http\Controllers\Controller;use FireflyIII\Http\Middleware\IsDemoUser;use FireflyIII\Http\Requests\ConfigurationRequest;+use FireflyIII\Support\Facades\FireflyConfig;use Illuminate\Contracts\View\Factory;use Illuminate\Http\RedirectResponse;use Illuminate\Support\Facades\Log;@@ -68,8 +69,8 @@ class ConfigurationController extends Controller// all available configuration and their default value in case// they don't exist yet.- $singleUserMode = app('fireflyconfig')->get('single_user_mode', config('firefly.configuration.single_user_mode'))->data;- $isDemoSite = app('fireflyconfig')->get('is_demo_site', config('firefly.configuration.is_demo_site'))->data;+ $singleUserMode = FireflyConfig::get('single_user_mode', config('firefly.configuration.single_user_mode'))->data;+ $isDemoSite = FireflyConfig::get('is_demo_site', config('firefly.configuration.is_demo_site'))->data;$siteOwner = config('firefly.site_owner');return view(@@ -89,8 +90,8 @@ class ConfigurationController extends ControllerLog::channel('audit')->info('User updates global configuration.', $data);// store config values- app('fireflyconfig')->set('single_user_mode', $data['single_user_mode']);- app('fireflyconfig')->set('is_demo_site', $data['is_demo_site']);+ FireflyConfig::set('single_user_mode', $data['single_user_mode']);+ FireflyConfig::set('is_demo_site', $data['is_demo_site']);// flash messagesession()->flash('success', (string) trans('firefly.configuration_updated'));diff --git a/app/Http/Controllers/Admin/NotificationController.php b/app/Http/Controllers/Admin/NotificationController.phpindex aafcb69f69..39823066d1 100644--- a/app/Http/Controllers/Admin/NotificationController.php+++ b/app/Http/Controllers/Admin/NotificationController.php@@ -28,6 +28,7 @@ use FireflyIII\Events\Test\OwnerTestNotificationChannel;use FireflyIII\Http\Controllers\Controller;use FireflyIII\Http\Requests\NotificationRequest;use FireflyIII\Notifications\Notifiables\OwnerNotifiable;+use FireflyIII\Support\Facades\FireflyConfig;use Illuminate\Http\RedirectResponse;use Illuminate\Http\Request;use Illuminate\Support\Facades\Log;@@ -44,14 +45,14 @@ class NotificationController extends Controller$subTitleIcon = 'envelope-o';// notification settings:- $slackUrl = app('fireflyconfig')->getEncrypted('slack_webhook_url', '')->data;- $pushoverAppToken = app('fireflyconfig')->getEncrypted('pushover_app_token', '')->data;- $pushoverUserToken = app('fireflyconfig')->getEncrypted('pushover_user_token', '')->data;- $ntfyServer = app('fireflyconfig')->getEncrypted('ntfy_server', 'https://ntfy.sh')->data;- $ntfyTopic = app('fireflyconfig')->getEncrypted('ntfy_topic', '')->data;- $ntfyAuth = app('fireflyconfig')->get('ntfy_auth', false)->data;- $ntfyUser = app('fireflyconfig')->getEncrypted('ntfy_user', '')->data;- $ntfyPass = app('fireflyconfig')->getEncrypted('ntfy_pass', '')->data;+ $slackUrl = FireflyConfig::getEncrypted('slack_webhook_url', '')->data;+ $pushoverAppToken = FireflyConfig::getEncrypted('pushover_app_token', '')->data;+ $pushoverUserToken = FireflyConfig::getEncrypted('pushover_user_token', '')->data;+ $ntfyServer = FireflyConfig::getEncrypted('ntfy_server', 'https://ntfy.sh')->data;+ $ntfyTopic = FireflyConfig::getEncrypted('ntfy_topic', '')->data;+ $ntfyAuth = FireflyConfig::get('ntfy_auth', false)->data;+ $ntfyUser = FireflyConfig::getEncrypted('ntfy_user', '')->data;+ $ntfyPass = FireflyConfig::getEncrypted('ntfy_pass', '')->data;$channels = config('notifications.channels');$forcedAvailability = [];@@ -59,7 +60,7 @@ class NotificationController extends Controller$notifications = [];foreach (config('notifications.notifications.owner') as $key => $info) {if (true === $info['enabled']) {- $notifications[$key] = app('fireflyconfig')->get(sprintf('notification_%s', $key), true)->data;+ $notifications[$key] = FireflyConfig::get(sprintf('notification_%s', $key), true)->data;}}@@ -98,19 +99,19 @@ class NotificationController extends Controllerforeach (config('notifications.notifications.owner') as $key => $info) {if (array_key_exists($key, $all)) {- app('fireflyconfig')->set(sprintf('notification_%s', $key), $all[$key]);+ FireflyConfig::set(sprintf('notification_%s', $key), $all[$key]);}}$variables = ['slack_webhook_url', 'pushover_app_token', 'pushover_user_token', 'ntfy_server', 'ntfy_topic', 'ntfy_user', 'ntfy_pass'];foreach ($variables as $variable) {if ('' === $all[$variable]) {- app('fireflyconfig')->delete($variable);+ FireflyConfig::delete($variable);}if ('' !== $all[$variable]) {- app('fireflyconfig')->setEncrypted($variable, $all[$variable]);+ FireflyConfig::setEncrypted($variable, $all[$variable]);}}- app('fireflyconfig')->set('ntfy_auth', $all['ntfy_auth'] ?? false);+ FireflyConfig::set('ntfy_auth', $all['ntfy_auth'] ?? false);session()->flash('success', (string) trans('firefly.notification_settings_saved'));diff --git a/app/Notifications/ReturnsSettings.php b/app/Notifications/ReturnsSettings.phpindex 870b600792..942e459df4 100644--- a/app/Notifications/ReturnsSettings.php+++ b/app/Notifications/ReturnsSettings.php@@ -55,7 +55,7 @@ class ReturnsSettingsif ('user' === $type && null !== $user) {$settings['ntfy_server'] = Preferences::getEncryptedForUser($user, 'ntfy_server', 'https://ntfy.sh')->data;$settings['ntfy_topic'] = Preferences::getEncryptedForUser($user, 'ntfy_topic', '')->data;- $settings['ntfy_auth'] = Preferences::getForUser($user, 'ntfy_auth', false)->data;+ $settings['ntfy_auth'] = '1' === Preferences::getForUser($user, 'ntfy_auth', false)->data;$settings['ntfy_user'] = Preferences::getEncryptedForUser($user, 'ntfy_user', '')->data;$settings['ntfy_pass'] = Preferences::getEncryptedForUser($user, 'ntfy_pass', '')->data;Log::debug(sprintf('Auth is %s, user = "%s"', var_export($settings['ntfy_auth'], true), $settings['ntfy_user']));