summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorMalf Furious <m@lfurio.us>2018-09-23 22:02:27 -0400
committerMalf Furious <m@lfurio.us>2018-09-23 22:02:27 -0400
commitd9b75f4f38bb258893896443bdfb3a3e43773d47 (patch)
tree8980f55102d986ad0168436c7ad741fd85cc4e6f /app
parentbc897063c822ee90fb23abf5189cc2b95e1a4f76 (diff)
downloadscrott-d9b75f4f38bb258893896443bdfb3a3e43773d47.tar.gz
scrott-d9b75f4f38bb258893896443bdfb3a3e43773d47.zip
settings: Implement admin tab form handler
Diffstat (limited to 'app')
-rw-r--r--app/model/settings.php40
1 files changed, 40 insertions, 0 deletions
diff --git a/app/model/settings.php b/app/model/settings.php
index 3262dec..a3afa0f 100644
--- a/app/model/settings.php
+++ b/app/model/settings.php
@@ -13,6 +13,7 @@
*/
require_once "class/form.class.php";
+require_once "class/settings.class.php";
require_once "class/user.class.php";
/*
@@ -99,4 +100,43 @@ if (isAction("settings-user"))
$user->saveObj();
}
+/*
+ * Action: settings-admin - Modify global settings
+ */
+if (isAction("settings-admin"))
+{
+ $form = new form();
+ $form->flag("sslOnly");
+ $form->flag("allowPublicSignup");
+ $form->text("smtpEmailAddress", false);
+ $form->text("smtpFrom", false);
+ $form->text("smtpServer", false);
+ $form->numeric("smtpPort", 0, 65535);
+ $form->enum("smtpSecurity", array("", "ssl", "tls"));
+ $form->text("smtpUname", false);
+ $form->text("smtpPasswd", false);
+
+ if (!$form->populate(input()))
+ return;
+
+ /* permissions */
+ if (!($cu = user::getCurrent()) || $cu->admin == 0)
+ {
+ logError(ERROR, "You do not have permission to modify global settings");
+ return;
+ }
+
+ settings::sslOnly($form->sslOnly);
+ settings::allowPublicSignup($form->allowPublicSignup);
+ settings::smtpEmailAddress($form->smtpEmailAddress);
+ settings::smtpFrom($form->smtpFrom);
+ settings::smtpServer($form->smtpServer);
+ settings::smtpPort($form->smtpPort);
+ settings::smtpSecurity($form->smtpSecurity);
+ settings::smtpUname($form->smtpUname);
+
+ if ($form->smtpPasswd != "")
+ settings::smtpPasswd($form->smtpPasswd);
+}
+
?>