aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2022-03-04 18:43:21 +0000
committerMario <mario@mariovavti.com>2022-03-04 18:43:21 +0000
commit37f56e1efd9d412d1e84d699b40746b52a0a4fc2 (patch)
tree606d5ff09a43adffae056def7a4e4e2b73046497 /include
parent6294be371aa4b489212b76bc306420bf89f80588 (diff)
downloadvolse-hubzilla-37f56e1efd9d412d1e84d699b40746b52a0a4fc2.tar.gz
volse-hubzilla-37f56e1efd9d412d1e84d699b40746b52a0a4fc2.tar.bz2
volse-hubzilla-37f56e1efd9d412d1e84d699b40746b52a0a4fc2.zip
event fixes
Diffstat (limited to 'include')
-rw-r--r--include/event.php14
-rw-r--r--include/html2bbcode.php2
2 files changed, 10 insertions, 6 deletions
diff --git a/include/event.php b/include/event.php
index fbfa4c6d2..c15c44cc0 100644
--- a/include/event.php
+++ b/include/event.php
@@ -73,7 +73,7 @@ function format_event_obj($jobject) {
$event = [];
$object = json_decode($jobject, true);
-
+hz_syslog(print_r($object,true));
/*******
This is our encoded format
@@ -103,7 +103,11 @@ function format_event_obj($jobject) {
// mobilizon sets a timezone in the object
// we will assume that events with an timezone should be adjusted
$tz = $object['timezone'] ?? '';
- $adjust = ((strpos($object['startTime'], 'Z') !== false) || $tz);
+
+ // friendica has its own flag for adjust
+ $dfrn_adjust = $object['dfrn:adjust'] ?? '';
+
+ $adjust = ((strpos($object['startTime'], 'Z') !== false) || $tz || $dfrn_adjust);
$allday = (($adjust) ? false : true);
@@ -140,7 +144,7 @@ function format_event_obj($jobject) {
$event['content'] = replace_macros(get_markup_template('event_item_content.tpl'), array(
'$description' => $object['content'],
'$location_label' => t('Location:'),
- '$location' => ((array_path_exists('location/content', $object)) ? zidify_links(smilies(bbcode($object['location']['content']))) : EMPTY_STR)
+ '$location' => ((array_path_exists('location/name', $object)) ? zidify_links(smilies(bbcode($object['location']['name']))) : EMPTY_STR)
));
}
@@ -1210,7 +1214,7 @@ function event_store_item($arr, $event) {
// RFC3339 Section 4.3
'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'] ],
+ 'location' => [ 'type' => 'Place', 'name' => $arr['location'] ],
'source' => [ 'content' => format_event_bbcode($arr), 'mediaType' => 'text/x-multicode' ],
'url' => [ [ 'mediaType' => 'text/calendar', 'href' => z_root() . '/events/ical/' . $event['event_hash'] ] ],
'actor' => Activity::encode_person($r[0], false),
@@ -1370,7 +1374,7 @@ function event_store_item($arr, $event) {
// RFC3339 Section 4.3
'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' => bbcode($arr['location']) ],
+ 'location' => [ 'type' => 'Place', 'name' => bbcode($arr['location']) ],
'source' => [ 'content' => format_event_bbcode($arr), 'mediaType' => 'text/x-multicode' ],
'url' => [ [ 'mediaType' => 'text/calendar', 'href' => z_root() . '/events/ical/' . $event['event_hash'] ] ],
'actor' => Activity::encode_person($z, false),
diff --git a/include/html2bbcode.php b/include/html2bbcode.php
index 173ea63bd..cc67a5666 100644
--- a/include/html2bbcode.php
+++ b/include/html2bbcode.php
@@ -87,7 +87,7 @@ function deletenode(&$doc, $node)
function html2bbcode($message)
{
- if(!$message)
+ if(!is_string($message) && !$message)
return;
$message = str_replace("\r", "", $message);