2016-12-13 06:03:35 +01:00
|
|
|
<?php
|
|
|
|
use Respect\Validation\Validator as DataValidator;
|
|
|
|
|
|
|
|
class EditSettingsController extends Controller {
|
|
|
|
const PATH = '/edit-settings';
|
|
|
|
|
|
|
|
public function validations() {
|
2016-12-15 02:27:31 +01:00
|
|
|
return [
|
2016-12-13 06:03:35 +01:00
|
|
|
'permission' => 'staff_3',
|
2016-12-15 02:27:31 +01:00
|
|
|
'requestData' => []
|
2016-12-13 06:03:35 +01:00
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
public function handler() {
|
2016-12-15 02:27:31 +01:00
|
|
|
$settings = [
|
2016-12-20 03:17:35 +01:00
|
|
|
'language',
|
2016-12-15 02:27:31 +01:00
|
|
|
'recaptcha-public',
|
|
|
|
'recaptcha-private',
|
2016-12-20 03:17:35 +01:00
|
|
|
'no-reply-email',
|
|
|
|
'smtp-host',
|
|
|
|
'smtp-port',
|
|
|
|
'smtp-user',
|
|
|
|
'smtp-pass',
|
|
|
|
'time-zone',
|
|
|
|
'maintenance-mode',
|
|
|
|
'layout',
|
2016-12-15 02:27:31 +01:00
|
|
|
'allow-attachments',
|
2016-12-20 03:17:35 +01:00
|
|
|
'max-size',
|
|
|
|
'system-title'
|
2016-12-15 02:27:31 +01:00
|
|
|
];
|
2016-12-13 06:03:35 +01:00
|
|
|
|
2016-12-15 02:27:31 +01:00
|
|
|
foreach($settings as $setting) {
|
|
|
|
if(Controller::request($setting)) {
|
|
|
|
$settingInstance = Setting::getSetting($setting);
|
|
|
|
$settingInstance->value = Controller::request($setting);
|
|
|
|
$settingInstance->store();
|
|
|
|
}
|
2016-12-13 06:03:35 +01:00
|
|
|
}
|
2016-12-15 02:27:31 +01:00
|
|
|
Response::respondSuccess();
|
2016-12-13 06:03:35 +01:00
|
|
|
}
|
|
|
|
}
|