aboutsummaryrefslogtreecommitdiffstats
path: root/include/config.php
diff options
context:
space:
mode:
authorjeroenpraat <jeroenpraat@xs4all.nl>2016-03-01 22:09:06 +0100
committerjeroenpraat <jeroenpraat@xs4all.nl>2016-03-01 22:09:06 +0100
commit8b61e546fe488516fa3c5f37df80a68e346b84a9 (patch)
tree8af09fcff55cd613d5d2557a7c0956bd25a4afa3 /include/config.php
parent7206e8af3a943b0fb286f253ed3abbda2d2572b6 (diff)
parent7808689198601780041e022bf0698e559869f305 (diff)
downloadvolse-hubzilla-8b61e546fe488516fa3c5f37df80a68e346b84a9.tar.gz
volse-hubzilla-8b61e546fe488516fa3c5f37df80a68e346b84a9.tar.bz2
volse-hubzilla-8b61e546fe488516fa3c5f37df80a68e346b84a9.zip
Merge branch 'master' of https://github.com/redmatrix/hubzilla
Diffstat (limited to 'include/config.php')
-rw-r--r--include/config.php66
1 files changed, 65 insertions, 1 deletions
diff --git a/include/config.php b/include/config.php
index f65e4a470..51d4e99ac 100644
--- a/include/config.php
+++ b/include/config.php
@@ -549,4 +549,68 @@ function set_aconfig($account_id, $family, $key, $value) {
function del_aconfig($account_id, $family, $key) {
return del_xconfig('a_' . $account_id, $family, $key);
-} \ No newline at end of file
+}
+
+
+function load_abconfig($chash,$xhash) {
+ $r = q("select * from abconfig where chan = '%s' and xchan = '%s'",
+ dbesc($chash),
+ dbesc($xhash)
+ );
+ return $r;
+}
+
+function get_abconfig($chash,$xhash,$family,$key) {
+ $r = q("select * from abconfig where chan = '%s' and xchan = '%s' and cat = '%s' and k = '%s' limit 1",
+ dbesc($chash),
+ dbesc($xhash),
+ dbesc($family),
+ dbesc($key)
+ );
+ if($r) {
+ return ((preg_match('|^a:[0-9]+:{.*}$|s', $r[0]['v'])) ? unserialize($r[0]['v']) : $r[0]['v']);
+ }
+ return false;
+}
+
+
+function set_abconfig($chash,$xhash,$family,$key,$value) {
+
+ $dbvalue = ((is_array($value)) ? serialize($value) : $value);
+ $dbvalue = ((is_bool($dbvalue)) ? intval($dbvalue) : $dbvalue);
+
+ if(get_abconfig($chash,$xhash,$family,$key) === false) {
+ $r = q("insert into abconfig ( chan, xchan, cat, k, v ) values ( '%s', '%s', '%s', '%s', '%s' ) ",
+ dbesc($chash),
+ dbesc($xhash),
+ dbesc($family),
+ dbesc($key),
+ dbesc($dbvalue)
+ );
+ }
+ else {
+ $r = q("update abconfig set v = '%s' where chan = '%s' and xchan = '%s' and cat = '%s' and k = '%s' ",
+ dbesc($dbvalue),
+ dbesc($chash),
+ dbesc($xhash),
+ dbesc($family),
+ dbesc($key)
+ );
+ }
+ if($r)
+ return $value;
+ return false;
+}
+
+
+function del_abconfig($chash,$xhash,$family,$key) {
+
+ $r = q("delete from abconfig where chan = '%s' and xchan = '%s' and cat = '%s' and k = '%s' ",
+ dbesc($chash),
+ dbesc($xhash),
+ dbesc($family),
+ dbesc($key)
+ );
+
+ return $r;
+}