From 6e0bf04276074ad958024133f52a3be0ce88801a Mon Sep 17 00:00:00 2001 From: zotlabs Date: Mon, 6 May 2019 04:15:34 -0700 Subject: possible xchan (protocol) confusion in include/follow --- include/follow.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'include/follow.php') diff --git a/include/follow.php b/include/follow.php index 1b35f1b32..7e0e1644a 100644 --- a/include/follow.php +++ b/include/follow.php @@ -169,18 +169,19 @@ function new_contact($uid,$url,$channel,$interactive = false, $confirm = false) } if($wf || $d) { - $r = q("select * from xchan where xchan_hash = '%s' or xchan_url = '%s' limit 1", + $r = q("select * from xchan where xchan_hash = '%s' or xchan_url = '%s'", dbesc(($wf) ? $wf : $url), dbesc($url) ); } } + $xchan = zot_record_preferred($r,'xchan_network'); + // if discovery was a success we should have an xchan record in $r - if($r) { - $xchan = $r[0]; - $xchan_hash = $r[0]['xchan_hash']; + if($xchan) { + $xchan_hash = $xchan['xchan_hash']; $their_perms = 0; } } @@ -191,7 +192,7 @@ function new_contact($uid,$url,$channel,$interactive = false, $confirm = false) return $result; } - $allowed = (($is_zot || in_array($r[0]['xchan_network'],['rss','zot6'])) ? 1 : 0); + $allowed = (($is_zot || in_array($xchan['xchan_network'],['rss','zot6'])) ? 1 : 0); $x = array('channel_id' => $uid, 'follow_address' => $url, 'xchan' => $r[0], 'allowed' => $allowed, 'singleton' => 0); -- cgit v1.2.3