X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/dec0cbb1b25d139c504923a15b4ce884562c7404..refs/pull/524/head:/app/Http/Controllers/SettingController.php diff --git a/app/Http/Controllers/SettingController.php b/app/Http/Controllers/SettingController.php index 5193a9d3b..70a12631a 100644 --- a/app/Http/Controllers/SettingController.php +++ b/app/Http/Controllers/SettingController.php @@ -1,44 +1,44 @@ -checkPermission('settings-update'); - return view('settings/index'); - } + $this->checkPermission('settings-manage'); + $this->setPageTitle('Settings'); + // Get application version + $version = trim(file_get_contents(base_path('version'))); + return view('settings/index', ['version' => $version]); + } /** * Update the specified settings in storage. - * - * @param Request $request + * @param Request $request * @return Response */ public function update(Request $request) { - $this->checkPermission('settings-update'); + $this->preventAccessForDemoUsers(); + $this->checkPermission('settings-manage'); + // Cycles through posted settings and update them - foreach($request->all() as $name => $value) { - if(strpos($name, 'setting-') !== 0) continue; + foreach ($request->all() as $name => $value) { + if (strpos($name, 'setting-') !== 0) continue; $key = str_replace('setting-', '', trim($name)); Setting::put($key, $value); } - session()->flash('success', 'Settings Saved'); + + session()->flash('success', trans('settings.settings_save_success')); return redirect('/settings'); }