-<?php namespace BookStack\Http\Controllers;
+<?php
+namespace BookStack\Http\Controllers;
+
+use BookStack\Actions\ActivityType;
use BookStack\Auth\User;
use BookStack\Uploads\ImageRepo;
use Illuminate\Http\Request;
public function __construct(ImageRepo $imageRepo)
{
$this->imageRepo = $imageRepo;
- parent::__construct();
}
/**
$version = trim(file_get_contents(base_path('version')));
return view('settings.index', [
- 'version' => $version,
- 'guestUser' => User::getDefault()
+ 'version' => $version,
+ 'guestUser' => User::getDefault(),
]);
}
$this->preventAccessInDemoMode();
$this->checkPermission('settings-manage');
$this->validate($request, [
- 'app_logo' => 'nullable|' . $this->getImageValidationRules(),
+ 'app_logo' => array_merge(['nullable'], $this->getImageValidationRules()),
]);
// Cycles through posted settings and update them
foreach ($request->all() as $name => $value) {
+ $key = str_replace('setting-', '', trim($name));
if (strpos($name, 'setting-') !== 0) {
continue;
}
- $key = str_replace('setting-', '', trim($name));
setting()->put($key, $value);
}
setting()->remove('app-logo');
}
+ $section = $request->get('section', '');
+ $this->logActivity(ActivityType::SETTINGS_UPDATE, $section);
$this->showSuccessNotification(trans('settings.settings_save_success'));
- $redirectLocation = '/settings#' . $request->get('section', '');
+ $redirectLocation = '/settings#' . $section;
+
return redirect(rtrim($redirectLocation, '#'));
}
}