summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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'];
+ }
+}
+
+?>