4 commits - plugins/calendar
Thomas Brüderli
bruederli at kolabsys.com
Wed Mar 20 09:15:53 CET 2013
plugins/calendar/calendar.php | 5 +++--
plugins/calendar/lib/calendar_ical.php | 22 +++++++++++-----------
2 files changed, 14 insertions(+), 13 deletions(-)
New commits:
commit abceeb6684e44731005d50394c092d49b9e0f363
Merge: c8921be 8ee53e5
Author: Thomas Bruederli <bruederli at kolabsys.com>
Date: Wed Mar 20 09:14:39 2013 +0100
Merge branch 'master' of ssh://git.kolab.org/git/roundcubemail-plugins-kolab
commit c8921be8122d1bf7af4a3b32da8a99249603f25f
Author: Thomas Bruederli <bruederli at kolabsys.com>
Date: Thu Mar 14 09:43:29 2013 +0100
Mention the correct RFC section for iCal value escaping
diff --git a/plugins/calendar/lib/calendar_ical.php b/plugins/calendar/lib/calendar_ical.php
index d859f38..f1716f4 100644
--- a/plugins/calendar/lib/calendar_ical.php
+++ b/plugins/calendar/lib/calendar_ical.php
@@ -482,7 +482,7 @@ class calendar_ical
}
/**
- * Escape values according to RFC 2426 2.5
+ * Escape values according to RFC 2445 4.3.11
*/
private function escape($str)
{
commit bd2cf48d4074c2f236f52ad648bd03dffeab8cbd
Author: Thomas Bruederli <bruederli at kolabsys.com>
Date: Thu Mar 14 09:30:12 2013 +0100
Fix iCal newline escaping (#1694) + typo
diff --git a/plugins/calendar/lib/calendar_ical.php b/plugins/calendar/lib/calendar_ical.php
index 3dfe4c1..d859f38 100644
--- a/plugins/calendar/lib/calendar_ical.php
+++ b/plugins/calendar/lib/calendar_ical.php
@@ -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', ';' => '\;', ',' => '\,'));
}
/**
commit 818cc7a399a1124974557bf2649dd2bab514e40f
Author: Thomas Bruederli <bruederli at kolabsys.com>
Date: Thu Mar 14 09:28:53 2013 +0100
Don't set empty attendees array for move/resize actions; otherwise attendees are deleted
diff --git a/plugins/calendar/calendar.php b/plugins/calendar/calendar.php
index 1835409..1c6f9cd 100644
--- a/plugins/calendar/calendar.php
+++ b/plugins/calendar/calendar.php
@@ -1287,9 +1287,10 @@ class calendar extends rcube_plugin
$event['attachments'] = $attachments;
// check for organizer in attendees
- if (!$event['attendees'])
- $event['attendees'] = array();
if ($action == 'new' || $action == 'edit') {
+ if (!$event['attendees'])
+ $event['attendees'] = array();
+
$emails = $this->get_user_emails();
$organizer = $owner = false;
foreach ((array)$event['attendees'] as $i => $attendee) {
More information about the commits
mailing list