public static function sortByDate(array $event_list): array
{
- usort($event_list, ['self', 'compareDatesCallback']);
+ usort($event_list, [self::class, 'compareDatesCallback']);
return $event_list;
}
$event['id'] = $event_id;
$item['uid'] = $event['uid'];
- $item['contact-id'] = $event['cid'];
$item['uri'] = $event['uri'];
$item['uri-id'] = ItemURI::getIdByURI($event['uri']);
$item['guid'] = $event['guid'];
$item['allow_gid'] = $event['allow_gid'];
$item['deny_cid'] = $event['deny_cid'];
$item['deny_gid'] = $event['deny_gid'];
- $item['private'] = intval($event['private'] ?? 0);
+ $item['private'] = $event['allow_cid'] && $event['allow_gid'] && $event['deny_cid'] && $event['deny_gid'] ? 0 : 1;
$item['visible'] = 1;
$item['verb'] = Activity::POST;
$item['object-type'] = Activity\ObjectType::EVENT;
- $item['post-type'] = Item::PT_EVENT;
$item['origin'] = $event['cid'] === 0 ? 1 : 0;
$item['body'] = self::getBBCode($event);
$item['event-id'] = $event['id'];
// Query for the event by event id
$events = DBA::toArray(DBA::p(
"SELECT `event`.*, `post-user`.`id` AS `itemid` FROM `event`
- LEFT JOIN `post-user`
- ON `post-user`.`event-id` = `event`.`id`
+ LEFT JOIN `post-user`
+ ON `post-user`.`event-id` = `event`.`id`
AND `post-user`.`uid` = `event`.`uid`
WHERE `event`.`id` = ?
AND `event`.`uid` = ?
$sql_perms",
- $event_id, $owner_uid
+ $event_id,
+ $owner_uid
));
if (empty($events)) {
throw new HTTPException\NotFoundException(DI::l10n()->t('Event not found.'));
AND `start` <= ?
$sql_perms",
$owner_uid,
- $start, $start,
+ $start,
+ $start,
$finish
));
}
// Show edit and drop actions only if the user is the owner of the event and the event
- // is a real event (no bithdays).
+ // is a real event (no birthdays).
$edit = null;
$copy = null;
$drop = null;
if (DI::userSession()->getLocalUserId() && DI::userSession()->getLocalUserId() == $event['uid'] && $event['type'] == 'event') {
- $edit = !$event['cid'] ? ['calendar/event/edit/' . $event['id'], DI::l10n()->t('Edit event') , '', ''] : null;
- $copy = !$event['cid'] ? ['calendar/event/copy/' . $event['id'] , DI::l10n()->t('Duplicate event'), '', ''] : null;
- $drop = ['calendar/api/delete/' . $event['id'] , DI::l10n()->t('Delete event') , '', ''];
+ $edit = !$event['cid'] ? ['calendar/event/edit/' . $event['id'], DI::l10n()->t('Edit event'), '', ''] : null;
+ $copy = !$event['cid'] ? ['calendar/event/copy/' . $event['id'], DI::l10n()->t('Duplicate event'), '', ''] : null;
+ $drop = ['calendar/api/delete/' . $event['id'], DI::l10n()->t('Delete event'), '', ''];
}
$title = BBCode::convertForUriId($event['uri-id'], Strings::escapeHtml($event['summary']));
}
switch ($format) {
- // Format the exported data as a CSV file.
+ // Format the exported data as a CSV file.
case "csv":
$o .= '"Subject", "Start Date", "Start Time", "Description", "End Date", "End Time", "Location"' . PHP_EOL;
}
break;
- // Format the exported data as a ics file.
+ // Format the exported data as a ics file.
case "ical":
$o = 'BEGIN:VCALENDAR' . PHP_EOL
. 'VERSION:2.0' . PHP_EOL
$location = self::locationToArray($item['event-location']);
// Construct the profile link (magic-auth).
- $author = ['uid' => 0, 'id' => $item['author-id'],
- 'network' => $item['author-network'], 'url' => $item['author-link']];
+ $author = [
+ 'uid' => 0,
+ 'id' => $item['author-id'],
+ 'network' => $item['author-network'],
+ 'url' => $item['author-link'],
+ 'alias' => $item['author-alias']
+ ];
$profile_link = Contact::magicLinkByContact($author);
$tpl = Renderer::getMarkupTemplate('event_stream_item.tpl');
}
}
- $location['name'] = BBCode::convert($location['name']);
+ $location['name'] = BBCode::toPlaintext($location['name'], false);
// Construct the map HTML.
if (isset($location['address'])) {