X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/dec0cbb1b25d139c504923a15b4ce884562c7404..refs/pull/110/head:/app/Http/Controllers/SettingController.php diff --git a/app/Http/Controllers/SettingController.php b/app/Http/Controllers/SettingController.php index 5193a9d3b..61ce55fa9 100644 --- a/app/Http/Controllers/SettingController.php +++ b/app/Http/Controllers/SettingController.php @@ -1,43 +1,47 @@ -checkPermission('settings-update'); - return view('settings/index'); - } + $this->checkPermission('settings-manage'); + $this->setPageTitle('Settings'); + // Get application version + $version = false; + if (function_exists('exec')) { + $version = exec('git describe --always --tags '); + } + 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'); return redirect('/settings'); }