From b19bbf54736b83afaa26aa11ba95c7816c7f8599 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Thu, 23 Jun 2016 18:12:26 -0700 Subject: change AbConfig to use channel_id instead of channel_hash; which was a mistake in retrospect --- Zotlabs/Lib/AbConfig.php | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'Zotlabs/Lib/AbConfig.php') diff --git a/Zotlabs/Lib/AbConfig.php b/Zotlabs/Lib/AbConfig.php index f2d6522b9..138d0dfea 100644 --- a/Zotlabs/Lib/AbConfig.php +++ b/Zotlabs/Lib/AbConfig.php @@ -5,18 +5,18 @@ namespace Zotlabs\Lib; class AbConfig { - static public function Load($chash,$xhash) { - $r = q("select * from abconfig where chan = '%s' and xchan = '%s'", - dbesc($chash), + static public function Load($chan,$xhash) { + $r = q("select * from abconfig where chan = %d and xchan = '%s'", + intval($chan), dbesc($xhash) ); return $r; } - static public function Get($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), + static public function Get($chan,$xhash,$family,$key) { + $r = q("select * from abconfig where chan = %d and xchan = '%s' and cat = '%s' and k = '%s' limit 1", + intval($chan), dbesc($xhash), dbesc($family), dbesc($key) @@ -28,14 +28,14 @@ class AbConfig { } - static public function Set($chash,$xhash,$family,$key,$value) { + static public function Set($chan,$xhash,$family,$key,$value) { $dbvalue = ((is_array($value)) ? serialize($value) : $value); $dbvalue = ((is_bool($dbvalue)) ? intval($dbvalue) : $dbvalue); - if(self::Get($chash,$xhash,$family,$key) === false) { - $r = q("insert into abconfig ( chan, xchan, cat, k, v ) values ( '%s', '%s', '%s', '%s', '%s' ) ", - dbesc($chash), + if(self::Get($chan,$xhash,$family,$key) === false) { + $r = q("insert into abconfig ( chan, xchan, cat, k, v ) values ( %d, '%s', '%s', '%s', '%s' ) ", + intval($chan), dbesc($xhash), dbesc($family), dbesc($key), @@ -43,9 +43,9 @@ class AbConfig { ); } else { - $r = q("update abconfig set v = '%s' where chan = '%s' and xchan = '%s' and cat = '%s' and k = '%s' ", + $r = q("update abconfig set v = '%s' where chan = %d and xchan = '%s' and cat = '%s' and k = '%s' ", dbesc($dbvalue), - dbesc($chash), + dbesc($chan), dbesc($xhash), dbesc($family), dbesc($key) @@ -58,10 +58,10 @@ class AbConfig { } - static public function Delete($chash,$xhash,$family,$key) { + static public function Delete($chan,$xhash,$family,$key) { - $r = q("delete from abconfig where chan = '%s' and xchan = '%s' and cat = '%s' and k = '%s' ", - dbesc($chash), + $r = q("delete from abconfig where chan = %d and xchan = '%s' and cat = '%s' and k = '%s' ", + intval($chan), dbesc($xhash), dbesc($family), dbesc($key) @@ -70,4 +70,4 @@ class AbConfig { return $r; } -} \ No newline at end of file +} -- cgit v1.2.3 From 00afe56cadbf72bd76efceb0663291d7f88a93fc Mon Sep 17 00:00:00 2001 From: redmatrix Date: Wed, 13 Jul 2016 20:17:40 -0700 Subject: let abconfig specify a family --- Zotlabs/Lib/AbConfig.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'Zotlabs/Lib/AbConfig.php') diff --git a/Zotlabs/Lib/AbConfig.php b/Zotlabs/Lib/AbConfig.php index 138d0dfea..cab59abbd 100644 --- a/Zotlabs/Lib/AbConfig.php +++ b/Zotlabs/Lib/AbConfig.php @@ -5,8 +5,10 @@ namespace Zotlabs\Lib; class AbConfig { - static public function Load($chan,$xhash) { - $r = q("select * from abconfig where chan = %d and xchan = '%s'", + static public function Load($chan,$xhash,$family = '') { + if($family) + $where = sprintf(" and family = '%s' ",dbesc($family)); + $r = q("select * from abconfig where chan = %d and xchan = '%s' $where", intval($chan), dbesc($xhash) ); -- cgit v1.2.3 From 237cca7a0d0a025bdbccef19b8e25a687ec7cfa3 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Tue, 19 Jul 2016 19:33:48 -0700 Subject: fixes to perms --- Zotlabs/Lib/AbConfig.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Zotlabs/Lib/AbConfig.php') diff --git a/Zotlabs/Lib/AbConfig.php b/Zotlabs/Lib/AbConfig.php index cab59abbd..cb5d96951 100644 --- a/Zotlabs/Lib/AbConfig.php +++ b/Zotlabs/Lib/AbConfig.php @@ -7,7 +7,7 @@ class AbConfig { static public function Load($chan,$xhash,$family = '') { if($family) - $where = sprintf(" and family = '%s' ",dbesc($family)); + $where = sprintf(" and cat = '%s' ",dbesc($family)); $r = q("select * from abconfig where chan = %d and xchan = '%s' $where", intval($chan), dbesc($xhash) -- cgit v1.2.3 From bc74425872704ad955b37de18639ec831a245761 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Thu, 28 Jul 2016 16:02:51 -0700 Subject: Revert "Merge branch '1.10RC' of https://github.com/redmatrix/hubzilla into 1.10RC_merge" This reverts commit 35f17acb388f68745068d6a60e12c7b777b92282, reversing changes made to 58cf5f310d89026fb526e201c301075725044e48. --- Zotlabs/Lib/AbConfig.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Zotlabs/Lib/AbConfig.php') diff --git a/Zotlabs/Lib/AbConfig.php b/Zotlabs/Lib/AbConfig.php index cb5d96951..cab59abbd 100644 --- a/Zotlabs/Lib/AbConfig.php +++ b/Zotlabs/Lib/AbConfig.php @@ -7,7 +7,7 @@ class AbConfig { static public function Load($chan,$xhash,$family = '') { if($family) - $where = sprintf(" and cat = '%s' ",dbesc($family)); + $where = sprintf(" and family = '%s' ",dbesc($family)); $r = q("select * from abconfig where chan = %d and xchan = '%s' $where", intval($chan), dbesc($xhash) -- cgit v1.2.3