X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=include%2Fevent.php;h=a9f054fc2ed2bf530e9c6c0d9fbadf7570313c6d;hb=146dc5c8cd75dd34b5d0e0f1f214927cdd10ea4b;hp=a87dba64fbcde1b5c4816d7f64bdbecb6805b989;hpb=fcc185a18261f5ae2addeb80bf32e3a9b69ca5ce;p=friendica.git diff --git a/include/event.php b/include/event.php index a87dba64fb..a9f054fc2e 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['desc'])."
"; + + $o .= "".$event_start."
"; + + if(! $ev['nofinish']) + $o .= "".$event_end."
"; + + if(strlen($ev['location'])) + $o .= "".$ev['location']."
"; + + return $o; + } + $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'])){ @@ -43,7 +61,7 @@ function format_event_html($ev) { . bbcode($ev['location']) . '' . "\r\n"; - if (strpos($ev['location'], "[map")===False) { + if (strpos($ev['location'], "[map") !== False) { $map = generate_named_map($ev['location']); if ($map!==$ev['location']) $o.=$map; } @@ -58,7 +76,6 @@ function format_event_html($ev) { function parse_event($h) { require_once('include/Scrape.php'); - require_once('library/HTMLPurifier.auto.php'); require_once('include/html2bbcode'); $h = '' . $h . ''; @@ -204,7 +221,13 @@ function ev_compare($a,$b) { return strcmp($date_a,$date_b); } +function event_delete($event_id) { + if ($event_id == 0) + return; + q("DELETE FROM `event` WHERE `id` = %d", intval($event_id)); + logger("Deleted event ".$event_id, LOGGER_DEBUG); +} function event_store($arr) {