|
3 | 3 | * @copyright Copyright (c) 2016, ownCloud, Inc. |
4 | 4 | * @copyright Copyright (c) 2017, Georg Ehrke |
5 | 5 | * |
6 | | - * @author brad2014 <[email protected]> |
7 | 6 | * @author Brad Rubenstein <[email protected]> |
8 | 7 | * @author Christoph Wurst <[email protected]> |
9 | 8 | * @author Georg Ehrke <[email protected]> |
@@ -242,8 +241,7 @@ public function schedule(Message $iTipMessage) { |
242 | 241 |
|
243 | 242 | $summary = ((string) $summary !== '') ? (string) $summary : $l10n->t('Untitled event'); |
244 | 243 |
|
245 | | - $this->addSubjectAndHeading($template, $l10n, $method, $summary, |
246 | | - $meetingAttendeeName, $meetingInviteeName); |
| 244 | + $this->addSubjectAndHeading($template, $l10n, $method, $summary); |
247 | 245 | $this->addBulletList($template, $l10n, $vevent); |
248 | 246 |
|
249 | 247 |
|
@@ -408,13 +406,13 @@ private function generateWhenString(IL10N $l10n, VEvent $vevent) { |
408 | 406 | } elseif (isset($vevent->DURATION)) { |
409 | 407 | $isFloating = $vevent->DTSTART->isFloating(); |
410 | 408 | $dtend = clone $vevent->DTSTART; |
411 | | - $endDateTime = $end->getDateTime(); |
| 409 | + $endDateTime = $dtend->getDateTime(); |
412 | 410 | $endDateTime = $endDateTime->add(DateTimeParser::parse($vevent->DURATION->getValue())); |
413 | 411 | $dtend->setDateTime($endDateTime, $isFloating); |
414 | 412 | } elseif (!$vevent->DTSTART->hasTime()) { |
415 | 413 | $isFloating = $vevent->DTSTART->isFloating(); |
416 | 414 | $dtend = clone $vevent->DTSTART; |
417 | | - $endDateTime = $end->getDateTime(); |
| 415 | + $endDateTime = $dtend->getDateTime(); |
418 | 416 | $endDateTime = $endDateTime->modify('+1 day'); |
419 | 417 | $dtend->setDateTime($endDateTime, $isFloating); |
420 | 418 | } else { |
@@ -539,19 +537,20 @@ private function addBulletList(IEMailTemplate $template, IL10N $l10n, $vevent) { |
539 | 537 | $this->getAbsoluteImagePath('caldav/location.svg'),'','',self::IMIP_INDENT); |
540 | 538 | } |
541 | 539 | if ($vevent->URL) { |
| 540 | + $url = $vevent->URL->getValue(); |
542 | 541 | $template->addBodyListItem(sprintf('<a href="%s">%s</a>', |
543 | | - htmlspecialchars($vevent->URL), |
544 | | - htmlspecialchars($vevent->URL)), |
| 542 | + htmlspecialchars($url), |
| 543 | + htmlspecialchars($url)), |
545 | 544 | $l10n->t('Link:'), |
546 | 545 | $this->getAbsoluteImagePath('caldav/link.svg'), |
547 | | - $vevent->URL,'',self::IMIP_INDENT); |
| 546 | + $url,'',self::IMIP_INDENT); |
548 | 547 | } |
549 | 548 |
|
550 | 549 | $this->addAttendees($template, $l10n, $vevent); |
551 | 550 |
|
552 | 551 | /* Put description last, like an email body, since it can be arbitrarily long */ |
553 | 552 | if ($vevent->DESCRIPTION) { |
554 | | - $template->addBodyListItem($vevent->DESCRIPTION, $l10n->t('Description:'), |
| 553 | + $template->addBodyListItem($vevent->DESCRIPTION->getValue(), $l10n->t('Description:'), |
555 | 554 | $this->getAbsoluteImagePath('caldav/description.svg'),'','',self::IMIP_INDENT); |
556 | 555 | } |
557 | 556 | } |
@@ -579,18 +578,23 @@ private function addAttendees(IEMailTemplate $template, IL10N $l10n, VEvent $vev |
579 | 578 | } |
580 | 579 |
|
581 | 580 | if (isset($vevent->ORGANIZER)) { |
| 581 | + /** @var Property\ICalendar\CalAddress $organizer */ |
582 | 582 | $organizer = $vevent->ORGANIZER; |
583 | 583 | $organizerURI = $organizer->getNormalizedValue(); |
584 | 584 | list($scheme,$organizerEmail) = explode(':',$organizerURI,2); # strip off scheme mailto: |
| 585 | + /** @var string|null $organizerName */ |
585 | 586 | $organizerName = isset($organizer['CN']) ? $organizer['CN'] : null; |
586 | 587 | $organizerHTML = sprintf('<a href="%s">%s</a>', |
587 | 588 | htmlspecialchars($organizerURI), |
588 | 589 | htmlspecialchars($organizerName ?: $organizerEmail)); |
589 | 590 | $organizerText = sprintf('%s <%s>', $organizerName, $organizerEmail); |
590 | | - if (isset($organizer['PARTSTAT']) |
591 | | - && strcasecmp($organizer['PARTSTAT'], 'ACCEPTED') === 0) { |
592 | | - $organizerHTML .= ' ✔︎'; |
593 | | - $organizerText .= ' ✔︎'; |
| 591 | + if (isset($organizer['PARTSTAT'])) { |
| 592 | + /** @var Parameter $partstat */ |
| 593 | + $partstat = $organizer['PARTSTAT']; |
| 594 | + if (strcasecmp($partstat->getValue(), 'ACCEPTED') === 0) { |
| 595 | + $organizerHTML .= ' ✔︎'; |
| 596 | + $organizerText .= ' ✔︎'; |
| 597 | + } |
594 | 598 | } |
595 | 599 | $template->addBodyListItem($organizerHTML, $l10n->t('Organizer:'), |
596 | 600 | $this->getAbsoluteImagePath('caldav/organizer.svg'), |
|
0 commit comments