aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2019-05-06 13:49:17 +0200
committerMario <mario@mariovavti.com>2019-05-06 13:49:17 +0200
commit242878c45c2777d3f603ed0ccfb80bc98bd8d023 (patch)
treec94f10b2d32449791886c98af18a7cd791355848 /include
parent56c460d932f482b3cd0e2493f00927867325287e (diff)
parentc0911da887d610f95c5f544d4b6f63914b1c85bb (diff)
downloadvolse-hubzilla-242878c45c2777d3f603ed0ccfb80bc98bd8d023.tar.gz
volse-hubzilla-242878c45c2777d3f603ed0ccfb80bc98bd8d023.tar.bz2
volse-hubzilla-242878c45c2777d3f603ed0ccfb80bc98bd8d023.zip
Merge branch 'dev' into 'dev'
possible xchan confusion include/follow See merge request hubzilla/core!1635
Diffstat (limited to 'include')
-rw-r--r--include/follow.php15
1 files changed, 8 insertions, 7 deletions
diff --git a/include/follow.php b/include/follow.php
index 1b35f1b32..50b952881 100644
--- a/include/follow.php
+++ b/include/follow.php
@@ -142,7 +142,7 @@ function new_contact($uid,$url,$channel,$interactive = false, $confirm = false)
$sql_options = (($protocol) ? " and xchan_network = '" . dbesc($protocol) . "' " : '');
- $r = q("select * from xchan where xchan_hash = '%s' or xchan_url = '%s' $sql_options limit 1",
+ $r = q("select * from xchan where xchan_hash = '%s' or xchan_url = '%s' $sql_options ",
dbesc($url),
dbesc($url)
);
@@ -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,9 +192,9 @@ 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);
+ $x = array('channel_id' => $uid, 'follow_address' => $url, 'xchan' => $xchan, 'allowed' => $allowed, 'singleton' => 0);
call_hooks('follow_allow',$x);