Fix iCal export: no empty organizer or attendee attributes; correctly escape special characters
This commit is contained in:
parent
f99bcb3c54
commit
56cddd1e2c
1 changed files with 12 additions and 8 deletions
|
@ -454,9 +454,12 @@ class calendar_ical
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Escape values according to RFC 2426 2.5
|
||||
*/
|
||||
private function escpape($str)
|
||||
{
|
||||
return preg_replace('/(?<!\\\\)([\:\;\,\\n\\r])/', '\\\$1', $str);
|
||||
return strtr($str, array('\\' => '\\\\', ';' => '\\;', ',' => '\\,'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -469,14 +472,15 @@ class calendar_ical
|
|||
$organizer = "";
|
||||
$attendees = "";
|
||||
foreach ($ats as $at) {
|
||||
if ($at['role']=="ORGANIZER") {
|
||||
//I am an orginizer
|
||||
$organizer .= "ORGANIZER;";
|
||||
if (!empty($at['name']))
|
||||
$organizer .= 'CN="' . $at['name'] . '"';
|
||||
$organizer .= ":mailto:". $at['email'] . self::EOL;
|
||||
if ($at['role'] == "ORGANIZER") {
|
||||
if ($at['email']) {
|
||||
$organizer .= "ORGANIZER;";
|
||||
if (!empty($at['name']))
|
||||
$organizer .= 'CN="' . $at['name'] . '"';
|
||||
$organizer .= ":mailto:". $at['email'] . self::EOL;
|
||||
}
|
||||
}
|
||||
else {
|
||||
else if ($at['email']) {
|
||||
//I am an attendee
|
||||
$attendees .= "ATTENDEE;ROLE=" . $at['role'] . ";PARTSTAT=" . $at['status'];
|
||||
if ($at['rsvp'])
|
||||
|
|
Loading…
Add table
Reference in a new issue