diff options
-rw-r--r-- | Zotlabs/Lib/Activity.php | 30 | ||||
-rw-r--r-- | Zotlabs/Lib/Libzot.php | 5 | ||||
-rw-r--r-- | images/default_cover_photos/bggenerator/1200.png | bin | 0 -> 619094 bytes | |||
-rw-r--r-- | images/default_cover_photos/bggenerator/425.png | bin | 0 -> 90041 bytes | |||
-rw-r--r-- | images/default_cover_photos/bggenerator/850.png | bin | 0 -> 315235 bytes | |||
-rw-r--r-- | include/channel.php | 4 | ||||
-rw-r--r-- | include/conversation.php | 11 | ||||
-rw-r--r-- | include/zot.php | 56 |
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 Binary files differnew file mode 100644 index 000000000..53aaafd7f --- /dev/null +++ b/images/default_cover_photos/bggenerator/1200.png diff --git a/images/default_cover_photos/bggenerator/425.png b/images/default_cover_photos/bggenerator/425.png Binary files differnew file mode 100644 index 000000000..5dbfe1e2b --- /dev/null +++ b/images/default_cover_photos/bggenerator/425.png diff --git a/images/default_cover_photos/bggenerator/850.png b/images/default_cover_photos/bggenerator/850.png Binary files differnew file mode 100644 index 000000000..e9f476f86 --- /dev/null +++ b/images/default_cover_photos/bggenerator/850.png 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; +} |