aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2020-10-13 08:31:57 +0000
committerMario <mario@mariovavti.com>2020-10-13 08:31:57 +0000
commitc01e1b6c337e435d768c8e4e42dc7b06bdfc71e6 (patch)
tree574f2958a6e3109313afbd09291b10c07d65f347
parent612ef9052334b6bb0ac96fb5d7868b8c26c281f0 (diff)
parent08e7c7b249e123edaa81348e54180e89080de012 (diff)
downloadvolse-hubzilla-c01e1b6c337e435d768c8e4e42dc7b06bdfc71e6.tar.gz
volse-hubzilla-c01e1b6c337e435d768c8e4e42dc7b06bdfc71e6.tar.bz2
volse-hubzilla-c01e1b6c337e435d768c8e4e42dc7b06bdfc71e6.zip
Merge branch 'dev' into 5.0RC
-rw-r--r--Zotlabs/Lib/Activity.php30
-rw-r--r--Zotlabs/Lib/Libzot.php5
-rw-r--r--images/default_cover_photos/bggenerator/1200.pngbin0 -> 619094 bytes
-rw-r--r--images/default_cover_photos/bggenerator/425.pngbin0 -> 90041 bytes
-rw-r--r--images/default_cover_photos/bggenerator/850.pngbin0 -> 315235 bytes
-rw-r--r--include/channel.php4
-rw-r--r--include/conversation.php11
-rw-r--r--include/zot.php56
8 files changed, 85 insertions, 21 deletions
diff --git a/Zotlabs/Lib/Activity.php b/Zotlabs/Lib/Activity.php
index f3885033b..6d12f7ea1 100644
--- a/Zotlabs/Lib/Activity.php
+++ b/Zotlabs/Lib/Activity.php
@@ -2499,11 +2499,17 @@ class Activity {
$item['author_xchan'] = self::find_best_identity($item['author_xchan']);
$item['owner_xchan'] = self::find_best_identity($item['owner_xchan']);
- if(! ( $item['author_xchan'] && $item['owner_xchan'])) {
- logger('owner or author missing.');
- return;
+ if(!$item['author_xchan']) {
+ logger('No author: ' . print_r($act, true));
}
+ if(!$item['owner_xchan']) {
+ logger('No owner: ' . print_r($act, true));
+ }
+
+ if(!$item['author_xchan'] || !$item['owner_xchan'])
+ return;
+
if($channel['channel_system']) {
if(! MessageFilter::evaluate($item,get_config('system','pubstream_incl'),get_config('system','pubstream_excl'))) {
logger('post is filtered');
@@ -2699,6 +2705,7 @@ class Activity {
static public function fetch_and_store_replies($channel, $arr) {
logger('fetching replies');
+ logger(print_r($arr,true));
$p = [];
@@ -3185,14 +3192,19 @@ class Activity {
}
static function find_best_identity($xchan) {
- $r = q("select hubloc_hash, hubloc_network from hubloc where hubloc_id_url = '%s'",
- dbesc($xchan)
- );
- if ($r) {
- $r = Libzot::zot_record_preferred($r);
- return $r['hubloc_hash'];
+
+ if(filter_var($xchan, FILTER_VALIDATE_URL)) {
+ $r = q("select hubloc_hash, hubloc_network from hubloc where hubloc_id_url = '%s'",
+ dbesc($xchan)
+ );
+ if ($r) {
+ $r = Libzot::zot_record_preferred($r);
+ return $r['hubloc_hash'];
+ }
}
+
return $xchan;
+
}
}
diff --git a/Zotlabs/Lib/Libzot.php b/Zotlabs/Lib/Libzot.php
index fb64626d6..44f1f399e 100644
--- a/Zotlabs/Lib/Libzot.php
+++ b/Zotlabs/Lib/Libzot.php
@@ -1467,11 +1467,6 @@ class Libzot {
$result = [];
- // Make sure we use the zot6 identity where applicable
-
- $msg_arr['author_xchan'] = Activity::find_best_identity($msg_arr['author_xchan']);
- $msg_arr['owner_xchan'] = Activity::find_best_identity($msg_arr['owner_xchan']);
-
// We've validated the sender. Now make sure that the sender is the owner or author
if(! $public) {
diff --git a/images/default_cover_photos/bggenerator/1200.png b/images/default_cover_photos/bggenerator/1200.png
new file mode 100644
index 000000000..53aaafd7f
--- /dev/null
+++ b/images/default_cover_photos/bggenerator/1200.png
Binary files differ
diff --git a/images/default_cover_photos/bggenerator/425.png b/images/default_cover_photos/bggenerator/425.png
new file mode 100644
index 000000000..5dbfe1e2b
--- /dev/null
+++ b/images/default_cover_photos/bggenerator/425.png
Binary files differ
diff --git a/images/default_cover_photos/bggenerator/850.png b/images/default_cover_photos/bggenerator/850.png
new file mode 100644
index 000000000..e9f476f86
--- /dev/null
+++ b/images/default_cover_photos/bggenerator/850.png
Binary files differ
diff --git a/include/channel.php b/include/channel.php
index ccec4f9ee..ae186d02f 100644
--- a/include/channel.php
+++ b/include/channel.php
@@ -2384,7 +2384,7 @@ function get_zcard($channel, $observer_hash = '', $args = array()) {
$cover = $r[0];
$cover['href'] = z_root() . '/photo/' . $r[0]['resource_id'] . '-' . $r[0]['imgscale'];
} else {
- $default_cover = get_config('system','default_cover_photo','pexels-94622');
+ $default_cover = get_config('system','default_cover_photo','bggenerator');
$cover = [ 'href' => z_root() . '/images/default_cover_photos/' . $default_cover . '/' . $cover_width . '.jpg' ];
}
@@ -2458,7 +2458,7 @@ function get_zcard_embed($channel, $observer_hash = '', $args = array()) {
$cover['href'] = z_root() . '/photo/' . $r[0]['resource_id'] . '-' . $r[0]['imgscale'];
}
else {
- $default_cover = get_config('system','default_cover_photo','pexels-94622');
+ $default_cover = get_config('system','default_cover_photo','bggenerator');
$cover = [ 'href' => z_root() . '/images/default_cover_photos/' . $default_cover . '/' . $cover_width . '.jpg' ];
}
diff --git a/include/conversation.php b/include/conversation.php
index c8c36f241..e77404cff 100644
--- a/include/conversation.php
+++ b/include/conversation.php
@@ -102,19 +102,20 @@ function localize_item(&$item){
logger('localize_item: failed to decode object: ' . print_r($item['obj'],true));
}
- if($obj['author'] && $obj['author']['link'])
+ if(is_array($obj['author']) && $obj['author']['link'])
$author_link = get_rel_link($obj['author']['link'],'alternate');
- elseif($obj['actor'] && $obj['actor']['url'])
- $author_link = $obj['actor']['url'][0]['href'];
+ elseif(is_array($obj['actor']) && $obj['actor']['url'])
+ $author_link = ((is_array($obj['actor']['url'])) ? $obj['actor']['url'][0]['href'] : $obj['actor']['url']);
else
$author_link = '';
$author_name = (($obj['author'] && $obj['author']['name']) ? $obj['author']['name'] : '');
if(!$author_name)
- $author_name = (($obj['actor'] && $obj['actor']['name']) ? $obj['actor']['name'] : '');
+ $author_name = ((is_array($obj['actor']) && $obj['actor']['name']) ? $obj['actor']['name'] : '');
- $item_url = get_rel_link($obj['link'],'alternate');
+ if(is_array($obj['link']))
+ $item_url = get_rel_link($obj['link'],'alternate');
if(!$item_url)
$item_url = $obj['id'];
diff --git a/include/zot.php b/include/zot.php
index e10ef6fd7..38d6288cf 100644
--- a/include/zot.php
+++ b/include/zot.php
@@ -9,6 +9,7 @@
*/
use Zotlabs\Lib\DReport;
+use Zotlabs\Lib\Libzot;
require_once('include/crypto.php');
require_once('include/items.php');
@@ -1952,6 +1953,31 @@ function process_delivery($sender, $arr, $deliveries, $relay, $public = false, $
intval($channel['channel_id']),
dbesc($arr['owner_xchan'])
);
+
+ if(! $ab) {
+
+ $best_owner_xchan = find_best_zot_identity($arr['owner_xchan']);
+
+ $ab = q("select * from abook where abook_channel = %d and abook_xchan = '%s'",
+ intval($channel['channel_id']),
+ dbesc($best_owner_xchan)
+ );
+
+ if($ab)
+ $arr['owner_xchan'] = $best_owner_xchan;
+ }
+
+ $best_author_xchan = find_best_zot_identity($arr['author_xchan']);
+
+ $ab_author = q("select * from abook where abook_channel = %d and abook_xchan = '%s'",
+ intval($channel['channel_id']),
+ dbesc($best_author_xchan)
+ );
+
+ if($ab_author)
+ $arr['author_xchan'] = $best_author_xchan;
+
+
$abook = (($ab) ? $ab[0] : null);
if(intval($arr['item_deleted'])) {
@@ -5341,3 +5367,33 @@ function zot_record_preferred($arr, $check = 'hubloc_network') {
return $arr[0];
}
+
+function find_best_zot_identity($xchan) {
+
+ if (filter_var($xchan, FILTER_VALIDATE_URL)) {
+ $r = q("select hubloc_hash, hubloc_network from hubloc where hubloc_id_url = '%s'",
+ dbesc($xchan)
+ );
+ if ($r) {
+ $r = Libzot::zot_record_preferred($r);
+ return $r['hubloc_hash'];
+ }
+ }
+
+ $r = q("select hubloc_addr from hubloc where hubloc_hash = '%s'",
+ dbesc($xchan)
+ );
+
+ if ($r) {
+
+ $r = q("select hubloc_hash, hubloc_network from hubloc where hubloc_addr = '%s'",
+ dbesc($r[0]['hubloc_addr'])
+ );
+ if ($r) {
+ $r = Libzot::zot_record_preferred($r);
+ return $r['hubloc_hash'];
+ }
+ }
+
+ return $xchan;
+}