aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Zot6/HTTPSig.php
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2018-11-05 21:29:26 -0800
committerzotlabs <mike@macgirvin.com>2018-11-05 21:29:26 -0800
commite7f1d350c92bb2be87adefd33ab877ef6e121af2 (patch)
tree6d1284ae5549c7d1683330b6e3de7325d8870045 /Zotlabs/Zot6/HTTPSig.php
parent3b9aedec5f8445d723e41835ccba6d0add8068c8 (diff)
downloadvolse-hubzilla-e7f1d350c92bb2be87adefd33ab877ef6e121af2.tar.gz
volse-hubzilla-e7f1d350c92bb2be87adefd33ab877ef6e121af2.tar.bz2
volse-hubzilla-e7f1d350c92bb2be87adefd33ab877ef6e121af2.zip
more zot6 work
Diffstat (limited to 'Zotlabs/Zot6/HTTPSig.php')
-rw-r--r--Zotlabs/Zot6/HTTPSig.php44
1 files changed, 34 insertions, 10 deletions
diff --git a/Zotlabs/Zot6/HTTPSig.php b/Zotlabs/Zot6/HTTPSig.php
index a0f0d3500..f5c59f9d6 100644
--- a/Zotlabs/Zot6/HTTPSig.php
+++ b/Zotlabs/Zot6/HTTPSig.php
@@ -215,14 +215,19 @@ class HTTPSig {
*/
function get_activitystreams_key($id) {
-
- $x = q("select * from xchan left join hubloc on xchan_hash = hubloc_hash where hubloc_addr = '%s' or hubloc_id_url = '%s' limit 1",
+ $x = q("select * from xchan left join hubloc on xchan_portable_id = hubloc_hash where hubloc_addr = '%s' or hubloc_id_url = '%s' limit 1",
dbesc(str_replace('acct:','',$id)),
dbesc($id)
);
+ if(! $x) {
+ $x = q("select * from xchan left join hubloc on xchan_hash = hubloc_hash where hubloc_addr = '%s' or hubloc_id_url = '%s' limit 1",
+ dbesc(str_replace('acct:','',$id)),
+ dbesc($id)
+ );
+ }
if($x && $x[0]['xchan_pubkey']) {
- return [ 'portable_id' => $x[0]['xchan_hash'], 'public_key' => $x[0]['xchan_pubkey'] , 'hubloc' => $x[0] ];
+ return [ 'portable_id' => $x[0]['hubloc_hash'], 'public_key' => $x[0]['xchan_pubkey'] , 'hubloc' => $x[0] ];
}
$r = ActivityStreams::fetch_property($id);
@@ -235,19 +240,25 @@ class HTTPSig {
}
}
- return false;
+ return false;
}
function get_webfinger_key($id) {
- $x = q("select * from xchan left join hubloc on xchan_hash = hubloc_hash where hubloc_addr = '%s' or hubloc_id_url = '%s' limit 1",
+ $x = q("select * from xchan left join hubloc on xchan_portable_id = hubloc_hash where hubloc_addr = '%s' or hubloc_id_url = '%s' limit 1",
dbesc(str_replace('acct:','',$id)),
dbesc($id)
);
+ if(! $x) {
+ $x = q("select * from xchan left join hubloc on xchan_hash = hubloc_hash where hubloc_addr = '%s' or hubloc_id_url = '%s' limit 1",
+ dbesc(str_replace('acct:','',$id)),
+ dbesc($id)
+ );
+ }
if($x && $x[0]['xchan_pubkey']) {
- return [ 'portable_id' => $x[0]['xchan_hash'], 'public_key' => $x[0]['xchan_pubkey'] , 'hubloc' => $x[0] ];
+ return [ 'portable_id' => $x[0]['hubloc_hash'], 'public_key' => $x[0]['xchan_pubkey'] , 'hubloc' => $x[0] ];
}
$wf = Webfinger::exec($id);
@@ -269,18 +280,26 @@ class HTTPSig {
}
}
- return (($key['public_key']) ? $key : false);
+ return (($key['public_key']) ? $key : false);
}
function get_zotfinger_key($id) {
- $x = q("select * from xchan left join hubloc on xchan_hash = hubloc_hash where hubloc_addr = '%s' or hubloc_id_url = '%s' limit 1",
+ $x = q("select * from xchan left join hubloc on xchan_portable_id = hubloc_hash where hubloc_addr = '%s' or hubloc_id_url = '%s' limit 1",
dbesc(str_replace('acct:','',$id)),
dbesc($id)
);
+ if(! $x) {
+ $x = q("select * from xchan left join hubloc on xchan_hash = hubloc_hash where hubloc_addr = '%s' or hubloc_id_url = '%s' limit 1",
+ dbesc(str_replace('acct:','',$id)),
+ dbesc($id)
+ );
+ }
+
+
if($x && $x[0]['xchan_pubkey']) {
- return [ 'portable_id' => $x[0]['xchan_hash'], 'public_key' => $x[0]['xchan_pubkey'] , 'hubloc' => $x[0] ];
+ return [ 'portable_id' => $x[0]['hubloc_hash'], 'public_key' => $x[0]['xchan_pubkey'] , 'hubloc' => $x[0] ];
}
$wf = Webfinger::exec($id);
@@ -302,9 +321,14 @@ class HTTPSig {
if($i['success']) {
$key['portable_id'] = $i['hash'];
- $x = q("select * from xchan left join hubloc on xchan_hash = hubloc_hash where hubloc_id_url = '%s' limit 1",
+ $x = q("select * from xchan left join hubloc on xchan_portable_id = hubloc_hash where hubloc_id_url = '%s' limit 1",
dbesc($l['href'])
);
+ if(! $x) {
+ $x = q("select * from xchan left join hubloc on xchan_hash = hubloc_hash where hubloc_id_url = '%s' limit 1",
+ dbesc($l['href'])
+ );
+ }
if($x) {
$key['hubloc'] = $x[0];
}