summaryrefslogtreecommitdiffstats
path: root/app/class/setting.class.php
diff options
context:
space:
mode:
authorMalf Furious <m@lfurio.us>2016-02-07 14:01:22 -0500
committerMalf Furious <m@lfurio.us>2016-02-07 14:01:22 -0500
commit72e37180b69db2c067b926b54c64e1989bef0be4 (patch)
treed5e76f4894d3822f1923464c641c63fa283bdd2b /app/class/setting.class.php
parent43ca317ea7d49396eb2958a38aed8b737ef4186b (diff)
parentc5564a0a2ae183c533a38905eccdbf383030cd4c (diff)
downloadscrott-72e37180b69db2c067b926b54c64e1989bef0be4.tar.gz
scrott-72e37180b69db2c067b926b54c64e1989bef0be4.zip
Merge branch 'auth' into dev
Diffstat (limited to 'app/class/setting.class.php')
-rw-r--r--app/class/setting.class.php30
1 files changed, 30 insertions, 0 deletions
diff --git a/app/class/setting.class.php b/app/class/setting.class.php
index ea5fac3..e3ef7f1 100644
--- a/app/class/setting.class.php
+++ b/app/class/setting.class.php
@@ -23,6 +23,36 @@ class Setting extends Framework
return $res[0]['value'];
}
+
+ /*
+ * Helper function for setting setting values on the database
+ */
+ static function setValue($key, $value)
+ {
+ $db = parent::getDbConnection();
+ $escdKey = $db->esc($key);
+ $escdValue = $db->esc($value);
+
+ if (self::getValue($key) === false)
+ $query = "INSERT INTO setting (`key`, value) VALUES('" . $escdKey . "', '" . $escdValue . "')";
+ else
+ $query = "UPDATE setting SET value = '" . $escdValue . "' WHERE `key` = '" . $escdKey . "'";
+
+ $db->query($query);
+ }
+
+ /*
+ * Should the app allow the public to signup their own accounts with Scrott?
+ */
+ static function allowPublicSignup($value = null)
+ {
+ $opt = "allowPublicSignup";
+
+ if ($value != null)
+ self::setValue($opt, $value);
+
+ return self::getValue($opt);
+ }
}
?>