From 8395f67351b3ac2b3739a99967ba58bf8e731051 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Sat, 17 Oct 2015 09:41:58 +0200 Subject: [PATCH] Events on Diaspora now looking okay. --- include/bbcode.php | 2 +- include/event.php | 40 +++++++++++++++++++++++++++++----------- 2 files changed, 30 insertions(+), 12 deletions(-) diff --git a/include/bbcode.php b/include/bbcode.php index 2fcf6c3247..81536d3720 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -1210,7 +1210,7 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true, $simplehtml = fal // start which is always required). Allow desc with a missing summary for compatibility. if((x($ev,'desc') || x($ev,'summary')) && x($ev,'start')) { - $sub = format_event_html($ev); + $sub = format_event_html($ev, $simplehtml); $Text = preg_replace("/\[event\-summary\](.*?)\[\/event\-summary\]/ism",'',$Text); $Text = preg_replace("/\[event\-description\](.*?)\[\/event\-description\]/ism",'',$Text); diff --git a/include/event.php b/include/event.php index d56388a77a..c4111dc0b1 100644 --- a/include/event.php +++ b/include/event.php @@ -3,7 +3,7 @@ require_once('include/bbcode.php'); require_once('include/map.php'); -function format_event_html($ev) { +function format_event_html($ev, $simple = false) { @@ -12,6 +12,32 @@ function format_event_html($ev) { $bd_format = t('l F d, Y \@ g:i A') ; // Friday January 18, 2011 @ 8 AM + $event_start = (($ev['adjust']) ? day_translate(datetime_convert('UTC', date_default_timezone_get(), + $ev['start'] , $bd_format )) + : day_translate(datetime_convert('UTC', 'UTC', + $ev['start'] , $bd_format))); + + $event_end = (($ev['adjust']) ? day_translate(datetime_convert('UTC', date_default_timezone_get(), + $ev['finish'] , $bd_format )) + : day_translate(datetime_convert('UTC', 'UTC', + $ev['finish'] , $bd_format ))); + + if ($simple) { + $o = "

".bbcode($ev['summary'])."

"; + + $o .= "

".bbcode($ev['desc'])."

"; + + $o .= "

".t('Starts:')."

".$event_start."

"; + + if(! $ev['nofinish']) + $o .= "

".t('Finishes:')."

".$event_end."

"; + + if(strlen($ev['location'])) + $o .= "

".t('Location:')."

".$ev['location']."

"; + + return $o; + } + $o = '
' . "\r\n"; @@ -21,21 +47,13 @@ function format_event_html($ev) { $o .= '

' . t('Starts:') . ' ' - . (($ev['adjust']) ? day_translate(datetime_convert('UTC', date_default_timezone_get(), - $ev['start'] , $bd_format )) - : day_translate(datetime_convert('UTC', 'UTC', - $ev['start'] , $bd_format))) + . '" >'.$event_start . '

' . "\r\n"; if(! $ev['nofinish']) $o .= '

' . t('Finishes:') . ' ' - . (($ev['adjust']) ? day_translate(datetime_convert('UTC', date_default_timezone_get(), - $ev['finish'] , $bd_format )) - : day_translate(datetime_convert('UTC', 'UTC', - $ev['finish'] , $bd_format ))) + . '" >'.$event_end . '

' . "\r\n"; if(strlen($ev['location'])){