2016-08-20 23:06:41 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
class GetSettingsController extends Controller {
|
|
|
|
const PATH = '/get-settings';
|
|
|
|
|
|
|
|
public function validations() {
|
|
|
|
return [
|
|
|
|
'permission' => 'any',
|
|
|
|
'requestData' => []
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
public function handler() {
|
2017-01-04 23:29:23 +01:00
|
|
|
|
|
|
|
if(Controller::request('allSettings') && Controller::isStaffLogged(3)) {
|
|
|
|
$settingsList = [
|
|
|
|
'language' => Setting::getSetting('language')->getValue(),
|
|
|
|
'reCaptchaKey' => Setting::getSetting('recaptcha-public')->getValue(),
|
|
|
|
'reCaptchaPrivate' => Setting::getSetting('recaptcha-private')->getValue(),
|
|
|
|
'time-zone' => Setting::getSetting('time-zone')->getValue(),
|
|
|
|
'maintenance-mode' => Setting::getSetting('maintenance-mode')->getValue(),
|
|
|
|
'layout' => Setting::getSetting('layout')->getValue(),
|
|
|
|
'allow-attachments' => Setting::getSetting('allow-attachments')->getValue(),
|
|
|
|
'max-size' => Setting::getSetting('max-size')->getValue(),
|
|
|
|
'url' => Setting::getSetting('url')->getValue(),
|
|
|
|
'title' => Setting::getSetting('title')->getValue(),
|
|
|
|
'no-reply-email' => Setting::getSetting('no-reply-email')->getValue(),
|
|
|
|
'smtp-port' => Setting::getSetting('smtp-port')->getValue(),
|
2017-01-11 04:21:27 +01:00
|
|
|
'smtp-host' => Setting::getSetting('smtp-host')->getValue(),
|
|
|
|
'smtp-user' => Setting::getSetting('smtp-user')->getValue(),
|
2017-01-10 20:04:25 +01:00
|
|
|
'registration' => Setting::getSetting('registration')->getValue(),
|
2017-01-04 23:29:23 +01:00
|
|
|
'departments' => Department::getDepartmentNames(),
|
|
|
|
'supportedLanguages' => Language::getSupportedLanguages(),
|
|
|
|
'allowedLanguages' => Language::getAllowedLanguages()
|
|
|
|
];
|
|
|
|
} else {
|
|
|
|
$settingsList = [
|
|
|
|
'language' => Setting::getSetting('language')->getValue(),
|
|
|
|
'reCaptchaKey' => Setting::getSetting('recaptcha-public')->getValue(),
|
|
|
|
'time-zone' => Setting::getSetting('time-zone')->getValue(),
|
|
|
|
'maintenance-mode' => Setting::getSetting('maintenance-mode')->getValue(),
|
|
|
|
'layout' => Setting::getSetting('layout')->getValue(),
|
|
|
|
'allow-attachments' => Setting::getSetting('allow-attachments')->getValue(),
|
|
|
|
'max-size' => Setting::getSetting('max-size')->getValue(),
|
|
|
|
'title' => Setting::getSetting('title')->getValue(),
|
2017-01-10 20:04:25 +01:00
|
|
|
'registration' => Setting::getSetting('registration')->getValue(),
|
2017-01-04 23:29:23 +01:00
|
|
|
'departments' => Department::getDepartmentNames(),
|
|
|
|
'supportedLanguages' => Language::getSupportedLanguages(),
|
|
|
|
'allowedLanguages' => Language::getAllowedLanguages()
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
Response::respondSuccess($settingsList);
|
2016-08-20 23:06:41 +02:00
|
|
|
}
|
|
|
|
}
|