aboutsummaryrefslogtreecommitdiffstats
path: root/include/follow.php
diff options
context:
space:
mode:
authorManuel Jiménez Friaza <mjfriaza@openmailbox.org>2019-05-19 13:25:00 +0200
committerManuel Jiménez Friaza <mjfriaza@openmailbox.org>2019-05-19 13:25:00 +0200
commit429140df97a2c273fba6974147ac2e48e7688263 (patch)
tree2e337542da1b0f4c9c383dfeb8a7d9eb63990a72 /include/follow.php
parentf92d2e3f7c6573bd7bab04223c7e28662605c6d8 (diff)
parentaf2b263bc74b16601ec7c123a58f0549613aed27 (diff)
downloadvolse-hubzilla-429140df97a2c273fba6974147ac2e48e7688263.tar.gz
volse-hubzilla-429140df97a2c273fba6974147ac2e48e7688263.tar.bz2
volse-hubzilla-429140df97a2c273fba6974147ac2e48e7688263.zip
Merge remote-tracking branch 'upstream/dev' into dev
Diffstat (limited to 'include/follow.php')
-rw-r--r--include/follow.php16
1 files changed, 9 insertions, 7 deletions
diff --git a/include/follow.php b/include/follow.php
index db77a0160..50b952881 100644
--- a/include/follow.php
+++ b/include/follow.php
@@ -119,6 +119,7 @@ function new_contact($uid,$url,$channel,$interactive = false, $confirm = false)
if( array_key_exists('permissions',$j) && array_key_exists('data',$j['permissions'])) {
$permissions = crypto_unencapsulate(array(
'data' => $j['permissions']['data'],
+ 'alg' => $j['permissions']['alg'],
'key' => $j['permissions']['key'],
'iv' => $j['permissions']['iv']),
$channel['channel_prvkey']);
@@ -141,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)
);
@@ -168,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;
}
}
@@ -190,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);