diff options
author | Mario Vavti <mario@mariovavti.com> | 2019-05-29 09:08:40 +0200 |
---|---|---|
committer | Mario Vavti <mario@mariovavti.com> | 2019-05-29 09:08:40 +0200 |
commit | b6bd2884d56877b9b6c69ac1403e17060341256e (patch) | |
tree | 6ce3c263a5ef87acb27f39a17b2e832b6ee37113 | |
parent | 097b2390dbe2f80e966ae8486ffe8aedaa7461af (diff) | |
parent | 767a235611012200c6767ca602d736e7ab3b8b40 (diff) | |
download | volse-hubzilla-b6bd2884d56877b9b6c69ac1403e17060341256e.tar.gz volse-hubzilla-b6bd2884d56877b9b6c69ac1403e17060341256e.tar.bz2 volse-hubzilla-b6bd2884d56877b9b6c69ac1403e17060341256e.zip |
Merge branch 'dev' into 4.2RC
-rw-r--r-- | Zotlabs/Lib/Activity.php | 44 | ||||
-rw-r--r-- | Zotlabs/Module/Apschema.php | 1 | ||||
-rwxr-xr-x | boot.php | 2 | ||||
-rw-r--r-- | include/import.php | 12 |
4 files changed, 38 insertions, 21 deletions
diff --git a/Zotlabs/Lib/Activity.php b/Zotlabs/Lib/Activity.php index 0843e0a7b..4a1171c5d 100644 --- a/Zotlabs/Lib/Activity.php +++ b/Zotlabs/Lib/Activity.php @@ -294,8 +294,12 @@ class Activity { $ret['published'] = datetime_convert('UTC','UTC',$i['created'],ATOM_TIME); if($i['created'] !== $i['edited']) $ret['updated'] = datetime_convert('UTC','UTC',$i['edited'],ATOM_TIME); + if ($i['expires'] <= NULL_DATE) { + $ret['expires'] = datetime_convert('UTC','UTC',$i['expires'],ATOM_TIME); + } + if($i['app']) { - $ret['instrument'] = [ 'type' => 'Service', 'name' => $i['app'] ]; + $ret['generator'] = [ 'type' => 'Application', 'name' => $i['app'] ]; } if($i['location'] || $i['coord']) { $ret['location'] = [ 'type' => 'Place' ]; @@ -502,7 +506,7 @@ class Activity { if($i['created'] !== $i['edited']) $ret['updated'] = datetime_convert('UTC','UTC',$i['edited'],ATOM_TIME); if($i['app']) { - $ret['instrument'] = [ 'type' => 'Service', 'name' => $i['app'] ]; + $ret['generator'] = [ 'type' => 'Application', 'name' => $i['app'] ]; } if($i['location'] || $i['coord']) { $ret['location'] = [ 'type' => 'Place' ]; @@ -1309,6 +1313,12 @@ class Activity { elseif($act->obj['updated']) { $s['edited'] = datetime_convert('UTC','UTC',$act->obj['updated']); } + if ($act->data['expires']) { + $s['expires'] = datetime_convert('UTC','UTC',$act->data['expires']); + } + elseif ($act->obj['expires']) { + $s['expires'] = datetime_convert('UTC','UTC',$act->obj['expires']); + } if(! $s['created']) $s['created'] = datetime_convert(); @@ -1327,13 +1337,13 @@ class Activity { $s['verb'] = ACTIVITY_POST; $s['obj_type'] = ACTIVITY_OBJ_NOTE; - $instrument = $act->get_property_obj('instrument'); - if(! $instrument) - $instrument = $act->get_property_obj('instrument',$act->obj); + $generator = $act->get_property_obj('generator'); + if(! $generator) + $generator = $act->get_property_obj('generator',$act->obj); - if($instrument && array_key_exists('type',$instrument) - && $instrument['type'] === 'Service' && array_key_exists('name',$instrument)) { - $s['app'] = escape_tags($instrument['name']); + if($generator && array_key_exists('type',$generator) + && in_array($generator['type'], [ 'Application','Service' ] ) && array_key_exists('name',$generator)) { + $s['app'] = escape_tags($generator['name']); } if($channel['channel_system']) { @@ -1493,6 +1503,12 @@ class Activity { elseif($act->obj['updated']) { $s['edited'] = datetime_convert('UTC','UTC',$act->obj['updated']); } + if ($act->data['expires']) { + $s['expires'] = datetime_convert('UTC','UTC',$act->data['expires']); + } + elseif ($act->obj['expires']) { + $s['expires'] = datetime_convert('UTC','UTC',$act->obj['expires']); + } if(in_array($act->type, [ 'Like', 'Dislike', 'Flag', 'Block', 'Announce', 'Accept', 'Reject', 'TentativeAccept', 'emojiReaction' ])) { @@ -1590,14 +1606,14 @@ class Activity { $s['obj'] = $act->obj; } - $instrument = $act->get_property_obj('instrument'); - if((! $instrument) && (! $response_activity)) { - $instrument = $act->get_property_obj('instrument',$act->obj); + $generator = $act->get_property_obj('generator'); + if((! $generator) && (! $response_activity)) { + $generator = $act->get_property_obj('generator',$act->obj); } - if($instrument && array_key_exists('type',$instrument) - && $instrument['type'] === 'Service' && array_key_exists('name',$instrument)) { - $s['app'] = escape_tags($instrument['name']); + if($generator && array_key_exists('type',$generator) + && in_array($generator['type'], [ 'Application', 'Service' ] ) && array_key_exists('name',$generator)) { + $s['app'] = escape_tags($generator['name']); } diff --git a/Zotlabs/Module/Apschema.php b/Zotlabs/Module/Apschema.php index 5b249bfe8..d217041f2 100644 --- a/Zotlabs/Module/Apschema.php +++ b/Zotlabs/Module/Apschema.php @@ -27,6 +27,7 @@ class Apschema extends \Zotlabs\Web\Controller { 'nomadicLocation' => 'zot:nomadicLocation', 'nomadicHubs' => 'zot:nomadicHubs', 'emojiReaction' => 'zot:emojiReaction', + 'expires' => 'zot:expires', 'magicEnv' => [ '@id' => 'zot:magicEnv', @@ -468,7 +468,7 @@ define ( 'NAMESPACE_YMEDIA', 'http://search.yahoo.com/mrss/' ); define ( 'ACTIVITYSTREAMS_JSONLD_REV', 'https://www.w3.org/ns/activitystreams' ); -define ( 'ZOT_APSCHEMA_REV', '/apschema/v1.4' ); +define ( 'ZOT_APSCHEMA_REV', '/apschema/v1.5' ); /** * activity stream defines */ diff --git a/include/import.php b/include/import.php index 92ba014d8..4da0d1a0b 100644 --- a/include/import.php +++ b/include/import.php @@ -897,9 +897,9 @@ function import_menus($channel, $menus) { $m['menu_name'] = $menu['pagetitle']; $m['menu_desc'] = $menu['desc']; if($menu['created']) - $m['menu_created'] = datetime_convert($menu['created']); + $m['menu_created'] = datetime_convert('UTC','UTC',$menu['created']); if($menu['edited']) - $m['menu_edited'] = datetime_convert($menu['edited']); + $m['menu_edited'] = datetime_convert('UTC','UTC',$menu['edited']); $m['menu_flags'] = 0; if($menu['flags']) { @@ -955,9 +955,9 @@ function sync_menus($channel, $menus) { $m['menu_name'] = $menu['pagetitle']; $m['menu_desc'] = $menu['desc']; if($menu['created']) - $m['menu_created'] = datetime_convert($menu['created']); + $m['menu_created'] = datetime_convert('UTC','UTC',$menu['created']); if($menu['edited']) - $m['menu_edited'] = datetime_convert($menu['edited']); + $m['menu_edited'] = datetime_convert('UTC','UTC',$menu['edited']); $m['menu_flags'] = 0; if($menu['flags']) { @@ -1643,12 +1643,12 @@ function import_webpage_element($element, $channel, $type) { $arr['created'] = $iteminfo[0]['created']; } else { // otherwise, generate the creation times and unique id - $arr['created'] = datetime_convert('UTC', 'UTC'); + $arr['created'] = datetime_convert(); $arr['uuid'] = item_message_id(); $arr['mid'] = $arr['parent_mid'] = z_root() . '/item/' . $arr['uuid']; } // Update the edited time whether or not the element already exists - $arr['edited'] = datetime_convert('UTC', 'UTC'); + $arr['edited'] = datetime_convert(); // Import the actual element content $arr['body'] = file_get_contents($element['path']); // The element owner is the channel importing the elements |