diff options
author | Mario <mario@mariovavti.com> | 2022-05-16 20:44:53 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2022-05-16 20:44:53 +0000 |
commit | c1dc16a89dedd029f4cb206009c6ef7d66626c01 (patch) | |
tree | 5652c48329fe01dfadf5ef98fb09d4cab29896c2 /include | |
parent | 66436ce4a2c017b2de167310f302fc5b0c4c6f60 (diff) | |
download | volse-hubzilla-c1dc16a89dedd029f4cb206009c6ef7d66626c01.tar.gz volse-hubzilla-c1dc16a89dedd029f4cb206009c6ef7d66626c01.tar.bz2 volse-hubzilla-c1dc16a89dedd029f4cb206009c6ef7d66626c01.zip |
make sure we use source.content when rendering events to correctly render observer related content. fix wrong media types.
Diffstat (limited to 'include')
-rw-r--r-- | include/event.php | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/include/event.php b/include/event.php index 3d3dda035..f62c22792 100644 --- a/include/event.php +++ b/include/event.php @@ -85,7 +85,7 @@ function format_event_obj($jobject) { 'startTime' => (($arr['adjust']) ? datetime_convert('UTC','UTC',$arr['dtstart'], ATOM_TIME) : datetime_convert('UTC','UTC',$arr['dtstart'],'Y-m-d\\TH:i:s-00:00')), 'content' => bbcode($arr['description']), 'location' => [ 'type' => 'Place', 'content' => $arr['location'] ], - 'source' => [ 'content' => format_event_bbcode($arr), 'mediaType' => 'text/x-multicode' ], + 'source' => [ 'content' => format_event_bbcode($arr), 'mediaType' => 'text/bbcode' ], 'url' => [ [ 'mediaType' => 'text/calendar', 'href' => z_root() . '/events/ical/' . $event['event_hash'] ] ], 'actor' => Activity::encode_person($r[0],false), ]; @@ -141,8 +141,15 @@ function format_event_obj($jobject) { '$event_tz' => ['label' => t('Timezone'), 'value' => (($tz === date_default_timezone_get()) ? '' : $tz)] )); + + $description = []; + + if (strpos($object['source']['content'], '[/event-description]') !== false) { + preg_match("/\[event\-description\](.*?)\[\/event\-description\]/ism", $object['source']['content'], $description); + } + $event['content'] = replace_macros(get_markup_template('event_item_content.tpl'), array( - '$description' => $object['content'], + '$description' => ((isset($description[1]))? zidify_links(smilies(bbcode($description[1]))) : EMPTY_STR), '$location_label' => t('Location:'), '$location' => ((array_path_exists('location/name', $object)) ? zidify_links(smilies(bbcode($object['location']['name']))) : EMPTY_STR) )); @@ -1215,7 +1222,7 @@ function event_store_item($arr, $event) { 'startTime' => (($arr['adjust']) ? datetime_convert('UTC', 'UTC', $arr['dtstart'], ATOM_TIME) : datetime_convert('UTC', 'UTC', $arr['dtstart'], 'Y-m-d\\TH:i:s-00:00')), 'content' => bbcode($arr['description']), 'location' => [ 'type' => 'Place', 'name' => $arr['location'] ], - 'source' => [ 'content' => format_event_bbcode($arr), 'mediaType' => 'text/x-multicode' ], + 'source' => [ 'content' => format_event_bbcode($arr), 'mediaType' => 'text/bbcode' ], 'url' => [ [ 'mediaType' => 'text/calendar', 'href' => z_root() . '/events/ical/' . $event['event_hash'] ] ], 'actor' => Activity::encode_person($r[0], false), 'attachment' => Activity::encode_attachment($r[0]), @@ -1375,7 +1382,7 @@ function event_store_item($arr, $event) { 'startTime' => (($arr['adjust']) ? datetime_convert('UTC', 'UTC', $arr['dtstart'], ATOM_TIME) : datetime_convert('UTC', 'UTC', $arr['dtstart'], 'Y-m-d\\TH:i:s-00:00')), 'content' => bbcode($arr['description']), 'location' => [ 'type' => 'Place', 'name' => bbcode($arr['location']) ], - 'source' => [ 'content' => format_event_bbcode($arr), 'mediaType' => 'text/x-multicode' ], + 'source' => [ 'content' => format_event_bbcode($arr), 'mediaType' => 'text/bbcode' ], 'url' => [ [ 'mediaType' => 'text/calendar', 'href' => z_root() . '/events/ical/' . $event['event_hash'] ] ], 'actor' => Activity::encode_person($z, false), 'attachment' => Activity::encode_attachment($item_arr), |