aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2019-03-10 11:40:33 +0100
committerMario <mario@mariovavti.com>2019-03-10 11:40:33 +0100
commit91358010a0501eebc6289926ec0f5a670f9a8e1f (patch)
tree37423abb2147b56945ac43a7ad0f13936890eec4
parent73c96f35c1b1e50518179f430ceaa3ebc0a7d643 (diff)
parent51024d382172c5e2e62bacc6d9103a1caa40e4a5 (diff)
downloadvolse-hubzilla-91358010a0501eebc6289926ec0f5a670f9a8e1f.tar.gz
volse-hubzilla-91358010a0501eebc6289926ec0f5a670f9a8e1f.tar.bz2
volse-hubzilla-91358010a0501eebc6289926ec0f5a670f9a8e1f.zip
Merge branch 'dev' into 'dev'
non-critical: port zot_record_preferred() See merge request hubzilla/core!1546
-rw-r--r--Zotlabs/Lib/ActivityStreams.php5
-rw-r--r--Zotlabs/Lib/Apps.php1
-rw-r--r--Zotlabs/Lib/Libzot.php24
-rw-r--r--Zotlabs/Module/Item.php1
-rw-r--r--include/zid.php48
5 files changed, 76 insertions, 3 deletions
diff --git a/Zotlabs/Lib/ActivityStreams.php b/Zotlabs/Lib/ActivityStreams.php
index a357b6d69..006744aff 100644
--- a/Zotlabs/Lib/ActivityStreams.php
+++ b/Zotlabs/Lib/ActivityStreams.php
@@ -319,7 +319,10 @@ class ActivityStreams {
function get_compound_property($property, $base = '', $namespace = '', $first = false) {
$x = $this->get_property_obj($property, $base, $namespace);
if($this->is_url($x)) {
- $x = $this->fetch_property($x);
+ $y = $this->fetch_property($x);
+ if (is_array($y)) {
+ $x = $y;
+ }
}
// verify and unpack JSalmon signature if present
diff --git a/Zotlabs/Lib/Apps.php b/Zotlabs/Lib/Apps.php
index 7541c68a4..fefc6639d 100644
--- a/Zotlabs/Lib/Apps.php
+++ b/Zotlabs/Lib/Apps.php
@@ -328,6 +328,7 @@ class Apps {
'Bookmarks' => t('Bookmarks'),
'Chatrooms' => t('Chatrooms'),
'Content Filter' => t('Content Filter'),
+ 'Content Import' => t('Content Import'),
'Connections' => t('Connections'),
'Remote Diagnostics' => t('Remote Diagnostics'),
'Suggest Channels' => t('Suggest Channels'),
diff --git a/Zotlabs/Lib/Libzot.php b/Zotlabs/Lib/Libzot.php
index fd1538f0b..70602bbbc 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'];
}
@@ -3096,4 +3098,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];
+
+ }
+
}
diff --git a/Zotlabs/Module/Item.php b/Zotlabs/Module/Item.php
index ebcf632ef..b247df0fd 100644
--- a/Zotlabs/Module/Item.php
+++ b/Zotlabs/Module/Item.php
@@ -55,6 +55,7 @@ class Item extends Controller {
$sigdata = HTTPSig::verify(EMPTY_STR);
if($sigdata['portable_id'] && $sigdata['header_valid']) {
$portable_id = $sigdata['portable_id'];
+ observer_auth($portable_id);
}
$item_normal = " and item.item_hidden = 0 and item.item_type = 0 and item.item_unpublished = 0 and item.item_delayed = 0 and item.item_blocked = 0 ";
diff --git a/include/zid.php b/include/zid.php
index a37ebe1f6..0b12689ef 100644
--- a/include/zid.php
+++ b/include/zid.php
@@ -352,3 +352,51 @@ function owt_init($token) {
logger('OpenWebAuth: auth success from ' . $hubloc['xchan_addr']);
}
+
+
+function observer_auth($ob_hash) {
+
+ if($ob_hash === false) {
+ return;
+ }
+
+ $r = q("select * from hubloc left join xchan on xchan_hash = hubloc_hash
+ 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.
+ $wf = discover_by_webbie($ob_hash);
+ if($wf) {
+ $r = q("select * from hubloc left join xchan on xchan_hash = hubloc_hash
+ 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('unable to finger ' . $ob_hash);
+ return;
+ }
+
+ $hubloc = $r[0];
+
+ $_SESSION['authenticated'] = 1;
+
+ // normal visitor (remote_channel) login session credentials
+ $_SESSION['visitor_id'] = $hubloc['xchan_hash'];
+ $_SESSION['my_url'] = $hubloc['xchan_url'];
+ $_SESSION['my_address'] = $hubloc['hubloc_addr'];
+ $_SESSION['remote_hub'] = $hubloc['hubloc_url'];
+ $_SESSION['DNT'] = 1;
+
+ \App::set_observer($hubloc);
+ require_once('include/security.php');
+ \App::set_groups(init_groups_visitor($_SESSION['visitor_id']));
+
+}