aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2019-05-29 09:06:52 +0200
committerMario <mario@mariovavti.com>2019-05-29 09:06:52 +0200
commit767a235611012200c6767ca602d736e7ab3b8b40 (patch)
tree02e161ec42c61fed13ac5020a0a0f0b3dda1f887
parentca8d252ad75306e6d3cd066d5c593e94de1dfbdd (diff)
parent620fc06b6cd068d6819e1613c4ef0ad10f3ba2a6 (diff)
downloadvolse-hubzilla-767a235611012200c6767ca602d736e7ab3b8b40.tar.gz
volse-hubzilla-767a235611012200c6767ca602d736e7ab3b8b40.tar.bz2
volse-hubzilla-767a235611012200c6767ca602d736e7ab3b8b40.zip
Merge branch 'dev' into 'dev'
support 'expires' over Zot6 See merge request hubzilla/core!1661
-rw-r--r--Zotlabs/Lib/Activity.php44
-rw-r--r--Zotlabs/Module/Apschema.php1
-rwxr-xr-xboot.php2
-rw-r--r--include/import.php12
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',
diff --git a/boot.php b/boot.php
index e76440e10..86c3c3272 100755
--- a/boot.php
+++ b/boot.php
@@ -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