From 587bdef47abbf4545508cac95a0495be0d5ddaa5 Mon Sep 17 00:00:00 2001 From: Malf Furious Date: Sat, 12 Mar 2016 16:21:41 -0500 Subject: Handle submissions to setting modal, admin tab --- app/model/common.mod.php | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) (limited to 'app/model/common.mod.php') diff --git a/app/model/common.mod.php b/app/model/common.mod.php index 33acb1b..34ac17d 100644 --- a/app/model/common.mod.php +++ b/app/model/common.mod.php @@ -47,7 +47,8 @@ class CommonModel extends MasterModel { switch ($input['action']) { - case "common-setting-user": $this->saveSettingUser($input); break; + case "common-setting-user": $this->saveSettingUser($input); break; + case "common-setting-admin": $this->saveSettingAdmin($input); break; } } @@ -109,6 +110,33 @@ class CommonModel extends MasterModel $user->saveObj(); } + + /* + * Save changes to admin settings + */ + function saveSettingAdmin($input) + { + $form = new Form(); + $form->field_enum("settSSL", array("force", "neither", "forbid")); + $form->field_bool("allowPublicSignup"); + + if (!$form->populate($input)) + { + $this->logFormErrors($form); + return; + } + + $user = $this->getCurrentUser(); + + if (!$user || $user->admin == 0) + { + $this->logError("Admin permissions required"); + return; + } + + Setting::settSSL($form->settSSL); + Setting::allowPublicSignup($form->allowPublicSignup); + } } ?> -- cgit v1.2.3