]> git.mxchange.org Git - friendica.git/blobdiff - include/Core/Config.php
Merge pull request #3044 from rabuzarus/20161224_-_update_perfect_scrollbar
[friendica.git] / include / Core / Config.php
index b56edb4c26f5fdc2176bf03ed68b4d94bdb33fc7..7b7045a9ee3ed2f3fe00989d97db6cba13e9959f 100644 (file)
@@ -1,5 +1,8 @@
 <?php
 namespace Friendica\Core;
+
+use dbm;
+
 /**
  * @file include/Core/Config.php
  *
@@ -30,10 +33,10 @@ class Config {
         * @return void
         */
        public static function load($family) {
-               global $a;
+               $a = get_app();
 
                $r = q("SELECT `v`, `k` FROM `config` WHERE `cat` = '%s' ORDER BY `cat`, `k`, `id`", dbesc($family));
-               if (count($r)) {
+               if (dbm::is_result($r)) {
                        foreach ($r as $rr) {
                                $k = $rr['k'];
                                if ($family === 'config') {
@@ -72,7 +75,7 @@ class Config {
         */
        public static function get($family, $key, $default_value = null, $refresh = false) {
 
-               global $a;
+               $a = get_app();
 
                if (!$refresh) {
                        // Looking if the whole family isn't set
@@ -123,7 +126,7 @@ class Config {
         * @return mixed Stored $value or false if the database update failed
         */
        public static function set($family, $key, $value) {
-               global $a;
+               $a = get_app();
 
                $stored = self::get($family, $key);
 
@@ -134,7 +137,7 @@ class Config {
                $a->config[$family][$key] = $value;
 
                // manage array value
-               $dbvalue = (is_array($value) ? serialize($value):$value);
+               $dbvalue = (is_array($value) ? serialize($value) : $value);
                $dbvalue = (is_bool($dbvalue) ? intval($dbvalue) : $dbvalue);
 
                if (is_null($stored)) {
@@ -171,7 +174,7 @@ class Config {
         */
        public static function delete($family, $key) {
 
-               global $a;
+               $a = get_app();
                if (x($a->config[$family],$key)) {
                        unset($a->config[$family][$key]);
                }