X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FModel%2FEvent.php;h=6f77832209274a12360fa5ff33c3e63d7800d8d6;hb=999c56a2845ba94cc7c6950a2c951fedc8c966b6;hp=5d71dd16af68594ff0c88b2c2232889ab393fc6f;hpb=84b2a35e0500df8114e8a20b032cb3a195c3737d;p=friendica.git diff --git a/src/Model/Event.php b/src/Model/Event.php index 5d71dd16af..6f77832209 100644 --- a/src/Model/Event.php +++ b/src/Model/Event.php @@ -1,6 +1,6 @@ get(DI::userSession()->getLocalUserId(), 'system', 'first_day_of_week', 0); - - $i18n = [ - "firstDay" => $firstDay, - "allday" => DI::l10n()->t("all-day"), - - "Sun" => DI::l10n()->t("Sun"), - "Mon" => DI::l10n()->t("Mon"), - "Tue" => DI::l10n()->t("Tue"), - "Wed" => DI::l10n()->t("Wed"), - "Thu" => DI::l10n()->t("Thu"), - "Fri" => DI::l10n()->t("Fri"), - "Sat" => DI::l10n()->t("Sat"), - - "Sunday" => DI::l10n()->t("Sunday"), - "Monday" => DI::l10n()->t("Monday"), - "Tuesday" => DI::l10n()->t("Tuesday"), - "Wednesday" => DI::l10n()->t("Wednesday"), - "Thursday" => DI::l10n()->t("Thursday"), - "Friday" => DI::l10n()->t("Friday"), - "Saturday" => DI::l10n()->t("Saturday"), - - "Jan" => DI::l10n()->t("Jan"), - "Feb" => DI::l10n()->t("Feb"), - "Mar" => DI::l10n()->t("Mar"), - "Apr" => DI::l10n()->t("Apr"), - "May" => DI::l10n()->t("May"), - "Jun" => DI::l10n()->t("Jun"), - "Jul" => DI::l10n()->t("Jul"), - "Aug" => DI::l10n()->t("Aug"), - "Sep" => DI::l10n()->t("Sept"), - "Oct" => DI::l10n()->t("Oct"), - "Nov" => DI::l10n()->t("Nov"), - "Dec" => DI::l10n()->t("Dec"), - - "January" => DI::l10n()->t("January"), - "February" => DI::l10n()->t("February"), - "March" => DI::l10n()->t("March"), - "April" => DI::l10n()->t("April"), - "June" => DI::l10n()->t("June"), - "July" => DI::l10n()->t("July"), - "August" => DI::l10n()->t("August"), - "September" => DI::l10n()->t("September"), - "October" => DI::l10n()->t("October"), - "November" => DI::l10n()->t("November"), - "December" => DI::l10n()->t("December"), - - "today" => DI::l10n()->t("today"), - "month" => DI::l10n()->t("month"), - "week" => DI::l10n()->t("week"), - "day" => DI::l10n()->t("day"), - - "noevent" => DI::l10n()->t("No events to display"), - - "dtstart_label" => DI::l10n()->t("Starts:"), - "dtend_label" => DI::l10n()->t("Finishes:"), - "location_label" => DI::l10n()->t("Location:") - ]; + $firstDay = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'calendar', 'first_day_of_week') ?? 0; + $defaultView = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'calendar', 'defaultView') ?? 'month'; - return $i18n; + return [ + 'firstDay' => $firstDay, + 'defaultView' => $defaultView, + 'allday' => DI::l10n()->t('all-day'), + + 'Sun' => DI::l10n()->t('Sun'), + 'Mon' => DI::l10n()->t('Mon'), + 'Tue' => DI::l10n()->t('Tue'), + 'Wed' => DI::l10n()->t('Wed'), + 'Thu' => DI::l10n()->t('Thu'), + 'Fri' => DI::l10n()->t('Fri'), + 'Sat' => DI::l10n()->t('Sat'), + + 'Sunday' => DI::l10n()->t('Sunday'), + 'Monday' => DI::l10n()->t('Monday'), + 'Tuesday' => DI::l10n()->t('Tuesday'), + 'Wednesday' => DI::l10n()->t('Wednesday'), + 'Thursday' => DI::l10n()->t('Thursday'), + 'Friday' => DI::l10n()->t('Friday'), + 'Saturday' => DI::l10n()->t('Saturday'), + + 'Jan' => DI::l10n()->t('Jan'), + 'Feb' => DI::l10n()->t('Feb'), + 'Mar' => DI::l10n()->t('Mar'), + 'Apr' => DI::l10n()->t('Apr'), + 'May' => DI::l10n()->t('May'), + 'Jun' => DI::l10n()->t('Jun'), + 'Jul' => DI::l10n()->t('Jul'), + 'Aug' => DI::l10n()->t('Aug'), + 'Sep' => DI::l10n()->t('Sept'), + 'Oct' => DI::l10n()->t('Oct'), + 'Nov' => DI::l10n()->t('Nov'), + 'Dec' => DI::l10n()->t('Dec'), + + 'January' => DI::l10n()->t('January'), + 'February' => DI::l10n()->t('February'), + 'March' => DI::l10n()->t('March'), + 'April' => DI::l10n()->t('April'), + 'June' => DI::l10n()->t('June'), + 'July' => DI::l10n()->t('July'), + 'August' => DI::l10n()->t('August'), + 'September' => DI::l10n()->t('September'), + 'October' => DI::l10n()->t('October'), + 'November' => DI::l10n()->t('November'), + 'December' => DI::l10n()->t('December'), + + 'today' => DI::l10n()->t('today'), + 'month' => DI::l10n()->t('month'), + 'week' => DI::l10n()->t('week'), + 'day' => DI::l10n()->t('day'), + + 'noevent' => DI::l10n()->t('No events to display'), + + 'dtstart_label' => DI::l10n()->t('Starts:'), + 'dtend_label' => DI::l10n()->t('Finishes:'), + 'location_label' => DI::l10n()->t('Location:') + ]; } /** @@ -547,13 +545,14 @@ class Event // 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.')); @@ -616,7 +615,8 @@ class Event AND `start` <= ? $sql_perms", $owner_uid, - $start, $start, + $start, + $start, $finish )); @@ -656,14 +656,14 @@ class Event } // 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'])); @@ -672,9 +672,6 @@ class Event } $event['author-link'] = Contact::magicLink($event['author-link']); - $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'])); return [ 'id' => $event['id'], @@ -711,7 +708,7 @@ class Event } 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; @@ -731,7 +728,7 @@ class Event } 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 @@ -932,8 +929,13 @@ class Event $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'); @@ -1008,7 +1010,7 @@ class Event } } - $location['name'] = BBCode::convert($location['name']); + $location['name'] = BBCode::toPlaintext($location['name'], false); // Construct the map HTML. if (isset($location['address'])) {