Small fixes to iCal import/export

This commit is contained in:
Thomas Bruederli 2012-07-11 09:59:53 +02:00
parent 8d818e8cb1
commit 15a0997601
2 changed files with 7 additions and 2 deletions

View file

@ -927,6 +927,8 @@ class calendar extends rcube_plugin
if ($calendars[$calid]) {
$calname = $calendars[$calid]['name'] ? $calendars[$calid]['name'] : $calid;
$calname = preg_replace('/[^a-z0-9_.-]/i', '', html_entity_decode($calname)); // to 7bit ascii
if (empty($calname)) $calname = $calid;
$events = $this->driver->load_events($start, $end, null, $calid, 0);
}
else

View file

@ -427,9 +427,12 @@ class calendar_ical
// fold lines to 75 chars
return rcube_vcard::rfc2425_fold($ical);
}
private function format_datetime($attr, $dt, $dateonly = false, $utc = false)
{
if (is_numeric($dt))
$dt = new DateTime('@'.$dt);
if ($utc)
$dt->setTimezone(new DateTimeZone('UTC'));
@ -443,7 +446,7 @@ class calendar_ical
return $attr . $tzid . ':' . $dt->format('Ymd\THis' . ($tzid ? '' : 'Z'));
}
}
private function escpape($str)
{
return preg_replace('/(?<!\\\\)([\:\;\,\\n\\r])/', '\\\$1', $str);