Merge branch 'dev'

This commit is contained in:
zotlabs 2018-09-17 22:54:12 -07:00
commit 1da3b960bd
5 changed files with 19 additions and 13 deletions

View file

@ -49,7 +49,7 @@ class Activity {
if(! $r) if(! $r)
return []; return [];
return self::encode_person($r[0]); return self::encode_person($r[0],false);
} }

View file

@ -1,6 +1,9 @@
<?php <?php
namespace Zotlabs\Module; namespace Zotlabs\Module;
use Zotlabs\Lib\Activity;
use Zotlabs\Access\AccessList;
/* /*
@file cover_photo.php @file cover_photo.php
@brief Module-file with functions for handling of cover-photos @brief Module-file with functions for handling of cover-photos
@ -258,7 +261,7 @@ logger('gis: ' . print_r($gis,true));
$arr['item_origin'] = 1; $arr['item_origin'] = 1;
$arr['item_wall'] = 1; $arr['item_wall'] = 1;
$arr['mid'] = item_message_id(); $arr['mid'] = item_message_id();
$arr['obj_type'] = ACTIVITY_OBJ_PHOTO; $arr['obj_type'] = ACTIVITY_OBJ_NOTE;
$arr['verb'] = ACTIVITY_UPDATE; $arr['verb'] = ACTIVITY_UPDATE;
if($profile && stripos($profile['gender'],t('female')) !== false) if($profile && stripos($profile['gender'],t('female')) !== false)
@ -275,17 +278,17 @@ logger('gis: ' . print_r($gis,true));
$arr['body'] = sprintf($t,$channel['channel_name'],$ptext) . "\n\n" . $ltext; $arr['body'] = sprintf($t,$channel['channel_name'],$ptext) . "\n\n" . $ltext;
$arr['obj'] = [ $arr['obj'] = [
'type' => ACTIVITY_OBJ_PHOTO, 'type' => ACTIVITY_OBJ_NOTE,
'published' => datetime_convert('UTC','UTC',$photo['created'],ATOM_TIME), 'published' => datetime_convert('UTC','UTC',$photo['created'],ATOM_TIME),
'updated' => datetime_convert('UTC','UTC',$photo['edited'],ATOM_TIME), 'updated' => datetime_convert('UTC','UTC',$photo['edited'],ATOM_TIME),
'id' => $arr['mid'], 'id' => $arr['mid'],
'url' => [ 'type' => 'Link', 'mediaType' => $photo['mimetype'], 'href' => z_root() . '/photo/' . $photo['resource_id'] . '-7' ], 'url' => [ 'type' => 'Link', 'mediaType' => $photo['mimetype'], 'href' => z_root() . '/photo/' . $photo['resource_id'] . '-7' ],
'source' => [ 'content' => $arr['body'], 'mediaType' => 'text/bbcode' ], 'source' => [ 'content' => $arr['body'], 'mediaType' => 'text/bbcode' ],
'content' => bbcode($arr['body']), 'content' => bbcode($arr['body']),
'actor' => \Zotlabs\Lib\Activity::encode_person($channel), 'actor' => Activity::encode_person($channel,false),
]; ];
$acl = new \Zotlabs\Access\AccessList($channel); $acl = new AccessList($channel);
$x = $acl->get(); $x = $acl->get();
$arr['allow_cid'] = $x['allow_cid']; $arr['allow_cid'] = $x['allow_cid'];

View file

@ -5,6 +5,7 @@ use Zotlabs\Lib\Libsync;
use Zotlabs\Lib\ActivityStreams; use Zotlabs\Lib\ActivityStreams;
use Zotlabs\Lib\Activity; use Zotlabs\Lib\Activity;
use Zotlabs\Web\HTTPSignatures; use Zotlabs\Web\HTTPSignatures;
use Zotlabs\Lib\LDSignatures;
require_once('include/follow.php'); require_once('include/follow.php');
@ -17,7 +18,8 @@ class Follow extends \Zotlabs\Web\Controller {
return; return;
} }
if(ActivityStreams::is_as_request() && argc() == 2) { $abook_id = intval(argv(1)); if(ActivityStreams::is_as_request() && argc() == 2) {
$abook_id = intval(argv(1));
if(! $abook_id) if(! $abook_id)
return; return;
@ -32,7 +34,7 @@ class Follow extends \Zotlabs\Web\Controller {
if(! $chan) if(! $chan)
http_status_exit(404, 'Not found'); http_status_exit(404, 'Not found');
$actor = Activity::encode_person($chan); $actor = Activity::encode_person($chan,true,true);
if(! $actor) if(! $actor)
http_status_exit(404, 'Not found'); http_status_exit(404, 'Not found');
@ -50,7 +52,7 @@ class Follow extends \Zotlabs\Web\Controller {
$headers = []; $headers = [];
$headers['Content-Type'] = 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"' ; $headers['Content-Type'] = 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"' ;
$x['signature'] = \Zotlabs\Lib\LDSignatures::sign($x,$chan); $x['signature'] = LDSignatures::sign($x,$chan);
$ret = json_encode($x, JSON_UNESCAPED_SLASHES); $ret = json_encode($x, JSON_UNESCAPED_SLASHES);
$headers['Digest'] = HTTPSig::generate_digest_header($ret); $headers['Digest'] = HTTPSig::generate_digest_header($ret);
$h = HTTPSig::create_sig($headers,$chan['channel_prvkey'],channel_url($chan)); $h = HTTPSig::create_sig($headers,$chan['channel_prvkey'],channel_url($chan));

View file

@ -6,6 +6,7 @@
use Sabre\VObject; use Sabre\VObject;
use Zotlabs\Lib\Libsync; use Zotlabs\Lib\Libsync;
use Zotlabs\Lib\Activity;
require_once('include/bbcode.php'); require_once('include/bbcode.php');
@ -1038,7 +1039,7 @@ function event_store_item($arr, $event) {
'location' => [ 'type' => 'Place', 'content' => $arr['location'] ], 'location' => [ 'type' => 'Place', 'content' => $arr['location'] ],
'content' => format_event_html($arr), 'content' => format_event_html($arr),
'source' => [ 'content' => format_event_bbcode($arr), 'mediaType' => 'text/bbcode' ], 'source' => [ 'content' => format_event_bbcode($arr), 'mediaType' => 'text/bbcode' ],
'actor' => \Zotlabs\Lib\Activity::encode_person($r[0]), 'actor' => Activity::encode_person($r[0],false),
]; ];
if(! $arr['nofinish']) { if(! $arr['nofinish']) {
@ -1183,7 +1184,7 @@ function event_store_item($arr, $event) {
'location' => [ 'type' => 'Place', 'content' => bbcode($arr['location']) ], 'location' => [ 'type' => 'Place', 'content' => bbcode($arr['location']) ],
'content' => format_event_html($arr), 'content' => format_event_html($arr),
'source' => [ 'content' => format_event_bbcode($arr), 'mediaType' => 'text/bbcode' ], 'source' => [ 'content' => format_event_bbcode($arr), 'mediaType' => 'text/bbcode' ],
'actor' => \Zotlabs\Lib\Activity::encode_person($z), 'actor' => Activity::encode_person($z,false),
]; ];
if(! $arr['nofinish']) { if(! $arr['nofinish']) {

View file

@ -4543,7 +4543,7 @@ function send_profile_photo_activity($channel,$photo,$profile) {
$arr['item_thread_top'] = 1; $arr['item_thread_top'] = 1;
$arr['item_origin'] = 1; $arr['item_origin'] = 1;
$arr['item_wall'] = 1; $arr['item_wall'] = 1;
$arr['obj_type'] = ACTIVITY_OBJ_PHOTO; $arr['obj_type'] = ACTIVITY_OBJ_NOTE;
$arr['verb'] = ACTIVITY_UPDATE; $arr['verb'] = ACTIVITY_UPDATE;
$arr['mid'] = item_message_id(); $arr['mid'] = item_message_id();
@ -4562,14 +4562,14 @@ function send_profile_photo_activity($channel,$photo,$profile) {
$arr['obj'] = [ $arr['obj'] = [
'type' => ACTIVITY_OBJ_PHOTO, 'type' => ACTIVITY_OBJ_NOTE,
'published' => datetime_convert('UTC','UTC',$photo['created'],ATOM_TIME), 'published' => datetime_convert('UTC','UTC',$photo['created'],ATOM_TIME),
'updated' => datetime_convert('UTC','UTC',$photo['edited'],ATOM_TIME), 'updated' => datetime_convert('UTC','UTC',$photo['edited'],ATOM_TIME),
'id' => $arr['mid'], 'id' => $arr['mid'],
'url' => [ 'type' => 'Link', 'mediaType' => $photo['mimetype'], 'href' => z_root() . '/photo/profile/l/' . $channel['channel_id'] ], 'url' => [ 'type' => 'Link', 'mediaType' => $photo['mimetype'], 'href' => z_root() . '/photo/profile/l/' . $channel['channel_id'] ],
'source' => [ 'content' => $arr['body'], 'mediaType' => 'text/bbcode' ], 'source' => [ 'content' => $arr['body'], 'mediaType' => 'text/bbcode' ],
'content' => bbcode($arr['body']), 'content' => bbcode($arr['body']),
'actor' => \Zotlabs\Lib\Activity::encode_person($channel), 'actor' => Activity::encode_person($channel,false),
]; ];
$acl = new AccessList($channel); $acl = new AccessList($channel);