diff options
author | Malf Furious <m@lfurio.us> | 2016-03-12 16:21:41 -0500 |
---|---|---|
committer | Malf Furious <m@lfurio.us> | 2016-03-27 20:16:32 -0400 |
commit | 587bdef47abbf4545508cac95a0495be0d5ddaa5 (patch) | |
tree | 761e9d7770c26ad0a51034fbb53e54ca36c1f88b /app | |
parent | cc755e3756e43109d0db0de963b3a132039456b1 (diff) | |
download | scrott-587bdef47abbf4545508cac95a0495be0d5ddaa5.tar.gz scrott-587bdef47abbf4545508cac95a0495be0d5ddaa5.zip |
Handle submissions to setting modal, admin tab
Diffstat (limited to 'app')
-rw-r--r-- | app/model/common.mod.php | 30 |
1 files changed, 29 insertions, 1 deletions
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); + } } ?> |