aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Lib
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2019-03-08 14:51:30 -0800
committerzotlabs <mike@macgirvin.com>2019-03-08 14:51:30 -0800
commitb5ed3edc8f3e2a442d836ddef8ffa9114b49e523 (patch)
tree2c1e4ab38fd078b2b9da33646c3558b448002688 /Zotlabs/Lib
parentce0067d8ebf1f7363bfb238bb73fb24078783261 (diff)
downloadvolse-hubzilla-b5ed3edc8f3e2a442d836ddef8ffa9114b49e523.tar.gz
volse-hubzilla-b5ed3edc8f3e2a442d836ddef8ffa9114b49e523.tar.bz2
volse-hubzilla-b5ed3edc8f3e2a442d836ddef8ffa9114b49e523.zip
port zot_record_preferred
Diffstat (limited to 'Zotlabs/Lib')
-rw-r--r--Zotlabs/Lib/Libzot.php24
1 files changed, 22 insertions, 2 deletions
diff --git a/Zotlabs/Lib/Libzot.php b/Zotlabs/Lib/Libzot.php
index bc0826189..50053a2fd 100644
--- a/Zotlabs/Lib/Libzot.php
+++ b/Zotlabs/Lib/Libzot.php
@@ -1197,12 +1197,14 @@ class Libzot {
//logger($AS->debug());
- $r = q("select hubloc_hash from hubloc where hubloc_id_url = '%s' and hubloc_network = 'zot6' limit 1",
+ $r = q("select hubloc_hash, hubloc_network from hubloc where hubloc_id_url = '%s' ",
dbesc($AS->actor['id'])
);
if($r) {
- $arr['author_xchan'] = $r[0]['hubloc_hash'];
+ // selects a zot6 hash if available, otherwise use whatever we have
+ $r = self::zot_record_preferred($r);
+ $arr['author_xchan'] = $r['hubloc_hash'];
}
@@ -3099,4 +3101,22 @@ class Libzot {
return(($x) ? true : false);
}
+
+ static public function zot_record_preferred($arr, $check = 'hubloc_network') {
+
+ if(! $arr) {
+ return $arr;
+ }
+
+ foreach($arr as $v) {
+ if($v[$check] === 'zot6') {
+
+ return $v;
+ }
+ }
+
+ return $arr[0];
+
+ }
+
}