diff options
| author | Malf Furious <m@lfurio.us> | 2016-01-01 16:50:22 -0500 | 
|---|---|---|
| committer | Malf Furious <m@lfurio.us> | 2016-01-01 16:50:22 -0500 | 
| commit | 0a92a484554f214d0e499c872807e6b0a3e865ad (patch) | |
| tree | e2565c1e1dc7ba5de7342b7b6199d970c60dae94 /app/class | |
| parent | 4f2f824cfef24b572994c9831dd4bf4bbc575dc1 (diff) | |
| download | scrott-0a92a484554f214d0e499c872807e6b0a3e865ad.tar.gz scrott-0a92a484554f214d0e499c872807e6b0a3e865ad.zip | |
+ Added class file for setting table
Diffstat (limited to '')
| -rw-r--r-- | app/class/framework.class.php | 2 | ||||
| -rw-r--r-- | app/class/setting.class.php | 28 | 
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']; +    } +} + +?> | 
