Exporting and Importing ICS-Files

This commit is contained in:
Tobias Hößl 2012-07-14 17:02:21 +00:00
parent a96c8ce670
commit 66384e2e2c
16 changed files with 245 additions and 47 deletions

View file

@ -185,12 +185,7 @@ function wdcal_mySql2icalTime($myqlDate)
*/
function icalendar_sanitize_string($str = "")
{
$str = str_replace("\r\n", "\n", $str);
$str = str_replace("\n\r", "\n", $str);
$str = str_replace("\r", "\n", $str);
$str = str_replace("\n\n", "\n", $str);
$str = str_replace("\n\n", "\n", $str);
return $str;
return preg_replace("/[\\r\\n]+/siu", "\r\n", $str);
}
@ -361,10 +356,8 @@ function dav_create_empty_vevent($uid = "")
}
/**
* @param Sabre_VObject_Component_VEvent $vObject
* @param Sabre_VObject_Component_VCalendar $vObject
* @return Sabre_VObject_Component_VEvent|null
*/
function dav_get_eventComponent(&$vObject)

View file

@ -130,6 +130,7 @@ abstract class Sabre_CalDAV_Backend_Common extends Sabre_CalDAV_Backend_Abstract
$component = null;
$firstOccurence = null;
$lastOccurence = null;
foreach ($vObject->getComponents() as $component) {
if ($component->name !== 'VTIMEZONE') {
$componentType = $component->name;

View file

@ -431,7 +431,6 @@ class Sabre_CalDAV_Backend_Private extends Sabre_CalDAV_Backend_Common
*/
function createCalendarObject($calendarId, $objectUri, $calendarData)
{
$calendarData = icalendar_sanitize_string($calendarData);
$extraData = $this->getDenormalizedData($calendarData);

View file

@ -325,7 +325,7 @@ function wdcal_getEditPage_str(&$localization, $baseurl, $uid, $calendar_id, $ur
$out .= "</div>\n";
if ($recurrence->frequency == "yearly") {
if ($recurrence->byMonth != IntVal(date("m", $event["StartTime"]))) notice("The recurrence of this event cannot be parsed");
if (count($recurrence->byMonth) != 1 || $recurrence->byMonth[0] != date("n", $event["StartTime"])) notice("The recurrence of this event cannot be parsed!");
}
$out .= "<div class='rec_yearly'>";