Merge branch 'dev' into 'dev'

possible xchan confusion include/follow

See merge request hubzilla/core!1635
This commit is contained in:
Mario 2019-05-06 13:49:17 +02:00
commit 242878c45c

View File

@ -142,7 +142,7 @@ function new_contact($uid,$url,$channel,$interactive = false, $confirm = false)
$sql_options = (($protocol) ? " and xchan_network = '" . dbesc($protocol) . "' " : ''); $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),
dbesc($url) dbesc($url)
); );
@ -169,18 +169,19 @@ function new_contact($uid,$url,$channel,$interactive = false, $confirm = false)
} }
if($wf || $d) { 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(($wf) ? $wf : $url),
dbesc($url) dbesc($url)
); );
} }
} }
$xchan = zot_record_preferred($r,'xchan_network');
// if discovery was a success we should have an xchan record in $r // if discovery was a success we should have an xchan record in $r
if($r) { if($xchan) {
$xchan = $r[0]; $xchan_hash = $xchan['xchan_hash'];
$xchan_hash = $r[0]['xchan_hash'];
$their_perms = 0; $their_perms = 0;
} }
} }
@ -191,9 +192,9 @@ function new_contact($uid,$url,$channel,$interactive = false, $confirm = false)
return $result; 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); call_hooks('follow_allow',$x);