class Event
{
- public static function getHTML(array $event, $simple = false)
+ public static function getHTML(array $event, $simple = false, $uriid = 0)
{
if (empty($event)) {
return '';
}
+ $uriid = $event['uri-id'] ?? $uriid;
+
$bd_format = DI::l10n()->t('l F d, Y \@ g:i A'); // Friday January 18, 2011 @ 8 AM.
$event_start = DI::l10n()->getDay(
$o = '';
if (!empty($event['summary'])) {
- $o .= "<h3>" . BBCode::convert(Strings::escapeHtml($event['summary']), false, $simple) . "</h3>";
+ $o .= "<h3>" . BBCode::convertForUriId($uriid, Strings::escapeHtml($event['summary']), $simple) . "</h3>";
}
if (!empty($event['desc'])) {
- $o .= "<div>" . BBCode::convert(Strings::escapeHtml($event['desc']), false, $simple) . "</div>";
+ $o .= "<div>" . BBCode::convertForUriId($uriid, Strings::escapeHtml($event['desc']), $simple) . "</div>";
}
$o .= "<h4>" . DI::l10n()->t('Starts:') . "</h4><p>" . $event_start . "</p>";
}
if (!empty($event['location'])) {
- $o .= "<h4>" . DI::l10n()->t('Location:') . "</h4><p>" . BBCode::convert(Strings::escapeHtml($event['location']), false, $simple) . "</p>";
+ $o .= "<h4>" . DI::l10n()->t('Location:') . "</h4><p>" . BBCode::convertForUriId($uriid, Strings::escapeHtml($event['location']), $simple) . "</p>";
}
return $o;
$o = '<div class="vevent">' . "\r\n";
- $o .= '<div class="summary event-summary">' . BBCode::convert(Strings::escapeHtml($event['summary']), false, $simple) . '</div>' . "\r\n";
+ $o .= '<div class="summary event-summary">' . BBCode::convertForUriId($uriid, Strings::escapeHtml($event['summary']), $simple) . '</div>' . "\r\n";
$o .= '<div class="event-start"><span class="event-label">' . DI::l10n()->t('Starts:') . '</span> <span class="dtstart" title="'
. DateTimeFormat::utc($event['start'], (!empty($event['adjust']) ? DateTimeFormat::ATOM : 'Y-m-d\TH:i:s'))
}
if (!empty($event['desc'])) {
- $o .= '<div class="description event-description">' . BBCode::convert(Strings::escapeHtml($event['desc']), false, $simple) . '</div>' . "\r\n";
+ $o .= '<div class="description event-description">' . BBCode::convertForUriId($uriid, Strings::escapeHtml($event['desc']), $simple) . '</div>' . "\r\n";
}
if (!empty($event['location'])) {
$o .= '<div class="event-location"><span class="event-label">' . DI::l10n()->t('Location:') . '</span> <span class="location">'
- . BBCode::convert(Strings::escapeHtml($event['location']), false, $simple)
+ . BBCode::convertForUriId($uriid, Strings::escapeHtml($event['location']), $simple)
. '</span></div>' . "\r\n";
// Include a map of the location if the [map] BBCode is used.
$event['cid'] = intval($arr['cid'] ?? 0);
$event['guid'] = ($arr['guid'] ?? '') ?: System::createUUID();
$event['uri'] = ($arr['uri'] ?? '') ?: Item::newURI($event['uid'], $event['guid']);
+ $event['uri-id'] = ItemURI::insert(['uri' => $event['uri'], 'guid' => $event['guid']]);
$event['type'] = ($arr['type'] ?? '') ?: 'event';
$event['summary'] = $arr['summary'] ?? '';
$event['desc'] = $arr['desc'] ?? '';
}
$private = intval($arr['private'] ?? 0);
- $conditions = ['uid' => $event['uid']];
if ($event['cid']) {
- $conditions['id'] = $event['cid'];
+ $conditions = ['id' => $event['cid']];
} else {
- $conditions['self'] = true;
+ $conditions = ['uid' => $event['uid'], 'self' => true];
}
$contact = DBA::selectFirst('contact', [], $conditions);
$last_date = '';
$fmt = DI::l10n()->t('l, F j');
foreach ($event_result as $event) {
- $item = Post::selectFirst(['plink', 'author-name', 'author-avatar', 'author-link'], ['id' => $event['itemid']]);
+ $item = Post::selectFirst(['plink', 'author-name', 'author-avatar', 'author-link', 'private', 'uri-id'], ['id' => $event['itemid']]);
if (!DBA::isResult($item)) {
// Using default values when no item had been found
- $item = ['plink' => '', 'author-name' => '', 'author-avatar' => '', 'author-link' => ''];
+ $item = ['plink' => '', 'author-name' => '', 'author-avatar' => '', 'author-link' => '', 'private' => Item::PUBLIC, 'uri-id' => ($event['uri-id'] ?? 0)];
}
$event = array_merge($event, $item);
$drop = [DI::baseUrl() . '/events/drop/' . $event['id'] , DI::l10n()->t('Delete event') , '', ''];
}
- $title = BBCode::convert(Strings::escapeHtml($event['summary']));
+ $title = BBCode::convertForUriId($event['uri-id'], Strings::escapeHtml($event['summary']));
if (!$title) {
- list($title, $_trash) = explode("<br", BBCode::convert(Strings::escapeHtml($event['desc'])), BBCode::API);
+ list($title, $_trash) = explode("<br", BBCode::convertForUriId($event['uri-id'], Strings::escapeHtml($event['desc'])), BBCode::API);
}
$author_link = $event['author-link'];
$event['author-link'] = Contact::magicLink($author_link);
$html = self::getHTML($event);
- $event['summary'] = BBCode::convert(Strings::escapeHtml($event['summary']));
- $event['desc'] = BBCode::convert(Strings::escapeHtml($event['desc']));
- $event['location'] = BBCode::convert(Strings::escapeHtml($event['location']));
+ $event['summary'] = BBCode::convertForUriId($event['uri-id'], Strings::escapeHtml($event['summary']));
+ $event['desc'] = BBCode::convertForUriId($event['uri-id'], Strings::escapeHtml($event['desc']));
+ $event['location'] = BBCode::convertForUriId($event['uri-id'], Strings::escapeHtml($event['location']));
$event_list[] = [
'id' => $event['id'],
'start' => $start,
$tpl = Renderer::getMarkupTemplate('event_stream_item.tpl');
$return = Renderer::replaceMacros($tpl, [
'$id' => $item['event-id'],
- '$title' => BBCode::convert($item['event-summary']),
+ '$title' => BBCode::convertForUriId($item['uri-id'], $item['event-summary']),
'$dtstart_label' => DI::l10n()->t('Starts:'),
'$dtstart_title' => $dtstart_title,
'$dtstart_dt' => $dtstart_dt,
'$author_name' => $item['author-name'],
'$author_link' => $profile_link,
'$author_avatar' => $item['author-avatar'],
- '$description' => BBCode::convert($item['event-desc']),
+ '$description' => BBCode::convertForUriId($item['uri-id'], $item['event-desc']),
'$location_label' => DI::l10n()->t('Location:'),
'$show_map_label' => DI::l10n()->t('Show map'),
'$hide_map_label' => DI::l10n()->t('Hide map'),