From 7de0936dbb3f81f489596ccbe973cdc27c5860b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Lehrke?= Date: Fri, 21 May 2010 16:36:24 +0000 Subject: [PATCH] Fix iCal attendee CN issue --- calendar/inc/class.calendar_ical.inc.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/calendar/inc/class.calendar_ical.inc.php b/calendar/inc/class.calendar_ical.inc.php index 81e3e2f327..b82220868b 100644 --- a/calendar/inc/class.calendar_ical.inc.php +++ b/calendar/inc/class.calendar_ical.inc.php @@ -456,10 +456,13 @@ class calendar_ical extends calendar_boupdate error_log(__FILE__.'['.__LINE__.'] '.__METHOD__ . '()attendee:' . array2string($info) ."\n",3,$this->logfile); } - $participantCN = '"' . (empty($info['cn']) ? $info['name'] : $info['cn']) . '"'; + $participantCN = trim(empty($info['cn']) ? $info['name'] : $info['cn']); + $participantCN = str_replace(array('\\', ',', ';', ':'), + array('\\\\', '\\,', '\\;', '\\:'), + $participantCN); if ($version == '1.0') { - $participantURL = trim($participantCN . (empty($info['email']) ? '' : ' <' . $info['email'] .'>')); + $participantURL = trim('"' . $participantCN . '"' . (empty($info['email']) ? '' : ' <' . $info['email'] .'>')); } else { @@ -2554,7 +2557,9 @@ class calendar_ical extends calendar_boupdate // ... and for provided CN if (!empty($attributes['params']['CN'])) { - $cn = $attributes['params']['CN']; + $cn = str_replace(array('\\,', '\\;', '\\:', '\\\\'), + array(',', ';', ':', '\\'), + $attributes['params']['CN']); if ($cn[0] == '"' && substr($cn,-1) == '"') { $cn = substr($cn,1,-1);