aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorMario Vavti <mario@mariovavti.com>2020-09-26 15:05:16 +0200
committerMario Vavti <mario@mariovavti.com>2020-09-26 15:05:16 +0200
commit3f784a974a1ccc15f69865f8015b0c36fd7bc1d7 (patch)
tree4eb9aa05fd00be89fafe943a846042b64b750c65 /include
parentb25054e891fdb1eb88474a289025cf6d9d1d534c (diff)
downloadvolse-hubzilla-3f784a974a1ccc15f69865f8015b0c36fd7bc1d7.tar.gz
volse-hubzilla-3f784a974a1ccc15f69865f8015b0c36fd7bc1d7.tar.bz2
volse-hubzilla-3f784a974a1ccc15f69865f8015b0c36fd7bc1d7.zip
deprecate \Zotlabs\Zot\Finger where apropriate
Diffstat (limited to 'include')
-rw-r--r--include/dir_fns.php21
-rw-r--r--include/socgraph.php2
-rw-r--r--include/zid.php42
3 files changed, 29 insertions, 36 deletions
diff --git a/include/dir_fns.php b/include/dir_fns.php
index 34a6f13cd..f477b35dd 100644
--- a/include/dir_fns.php
+++ b/include/dir_fns.php
@@ -3,6 +3,10 @@
* @file include/dir_fns.php
*/
+use Zotlabs\Lib\Libzot;
+use Zotlabs\Lib\Webfinger;
+use Zotlabs\Lib\Zotfinger;
+
require_once('include/permissions.php');
/**
@@ -67,15 +71,10 @@ function check_upstream_directory() {
$isadir = true;
if ($directory) {
- $h = parse_url($directory);
- if ($h) {
- $j = Zotlabs\Zot\Finger::run('[system]@' . $h['host']);
- if ($j['success']) {
- if (array_key_exists('site', $j) && array_key_exists('directory_mode', $j['site'])) {
- if ($j['site']['directory_mode'] === 'normal') {
- $isadir = false;
- }
- }
+ $j = Zotfinger::exec($directory);
+ if (array_path_exists('data/directory_mode',$j)) {
+ if ($j['data']['directory_mode'] === 'normal') {
+ $isadir = false;
}
}
}
@@ -341,9 +340,9 @@ function update_directory_entry($ud) {
// Hubzilla channels running traditional zot which have not upgraded can or will be dropped from the directory or
// "not found" at the end of the transition period as the directory will only serve zot6 entries at that time.
- $uri = \Zotlabs\Lib\Webfinger::zot_url($ud['ud_addr']);
+ $uri = Webfinger::zot_url($ud['ud_addr']);
if($uri) {
- $record = \Zotlabs\Lib\Zotfinger::exec($uri);
+ $record = Zotfinger::exec($uri);
// Check the HTTP signature
diff --git a/include/socgraph.php b/include/socgraph.php
index 3d26f5cfd..3da4dce63 100644
--- a/include/socgraph.php
+++ b/include/socgraph.php
@@ -158,7 +158,7 @@ function poco_load($xchan = '', $url = null) {
if($address) {
if($network === 'zot6') {
$j = Zotfinger::exec($profile_url);
- if(is_array($j) && array_path_exists('signature/signer',$j) && $j['signature']['signer'] === $profile_url && intval($j['signature']['header_valid'])) {
+ if(array_path_exists('signature/signer',$j) && $j['signature']['signer'] === $profile_url && intval($j['signature']['header_valid'])) {
Libzot::import_xchan($j['data']);
}
$x = q("select xchan_hash from xchan where xchan_hash = '%s' limit 1",
diff --git a/include/zid.php b/include/zid.php
index 10e09e212..538adcc41 100644
--- a/include/zid.php
+++ b/include/zid.php
@@ -2,7 +2,6 @@
use Zotlabs\Lib\Libzot;
use Zotlabs\Lib\Verify;
-use Zotlabs\Zot\Finger;
function is_matrix_url($url) {
@@ -280,44 +279,39 @@ function owt_init($token) {
Verify::purge('owt', '3 MINUTE');
- $key = Verify::get_meta('owt', 0, $token);
+ $ob_hash = Verify::get_meta('owt', 0, $token);
- if($key === false) {
- return;
- }
-
- $parts = explode(',',$key,2);
- if(count($parts) < 2) {
+ if($ob_hash === false) {
return;
}
$r = q("select * from hubloc left join xchan on xchan_hash = hubloc_hash
- where hubloc_network = '%s' and hubloc_addr = '%s' order by hubloc_id desc",
- dbesc($parts[0]),
- dbesc($parts[1])
+ where hubloc_addr = '%s' or hubloc_id_url = '%s' or hubloc_hash = '%s' order by hubloc_id desc",
+ dbesc($ob_hash),
+ dbesc($ob_hash),
+ dbesc($ob_hash)
);
if(! $r) {
-
// finger them if they can't be found.
- // @todo check that this is still needed. Discovery should have been performed in the Owa module.
-
- $j = \Zotlabs\Zot\Finger::run($parts[1], null);
- if ($j['success']) {
- import_xchan($j);
+ $wf = discover_by_webbie($ob_hash);
+ if($wf) {
$r = q("select * from hubloc left join xchan on xchan_hash = hubloc_hash
- where hubloc_network = '%s' and hubloc_addr = '%s' order by hubloc_id desc",
- dbesc($parts[0]),
- dbesc($parts[1])
+ where hubloc_addr = '%s' or hubloc_id_url = '%s' or hubloc_hash = '%s' order by hubloc_id desc",
+ dbesc($ob_hash),
+ dbesc($ob_hash),
+ dbesc($ob_hash)
);
}
}
if(! $r) {
- logger('owt: unable to finger ' . $key);
+ logger('owt: unable to finger ' . $ob_hash);
return;
}
-
- $hubloc = $r[0];
+
+ $r = Libzot::zot_record_preferred($r);
+
+ $hubloc = $r;
$_SESSION['authenticated'] = 1;
@@ -343,7 +337,7 @@ function owt_init($token) {
if (! $delegate_success) {
// normal visitor (remote_channel) login session credentials
$_SESSION['visitor_id'] = $hubloc['xchan_hash'];
- $_SESSION['my_url'] = $hubloc['xchan_url'];
+ $_SESSION['my_url'] = $hubloc['xchan_url'];
$_SESSION['my_address'] = $hubloc['hubloc_addr'];
$_SESSION['remote_hub'] = $hubloc['hubloc_url'];
$_SESSION['DNT'] = 1;