summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorMalf Furious <m@lfurio.us>2016-01-01 16:50:22 -0500
committerMalf Furious <m@lfurio.us>2016-01-01 16:50:22 -0500
commit0a92a484554f214d0e499c872807e6b0a3e865ad (patch)
treee2565c1e1dc7ba5de7342b7b6199d970c60dae94 /app
parent4f2f824cfef24b572994c9831dd4bf4bbc575dc1 (diff)
downloadscrott-0a92a484554f214d0e499c872807e6b0a3e865ad.tar.gz
scrott-0a92a484554f214d0e499c872807e6b0a3e865ad.zip
+ Added class file for setting table
Diffstat (limited to 'app')
-rw-r--r--app/class/framework.class.php2
-rw-r--r--app/class/setting.class.php28
2 files changed, 29 insertions, 1 deletions
diff --git a/app/class/framework.class.php b/app/class/framework.class.php
index eea6c25..d1293de 100644
--- a/app/class/framework.class.php
+++ b/app/class/framework.class.php
@@ -50,7 +50,7 @@ abstract class Framework
/*
* Get or create the app's database connection object (this is a singleton object and dependent on system-level config)
*/
- function getDbConnection()
+ static function getDbConnection()
{
global $_SCROTT;
diff --git a/app/class/setting.class.php b/app/class/setting.class.php
new file mode 100644
index 0000000..ea5fac3
--- /dev/null
+++ b/app/class/setting.class.php
@@ -0,0 +1,28 @@
+<?php
+
+require_once "class/framework.class.php";
+
+/*
+ * Scrott administrative settings
+ */
+class Setting extends Framework
+{
+ /*
+ * Helper function for getting setting values from the database
+ */
+ static function getValue($key)
+ {
+ $db = parent::getDbConnection();
+ $escdKey = $db->esc($key);
+
+ $query = "SELECT `value` FROM `setting` WHERE `key` = '" . $escdKey . "'";
+ $res = $db->query($query);
+
+ if (count($res) == 0)
+ return false;
+
+ return $res[0]['value'];
+ }
+}
+
+?>