Fix iCal newline escaping (#1694) + typo
This commit is contained in:
parent
818cc7a399
commit
bd2cf48d40
1 changed files with 10 additions and 10 deletions
|
@ -366,7 +366,7 @@ class calendar_ical
|
|||
|
||||
foreach ($events as $event) {
|
||||
$vevent = "BEGIN:VEVENT" . self::EOL;
|
||||
$vevent .= "UID:" . self::escpape($event['uid']) . self::EOL;
|
||||
$vevent .= "UID:" . self::escape($event['uid']) . self::EOL;
|
||||
$vevent .= $this->format_datetime("DTSTAMP", $event['changed'] ?: new DateTime(), false, true) . self::EOL;
|
||||
if ($event['sequence'])
|
||||
$vevent .= "SEQUENCE:" . intval($event['sequence']) . self::EOL;
|
||||
|
@ -384,21 +384,21 @@ class calendar_ical
|
|||
$vevent .= $this->format_datetime("DTSTART", $event['start'], false) . self::EOL;
|
||||
$vevent .= $this->format_datetime("DTEND", $event['end'], false) . self::EOL;
|
||||
}
|
||||
$vevent .= "SUMMARY:" . self::escpape($event['title']) . self::EOL;
|
||||
$vevent .= "DESCRIPTION:" . self::escpape($event['description']) . self::EOL;
|
||||
$vevent .= "SUMMARY:" . self::escape($event['title']) . self::EOL;
|
||||
$vevent .= "DESCRIPTION:" . self::escape($event['description']) . self::EOL;
|
||||
|
||||
if (!empty($event['attendees'])){
|
||||
$vevent .= $this->_get_attendees($event['attendees']);
|
||||
}
|
||||
|
||||
if (!empty($event['location'])) {
|
||||
$vevent .= "LOCATION:" . self::escpape($event['location']) . self::EOL;
|
||||
$vevent .= "LOCATION:" . self::escape($event['location']) . self::EOL;
|
||||
}
|
||||
if ($event['recurrence'] && !$recurrence_id) {
|
||||
$vevent .= "RRULE:" . libcalendaring::to_rrule($event['recurrence'], self::EOL) . self::EOL;
|
||||
}
|
||||
if(!empty($event['categories'])) {
|
||||
$vevent .= "CATEGORIES:" . self::escpape(strtoupper($event['categories'])) . self::EOL;
|
||||
$vevent .= "CATEGORIES:" . self::escape(strtoupper($event['categories'])) . self::EOL;
|
||||
}
|
||||
if ($event['sensitivity'] > 0) {
|
||||
$vevent .= "CLASS:" . ($event['sensitivity'] == 2 ? 'CONFIDENTIAL' : 'PRIVATE') . self::EOL;
|
||||
|
@ -410,7 +410,7 @@ class calendar_ical
|
|||
$vevent .= "BEGIN:VALARM\n";
|
||||
if ($val[1]) $vevent .= "TRIGGER:" . preg_replace('/^([-+])(.+)/', '\\1PT\\2', $trigger) . self::EOL;
|
||||
else $vevent .= "TRIGGER;VALUE=DATE-TIME:" . gmdate('Ymd\THis\Z', $val[0]) . self::EOL;
|
||||
if ($action) $vevent .= "ACTION:" . self::escpape(strtoupper($action)) . self::EOL;
|
||||
if ($action) $vevent .= "ACTION:" . self::escape(strtoupper($action)) . self::EOL;
|
||||
$vevent .= "END:VALARM\n";
|
||||
}
|
||||
|
||||
|
@ -426,7 +426,7 @@ class calendar_ical
|
|||
$vevent .= "STATUS:TENTATIVE" . self::EOL;
|
||||
|
||||
foreach ((array)$event['x-custom'] as $prop)
|
||||
$vevent .= $prop[0] . ':' . $this->escpape($prop[1]) . self::EOL;
|
||||
$vevent .= $prop[0] . ':' . self::escape($prop[1]) . self::EOL;
|
||||
|
||||
// TODO: export attachments
|
||||
|
||||
|
@ -476,7 +476,7 @@ class calendar_ical
|
|||
// <ATTR>;TZID=Europe/Zurich:20120706T210000
|
||||
$tz = $dt->getTimezone();
|
||||
$tzname = $tz ? $tz->getName() : null;
|
||||
$tzid = $tzname && $tzname != 'UTC' && $tzname != '+00:00' ? ';TZID=' . $tzname : '';
|
||||
$tzid = $tzname && $tzname != 'UTC' && $tzname != '+00:00' ? ';TZID=' . self::escape($tzname) : '';
|
||||
return $attr . $tzid . ':' . $dt->format('Ymd\THis' . ($tzid ? '' : '\Z'));
|
||||
}
|
||||
}
|
||||
|
@ -484,9 +484,9 @@ class calendar_ical
|
|||
/**
|
||||
* Escape values according to RFC 2426 2.5
|
||||
*/
|
||||
private function escpape($str)
|
||||
private function escape($str)
|
||||
{
|
||||
return strtr($str, array('\\' => '\\\\', ';' => '\\;', ',' => '\\,'));
|
||||
return strtr($str, array('\\' => '\\\\', "\n" => '\n', ';' => '\;', ',' => '\,'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Reference in a new issue