diff options
author | Max Kostikov <max@kostikov.co> | 2019-10-06 19:26:23 +0200 |
---|---|---|
committer | Max Kostikov <max@kostikov.co> | 2019-10-06 19:26:23 +0200 |
commit | d017e34795f124ecf789d8a38b33e684ded6b7d2 (patch) | |
tree | 3aebd8ccbd4a9944bc85bf3cc9c3880cb33b4681 | |
parent | aa44da35bad02fda6c123a7961993ad687353031 (diff) | |
parent | a435363b949021b1beeb7cb124668f672bf41ea2 (diff) | |
download | volse-hubzilla-d017e34795f124ecf789d8a38b33e684ded6b7d2.tar.gz volse-hubzilla-d017e34795f124ecf789d8a38b33e684ded6b7d2.tar.bz2 volse-hubzilla-d017e34795f124ecf789d8a38b33e684ded6b7d2.zip |
Merge branch 'dev' into 'dev'
Dev sync
See merge request kostikov/core!1
-rw-r--r-- | Zotlabs/Lib/Activity.php | 12 | ||||
-rw-r--r-- | include/bbcode.php | 1 | ||||
-rw-r--r-- | include/event.php | 6 |
3 files changed, 16 insertions, 3 deletions
diff --git a/Zotlabs/Lib/Activity.php b/Zotlabs/Lib/Activity.php index b74f6b2bc..844127ee3 100644 --- a/Zotlabs/Lib/Activity.php +++ b/Zotlabs/Lib/Activity.php @@ -202,6 +202,11 @@ class Activity { $ev = bbtoevent($x['content']); if($ev) { + + if (! $ev['timezone']) { + $ev['timezone'] = 'UTC'; + } + $actor = null; if(array_key_exists('author',$x) && array_key_exists('link',$x['author'])) { $actor = $x['author']['link'][0]['href']; @@ -212,14 +217,14 @@ class Activity { 'name' => $ev['summary'], // 'summary' => bbcode($ev['summary'], [ 'cache' => true ]), // RFC3339 Section 4.3 - 'startTime' => (($ev['adjust']) ? datetime_convert('UTC','UTC',$ev['dtstart'], ATOM_TIME) : datetime_convert('UTC','UTC',$ev['dtstart'],'Y-m-d\\TH:i:s-00:00')), + 'startTime' => (($ev['adjust']) ? datetime_convert($ev['timezone'],'UTC',$ev['dtstart'], ATOM_TIME) : datetime_convert('UTC','UTC',$ev['dtstart'],'Y-m-d\\TH:i:s-00:00')), 'content' => bbcode($ev['description'], [ 'cache' => true ]), 'location' => [ 'type' => 'Place', 'content' => bbcode($ev['location'], [ 'cache' => true ]) ], 'source' => [ 'content' => format_event_bbcode($ev), 'mediaType' => 'text/bbcode' ], 'actor' => $actor, ]; if(! $ev['nofinish']) { - $y['endTime'] = (($ev['adjust']) ? datetime_convert('UTC','UTC',$ev['dtend'], ATOM_TIME) : datetime_convert('UTC','UTC',$ev['dtend'],'Y-m-d\\TH:i:s-00:00')); + $y['endTime'] = (($ev['adjust']) ? datetime_convert($ev['timezone'],'UTC',$ev['dtend'], ATOM_TIME) : datetime_convert('UTC','UTC',$ev['dtend'],'Y-m-d\\TH:i:s-00:00')); } // copy attachments from the passed object - these are already formatted for ActivityStreams @@ -1688,11 +1693,12 @@ class Activity { } if($act->obj['type'] === 'Event') { + $s['obj'] = []; $s['obj']['asld'] = $act->obj; $s['obj']['type'] = ACTIVITY_OBJ_EVENT; $s['obj']['id'] = $act->obj['id']; - $s['obj']['title'] = $act->obj['summary']; + $s['obj']['title'] = $act->obj['name']; if(strpos($act->obj['startTime'],'Z')) $s['obj']['adjust'] = true; diff --git a/include/bbcode.php b/include/bbcode.php index 485a1f5b2..bb9144b1d 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -1346,6 +1346,7 @@ function bbcode($Text, $options = []) { $Text = preg_replace("/\[event\-finish\](.*?)\[\/event\-finish\]/ism",'',$Text); $Text = preg_replace("/\[event\-id\](.*?)\[\/event\-id\]/ism",'',$Text); $Text = preg_replace("/\[event\-location\](.*?)\[\/event\-location\]/ism",'',$Text); + $Text = preg_replace("/\[event\-timezone\](.*?)\[\/event\-timezone\]/ism",'',$Text); $Text = preg_replace("/\[event\-adjust\](.*?)\[\/event\-adjust\]/ism",'',$Text); $Text = str_replace("\0",'$',$Text); diff --git a/include/event.php b/include/event.php index 6689919cf..6be1b6705 100644 --- a/include/event.php +++ b/include/event.php @@ -276,6 +276,9 @@ function format_event_bbcode($ev) { if($ev['event_hash']) $o .= '[event-id]' . $ev['event_hash'] . '[/event-id]'; + if($ev['timezone']) + $o .= '[event-timezone]' . $ev['timezone'] . '[/event-timezone]'; + if($ev['adjust']) $o .= '[event-adjust]' . $ev['adjust'] . '[/event-adjust]'; @@ -324,6 +327,9 @@ function bbtoevent($s) { if(preg_match("/\[event\-id\](.*?)\[\/event\-id\]/is",$s,$match)) $ev['event_hash'] = $match[1]; $match = ''; + if(preg_match("/\[event\-timezone\](.*?)\[\/event\-timezone\]/is",$s,$match)) + $ev['timezone'] = $match[1]; + $match = ''; if(preg_match("/\[event\-adjust\](.*?)\[\/event\-adjust\]/is",$s,$match)) $ev['adjust'] = $match[1]; if(array_key_exists('dtstart',$ev)) { |