X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/9a470b07fdc2bbada54735bb9d07045b6ff937a9..refs/pull/110/head:/app/Http/Controllers/SettingController.php diff --git a/app/Http/Controllers/SettingController.php b/app/Http/Controllers/SettingController.php index 1739e0b53..61ce55fa9 100644 --- a/app/Http/Controllers/SettingController.php +++ b/app/Http/Controllers/SettingController.php @@ -1,42 +1,43 @@ -checkPermission('settings-update'); + $this->checkPermission('settings-manage'); $this->setPageTitle('Settings'); - return view('settings/index'); - } + // 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->preventAccessForDemoUsers(); - $this->checkPermission('settings-update'); + $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); }