From: Tobias Hößl Date: Sat, 11 Aug 2012 08:07:19 +0000 (+0000) Subject: Second part of refactoring; should be runnable again, yet not thoroughly tested X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=6186153f689e4863a75bf574f97cc75ada7954c9;hp=b8234a1cb8d6603bf527fa12f6be9062b35efa8d;p=friendica-addons.git Second part of refactoring; should be runnable again, yet not thoroughly tested --- diff --git a/dav/SabreDAV/ChangeLog b/dav/SabreDAV/ChangeLog index 1199ae76..3f424d95 100644 --- a/dav/SabreDAV/ChangeLog +++ b/dav/SabreDAV/ChangeLog @@ -14,6 +14,7 @@ only used for informational purposes. * BC Break: The DAV: namespace is no longer converted to urn:DAV. This was a workaround for a bug in older PHP versions (pre-5.3). + * Changed: The Sabre_VObject library now spawned into it's own project! * New feature: Support for caldav notifications! * Changed: Responsibility for dealing with the calendar-query is now moved from the CalDAV plugin to the CalDAV backends. This allows for @@ -33,13 +34,14 @@ * Fixed: Uploaded VCards without a UID are now rejected. (thanks Dominik!) * Fixed: Rejecting calendar objects if they are not in the supported-calendar-component list. (thanks Armin!) - * Fixed: Workaround for 10.8 Mountain Lion vCards, as it needs \r line - endings to parse them correctly. * Fixed: Issue 219: serialize() now reorders correctly. * Fixed: Sabre_DAV_XMLUtil no longer returns empty $dom->childNodes if there is whitespace in $dom. -1.6.4-stable (2012-??-??) +1.6.5-stable (2012-??-??) + * Fixed: Workaround for line-ending bug OS X 10.8 addressbook has. + +1.6.4-stable (2012-08-02) * Fixed: Issue 220: Calendar-query filters may fail when filtering on alarms, if an overridden event has it's alarm removed. * Fixed: Compatibility for OS/X 10.8 iCal in the IMipHandler. @@ -56,6 +58,8 @@ exactly on the start of a time-range. * Fixed: HTTP basic auth did not correctly deal with passwords containing colons on some servers. + * Fixed: Issue 228: DTEND is now non-inclusive for all-day events in the + calendar-query REPORT and free-busy calculations. 1.6.3-stable (2012-06-12) * Added: It's now possible to specify in Sabre_DAV_Client which type of diff --git a/dav/SabreDAV/composer.json b/dav/SabreDAV/composer.json index 8875829e..1a427e76 100644 --- a/dav/SabreDAV/composer.json +++ b/dav/SabreDAV/composer.json @@ -1,21 +1,30 @@ { - "name": "evert/sabredav", + "name": "sabre/dav", "type": "library", "description": "WebDAV Framework for PHP", "keywords": ["Framework", "WebDAV", "CalDAV", "CardDAV", "iCalendar"], "homepage": "http://code.google.com/p/sabredav/", - "license": "New BSD License", + "license" : "BSD-3-Clause", "authors": [ { "name": "Evert Pot", "email": "evert@rooftopsolutions.nl", - "homepage" : "http://www.rooftopsolutions.nl/" + "homepage" : "http://www.rooftopsolutions.nl/", + "role" : "Developer" } ], "require": { - "php": ">=5.3.1" + "php": ">=5.3.1", + "sabre/vobject" : "master-dev" + }, + "provide" : { + "evert/sabredav" : "2.0.0" }, "autoload": { "psr-0": { "Sabre": "lib/" } + }, + "support" : { + "forum" : "https://groups.google.com/group/sabredav-discuss", + "source" : "https://github.com/evert/sabredav" } } diff --git a/dav/SabreDAV/lib/Sabre/CalDAV/Backend/Abstract.php b/dav/SabreDAV/lib/Sabre/CalDAV/Backend/Abstract.php index 480e6329..8adf10e1 100644 --- a/dav/SabreDAV/lib/Sabre/CalDAV/Backend/Abstract.php +++ b/dav/SabreDAV/lib/Sabre/CalDAV/Backend/Abstract.php @@ -1,5 +1,7 @@ getCalendarObject($object['calendarid'], $object['uri']); } - $vObject = Sabre_VObject_Reader::read($object['calendardata']); + $vObject = VObject\Reader::read($object['calendardata']); $validator = new Sabre_CalDAV_CalendarQueryValidator(); return $validator->validate($vObject, $filters); diff --git a/dav/SabreDAV/lib/Sabre/CalDAV/Backend/PDO.php b/dav/SabreDAV/lib/Sabre/CalDAV/Backend/PDO.php index 105ebd33..74b34267 100644 --- a/dav/SabreDAV/lib/Sabre/CalDAV/Backend/PDO.php +++ b/dav/SabreDAV/lib/Sabre/CalDAV/Backend/PDO.php @@ -1,5 +1,7 @@ DTEND->getDateTime()->getTimeStamp(); } elseif (isset($component->DURATION)) { $endDate = clone $component->DTSTART->getDateTime(); - $endDate->add(Sabre_VObject_DateTimeParser::parse($component->DURATION->value)); + $endDate->add(VObject\DateTimeParser::parse($component->DURATION->value)); $lastOccurence = $endDate->getTimeStamp(); - } elseif ($component->DTSTART->getDateType()===Sabre_VObject_Property_DateTime::DATE) { + } elseif ($component->DTSTART->getDateType()===VObject\Property\DateTime::DATE) { $endDate = clone $component->DTSTART->getDateTime(); $endDate->modify('+1 day'); $lastOccurence = $endDate->getTimeStamp(); @@ -494,7 +496,7 @@ class Sabre_CalDAV_Backend_PDO extends Sabre_CalDAV_Backend_Abstract { $lastOccurence = $firstOccurence; } } else { - $it = new Sabre_VObject_RecurrenceIterator($vObject, (string)$component->UID); + $it = new VObject\RecurrenceIterator($vObject, (string)$component->UID); $maxDate = new DateTime(self::MAX_DATE); if ($it->isInfinite()) { $lastOccurence = $maxDate->getTimeStamp(); diff --git a/dav/SabreDAV/lib/Sabre/CalDAV/CalendarQueryParser.php b/dav/SabreDAV/lib/Sabre/CalDAV/CalendarQueryParser.php index 098edccc..b95095f9 100644 --- a/dav/SabreDAV/lib/Sabre/CalDAV/CalendarQueryParser.php +++ b/dav/SabreDAV/lib/Sabre/CalDAV/CalendarQueryParser.php @@ -1,5 +1,7 @@ item(0); if ($start = $timeRangeNode->getAttribute('start')) { - $start = Sabre_VObject_DateTimeParser::parseDateTime($start); + $start = VObject\DateTimeParser::parseDateTime($start); } else { $start = null; } if ($end = $timeRangeNode->getAttribute('end')) { - $end = Sabre_VObject_DateTimeParser::parseDateTime($end); + $end = VObject\DateTimeParser::parseDateTime($end); } else { $end = null; } @@ -274,13 +276,13 @@ class Sabre_CalDAV_CalendarQueryParser { if(!$start) { throw new Sabre_DAV_Exception_BadRequest('The "start" attribute is required for the CALDAV:expand element'); } - $start = Sabre_VObject_DateTimeParser::parseDateTime($start); + $start = VObject\DateTimeParser::parseDateTime($start); $end = $parentNode->getAttribute('end'); if(!$end) { throw new Sabre_DAV_Exception_BadRequest('The "end" attribute is required for the CALDAV:expand element'); } - $end = Sabre_VObject_DateTimeParser::parseDateTime($end); + $end = VObject\DateTimeParser::parseDateTime($end); if ($end <= $start) { throw new Sabre_DAV_Exception_BadRequest('The end-date must be larger than the start-date in the expand element.'); diff --git a/dav/SabreDAV/lib/Sabre/CalDAV/CalendarQueryValidator.php b/dav/SabreDAV/lib/Sabre/CalDAV/CalendarQueryValidator.php index 8f674840..53e86fc5 100644 --- a/dav/SabreDAV/lib/Sabre/CalDAV/CalendarQueryValidator.php +++ b/dav/SabreDAV/lib/Sabre/CalDAV/CalendarQueryValidator.php @@ -1,5 +1,7 @@ parent->name === 'VEVENT' && $component->parent->RRULE) { // Fire up the iterator! - $it = new Sabre_VObject_RecurrenceIterator($component->parent->parent, (string)$component->parent->UID); + $it = new VObject\RecurrenceIterator($component->parent->parent, (string)$component->parent->UID); while($it->valid()) { $expandedEvent = $it->getEventObject(); diff --git a/dav/SabreDAV/lib/Sabre/CalDAV/ICSExportPlugin.php b/dav/SabreDAV/lib/Sabre/CalDAV/ICSExportPlugin.php index ec42b406..d3e4e7b7 100644 --- a/dav/SabreDAV/lib/Sabre/CalDAV/ICSExportPlugin.php +++ b/dav/SabreDAV/lib/Sabre/CalDAV/ICSExportPlugin.php @@ -1,5 +1,7 @@ version = '2.0'; if (Sabre_DAV_Server::$exposeVersion) { $calendar->prodid = '-//SabreDAV//SabreDAV ' . Sabre_DAV_Version::VERSION . '//EN'; @@ -103,7 +105,7 @@ class Sabre_CalDAV_ICSExportPlugin extends Sabre_DAV_ServerPlugin { } $nodeData = $node[200]['{' . Sabre_CalDAV_Plugin::NS_CALDAV . '}calendar-data']; - $nodeComp = Sabre_VObject_Reader::read($nodeData); + $nodeComp = VObject\Reader::read($nodeData); foreach($nodeComp->children() as $child) { diff --git a/dav/SabreDAV/lib/Sabre/CalDAV/Plugin.php b/dav/SabreDAV/lib/Sabre/CalDAV/Plugin.php index 0b0978f1..c0e4a206 100644 --- a/dav/SabreDAV/lib/Sabre/CalDAV/Plugin.php +++ b/dav/SabreDAV/lib/Sabre/CalDAV/Plugin.php @@ -1,5 +1,7 @@ server->getPropertiesForPath($uri,$properties); if ($expand && isset($objProps[200]['{' . self::NS_CALDAV . '}calendar-data'])) { - $vObject = Sabre_VObject_Reader::read($objProps[200]['{' . self::NS_CALDAV . '}calendar-data']); + $vObject = VObject\Reader::read($objProps[200]['{' . self::NS_CALDAV . '}calendar-data']); $vObject->expand($start, $end); $objProps[200]['{' . self::NS_CALDAV . '}calendar-data'] = $vObject->serialize(); } @@ -543,7 +545,7 @@ class Sabre_CalDAV_Plugin extends Sabre_DAV_ServerPlugin { if (isset($properties[200]['{urn:ietf:params:xml:ns:caldav}calendar-data'])) { $validator = new Sabre_CalDAV_CalendarQueryValidator(); - $vObject = Sabre_VObject_Reader::read($properties[200]['{urn:ietf:params:xml:ns:caldav}calendar-data']); + $vObject = VObject\Reader::read($properties[200]['{urn:ietf:params:xml:ns:caldav}calendar-data']); if ($validator->validate($vObject,$parser->filters)) { // If the client didn't require the calendar-data property, @@ -577,7 +579,7 @@ class Sabre_CalDAV_Plugin extends Sabre_DAV_ServerPlugin { if ($parser->expand) { // We need to do some post-processing - $vObject = Sabre_VObject_Reader::read($properties[200]['{urn:ietf:params:xml:ns:caldav}calendar-data']); + $vObject = VObject\Reader::read($properties[200]['{urn:ietf:params:xml:ns:caldav}calendar-data']); $vObject->expand($parser->expand['start'], $parser->expand['end']); $properties[200]['{' . self::NS_CALDAV . '}calendar-data'] = $vObject->serialize(); } @@ -617,10 +619,10 @@ class Sabre_CalDAV_Plugin extends Sabre_DAV_ServerPlugin { } if ($start) { - $start = Sabre_VObject_DateTimeParser::parseDateTime($start); + $start = VObject\DateTimeParser::parseDateTime($start); } if ($end) { - $end = Sabre_VObject_DateTimeParser::parseDateTime($end); + $end = VObject\DateTimeParser::parseDateTime($end); } if (!$start && !$end) { @@ -647,7 +649,7 @@ class Sabre_CalDAV_Plugin extends Sabre_DAV_ServerPlugin { return $obj; }, $calendar->getChildren()); - $generator = new Sabre_VObject_FreeBusyGenerator(); + $generator = new VObject\FreeBusyGenerator(); $generator->setObjects($objects); $generator->setTimeRange($start, $end); $result = $generator->getResult(); @@ -763,9 +765,9 @@ class Sabre_CalDAV_Plugin extends Sabre_DAV_ServerPlugin { try { - $vobj = Sabre_VObject_Reader::read($data); + $vobj = VObject\Reader::read($data); - } catch (Sabre_VObject_ParseException $e) { + } catch (VObject\ParseException $e) { throw new Sabre_DAV_Exception_UnsupportedMediaType('This resource only supports valid iCalendar 2.0 data. Parse error: ' . $e->getMessage()); @@ -868,8 +870,8 @@ class Sabre_CalDAV_Plugin extends Sabre_DAV_ServerPlugin { } try { - $vObject = Sabre_VObject_Reader::read($this->server->httpRequest->getBody(true)); - } catch (Sabre_VObject_ParseException $e) { + $vObject = VObject\Reader::read($this->server->httpRequest->getBody(true)); + } catch (VObject\ParseException $e) { throw new Sabre_DAV_Exception_BadRequest('The request body must be a valid iCalendar object. Parse error: ' . $e->getMessage()); } @@ -920,10 +922,10 @@ class Sabre_CalDAV_Plugin extends Sabre_DAV_ServerPlugin { * * @param string $originator * @param array $recipients - * @param Sabre_VObject_Component $vObject + * @param Sabre\VObject\Component $vObject * @return array */ - protected function iMIPMessage($originator, array $recipients, Sabre_VObject_Component $vObject, $principal) { + protected function iMIPMessage($originator, array $recipients, VObject\Component $vObject, $principal) { if (!$this->imipHandler) { $resultStatus = '5.2;This server does not support this operation'; diff --git a/dav/SabreDAV/lib/Sabre/CalDAV/Schedule/IMip.php b/dav/SabreDAV/lib/Sabre/CalDAV/Schedule/IMip.php index 1be63a06..f62f94af 100644 --- a/dav/SabreDAV/lib/Sabre/CalDAV/Schedule/IMip.php +++ b/dav/SabreDAV/lib/Sabre/CalDAV/Schedule/IMip.php @@ -1,5 +1,7 @@ getMessage()); @@ -441,7 +443,7 @@ class Sabre_CardDAV_Plugin extends Sabre_DAV_ServerPlugin { */ public function validateFilters($vcardData, array $filters, $test) { - $vcard = Sabre_VObject_Reader::read($vcardData); + $vcard = VObject\Reader::read($vcardData); if (!$filters) return true; diff --git a/dav/SabreDAV/lib/Sabre/VObject/Component.php b/dav/SabreDAV/lib/Sabre/VObject/Component.php deleted file mode 100644 index ced59384..00000000 --- a/dav/SabreDAV/lib/Sabre/VObject/Component.php +++ /dev/null @@ -1,400 +0,0 @@ - 'Sabre_VObject_Component_VCalendar', - 'VEVENT' => 'Sabre_VObject_Component_VEvent', - 'VTODO' => 'Sabre_VObject_Component_VTodo', - 'VJOURNAL' => 'Sabre_VObject_Component_VJournal', - 'VALARM' => 'Sabre_VObject_Component_VAlarm', - ); - - /** - * Creates the new component by name, but in addition will also see if - * there's a class mapped to the property name. - * - * @param string $name - * @param string $value - * @return Sabre_VObject_Component - */ - static public function create($name, $value = null) { - - $name = strtoupper($name); - - if (isset(self::$classMap[$name])) { - return new self::$classMap[$name]($name, $value); - } else { - return new self($name, $value); - } - - } - - /** - * Creates a new component. - * - * By default this object will iterate over its own children, but this can - * be overridden with the iterator argument - * - * @param string $name - * @param Sabre_VObject_ElementList $iterator - */ - public function __construct($name, Sabre_VObject_ElementList $iterator = null) { - - $this->name = strtoupper($name); - if (!is_null($iterator)) $this->iterator = $iterator; - - } - - /** - * Turns the object back into a serialized blob. - * - * @return string - */ - public function serialize() { - - $str = "BEGIN:" . $this->name . "\r\n"; - - /** - * Gives a component a 'score' for sorting purposes. - * - * This is solely used by the childrenSort method. - * - * A higher score means the item will be lower in the list. - * To avoid score collisions, each "score category" has a reasonable - * space to accomodate elements. The $key is added to the $score to - * preserve the original relative order of elements. - * - * @param int $key - * @param Sabre_VObject $array - * @return int - */ - $sortScore = function($key, $array) { - - if ($array[$key] instanceof Sabre_VObject_Component) { - // We want to encode VTIMEZONE first, this is a personal - // preference. - if ($array[$key]->name === 'VTIMEZONE') { - $score=300000000; - return $score+$key; - } else { - $score=400000000; - return $score+$key; - } - } else { - // Properties get encoded first - // VCARD version 4.0 wants the VERSION property to appear first - if ($array[$key] instanceof Sabre_VObject_Property) { - if ($array[$key]->name === 'VERSION') { - $score=100000000; - return $score+$key; - } else { - // All other properties - $score=200000000; - return $score+$key; - } - } - } - next($children); - - }; - - $tmp = $this->children; - uksort($this->children, function($a, $b) use ($sortScore, $tmp) { - - $sA = $sortScore($a, $tmp); - $sB = $sortScore($b, $tmp); - - if ($sA === $sB) return 0; - - return ($sA < $sB) ? -1 : 1; - - }); - - foreach($this->children as $child) $str.=$child->serialize(); - $str.= "END:" . $this->name . "\r\n"; - - return $str; - - } - - /** - * Adds a new component or element - * - * You can call this method with the following syntaxes: - * - * add(Sabre_VObject_Element $element) - * add(string $name, $value) - * - * The first version adds an Element - * The second adds a property as a string. - * - * @param mixed $item - * @param mixed $itemValue - * @return void - */ - public function add($item, $itemValue = null) { - - if ($item instanceof Sabre_VObject_Element) { - if (!is_null($itemValue)) { - throw new InvalidArgumentException('The second argument must not be specified, when passing a VObject'); - } - $item->parent = $this; - $this->children[] = $item; - } elseif(is_string($item)) { - - if (!is_scalar($itemValue)) { - throw new InvalidArgumentException('The second argument must be scalar'); - } - $item = Sabre_VObject_Property::create($item,$itemValue); - $item->parent = $this; - $this->children[] = $item; - - } else { - - throw new InvalidArgumentException('The first argument must either be a Sabre_VObject_Element or a string'); - - } - - } - - /** - * Returns an iterable list of children - * - * @return Sabre_VObject_ElementList - */ - public function children() { - - return new Sabre_VObject_ElementList($this->children); - - } - - /** - * Returns an array with elements that match the specified name. - * - * This function is also aware of MIME-Directory groups (as they appear in - * vcards). This means that if a property is grouped as "HOME.EMAIL", it - * will also be returned when searching for just "EMAIL". If you want to - * search for a property in a specific group, you can select on the entire - * string ("HOME.EMAIL"). If you want to search on a specific property that - * has not been assigned a group, specify ".EMAIL". - * - * Keys are retained from the 'children' array, which may be confusing in - * certain cases. - * - * @param string $name - * @return array - */ - public function select($name) { - - $group = null; - $name = strtoupper($name); - if (strpos($name,'.')!==false) { - list($group,$name) = explode('.', $name, 2); - } - - $result = array(); - foreach($this->children as $key=>$child) { - - if ( - strtoupper($child->name) === $name && - (is_null($group) || ( $child instanceof Sabre_VObject_Property && strtoupper($child->group) === $group)) - ) { - - $result[$key] = $child; - - } - } - - reset($result); - return $result; - - } - - /** - * This method only returns a list of sub-components. Properties are - * ignored. - * - * @return array - */ - public function getComponents() { - - $result = array(); - foreach($this->children as $child) { - if ($child instanceof Sabre_VObject_Component) { - $result[] = $child; - } - } - - return $result; - - } - - /** - * Validates the node for correctness. - * An array is returned with warnings. - * - * Every item in the array has the following properties: - * * level - (number between 1 and 3 with severity information) - * * message - (human readable message) - * * node - (reference to the offending node) - * - * @return array - */ - public function validate() { - - $result = array(); - foreach($this->children as $child) { - $result = array_merge($result, $child->validate()); - } - return $result; - - } - - /* Magic property accessors {{{ */ - - /** - * Using 'get' you will either get a property or component, - * - * If there were no child-elements found with the specified name, - * null is returned. - * - * @param string $name - * @return Sabre_VObject_Property - */ - public function __get($name) { - - $matches = $this->select($name); - if (count($matches)===0) { - return null; - } else { - $firstMatch = current($matches); - /** @var $firstMatch Sabre_VObject_Property */ - $firstMatch->setIterator(new Sabre_VObject_ElementList(array_values($matches))); - return $firstMatch; - } - - } - - /** - * This method checks if a sub-element with the specified name exists. - * - * @param string $name - * @return bool - */ - public function __isset($name) { - - $matches = $this->select($name); - return count($matches)>0; - - } - - /** - * Using the setter method you can add properties or subcomponents - * - * You can either pass a Sabre_VObject_Component, Sabre_VObject_Property - * object, or a string to automatically create a Property. - * - * If the item already exists, it will be removed. If you want to add - * a new item with the same name, always use the add() method. - * - * @param string $name - * @param mixed $value - * @return void - */ - public function __set($name, $value) { - - $matches = $this->select($name); - $overWrite = count($matches)?key($matches):null; - - if ($value instanceof Sabre_VObject_Component || $value instanceof Sabre_VObject_Property) { - $value->parent = $this; - if (!is_null($overWrite)) { - $this->children[$overWrite] = $value; - } else { - $this->children[] = $value; - } - } elseif (is_scalar($value)) { - $property = Sabre_VObject_Property::create($name,$value); - $property->parent = $this; - if (!is_null($overWrite)) { - $this->children[$overWrite] = $property; - } else { - $this->children[] = $property; - } - } else { - throw new InvalidArgumentException('You must pass a Sabre_VObject_Component, Sabre_VObject_Property or scalar type'); - } - - } - - /** - * Removes all properties and components within this component. - * - * @param string $name - * @return void - */ - public function __unset($name) { - - $matches = $this->select($name); - foreach($matches as $k=>$child) { - - unset($this->children[$k]); - $child->parent = null; - - } - - } - - /* }}} */ - - /** - * This method is automatically called when the object is cloned. - * Specifically, this will ensure all child elements are also cloned. - * - * @return void - */ - public function __clone() { - - foreach($this->children as $key=>$child) { - $this->children[$key] = clone $child; - $this->children[$key]->parent = $this; - } - - } - -} diff --git a/dav/SabreDAV/lib/Sabre/VObject/Component/VAlarm.php b/dav/SabreDAV/lib/Sabre/VObject/Component/VAlarm.php deleted file mode 100644 index 1d1dd69d..00000000 --- a/dav/SabreDAV/lib/Sabre/VObject/Component/VAlarm.php +++ /dev/null @@ -1,100 +0,0 @@ -TRIGGER; - if(!isset($trigger['VALUE']) || strtoupper($trigger['VALUE']) === 'DURATION') { - $triggerDuration = Sabre_VObject_DateTimeParser::parseDuration($this->TRIGGER); - $related = (isset($trigger['RELATED']) && strtoupper($trigger['RELATED']) == 'END') ? 'END' : 'START'; - - $parentComponent = $this->parent; - if ($related === 'START') { - $effectiveTrigger = clone $parentComponent->DTSTART->getDateTime(); - $effectiveTrigger->add($triggerDuration); - } else { - if ($parentComponent->name === 'VTODO') { - $endProp = 'DUE'; - } elseif ($parentComponent->name === 'VEVENT') { - $endProp = 'DTEND'; - } else { - throw new Sabre_DAV_Exception('time-range filters on VALARM components are only supported when they are a child of VTODO or VEVENT'); - } - - if (isset($parentComponent->$endProp)) { - $effectiveTrigger = clone $parentComponent->$endProp->getDateTime(); - $effectiveTrigger->add($triggerDuration); - } elseif (isset($parentComponent->DURATION)) { - $effectiveTrigger = clone $parentComponent->DTSTART->getDateTime(); - $duration = Sabre_VObject_DateTimeParser::parseDuration($parentComponent->DURATION); - $effectiveTrigger->add($duration); - $effectiveTrigger->add($triggerDuration); - } else { - $effectiveTrigger = clone $parentComponent->DTSTART->getDateTime(); - $effectiveTrigger->add($triggerDuration); - } - } - } else { - $effectiveTrigger = $trigger->getDateTime(); - } - return $effectiveTrigger; - - } - - /** - * Returns true or false depending on if the event falls in the specified - * time-range. This is used for filtering purposes. - * - * The rules used to determine if an event falls within the specified - * time-range is based on the CalDAV specification. - * - * @param DateTime $start - * @param DateTime $end - * @return bool - */ - public function isInTimeRange(DateTime $start, DateTime $end) { - - $effectiveTrigger = $this->getEffectiveTriggerTime(); - - if (isset($this->DURATION)) { - $duration = Sabre_VObject_DateTimeParser::parseDuration($this->DURATION); - $repeat = (string)$this->repeat; - if (!$repeat) { - $repeat = 1; - } - - $period = new DatePeriod($effectiveTrigger, $duration, (int)$repeat); - - foreach($period as $occurrence) { - - if ($start <= $occurrence && $end > $occurrence) { - return true; - } - } - return false; - } else { - return ($start <= $effectiveTrigger && $end > $effectiveTrigger); - } - - } - -} diff --git a/dav/SabreDAV/lib/Sabre/VObject/Component/VCalendar.php b/dav/SabreDAV/lib/Sabre/VObject/Component/VCalendar.php deleted file mode 100644 index 35dd90f2..00000000 --- a/dav/SabreDAV/lib/Sabre/VObject/Component/VCalendar.php +++ /dev/null @@ -1,238 +0,0 @@ -children as $component) { - - if (!$component instanceof Sabre_VObject_Component) - continue; - - if (isset($component->{'RECURRENCE-ID'})) - continue; - - if ($componentName && $component->name !== strtoupper($componentName)) - continue; - - if ($component->name === 'VTIMEZONE') - continue; - - $components[] = $component; - - } - - return $components; - - } - - /** - * If this calendar object, has events with recurrence rules, this method - * can be used to expand the event into multiple sub-events. - * - * Each event will be stripped from it's recurrence information, and only - * the instances of the event in the specified timerange will be left - * alone. - * - * In addition, this method will cause timezone information to be stripped, - * and normalized to UTC. - * - * This method will alter the VCalendar. This cannot be reversed. - * - * This functionality is specifically used by the CalDAV standard. It is - * possible for clients to request expand events, if they are rather simple - * clients and do not have the possibility to calculate recurrences. - * - * @param DateTime $start - * @param DateTime $end - * @return void - */ - public function expand(DateTime $start, DateTime $end) { - - $newEvents = array(); - - foreach($this->select('VEVENT') as $key=>$vevent) { - - if (isset($vevent->{'RECURRENCE-ID'})) { - unset($this->children[$key]); - continue; - } - - - if (!$vevent->rrule) { - unset($this->children[$key]); - if ($vevent->isInTimeRange($start, $end)) { - $newEvents[] = $vevent; - } - continue; - } - - $uid = (string)$vevent->uid; - if (!$uid) { - throw new LogicException('Event did not have a UID!'); - } - - $it = new Sabre_VObject_RecurrenceIterator($this, $vevent->uid); - $it->fastForward($start); - - while($it->valid() && $it->getDTStart() < $end) { - - if ($it->getDTEnd() > $start) { - - $newEvents[] = $it->getEventObject(); - - } - $it->next(); - - } - unset($this->children[$key]); - - } - - foreach($newEvents as $newEvent) { - - foreach($newEvent->children as $child) { - if ($child instanceof Sabre_VObject_Property_DateTime && - $child->getDateType() == Sabre_VObject_Property_DateTime::LOCALTZ) { - $child->setDateTime($child->getDateTime(),Sabre_VObject_Property_DateTime::UTC); - } - } - - $this->add($newEvent); - - } - - // Removing all VTIMEZONE components - unset($this->VTIMEZONE); - - } - - /** - * Validates the node for correctness. - * An array is returned with warnings. - * - * Every item in the array has the following properties: - * * level - (number between 1 and 3 with severity information) - * * message - (human readable message) - * * node - (reference to the offending node) - * - * @return array - */ - public function validate() { - - $warnings = array(); - - $version = $this->select('VERSION'); - if (count($version)!==1) { - $warnings[] = array( - 'level' => 1, - 'message' => 'The VERSION property must appear in the VCALENDAR component exactly 1 time', - 'node' => $this, - ); - } else { - if ((string)$this->VERSION !== '2.0') { - $warnings[] = array( - 'level' => 1, - 'message' => 'Only iCalendar version 2.0 as defined in rfc5545 is supported.', - 'node' => $this, - ); - } - } - $version = $this->select('PRODID'); - if (count($version)!==1) { - $warnings[] = array( - 'level' => 2, - 'message' => 'The PRODID property must appear in the VCALENDAR component exactly 1 time', - 'node' => $this, - ); - } - if (count($this->CALSCALE) > 1) { - $warnings[] = array( - 'level' => 2, - 'message' => 'The CALSCALE property must not be specified more than once.', - 'node' => $this, - ); - } - if (count($this->METHOD) > 1) { - $warnings[] = array( - 'level' => 2, - 'message' => 'The METHOD property must not be specified more than once.', - 'node' => $this, - ); - } - - $allowedComponents = array( - 'VEVENT', - 'VTODO', - 'VJOURNAL', - 'VFREEBUSY', - 'VTIMEZONE', - ); - $allowedProperties = array( - 'PRODID', - 'VERSION', - 'CALSCALE', - 'METHOD', - ); - $componentsFound = 0; - foreach($this->children as $child) { - if($child instanceof Sabre_VObject_Component) { - $componentsFound++; - if (!in_array($child->name, $allowedComponents)) { - $warnings[] = array( - 'level' => 1, - 'message' => 'The ' . $child->name . " component is not allowed in the VCALENDAR component", - 'node' => $this, - ); - } - } - if ($child instanceof Sabre_VObject_Property) { - if (!in_array($child->name, $allowedProperties)) { - $warnings[] = array( - 'level' => 2, - 'message' => 'The ' . $child->name . " property is not allowed in the VCALENDAR component", - 'node' => $this, - ); - } - } - } - - if ($componentsFound===0) { - $warnings[] = array( - 'level' => 1, - 'message' => 'An iCalendar object must have at least 1 component.', - 'node' => $this, - ); - } - - return array_merge( - $warnings, - parent::validate() - ); - - } - -} - diff --git a/dav/SabreDAV/lib/Sabre/VObject/Component/VEvent.php b/dav/SabreDAV/lib/Sabre/VObject/Component/VEvent.php deleted file mode 100644 index 684f5f5a..00000000 --- a/dav/SabreDAV/lib/Sabre/VObject/Component/VEvent.php +++ /dev/null @@ -1,68 +0,0 @@ -RRULE) { - $it = new Sabre_VObject_RecurrenceIterator($this); - $it->fastForward($start); - - // We fast-forwarded to a spot where the end-time of the - // recurrence instance exceeded the start of the requested - // time-range. - // - // If the starttime of the recurrence did not exceed the - // end of the time range as well, we have a match. - return ($it->getDTStart() < $end && $it->getDTEnd() > $start); - - } - - $effectiveStart = $this->DTSTART->getDateTime(); - if (isset($this->DTEND)) { - $effectiveEnd = $this->DTEND->getDateTime(); - // If this was an all-day event, we should just increase the - // end-date by 1. Otherwise the event will last until the second - // the date changed, by increasing this by 1 day the event lasts - // all of the last day as well. - if ($this->DTSTART->getDateType() == Sabre_VObject_Property_DateTime::DATE) { - $effectiveEnd->modify('+1 day'); - } - } elseif (isset($this->DURATION)) { - $effectiveEnd = clone $effectiveStart; - $effectiveEnd->add( Sabre_VObject_DateTimeParser::parseDuration($this->DURATION) ); - } elseif ($this->DTSTART->getDateType() == Sabre_VObject_Property_DateTime::DATE) { - $effectiveEnd = clone $effectiveStart; - $effectiveEnd->modify('+1 day'); - } else { - $effectiveEnd = clone $effectiveStart; - } - return ( - ($start <= $effectiveEnd) && ($end > $effectiveStart) - ); - - } - -} diff --git a/dav/SabreDAV/lib/Sabre/VObject/Component/VJournal.php b/dav/SabreDAV/lib/Sabre/VObject/Component/VJournal.php deleted file mode 100644 index 6d394928..00000000 --- a/dav/SabreDAV/lib/Sabre/VObject/Component/VJournal.php +++ /dev/null @@ -1,44 +0,0 @@ -DTSTART)?$this->DTSTART->getDateTime():null; - if ($dtstart) { - $effectiveEnd = clone $dtstart; - if ($this->DTSTART->getDateType() == Sabre_VObject_Property_DateTime::DATE) { - $effectiveEnd->modify('+1 day'); - } - - return ($start <= $effectiveEnd && $end > $dtstart); - - } - return false; - - - } - -} diff --git a/dav/SabreDAV/lib/Sabre/VObject/Component/VTodo.php b/dav/SabreDAV/lib/Sabre/VObject/Component/VTodo.php deleted file mode 100644 index 2fb6654e..00000000 --- a/dav/SabreDAV/lib/Sabre/VObject/Component/VTodo.php +++ /dev/null @@ -1,66 +0,0 @@ -DTSTART)?$this->DTSTART->getDateTime():null; - $duration = isset($this->DURATION)?Sabre_VObject_DateTimeParser::parseDuration($this->DURATION):null; - $due = isset($this->DUE)?$this->DUE->getDateTime():null; - $completed = isset($this->COMPLETED)?$this->COMPLETED->getDateTime():null; - $created = isset($this->CREATED)?$this->CREATED->getDateTime():null; - - if ($dtstart) { - if ($duration) { - $effectiveEnd = clone $dtstart; - $effectiveEnd->add($duration); - return $start <= $effectiveEnd && $end > $dtstart; - } elseif ($due) { - return - ($start < $due || $start <= $dtstart) && - ($end > $dtstart || $end >= $due); - } else { - return $start <= $dtstart && $end > $dtstart; - } - } - if ($due) { - return ($start < $due && $end >= $due); - } - if ($completed && $created) { - return - ($start <= $created || $start <= $completed) && - ($end >= $created || $end >= $completed); - } - if ($completed) { - return ($start <= $completed && $end >= $completed); - } - if ($created) { - return ($end > $created); - } - return true; - - } - -} diff --git a/dav/SabreDAV/lib/Sabre/VObject/DateTimeParser.php b/dav/SabreDAV/lib/Sabre/VObject/DateTimeParser.php deleted file mode 100644 index 23a4bb69..00000000 --- a/dav/SabreDAV/lib/Sabre/VObject/DateTimeParser.php +++ /dev/null @@ -1,181 +0,0 @@ -setTimeZone(new DateTimeZone('UTC')); - return $date; - - } - - /** - * Parses an iCalendar (rfc5545) formatted date and returns a DateTime object - * - * @param string $date - * @return DateTime - */ - static public function parseDate($date) { - - // Format is YYYYMMDD - $result = preg_match('/^([1-3][0-9]{3})([0-1][0-9])([0-3][0-9])$/',$date,$matches); - - if (!$result) { - throw new Sabre_DAV_Exception_BadRequest('The supplied iCalendar date value is incorrect: ' . $date); - } - - $date = new DateTime($matches[1] . '-' . $matches[2] . '-' . $matches[3], new DateTimeZone('UTC')); - return $date; - - } - - /** - * Parses an iCalendar (RFC5545) formatted duration value. - * - * This method will either return a DateTimeInterval object, or a string - * suitable for strtotime or DateTime::modify. - * - * @param string $duration - * @param bool $asString - * @return DateInterval|string - */ - static public function parseDuration($duration, $asString = false) { - - $result = preg_match('/^(?P\+|-)?P((?P\d+)W)?((?P\d+)D)?(T((?P\d+)H)?((?P\d+)M)?((?P\d+)S)?)?$/', $duration, $matches); - if (!$result) { - throw new Sabre_DAV_Exception_BadRequest('The supplied iCalendar duration value is incorrect: ' . $duration); - } - - if (!$asString) { - $invert = false; - if ($matches['plusminus']==='-') { - $invert = true; - } - - - $parts = array( - 'week', - 'day', - 'hour', - 'minute', - 'second', - ); - foreach($parts as $part) { - $matches[$part] = isset($matches[$part])&&$matches[$part]?(int)$matches[$part]:0; - } - - - // We need to re-construct the $duration string, because weeks and - // days are not supported by DateInterval in the same string. - $duration = 'P'; - $days = $matches['day']; - if ($matches['week']) { - $days+=$matches['week']*7; - } - if ($days) - $duration.=$days . 'D'; - - if ($matches['minute'] || $matches['second'] || $matches['hour']) { - $duration.='T'; - - if ($matches['hour']) - $duration.=$matches['hour'].'H'; - - if ($matches['minute']) - $duration.=$matches['minute'].'M'; - - if ($matches['second']) - $duration.=$matches['second'].'S'; - - } - - if ($duration==='P') { - $duration = 'PT0S'; - } - $iv = new DateInterval($duration); - if ($invert) $iv->invert = true; - - return $iv; - - } - - - - $parts = array( - 'week', - 'day', - 'hour', - 'minute', - 'second', - ); - - $newDur = ''; - foreach($parts as $part) { - if (isset($matches[$part]) && $matches[$part]) { - $newDur.=' '.$matches[$part] . ' ' . $part . 's'; - } - } - - $newDur = ($matches['plusminus']==='-'?'-':'+') . trim($newDur); - if ($newDur === '+') { $newDur = '+0 seconds'; }; - return $newDur; - - } - - /** - * Parses either a Date or DateTime, or Duration value. - * - * @param string $date - * @param DateTimeZone|string $referenceTZ - * @return DateTime|DateInterval - */ - static public function parse($date, $referenceTZ = null) { - - if ($date[0]==='P' || ($date[0]==='-' && $date[1]==='P')) { - return self::parseDuration($date); - } elseif (strlen($date)===8) { - return self::parseDate($date); - } else { - return self::parseDateTime($date, $referenceTZ); - } - - } - - -} diff --git a/dav/SabreDAV/lib/Sabre/VObject/Element.php b/dav/SabreDAV/lib/Sabre/VObject/Element.php deleted file mode 100644 index e20ff0b3..00000000 --- a/dav/SabreDAV/lib/Sabre/VObject/Element.php +++ /dev/null @@ -1,16 +0,0 @@ -vevent where there's multiple VEVENT objects. - * - * @package Sabre - * @subpackage VObject - * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved. - * @author Evert Pot (http://www.rooftopsolutions.nl/) - * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License - */ -class Sabre_VObject_ElementList implements Iterator, Countable, ArrayAccess { - - /** - * Inner elements - * - * @var array - */ - protected $elements = array(); - - /** - * Creates the element list. - * - * @param array $elements - */ - public function __construct(array $elements) { - - $this->elements = $elements; - - } - - /* {{{ Iterator interface */ - - /** - * Current position - * - * @var int - */ - private $key = 0; - - /** - * Returns current item in iteration - * - * @return Sabre_VObject_Element - */ - public function current() { - - return $this->elements[$this->key]; - - } - - /** - * To the next item in the iterator - * - * @return void - */ - public function next() { - - $this->key++; - - } - - /** - * Returns the current iterator key - * - * @return int - */ - public function key() { - - return $this->key; - - } - - /** - * Returns true if the current position in the iterator is a valid one - * - * @return bool - */ - public function valid() { - - return isset($this->elements[$this->key]); - - } - - /** - * Rewinds the iterator - * - * @return void - */ - public function rewind() { - - $this->key = 0; - - } - - /* }}} */ - - /* {{{ Countable interface */ - - /** - * Returns the number of elements - * - * @return int - */ - public function count() { - - return count($this->elements); - - } - - /* }}} */ - - /* {{{ ArrayAccess Interface */ - - - /** - * Checks if an item exists through ArrayAccess. - * - * @param int $offset - * @return bool - */ - public function offsetExists($offset) { - - return isset($this->elements[$offset]); - - } - - /** - * Gets an item through ArrayAccess. - * - * @param int $offset - * @return mixed - */ - public function offsetGet($offset) { - - return $this->elements[$offset]; - - } - - /** - * Sets an item through ArrayAccess. - * - * @param int $offset - * @param mixed $value - * @return void - */ - public function offsetSet($offset,$value) { - - throw new LogicException('You can not add new objects to an ElementList'); - - } - - /** - * Sets an item through ArrayAccess. - * - * This method just forwards the request to the inner iterator - * - * @param int $offset - * @return void - */ - public function offsetUnset($offset) { - - throw new LogicException('You can not remove objects from an ElementList'); - - } - - /* }}} */ - -} diff --git a/dav/SabreDAV/lib/Sabre/VObject/FreeBusyGenerator.php b/dav/SabreDAV/lib/Sabre/VObject/FreeBusyGenerator.php deleted file mode 100644 index 1c96a64a..00000000 --- a/dav/SabreDAV/lib/Sabre/VObject/FreeBusyGenerator.php +++ /dev/null @@ -1,297 +0,0 @@ -baseObject = $vcalendar; - - } - - /** - * Sets the input objects - * - * Every object must either be a string or a Sabre_VObject_Component. - * - * @param array $objects - * @return void - */ - public function setObjects(array $objects) { - - $this->objects = array(); - foreach($objects as $object) { - - if (is_string($object)) { - $this->objects[] = Sabre_VObject_Reader::read($object); - } elseif ($object instanceof Sabre_VObject_Component) { - $this->objects[] = $object; - } else { - throw new InvalidArgumentException('You can only pass strings or Sabre_VObject_Component arguments to setObjects'); - } - - } - - } - - /** - * Sets the time range - * - * Any freebusy object falling outside of this time range will be ignored. - * - * @param DateTime $start - * @param DateTime $end - * @return void - */ - public function setTimeRange(DateTime $start = null, DateTime $end = null) { - - $this->start = $start; - $this->end = $end; - - } - - /** - * Parses the input data and returns a correct VFREEBUSY object, wrapped in - * a VCALENDAR. - * - * @return Sabre_VObject_Component - */ - public function getResult() { - - $busyTimes = array(); - - foreach($this->objects as $object) { - - foreach($object->getBaseComponents() as $component) { - - switch($component->name) { - - case 'VEVENT' : - - $FBTYPE = 'BUSY'; - if (isset($component->TRANSP) && (strtoupper($component->TRANSP) === 'TRANSPARENT')) { - break; - } - if (isset($component->STATUS)) { - $status = strtoupper($component->STATUS); - if ($status==='CANCELLED') { - break; - } - if ($status==='TENTATIVE') { - $FBTYPE = 'BUSY-TENTATIVE'; - } - } - - $times = array(); - - if ($component->RRULE) { - - $iterator = new Sabre_VObject_RecurrenceIterator($object, (string)$component->uid); - if ($this->start) { - $iterator->fastForward($this->start); - } - - $maxRecurrences = 200; - - while($iterator->valid() && --$maxRecurrences) { - - $startTime = $iterator->getDTStart(); - if ($this->end && $startTime > $this->end) { - break; - } - $times[] = array( - $iterator->getDTStart(), - $iterator->getDTEnd(), - ); - - $iterator->next(); - - } - - } else { - - $startTime = $component->DTSTART->getDateTime(); - if ($this->end && $startTime > $this->end) { - break; - } - $endTime = null; - if (isset($component->DTEND)) { - $endTime = $component->DTEND->getDateTime(); - } elseif (isset($component->DURATION)) { - $duration = Sabre_VObject_DateTimeParser::parseDuration((string)$component->DURATION); - $endTime = clone $startTime; - $endTime->add($duration); - } elseif ($component->DTSTART->getDateType() === Sabre_VObject_Property_DateTime::DATE) { - $endTime = clone $startTime; - $endTime->modify('+1 day'); - } else { - // The event had no duration (0 seconds) - break; - } - - $times[] = array($startTime, $endTime); - - } - - foreach($times as $time) { - - if ($this->end && $time[0] > $this->end) break; - if ($this->start && $time[1] < $this->start) break; - - $busyTimes[] = array( - $time[0], - $time[1], - $FBTYPE, - ); - } - break; - - case 'VFREEBUSY' : - foreach($component->FREEBUSY as $freebusy) { - - $fbType = isset($freebusy['FBTYPE'])?strtoupper($freebusy['FBTYPE']):'BUSY'; - - // Skipping intervals marked as 'free' - if ($fbType==='FREE') - continue; - - $values = explode(',', $freebusy); - foreach($values as $value) { - list($startTime, $endTime) = explode('/', $value); - $startTime = Sabre_VObject_DateTimeParser::parseDateTime($startTime); - - if (substr($endTime,0,1)==='P' || substr($endTime,0,2)==='-P') { - $duration = Sabre_VObject_DateTimeParser::parseDuration($endTime); - $endTime = clone $startTime; - $endTime->add($duration); - } else { - $endTime = Sabre_VObject_DateTimeParser::parseDateTime($endTime); - } - - if($this->start && $this->start > $endTime) continue; - if($this->end && $this->end < $startTime) continue; - $busyTimes[] = array( - $startTime, - $endTime, - $fbType - ); - - } - - - } - break; - - - - } - - - } - - } - - if ($this->baseObject) { - $calendar = $this->baseObject; - } else { - $calendar = new Sabre_VObject_Component('VCALENDAR'); - $calendar->version = '2.0'; - if (Sabre_DAV_Server::$exposeVersion) { - $calendar->prodid = '-//SabreDAV//Sabre VObject ' . Sabre_VObject_Version::VERSION . '//EN'; - } else { - $calendar->prodid = '-//SabreDAV//Sabre VObject//EN'; - } - $calendar->calscale = 'GREGORIAN'; - } - - $vfreebusy = new Sabre_VObject_Component('VFREEBUSY'); - $calendar->add($vfreebusy); - - if ($this->start) { - $dtstart = new Sabre_VObject_Property_DateTime('DTSTART'); - $dtstart->setDateTime($this->start,Sabre_VObject_Property_DateTime::UTC); - $vfreebusy->add($dtstart); - } - if ($this->end) { - $dtend = new Sabre_VObject_Property_DateTime('DTEND'); - $dtend->setDateTime($this->start,Sabre_VObject_Property_DateTime::UTC); - $vfreebusy->add($dtend); - } - $dtstamp = new Sabre_VObject_Property_DateTime('DTSTAMP'); - $dtstamp->setDateTime(new DateTime('now'), Sabre_VObject_Property_DateTime::UTC); - $vfreebusy->add($dtstamp); - - foreach($busyTimes as $busyTime) { - - $busyTime[0]->setTimeZone(new DateTimeZone('UTC')); - $busyTime[1]->setTimeZone(new DateTimeZone('UTC')); - - $prop = new Sabre_VObject_Property( - 'FREEBUSY', - $busyTime[0]->format('Ymd\\THis\\Z') . '/' . $busyTime[1]->format('Ymd\\THis\\Z') - ); - $prop['FBTYPE'] = $busyTime[2]; - $vfreebusy->add($prop); - - } - - return $calendar; - - } - -} - diff --git a/dav/SabreDAV/lib/Sabre/VObject/Node.php b/dav/SabreDAV/lib/Sabre/VObject/Node.php deleted file mode 100644 index 6c8319f7..00000000 --- a/dav/SabreDAV/lib/Sabre/VObject/Node.php +++ /dev/null @@ -1,166 +0,0 @@ -iterator)) - return $this->iterator; - - return new Sabre_VObject_ElementList(array($this)); - - } - - /** - * Sets the overridden iterator - * - * Note that this is not actually part of the iterator interface - * - * @param Sabre_VObject_ElementList $iterator - * @return void - */ - public function setIterator(Sabre_VObject_ElementList $iterator) { - - $this->iterator = $iterator; - - } - - /* }}} */ - - /* {{{ Countable interface */ - - /** - * Returns the number of elements - * - * @return int - */ - public function count() { - - $it = $this->getIterator(); - return $it->count(); - - } - - /* }}} */ - - /* {{{ ArrayAccess Interface */ - - - /** - * Checks if an item exists through ArrayAccess. - * - * This method just forwards the request to the inner iterator - * - * @param int $offset - * @return bool - */ - public function offsetExists($offset) { - - $iterator = $this->getIterator(); - return $iterator->offsetExists($offset); - - } - - /** - * Gets an item through ArrayAccess. - * - * This method just forwards the request to the inner iterator - * - * @param int $offset - * @return mixed - */ - public function offsetGet($offset) { - - $iterator = $this->getIterator(); - return $iterator->offsetGet($offset); - - } - - /** - * Sets an item through ArrayAccess. - * - * This method just forwards the request to the inner iterator - * - * @param int $offset - * @param mixed $value - * @return void - */ - public function offsetSet($offset,$value) { - - $iterator = $this->getIterator(); - $iterator->offsetSet($offset,$value); - - } - - /** - * Sets an item through ArrayAccess. - * - * This method just forwards the request to the inner iterator - * - * @param int $offset - * @return void - */ - public function offsetUnset($offset) { - - $iterator = $this->getIterator(); - $iterator->offsetUnset($offset); - - } - - /* }}} */ - -} diff --git a/dav/SabreDAV/lib/Sabre/VObject/Parameter.php b/dav/SabreDAV/lib/Sabre/VObject/Parameter.php deleted file mode 100644 index 2e39af5f..00000000 --- a/dav/SabreDAV/lib/Sabre/VObject/Parameter.php +++ /dev/null @@ -1,84 +0,0 @@ -name = strtoupper($name); - $this->value = $value; - - } - - /** - * Turns the object back into a serialized blob. - * - * @return string - */ - public function serialize() { - - if (is_null($this->value)) { - return $this->name; - } - $src = array( - '\\', - "\n", - ';', - ',', - ); - $out = array( - '\\\\', - '\n', - '\;', - '\,', - ); - - return $this->name . '=' . str_replace($src, $out, $this->value); - - } - - /** - * Called when this object is being cast to a string - * - * @return string - */ - public function __toString() { - - return $this->value; - - } - -} diff --git a/dav/SabreDAV/lib/Sabre/VObject/ParseException.php b/dav/SabreDAV/lib/Sabre/VObject/ParseException.php deleted file mode 100644 index 1b5e95bf..00000000 --- a/dav/SabreDAV/lib/Sabre/VObject/ParseException.php +++ /dev/null @@ -1,12 +0,0 @@ - 'Sabre_VObject_Property_DateTime', - 'CREATED' => 'Sabre_VObject_Property_DateTime', - 'DTEND' => 'Sabre_VObject_Property_DateTime', - 'DTSTAMP' => 'Sabre_VObject_Property_DateTime', - 'DTSTART' => 'Sabre_VObject_Property_DateTime', - 'DUE' => 'Sabre_VObject_Property_DateTime', - 'EXDATE' => 'Sabre_VObject_Property_MultiDateTime', - 'LAST-MODIFIED' => 'Sabre_VObject_Property_DateTime', - 'RECURRENCE-ID' => 'Sabre_VObject_Property_DateTime', - 'TRIGGER' => 'Sabre_VObject_Property_DateTime', - ); - - /** - * Creates the new property by name, but in addition will also see if - * there's a class mapped to the property name. - * - * @param string $name - * @param string $value - * @return Sabre_VObject_Property - */ - static public function create($name, $value = null) { - - $name = strtoupper($name); - $shortName = $name; - $group = null; - if (strpos($shortName,'.')!==false) { - list($group, $shortName) = explode('.', $shortName); - } - - if (isset(self::$classMap[$shortName])) { - return new self::$classMap[$shortName]($name, $value); - } else { - return new self($name, $value); - } - - } - - /** - * Creates a new property object - * - * By default this object will iterate over its own children, but this can - * be overridden with the iterator argument - * - * @param string $name - * @param string $value - * @param Sabre_VObject_ElementList $iterator - */ - public function __construct($name, $value = null, $iterator = null) { - - $name = strtoupper($name); - $group = null; - if (strpos($name,'.')!==false) { - list($group, $name) = explode('.', $name); - } - $this->name = $name; - $this->group = $group; - if (!is_null($iterator)) $this->iterator = $iterator; - $this->setValue($value); - - } - - - - /** - * Updates the internal value - * - * @param string $value - * @return void - */ - public function setValue($value) { - - $this->value = $value; - - } - - /** - * Turns the object back into a serialized blob. - * - * @return string - */ - public function serialize() { - - $str = $this->name; - if ($this->group) $str = $this->group . '.' . $this->name; - - if (count($this->parameters)) { - foreach($this->parameters as $param) { - - $str.=';' . $param->serialize(); - - } - } - $src = array( - '\\', - "\n", - ); - $out = array( - '\\\\', - '\n', - ); - $str.=':' . str_replace($src, $out, $this->value); - - $out = ''; - while(strlen($str)>0) { - if (strlen($str)>75) { - $out.= mb_strcut($str,0,75,'utf-8') . "\r\n"; - $str = ' ' . mb_strcut($str,75,strlen($str),'utf-8'); - } else { - $out.=$str . "\r\n"; - $str=''; - break; - } - } - - return $out; - - } - - /** - * Adds a new componenten or element - * - * You can call this method with the following syntaxes: - * - * add(Sabre_VObject_Parameter $element) - * add(string $name, $value) - * - * The first version adds an Parameter - * The second adds a property as a string. - * - * @param mixed $item - * @param mixed $itemValue - * @return void - */ - public function add($item, $itemValue = null) { - - if ($item instanceof Sabre_VObject_Parameter) { - if (!is_null($itemValue)) { - throw new InvalidArgumentException('The second argument must not be specified, when passing a VObject'); - } - $item->parent = $this; - $this->parameters[] = $item; - } elseif(is_string($item)) { - - if (!is_scalar($itemValue) && !is_null($itemValue)) { - throw new InvalidArgumentException('The second argument must be scalar'); - } - $parameter = new Sabre_VObject_Parameter($item,$itemValue); - $parameter->parent = $this; - $this->parameters[] = $parameter; - - } else { - - throw new InvalidArgumentException('The first argument must either be a Sabre_VObject_Element or a string'); - - } - - } - - /* ArrayAccess interface {{{ */ - - /** - * Checks if an array element exists - * - * @param mixed $name - * @return bool - */ - public function offsetExists($name) { - - if (is_int($name)) return parent::offsetExists($name); - - $name = strtoupper($name); - - foreach($this->parameters as $parameter) { - if ($parameter->name == $name) return true; - } - return false; - - } - - /** - * Returns a parameter, or parameter list. - * - * @param string $name - * @return Sabre_VObject_Element - */ - public function offsetGet($name) { - - if (is_int($name)) return parent::offsetGet($name); - $name = strtoupper($name); - - $result = array(); - foreach($this->parameters as $parameter) { - if ($parameter->name == $name) - $result[] = $parameter; - } - - if (count($result)===0) { - return null; - } elseif (count($result)===1) { - return $result[0]; - } else { - $result[0]->setIterator(new Sabre_VObject_ElementList($result)); - return $result[0]; - } - - } - - /** - * Creates a new parameter - * - * @param string $name - * @param mixed $value - * @return void - */ - public function offsetSet($name, $value) { - - if (is_int($name)) parent::offsetSet($name, $value); - - if (is_scalar($value)) { - if (!is_string($name)) - throw new InvalidArgumentException('A parameter name must be specified. This means you cannot use the $array[]="string" to add parameters.'); - - $this->offsetUnset($name); - $parameter = new Sabre_VObject_Parameter($name, $value); - $parameter->parent = $this; - $this->parameters[] = $parameter; - - } elseif ($value instanceof Sabre_VObject_Parameter) { - if (!is_null($name)) - throw new InvalidArgumentException('Don\'t specify a parameter name if you\'re passing a Sabre_VObject_Parameter. Add using $array[]=$parameterObject.'); - - $value->parent = $this; - $this->parameters[] = $value; - } else { - throw new InvalidArgumentException('You can only add parameters to the property object'); - } - - } - - /** - * Removes one or more parameters with the specified name - * - * @param string $name - * @return void - */ - public function offsetUnset($name) { - - if (is_int($name)) parent::offsetUnset($name); - $name = strtoupper($name); - - foreach($this->parameters as $key=>$parameter) { - if ($parameter->name == $name) { - $parameter->parent = null; - unset($this->parameters[$key]); - } - - } - - } - - /* }}} */ - - /** - * Called when this object is being cast to a string - * - * @return string - */ - public function __toString() { - - return (string)$this->value; - - } - - /** - * This method is automatically called when the object is cloned. - * Specifically, this will ensure all child elements are also cloned. - * - * @return void - */ - public function __clone() { - - foreach($this->parameters as $key=>$child) { - $this->parameters[$key] = clone $child; - $this->parameters[$key]->parent = $this; - } - - } - -} diff --git a/dav/SabreDAV/lib/Sabre/VObject/Property/DateTime.php b/dav/SabreDAV/lib/Sabre/VObject/Property/DateTime.php deleted file mode 100644 index ff2c867a..00000000 --- a/dav/SabreDAV/lib/Sabre/VObject/Property/DateTime.php +++ /dev/null @@ -1,228 +0,0 @@ -setValue($dt->format('Ymd\\THis')); - $this->offsetUnset('VALUE'); - $this->offsetUnset('TZID'); - $this->offsetSet('VALUE','DATE-TIME'); - break; - case self::UTC : - $dt->setTimeZone(new DateTimeZone('UTC')); - $this->setValue($dt->format('Ymd\\THis\\Z')); - $this->offsetUnset('VALUE'); - $this->offsetUnset('TZID'); - $this->offsetSet('VALUE','DATE-TIME'); - break; - case self::LOCALTZ : - $this->setValue($dt->format('Ymd\\THis')); - $this->offsetUnset('VALUE'); - $this->offsetUnset('TZID'); - $this->offsetSet('VALUE','DATE-TIME'); - $this->offsetSet('TZID', $dt->getTimeZone()->getName()); - break; - case self::DATE : - $this->setValue($dt->format('Ymd')); - $this->offsetUnset('VALUE'); - $this->offsetUnset('TZID'); - $this->offsetSet('VALUE','DATE'); - break; - default : - throw new InvalidArgumentException('You must pass a valid dateType constant'); - - } - $this->dateTime = $dt; - $this->dateType = $dateType; - - } - - /** - * Returns the current DateTime value. - * - * If no value was set, this method returns null. - * - * @return DateTime|null - */ - public function getDateTime() { - - if ($this->dateTime) - return $this->dateTime; - - list( - $this->dateType, - $this->dateTime - ) = self::parseData($this->value, $this); - return $this->dateTime; - - } - - /** - * Returns the type of Date format. - * - * This method returns one of the format constants. If no date was set, - * this method will return null. - * - * @return int|null - */ - public function getDateType() { - - if ($this->dateType) - return $this->dateType; - - list( - $this->dateType, - $this->dateTime, - ) = self::parseData($this->value, $this); - return $this->dateType; - - } - - /** - * Parses the internal data structure to figure out what the current date - * and time is. - * - * The returned array contains two elements: - * 1. A 'DateType' constant (as defined on this class), or null. - * 2. A DateTime object (or null) - * - * @param string|null $propertyValue The string to parse (yymmdd or - * ymmddThhmmss, etc..) - * @param Sabre_VObject_Property|null $property The instance of the - * property we're parsing. - * @return array - */ - static public function parseData($propertyValue, Sabre_VObject_Property $property = null) { - - if (is_null($propertyValue)) { - return array(null, null); - } - - $date = '(?P[1-2][0-9]{3})(?P[0-1][0-9])(?P[0-3][0-9])'; - $time = '(?P[0-2][0-9])(?P[0-5][0-9])(?P[0-5][0-9])'; - $regex = "/^$date(T$time(?PZ)?)?$/"; - - if (!preg_match($regex, $propertyValue, $matches)) { - throw new InvalidArgumentException($propertyValue . ' is not a valid DateTime or Date string'); - } - - if (!isset($matches['hour'])) { - // Date-only - return array( - self::DATE, - new DateTime($matches['year'] . '-' . $matches['month'] . '-' . $matches['date'] . ' 00:00:00'), - ); - } - - $dateStr = - $matches['year'] .'-' . - $matches['month'] . '-' . - $matches['date'] . ' ' . - $matches['hour'] . ':' . - $matches['minute'] . ':' . - $matches['second']; - - if (isset($matches['isutc'])) { - $dt = new DateTime($dateStr,new DateTimeZone('UTC')); - $dt->setTimeZone(new DateTimeZone('UTC')); - return array( - self::UTC, - $dt - ); - } - - // Finding the timezone. - $tzid = $property['TZID']; - if (!$tzid) { - return array( - self::LOCAL, - new DateTime($dateStr) - ); - } - - // To look up the timezone, we must first find the VCALENDAR component. - $root = $property; - while($root->parent) { - $root = $root->parent; - } - if ($root->name === 'VCALENDAR') { - $tz = Sabre_VObject_TimeZoneUtil::getTimeZone((string)$tzid, $root); - } else { - $tz = Sabre_VObject_TimeZoneUtil::getTimeZone((string)$tzid); - } - - $dt = new DateTime($dateStr, $tz); - $dt->setTimeZone($tz); - - return array( - self::LOCALTZ, - $dt - ); - - } - -} diff --git a/dav/SabreDAV/lib/Sabre/VObject/Property/MultiDateTime.php b/dav/SabreDAV/lib/Sabre/VObject/Property/MultiDateTime.php deleted file mode 100644 index ae53ab6a..00000000 --- a/dav/SabreDAV/lib/Sabre/VObject/Property/MultiDateTime.php +++ /dev/null @@ -1,166 +0,0 @@ -offsetUnset('VALUE'); - $this->offsetUnset('TZID'); - switch($dateType) { - - case Sabre_VObject_Property_DateTime::LOCAL : - $val = array(); - foreach($dt as $i) { - $val[] = $i->format('Ymd\\THis'); - } - $this->setValue(implode(',',$val)); - $this->offsetSet('VALUE','DATE-TIME'); - break; - case Sabre_VObject_Property_DateTime::UTC : - $val = array(); - foreach($dt as $i) { - $i->setTimeZone(new DateTimeZone('UTC')); - $val[] = $i->format('Ymd\\THis\\Z'); - } - $this->setValue(implode(',',$val)); - $this->offsetSet('VALUE','DATE-TIME'); - break; - case Sabre_VObject_Property_DateTime::LOCALTZ : - $val = array(); - foreach($dt as $i) { - $val[] = $i->format('Ymd\\THis'); - } - $this->setValue(implode(',',$val)); - $this->offsetSet('VALUE','DATE-TIME'); - $this->offsetSet('TZID', $dt[0]->getTimeZone()->getName()); - break; - case Sabre_VObject_Property_DateTime::DATE : - $val = array(); - foreach($dt as $i) { - $val[] = $i->format('Ymd'); - } - $this->setValue(implode(',',$val)); - $this->offsetSet('VALUE','DATE'); - break; - default : - throw new InvalidArgumentException('You must pass a valid dateType constant'); - - } - $this->dateTimes = $dt; - $this->dateType = $dateType; - - } - - /** - * Returns the current DateTime value. - * - * If no value was set, this method returns null. - * - * @return array|null - */ - public function getDateTimes() { - - if ($this->dateTimes) - return $this->dateTimes; - - $dts = array(); - - if (!$this->value) { - $this->dateTimes = null; - $this->dateType = null; - return null; - } - - foreach(explode(',',$this->value) as $val) { - list( - $type, - $dt - ) = Sabre_VObject_Property_DateTime::parseData($val, $this); - $dts[] = $dt; - $this->dateType = $type; - } - $this->dateTimes = $dts; - return $this->dateTimes; - - } - - /** - * Returns the type of Date format. - * - * This method returns one of the format constants. If no date was set, - * this method will return null. - * - * @return int|null - */ - public function getDateType() { - - if ($this->dateType) - return $this->dateType; - - if (!$this->value) { - $this->dateTimes = null; - $this->dateType = null; - return null; - } - - $dts = array(); - foreach(explode(',',$this->value) as $val) { - list( - $type, - $dt - ) = Sabre_VObject_Property_DateTime::parseData($val, $this); - $dts[] = $dt; - $this->dateType = $type; - } - $this->dateTimes = $dts; - return $this->dateType; - - } - -} diff --git a/dav/SabreDAV/lib/Sabre/VObject/Reader.php b/dav/SabreDAV/lib/Sabre/VObject/Reader.php deleted file mode 100644 index eea73fa3..00000000 --- a/dav/SabreDAV/lib/Sabre/VObject/Reader.php +++ /dev/null @@ -1,183 +0,0 @@ -add(self::readLine($lines)); - - $nextLine = current($lines); - - if ($nextLine===false) - throw new Sabre_VObject_ParseException('Invalid VObject. Document ended prematurely.'); - - } - - // Checking component name of the 'END:' line. - if (substr($nextLine,4)!==$obj->name) { - throw new Sabre_VObject_ParseException('Invalid VObject, expected: "END:' . $obj->name . '" got: "' . $nextLine . '"'); - } - next($lines); - - return $obj; - - } - - // Properties - //$result = preg_match('/(?P[A-Z0-9-]+)(?:;(?P^(?([^:^\"]|\"([^\"]*)\")*))?"; - $regex = "/^(?P$token)$parameters:(?P.*)$/i"; - - $result = preg_match($regex,$line,$matches); - - if (!$result) { - throw new Sabre_VObject_ParseException('Invalid VObject, line ' . ($lineNr+1) . ' did not follow the icalendar/vcard format'); - } - - $propertyName = strtoupper($matches['name']); - $propertyValue = preg_replace_callback('#(\\\\(\\\\|N|n|;|,))#',function($matches) { - if ($matches[2]==='n' || $matches[2]==='N') { - return "\n"; - } else { - return $matches[2]; - } - }, $matches['value']); - - $obj = Sabre_VObject_Property::create($propertyName, $propertyValue); - - if ($matches['parameters']) { - - foreach(self::readParameters($matches['parameters']) as $param) { - $obj->add($param); - } - - } - - return $obj; - - - } - - /** - * Reads a parameter list from a property - * - * This method returns an array of Sabre_VObject_Parameter - * - * @param string $parameters - * @return array - */ - static private function readParameters($parameters) { - - $token = '[A-Z0-9-]+'; - - $paramValue = '(?P[^\"^;]*|"[^"]*")'; - - $regex = "/(?<=^|;)(?P$token)(=$paramValue(?=$|;))?/i"; - preg_match_all($regex, $parameters, $matches, PREG_SET_ORDER); - - $params = array(); - foreach($matches as $match) { - - $value = isset($match['paramValue'])?$match['paramValue']:null; - - if (isset($value[0])) { - // Stripping quotes, if needed - if ($value[0] === '"') $value = substr($value,1,strlen($value)-2); - } else { - $value = ''; - } - - $value = preg_replace_callback('#(\\\\(\\\\|N|n|;|,))#',function($matches) { - if ($matches[2]==='n' || $matches[2]==='N') { - return "\n"; - } else { - return $matches[2]; - } - }, $value); - - $params[] = new Sabre_VObject_Parameter($match['paramName'], $value); - - } - - return $params; - - } - - -} diff --git a/dav/SabreDAV/lib/Sabre/VObject/RecurrenceIterator.php b/dav/SabreDAV/lib/Sabre/VObject/RecurrenceIterator.php deleted file mode 100644 index 7ccd2049..00000000 --- a/dav/SabreDAV/lib/Sabre/VObject/RecurrenceIterator.php +++ /dev/null @@ -1,1058 +0,0 @@ - 0, - 'MO' => 1, - 'TU' => 2, - 'WE' => 3, - 'TH' => 4, - 'FR' => 5, - 'SA' => 6, - ); - - /** - * Mappings between the day number and english day name. - * - * @var array - */ - private $dayNames = array( - 0 => 'Sunday', - 1 => 'Monday', - 2 => 'Tuesday', - 3 => 'Wednesday', - 4 => 'Thursday', - 5 => 'Friday', - 6 => 'Saturday', - ); - - /** - * If the current iteration of the event is an overriden event, this - * property will hold the VObject - * - * @var Sabre_VObject_Component - */ - private $currentOverriddenEvent; - - /** - * This property may contain the date of the next not-overridden event. - * This date is calculated sometimes a bit early, before overridden events - * are evaluated. - * - * @var DateTime - */ - private $nextDate; - - /** - * Creates the iterator - * - * You should pass a VCALENDAR component, as well as the UID of the event - * we're going to traverse. - * - * @param Sabre_VObject_Component $vcal - * @param string|null $uid - */ - public function __construct(Sabre_VObject_Component $vcal, $uid=null) { - - if (is_null($uid)) { - if ($vcal->name === 'VCALENDAR') { - throw new InvalidArgumentException('If you pass a VCALENDAR object, you must pass a uid argument as well'); - } - $components = array($vcal); - $uid = (string)$vcal->uid; - } else { - $components = $vcal->select('VEVENT'); - } - foreach($components as $component) { - if ((string)$component->uid == $uid) { - if (isset($component->{'RECURRENCE-ID'})) { - $this->overriddenEvents[$component->DTSTART->getDateTime()->getTimeStamp()] = $component; - $this->overriddenDates[] = $component->{'RECURRENCE-ID'}->getDateTime(); - } else { - $this->baseEvent = $component; - } - } - } - if (!$this->baseEvent) { - throw new InvalidArgumentException('Could not find a base event with uid: ' . $uid); - } - - $this->startDate = clone $this->baseEvent->DTSTART->getDateTime(); - - $this->endDate = null; - if (isset($this->baseEvent->DTEND)) { - $this->endDate = clone $this->baseEvent->DTEND->getDateTime(); - } else { - $this->endDate = clone $this->startDate; - if (isset($this->baseEvent->DURATION)) { - $this->endDate->add(Sabre_VObject_DateTimeParser::parse($this->baseEvent->DURATION->value)); - } elseif ($this->baseEvent->DTSTART->getDateType()===Sabre_VObject_Property_DateTime::DATE) { - $this->endDate->modify('+1 day'); - } - } - $this->currentDate = clone $this->startDate; - - $rrule = (string)$this->baseEvent->RRULE; - - $parts = explode(';', $rrule); - - // If no rrule was specified, we create a default setting - if (!$rrule) { - $this->frequency = 'daily'; - $this->count = 1; - } else foreach($parts as $part) { - - list($key, $value) = explode('=', $part, 2); - - switch(strtoupper($key)) { - - case 'FREQ' : - if (!in_array( - strtolower($value), - array('secondly','minutely','hourly','daily','weekly','monthly','yearly') - )) { - throw new InvalidArgumentException('Unknown value for FREQ=' . strtoupper($value)); - - } - $this->frequency = strtolower($value); - break; - - case 'UNTIL' : - $this->until = Sabre_VObject_DateTimeParser::parse($value); - break; - - case 'COUNT' : - $this->count = (int)$value; - break; - - case 'INTERVAL' : - $this->interval = (int)$value; - break; - - case 'BYSECOND' : - $this->bySecond = explode(',', $value); - break; - - case 'BYMINUTE' : - $this->byMinute = explode(',', $value); - break; - - case 'BYHOUR' : - $this->byHour = explode(',', $value); - break; - - case 'BYDAY' : - $this->byDay = explode(',', strtoupper($value)); - break; - - case 'BYMONTHDAY' : - $this->byMonthDay = explode(',', $value); - break; - - case 'BYYEARDAY' : - $this->byYearDay = explode(',', $value); - break; - - case 'BYWEEKNO' : - $this->byWeekNo = explode(',', $value); - break; - - case 'BYMONTH' : - $this->byMonth = explode(',', $value); - break; - - case 'BYSETPOS' : - $this->bySetPos = explode(',', $value); - break; - - case 'WKST' : - $this->weekStart = strtoupper($value); - break; - - } - - } - - // Parsing exception dates - if (isset($this->baseEvent->EXDATE)) { - foreach($this->baseEvent->EXDATE as $exDate) { - - foreach(explode(',', (string)$exDate) as $exceptionDate) { - - $this->exceptionDates[] = - Sabre_VObject_DateTimeParser::parse($exceptionDate, $this->startDate->getTimeZone()); - - } - - } - - } - - } - - /** - * Returns the current item in the list - * - * @return DateTime - */ - public function current() { - - if (!$this->valid()) return null; - return clone $this->currentDate; - - } - - /** - * This method returns the startdate for the current iteration of the - * event. - * - * @return DateTime - */ - public function getDtStart() { - - if (!$this->valid()) return null; - return clone $this->currentDate; - - } - - /** - * This method returns the enddate for the current iteration of the - * event. - * - * @return DateTime - */ - public function getDtEnd() { - - if (!$this->valid()) return null; - $dtEnd = clone $this->currentDate; - $dtEnd->add( $this->startDate->diff( $this->endDate ) ); - return clone $dtEnd; - - } - - /** - * Returns a VEVENT object with the updated start and end date. - * - * Any recurrence information is removed, and this function may return an - * 'overridden' event instead. - * - * This method always returns a cloned instance. - * - * @return Sabre_VObject_Component_VEvent - */ - public function getEventObject() { - - if ($this->currentOverriddenEvent) { - return clone $this->currentOverriddenEvent; - } - $event = clone $this->baseEvent; - unset($event->RRULE); - unset($event->EXDATE); - unset($event->RDATE); - unset($event->EXRULE); - - $event->DTSTART->setDateTime($this->getDTStart(), $event->DTSTART->getDateType()); - if (isset($event->DTEND)) { - $event->DTEND->setDateTime($this->getDtEnd(), $event->DTSTART->getDateType()); - } - if ($this->counter > 0) { - $event->{'RECURRENCE-ID'} = (string)$event->DTSTART; - } - - return $event; - - } - - /** - * Returns the current item number - * - * @return int - */ - public function key() { - - return $this->counter; - - } - - /** - * Whether or not there is a 'next item' - * - * @return bool - */ - public function valid() { - - if (!is_null($this->count)) { - return $this->counter < $this->count; - } - if (!is_null($this->until)) { - return $this->currentDate <= $this->until; - } - return true; - - } - - /** - * Resets the iterator - * - * @return void - */ - public function rewind() { - - $this->currentDate = clone $this->startDate; - $this->counter = 0; - - } - - /** - * This method allows you to quickly go to the next occurrence after the - * specified date. - * - * Note that this checks the current 'endDate', not the 'stardDate'. This - * means that if you forward to January 1st, the iterator will stop at the - * first event that ends *after* January 1st. - * - * @param DateTime $dt - * @return void - */ - public function fastForward(DateTime $dt) { - - while($this->valid() && $this->getDTEnd() <= $dt) { - $this->next(); - } - - } - - /** - * Returns true if this recurring event never ends. - * - * @return bool - */ - public function isInfinite() { - - return !$this->count && !$this->until; - - } - - /** - * Goes on to the next iteration - * - * @return void - */ - public function next() { - - /* - if (!is_null($this->count) && $this->counter >= $this->count) { - $this->currentDate = null; - }*/ - - - $previousStamp = $this->currentDate->getTimeStamp(); - - while(true) { - - $this->currentOverriddenEvent = null; - - // If we have a next date 'stored', we use that - if ($this->nextDate) { - $this->currentDate = $this->nextDate; - $currentStamp = $this->currentDate->getTimeStamp(); - $this->nextDate = null; - } else { - - // Otherwise, we calculate it - switch($this->frequency) { - - case 'daily' : - $this->nextDaily(); - break; - - case 'weekly' : - $this->nextWeekly(); - break; - - case 'monthly' : - $this->nextMonthly(); - break; - - case 'yearly' : - $this->nextYearly(); - break; - - } - $currentStamp = $this->currentDate->getTimeStamp(); - - // Checking exception dates - foreach($this->exceptionDates as $exceptionDate) { - if ($this->currentDate == $exceptionDate) { - $this->counter++; - continue 2; - } - } - foreach($this->overriddenDates as $overriddenDate) { - if ($this->currentDate == $overriddenDate) { - continue 2; - } - } - - } - - // Checking overridden events - foreach($this->overriddenEvents as $index=>$event) { - if ($index > $previousStamp && $index <= $currentStamp) { - - // We're moving the 'next date' aside, for later use. - $this->nextDate = clone $this->currentDate; - - $this->currentDate = $event->DTSTART->getDateTime(); - $this->currentOverriddenEvent = $event; - - break; - } - } - - break; - - } - - /* - if (!is_null($this->until)) { - if($this->currentDate > $this->until) { - $this->currentDate = null; - } - }*/ - - $this->counter++; - - } - - /** - * Does the processing for advancing the iterator for daily frequency. - * - * @return void - */ - protected function nextDaily() { - - if (!$this->byDay) { - $this->currentDate->modify('+' . $this->interval . ' days'); - return; - } - - $recurrenceDays = array(); - foreach($this->byDay as $byDay) { - - // The day may be preceeded with a positive (+n) or - // negative (-n) integer. However, this does not make - // sense in 'weekly' so we ignore it here. - $recurrenceDays[] = $this->dayMap[substr($byDay,-2)]; - - } - - do { - - $this->currentDate->modify('+' . $this->interval . ' days'); - - // Current day of the week - $currentDay = $this->currentDate->format('w'); - - } while (!in_array($currentDay, $recurrenceDays)); - - } - - /** - * Does the processing for advancing the iterator for weekly frequency. - * - * @return void - */ - protected function nextWeekly() { - - if (!$this->byDay) { - $this->currentDate->modify('+' . $this->interval . ' weeks'); - return; - } - - $recurrenceDays = array(); - foreach($this->byDay as $byDay) { - - // The day may be preceeded with a positive (+n) or - // negative (-n) integer. However, this does not make - // sense in 'weekly' so we ignore it here. - $recurrenceDays[] = $this->dayMap[substr($byDay,-2)]; - - } - - // Current day of the week - $currentDay = $this->currentDate->format('w'); - - // First day of the week: - $firstDay = $this->dayMap[$this->weekStart]; - - $time = array( - $this->currentDate->format('H'), - $this->currentDate->format('i'), - $this->currentDate->format('s') - ); - - // Increasing the 'current day' until we find our next - // occurrence. - while(true) { - - $currentDay++; - - if ($currentDay>6) { - $currentDay = 0; - } - - // We need to roll over to the next week - if ($currentDay === $firstDay) { - $this->currentDate->modify('+' . $this->interval . ' weeks'); - - // We need to go to the first day of this week, but only if we - // are not already on this first day of this week. - if($this->currentDate->format('w') != $firstDay) { - $this->currentDate->modify('last ' . $this->dayNames[$this->dayMap[$this->weekStart]]); - $this->currentDate->setTime($time[0],$time[1],$time[2]); - } - } - - // We have a match - if (in_array($currentDay ,$recurrenceDays)) { - $this->currentDate->modify($this->dayNames[$currentDay]); - $this->currentDate->setTime($time[0],$time[1],$time[2]); - break; - } - - } - - } - - /** - * Does the processing for advancing the iterator for monthly frequency. - * - * @return void - */ - protected function nextMonthly() { - - $currentDayOfMonth = $this->currentDate->format('j'); - if (!$this->byMonthDay && !$this->byDay) { - - // If the current day is higher than the 28th, rollover can - // occur to the next month. We Must skip these invalid - // entries. - if ($currentDayOfMonth < 29) { - $this->currentDate->modify('+' . $this->interval . ' months'); - } else { - $increase = 0; - do { - $increase++; - $tempDate = clone $this->currentDate; - $tempDate->modify('+ ' . ($this->interval*$increase) . ' months'); - } while ($tempDate->format('j') != $currentDayOfMonth); - $this->currentDate = $tempDate; - } - return; - } - - while(true) { - - $occurrences = $this->getMonthlyOccurrences(); - - foreach($occurrences as $occurrence) { - - // The first occurrence thats higher than the current - // day of the month wins. - if ($occurrence > $currentDayOfMonth) { - break 2; - } - - } - - // If we made it all the way here, it means there were no - // valid occurrences, and we need to advance to the next - // month. - $this->currentDate->modify('first day of this month'); - $this->currentDate->modify('+ ' . $this->interval . ' months'); - - // This goes to 0 because we need to start counting at hte - // beginning. - $currentDayOfMonth = 0; - - } - - $this->currentDate->setDate($this->currentDate->format('Y'), $this->currentDate->format('n'), $occurrence); - - } - - /** - * Does the processing for advancing the iterator for yearly frequency. - * - * @return void - */ - protected function nextYearly() { - - $currentMonth = $this->currentDate->format('n'); - $currentYear = $this->currentDate->format('Y'); - $currentDayOfMonth = $this->currentDate->format('j'); - - // No sub-rules, so we just advance by year - if (!$this->byMonth) { - - // Unless it was a leap day! - if ($currentMonth==2 && $currentDayOfMonth==29) { - - $counter = 0; - do { - $counter++; - // Here we increase the year count by the interval, until - // we hit a date that's also in a leap year. - // - // We could just find the next interval that's dividable by - // 4, but that would ignore the rule that there's no leap - // year every year that's dividable by a 100, but not by - // 400. (1800, 1900, 2100). So we just rely on the datetime - // functions instead. - $nextDate = clone $this->currentDate; - $nextDate->modify('+ ' . ($this->interval*$counter) . ' years'); - } while ($nextDate->format('n')!=2); - $this->currentDate = $nextDate; - - return; - - } - - // The easiest form - $this->currentDate->modify('+' . $this->interval . ' years'); - return; - - } - - $currentMonth = $this->currentDate->format('n'); - $currentYear = $this->currentDate->format('Y'); - $currentDayOfMonth = $this->currentDate->format('j'); - - $advancedToNewMonth = false; - - // If we got a byDay or getMonthDay filter, we must first expand - // further. - if ($this->byDay || $this->byMonthDay) { - - while(true) { - - $occurrences = $this->getMonthlyOccurrences(); - - foreach($occurrences as $occurrence) { - - // The first occurrence that's higher than the current - // day of the month wins. - // If we advanced to the next month or year, the first - // occurrence is always correct. - if ($occurrence > $currentDayOfMonth || $advancedToNewMonth) { - break 2; - } - - } - - // If we made it here, it means we need to advance to - // the next month or year. - $currentDayOfMonth = 1; - $advancedToNewMonth = true; - do { - - $currentMonth++; - if ($currentMonth>12) { - $currentYear+=$this->interval; - $currentMonth = 1; - } - } while (!in_array($currentMonth, $this->byMonth)); - - $this->currentDate->setDate($currentYear, $currentMonth, $currentDayOfMonth); - - } - - // If we made it here, it means we got a valid occurrence - $this->currentDate->setDate($currentYear, $currentMonth, $occurrence); - return; - - } else { - - // These are the 'byMonth' rules, if there are no byDay or - // byMonthDay sub-rules. - do { - - $currentMonth++; - if ($currentMonth>12) { - $currentYear+=$this->interval; - $currentMonth = 1; - } - } while (!in_array($currentMonth, $this->byMonth)); - $this->currentDate->setDate($currentYear, $currentMonth, $currentDayOfMonth); - - return; - - } - - } - - /** - * Returns all the occurrences for a monthly frequency with a 'byDay' or - * 'byMonthDay' expansion for the current month. - * - * The returned list is an array of integers with the day of month (1-31). - * - * @return array - */ - protected function getMonthlyOccurrences() { - - $startDate = clone $this->currentDate; - - $byDayResults = array(); - - // Our strategy is to simply go through the byDays, advance the date to - // that point and add it to the results. - if ($this->byDay) foreach($this->byDay as $day) { - - $dayName = $this->dayNames[$this->dayMap[substr($day,-2)]]; - - // Dayname will be something like 'wednesday'. Now we need to find - // all wednesdays in this month. - $dayHits = array(); - - $checkDate = clone $startDate; - $checkDate->modify('first day of this month'); - $checkDate->modify($dayName); - - do { - $dayHits[] = $checkDate->format('j'); - $checkDate->modify('next ' . $dayName); - } while ($checkDate->format('n') === $startDate->format('n')); - - // So now we have 'all wednesdays' for month. It is however - // possible that the user only really wanted the 1st, 2nd or last - // wednesday. - if (strlen($day)>2) { - $offset = (int)substr($day,0,-2); - - if ($offset>0) { - // It is possible that the day does not exist, such as a - // 5th or 6th wednesday of the month. - if (isset($dayHits[$offset-1])) { - $byDayResults[] = $dayHits[$offset-1]; - } - } else { - - // if it was negative we count from the end of the array - $byDayResults[] = $dayHits[count($dayHits) + $offset]; - } - } else { - // There was no counter (first, second, last wednesdays), so we - // just need to add the all to the list). - $byDayResults = array_merge($byDayResults, $dayHits); - - } - - } - - $byMonthDayResults = array(); - if ($this->byMonthDay) foreach($this->byMonthDay as $monthDay) { - - // Removing values that are out of range for this month - if ($monthDay > $startDate->format('t') || - $monthDay < 0-$startDate->format('t')) { - continue; - } - if ($monthDay>0) { - $byMonthDayResults[] = $monthDay; - } else { - // Negative values - $byMonthDayResults[] = $startDate->format('t') + 1 + $monthDay; - } - } - - // If there was just byDay or just byMonthDay, they just specify our - // (almost) final list. If both were provided, then byDay limits the - // list. - if ($this->byMonthDay && $this->byDay) { - $result = array_intersect($byMonthDayResults, $byDayResults); - } elseif ($this->byMonthDay) { - $result = $byMonthDayResults; - } else { - $result = $byDayResults; - } - $result = array_unique($result); - sort($result, SORT_NUMERIC); - - // The last thing that needs checking is the BYSETPOS. If it's set, it - // means only certain items in the set survive the filter. - if (!$this->bySetPos) { - return $result; - } - - $filteredResult = array(); - foreach($this->bySetPos as $setPos) { - - if ($setPos<0) { - $setPos = count($result)-($setPos+1); - } - if (isset($result[$setPos-1])) { - $filteredResult[] = $result[$setPos-1]; - } - } - - sort($filteredResult, SORT_NUMERIC); - return $filteredResult; - - } - - -} - diff --git a/dav/SabreDAV/lib/Sabre/VObject/TimeZoneUtil.php b/dav/SabreDAV/lib/Sabre/VObject/TimeZoneUtil.php deleted file mode 100644 index 276288aa..00000000 --- a/dav/SabreDAV/lib/Sabre/VObject/TimeZoneUtil.php +++ /dev/null @@ -1,351 +0,0 @@ -'Australia/Darwin', - 'AUS Eastern Standard Time'=>'Australia/Sydney', - 'Afghanistan Standard Time'=>'Asia/Kabul', - 'Alaskan Standard Time'=>'America/Anchorage', - 'Arab Standard Time'=>'Asia/Riyadh', - 'Arabian Standard Time'=>'Asia/Dubai', - 'Arabic Standard Time'=>'Asia/Baghdad', - 'Argentina Standard Time'=>'America/Buenos_Aires', - 'Armenian Standard Time'=>'Asia/Yerevan', - 'Atlantic Standard Time'=>'America/Halifax', - 'Azerbaijan Standard Time'=>'Asia/Baku', - 'Azores Standard Time'=>'Atlantic/Azores', - 'Bangladesh Standard Time'=>'Asia/Dhaka', - 'Canada Central Standard Time'=>'America/Regina', - 'Cape Verde Standard Time'=>'Atlantic/Cape_Verde', - 'Caucasus Standard Time'=>'Asia/Yerevan', - 'Cen. Australia Standard Time'=>'Australia/Adelaide', - 'Central America Standard Time'=>'America/Guatemala', - 'Central Asia Standard Time'=>'Asia/Almaty', - 'Central Brazilian Standard Time'=>'America/Cuiaba', - 'Central Europe Standard Time'=>'Europe/Budapest', - 'Central European Standard Time'=>'Europe/Warsaw', - 'Central Pacific Standard Time'=>'Pacific/Guadalcanal', - 'Central Standard Time'=>'America/Chicago', - 'Central Standard Time (Mexico)'=>'America/Mexico_City', - 'China Standard Time'=>'Asia/Shanghai', - 'Dateline Standard Time'=>'Etc/GMT+12', - 'E. Africa Standard Time'=>'Africa/Nairobi', - 'E. Australia Standard Time'=>'Australia/Brisbane', - 'E. Europe Standard Time'=>'Europe/Minsk', - 'E. South America Standard Time'=>'America/Sao_Paulo', - 'Eastern Standard Time'=>'America/New_York', - 'Egypt Standard Time'=>'Africa/Cairo', - 'Ekaterinburg Standard Time'=>'Asia/Yekaterinburg', - 'FLE Standard Time'=>'Europe/Kiev', - 'Fiji Standard Time'=>'Pacific/Fiji', - 'GMT Standard Time'=>'Europe/London', - 'GTB Standard Time'=>'Europe/Istanbul', - 'Georgian Standard Time'=>'Asia/Tbilisi', - 'Greenland Standard Time'=>'America/Godthab', - 'Greenwich Standard Time'=>'Atlantic/Reykjavik', - 'Hawaiian Standard Time'=>'Pacific/Honolulu', - 'India Standard Time'=>'Asia/Calcutta', - 'Iran Standard Time'=>'Asia/Tehran', - 'Israel Standard Time'=>'Asia/Jerusalem', - 'Jordan Standard Time'=>'Asia/Amman', - 'Kamchatka Standard Time'=>'Asia/Kamchatka', - 'Korea Standard Time'=>'Asia/Seoul', - 'Magadan Standard Time'=>'Asia/Magadan', - 'Mauritius Standard Time'=>'Indian/Mauritius', - 'Mexico Standard Time'=>'America/Mexico_City', - 'Mexico Standard Time 2'=>'America/Chihuahua', - 'Mid-Atlantic Standard Time'=>'Etc/GMT+2', - 'Middle East Standard Time'=>'Asia/Beirut', - 'Montevideo Standard Time'=>'America/Montevideo', - 'Morocco Standard Time'=>'Africa/Casablanca', - 'Mountain Standard Time'=>'America/Denver', - 'Mountain Standard Time (Mexico)'=>'America/Chihuahua', - 'Myanmar Standard Time'=>'Asia/Rangoon', - 'N. Central Asia Standard Time'=>'Asia/Novosibirsk', - 'Namibia Standard Time'=>'Africa/Windhoek', - 'Nepal Standard Time'=>'Asia/Katmandu', - 'New Zealand Standard Time'=>'Pacific/Auckland', - 'Newfoundland Standard Time'=>'America/St_Johns', - 'North Asia East Standard Time'=>'Asia/Irkutsk', - 'North Asia Standard Time'=>'Asia/Krasnoyarsk', - 'Pacific SA Standard Time'=>'America/Santiago', - 'Pacific Standard Time'=>'America/Los_Angeles', - 'Pacific Standard Time (Mexico)'=>'America/Santa_Isabel', - 'Pakistan Standard Time'=>'Asia/Karachi', - 'Paraguay Standard Time'=>'America/Asuncion', - 'Romance Standard Time'=>'Europe/Paris', - 'Russian Standard Time'=>'Europe/Moscow', - 'SA Eastern Standard Time'=>'America/Cayenne', - 'SA Pacific Standard Time'=>'America/Bogota', - 'SA Western Standard Time'=>'America/La_Paz', - 'SE Asia Standard Time'=>'Asia/Bangkok', - 'Samoa Standard Time'=>'Pacific/Apia', - 'Singapore Standard Time'=>'Asia/Singapore', - 'South Africa Standard Time'=>'Africa/Johannesburg', - 'Sri Lanka Standard Time'=>'Asia/Colombo', - 'Syria Standard Time'=>'Asia/Damascus', - 'Taipei Standard Time'=>'Asia/Taipei', - 'Tasmania Standard Time'=>'Australia/Hobart', - 'Tokyo Standard Time'=>'Asia/Tokyo', - 'Tonga Standard Time'=>'Pacific/Tongatapu', - 'US Eastern Standard Time'=>'America/Indianapolis', - 'US Mountain Standard Time'=>'America/Phoenix', - 'UTC'=>'Etc/GMT', - 'UTC+12'=>'Etc/GMT-12', - 'UTC-02'=>'Etc/GMT+2', - 'UTC-11'=>'Etc/GMT+11', - 'Ulaanbaatar Standard Time'=>'Asia/Ulaanbaatar', - 'Venezuela Standard Time'=>'America/Caracas', - 'Vladivostok Standard Time'=>'Asia/Vladivostok', - 'W. Australia Standard Time'=>'Australia/Perth', - 'W. Central Africa Standard Time'=>'Africa/Lagos', - 'W. Europe Standard Time'=>'Europe/Berlin', - 'West Asia Standard Time'=>'Asia/Tashkent', - 'West Pacific Standard Time'=>'Pacific/Port_Moresby', - 'Yakutsk Standard Time'=>'Asia/Yakutsk', - - // Microsoft exchange timezones - // Source: - // http://msdn.microsoft.com/en-us/library/ms988620%28v=exchg.65%29.aspx - // - // Correct timezones deduced with help from: - // http://en.wikipedia.org/wiki/List_of_tz_database_time_zones - 'Universal Coordinated Time' => 'UTC', - 'Casablanca, Monrovia' => 'Africa/Casablanca', - 'Greenwich Mean Time: Dublin, Edinburgh, Lisbon, London' => 'Europe/Lisbon', - 'Greenwich Mean Time; Dublin, Edinburgh, London' => 'Europe/London', - 'Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna' => 'Europe/Berlin', - 'Belgrade, Pozsony, Budapest, Ljubljana, Prague' => 'Europe/Prague', - 'Brussels, Copenhagen, Madrid, Paris' => 'Europe/Paris', - 'Paris, Madrid, Brussels, Copenhagen' => 'Europe/Paris', - 'Prague, Central Europe' => 'Europe/Prague', - 'Sarajevo, Skopje, Sofija, Vilnius, Warsaw, Zagreb' => 'Europe/Sarajevo', - 'West Central Africa' => 'Africa/Luanda', // This was a best guess - 'Athens, Istanbul, Minsk' => 'Europe/Athens', - 'Bucharest' => 'Europe/Bucharest', - 'Cairo' => 'Africa/Cairo', - 'Harare, Pretoria' => 'Africa/Harare', - 'Helsinki, Riga, Tallinn' => 'Europe/Helsinki', - 'Israel, Jerusalem Standard Time' => 'Asia/Jerusalem', - 'Baghdad' => 'Asia/Baghdad', - 'Arab, Kuwait, Riyadh' => 'Asia/Kuwait', - 'Moscow, St. Petersburg, Volgograd' => 'Europe/Moscow', - 'East Africa, Nairobi' => 'Africa/Nairobi', - 'Tehran' => 'Asia/Tehran', - 'Abu Dhabi, Muscat' => 'Asia/Muscat', // Best guess - 'Baku, Tbilisi, Yerevan' => 'Asia/Baku', - 'Kabul' => 'Asia/Kabul', - 'Ekaterinburg' => 'Asia/Yekaterinburg', - 'Islamabad, Karachi, Tashkent' => 'Asia/Karachi', - 'Kolkata, Chennai, Mumbai, New Delhi, India Standard Time' => 'Asia/Calcutta', - 'Kathmandu, Nepal' => 'Asia/Kathmandu', - 'Almaty, Novosibirsk, North Central Asia' => 'Asia/Almaty', - 'Astana, Dhaka' => 'Asia/Dhaka', - 'Sri Jayawardenepura, Sri Lanka' => 'Asia/Colombo', - 'Rangoon' => 'Asia/Rangoon', - 'Bangkok, Hanoi, Jakarta' => 'Asia/Bangkok', - 'Krasnoyarsk' => 'Asia/Krasnoyarsk', - 'Beijing, Chongqing, Hong Kong SAR, Urumqi' => 'Asia/Shanghai', - 'Irkutsk, Ulaan Bataar' => 'Asia/Irkutsk', - 'Kuala Lumpur, Singapore' => 'Asia/Singapore', - 'Perth, Western Australia' => 'Australia/Perth', - 'Taipei' => 'Asia/Taipei', - 'Osaka, Sapporo, Tokyo' => 'Asia/Tokyo', - 'Seoul, Korea Standard time' => 'Asia/Seoul', - 'Yakutsk' => 'Asia/Yakutsk', - 'Adelaide, Central Australia' => 'Australia/Adelaide', - 'Darwin' => 'Australia/Darwin', - 'Brisbane, East Australia' => 'Australia/Brisbane', - 'Canberra, Melbourne, Sydney, Hobart (year 2000 only)' => 'Australia/Sydney', - 'Guam, Port Moresby' => 'Pacific/Guam', - 'Hobart, Tasmania' => 'Australia/Hobart', - 'Vladivostok' => 'Asia/Vladivostok', - 'Magadan, Solomon Is., New Caledonia' => 'Asia/Magadan', - 'Auckland, Wellington' => 'Pacific/Auckland', - 'Fiji Islands, Kamchatka, Marshall Is.' => 'Pacific/Fiji', - 'Nuku\'alofa, Tonga' => 'Pacific/Tongatapu', - 'Azores' => 'Atlantic/Azores', - 'Cape Verde Is.' => 'Atlantic/Cape_Verde', - 'Mid-Atlantic' => 'America/Noronha', - 'Brasilia' => 'America/Sao_Paulo', // Best guess - 'Buenos Aires' => 'America/Argentina/Buenos_Aires', - 'Greenland' => 'America/Godthab', - 'Newfoundland' => 'America/St_Johns', - 'Atlantic Time (Canada)' => 'America/Halifax', - 'Caracas, La Paz' => 'America/Caracas', - 'Santiago' => 'America/Santiago', - 'Bogota, Lima, Quito' => 'America/Bogota', - 'Eastern Time (US & Canada)' => 'America/New_York', - 'Indiana (East)' => 'America/Indiana/Indianapolis', - 'Central America' => 'America/Guatemala', - 'Central Time (US & Canada)' => 'America/Chicago', - 'Mexico City, Tegucigalpa' => 'America/Mexico_City', - 'Saskatchewan' => 'America/Edmonton', - 'Arizona' => 'America/Phoenix', - 'Mountain Time (US & Canada)' => 'America/Denver', // Best guess - 'Pacific Time (US & Canada); Tijuana' => 'America/Los_Angeles', // Best guess - 'Alaska' => 'America/Anchorage', - 'Hawaii' => 'Pacific/Honolulu', - 'Midway Island, Samoa' => 'Pacific/Midway', - 'Eniwetok, Kwajalein, Dateline Time' => 'Pacific/Kwajalein', - - ); - - public static $microsoftExchangeMap = array( - 0 => 'UTC', - 31 => 'Africa/Casablanca', - 2 => 'Europe/Lisbon', - 1 => 'Europe/London', - 4 => 'Europe/Berlin', - 6 => 'Europe/Prague', - 3 => 'Europe/Paris', - 69 => 'Africa/Luanda', // This was a best guess - 7 => 'Europe/Athens', - 5 => 'Europe/Bucharest', - 49 => 'Africa/Cairo', - 50 => 'Africa/Harare', - 59 => 'Europe/Helsinki', - 27 => 'Asia/Jerusalem', - 26 => 'Asia/Baghdad', - 74 => 'Asia/Kuwait', - 51 => 'Europe/Moscow', - 56 => 'Africa/Nairobi', - 25 => 'Asia/Tehran', - 24 => 'Asia/Muscat', // Best guess - 54 => 'Asia/Baku', - 48 => 'Asia/Kabul', - 58 => 'Asia/Yekaterinburg', - 47 => 'Asia/Karachi', - 23 => 'Asia/Calcutta', - 62 => 'Asia/Kathmandu', - 46 => 'Asia/Almaty', - 71 => 'Asia/Dhaka', - 66 => 'Asia/Colombo', - 61 => 'Asia/Rangoon', - 22 => 'Asia/Bangkok', - 64 => 'Asia/Krasnoyarsk', - 45 => 'Asia/Shanghai', - 63 => 'Asia/Irkutsk', - 21 => 'Asia/Singapore', - 73 => 'Australia/Perth', - 75 => 'Asia/Taipei', - 20 => 'Asia/Tokyo', - 72 => 'Asia/Seoul', - 70 => 'Asia/Yakutsk', - 19 => 'Australia/Adelaide', - 44 => 'Australia/Darwin', - 18 => 'Australia/Brisbane', - 76 => 'Australia/Sydney', - 43 => 'Pacific/Guam', - 42 => 'Australia/Hobart', - 68 => 'Asia/Vladivostok', - 41 => 'Asia/Magadan', - 17 => 'Pacific/Auckland', - 40 => 'Pacific/Fiji', - 67 => 'Pacific/Tongatapu', - 29 => 'Atlantic/Azores', - 53 => 'Atlantic/Cape_Verde', - 30 => 'America/Noronha', - 8 => 'America/Sao_Paulo', // Best guess - 32 => 'America/Argentina/Buenos_Aires', - 69 => 'America/Godthab', - 28 => 'America/St_Johns', - 9 => 'America/Halifax', - 33 => 'America/Caracas', - 65 => 'America/Santiago', - 35 => 'America/Bogota', - 10 => 'America/New_York', - 34 => 'America/Indiana/Indianapolis', - 55 => 'America/Guatemala', - 11 => 'America/Chicago', - 37 => 'America/Mexico_City', - 36 => 'America/Edmonton', - 38 => 'America/Phoenix', - 12 => 'America/Denver', // Best guess - 13 => 'America/Los_Angeles', // Best guess - 14 => 'America/Anchorage', - 15 => 'Pacific/Honolulu', - 16 => 'Pacific/Midway', - 39 => 'Pacific/Kwajalein', - ); - - /** - * This method will try to find out the correct timezone for an iCalendar - * date-time value. - * - * You must pass the contents of the TZID parameter, as well as the full - * calendar. - * - * If the lookup fails, this method will return UTC. - * - * @param string $tzid - * @param Sabre_VObject_Component $vcalendar - * @return DateTimeZone - */ - static public function getTimeZone($tzid, Sabre_VObject_Component $vcalendar = null) { - - // First we will just see if the tzid is a support timezone identifier. - try { - return new DateTimeZone($tzid); - } catch (\Exception $e) { - } - - // Next, we check if the tzid is somewhere in our tzid map. - if (isset(self::$map[$tzid])) { - return new DateTimeZone(self::$map[$tzid]); - } - - if ($vcalendar) { - - // If that didn't work, we will scan VTIMEZONE objects - foreach($vcalendar->select('VTIMEZONE') as $vtimezone) { - - if ((string)$vtimezone->TZID === $tzid) { - - // Some clients add 'X-LIC-LOCATION' with the olson name. - if (isset($vtimezone->{'X-LIC-LOCATION'})) { - try { - return new DateTimeZone($vtimezone->{'X-LIC-LOCATION'}); - } catch (\Exception $e) { - } - - } - // Microsoft may add a magic number, which we also have an - // answer for. - if (isset($vtimezone->{'X-MICROSOFT-CDO-TZID'})) { - if (isset(self::$microsoftExchangeMap[(int)$vtimezone->{'X-MICROSOFT-CDO-TZID'}->value])) { - return new DateTimeZone(self::$microsoftExchangeMap[(int)$vtimezone->{'X-MICROSOFT-CDO-TZID'}->value]); - } - } - } - - } - - } - - // If we got all the way here, we default to UTC. - return new DateTimeZone(date_default_timezone_get()); - - - } - - -} diff --git a/dav/SabreDAV/lib/Sabre/VObject/Version.php b/dav/SabreDAV/lib/Sabre/VObject/Version.php deleted file mode 100644 index 9ee03d87..00000000 --- a/dav/SabreDAV/lib/Sabre/VObject/Version.php +++ /dev/null @@ -1,24 +0,0 @@ -RRULE = 'FREQ=MONTHLY'; $vevent->DTSTART = '20120101T120000Z'; $vevent->UID = 'bla'; - $valarm = Sabre_VObject_Component::create('VALARM'); + $valarm = VObject\Component::create('VALARM'); $valarm->TRIGGER = '-P15D'; $vevent->add($valarm); - $vcalendar = Sabre_VObject_Component::create('VCALENDAR'); + $vcalendar = VObject\Component::create('VCALENDAR'); $vcalendar->add($vevent); $filter = array( @@ -52,16 +54,16 @@ class Sabre_CalDAV_CalendarQueryVAlarmTest extends PHPUnit_Framework_TestCase { // A limited recurrence rule, should return false - $vevent = Sabre_VObject_Component::create('VEVENT'); + $vevent = VObject\Component::create('VEVENT'); $vevent->RRULE = 'FREQ=MONTHLY;COUNT=1'; $vevent->DTSTART = '20120101T120000Z'; $vevent->UID = 'bla'; - $valarm = Sabre_VObject_Component::create('VALARM'); + $valarm = VObject\Component::create('VALARM'); $valarm->TRIGGER = '-P15D'; $vevent->add($valarm); - $vcalendar = Sabre_VObject_Component::create('VCALENDAR'); + $vcalendar = VObject\Component::create('VCALENDAR'); $vcalendar->add($vevent); $this->assertFalse($validator->validate($vcalendar, $filter)); @@ -69,15 +71,15 @@ class Sabre_CalDAV_CalendarQueryVAlarmTest extends PHPUnit_Framework_TestCase { function testAlarmWayBefore() { - $vevent = Sabre_VObject_Component::create('VEVENT'); + $vevent = VObject\Component::create('VEVENT'); $vevent->DTSTART = '20120101T120000Z'; $vevent->UID = 'bla'; - $valarm = Sabre_VObject_Component::create('VALARM'); + $valarm = VObject\Component::create('VALARM'); $valarm->TRIGGER = '-P2W1D'; $vevent->add($valarm); - $vcalendar = Sabre_VObject_Component::create('VCALENDAR'); + $vcalendar = VObject\Component::create('VCALENDAR'); $vcalendar->add($vevent); $filter = array( diff --git a/dav/SabreDAV/tests/Sabre/CalDAV/CalendarQueryValidatorTest.php b/dav/SabreDAV/tests/Sabre/CalDAV/CalendarQueryValidatorTest.php index 18c8330d..dede4764 100644 --- a/dav/SabreDAV/tests/Sabre/CalDAV/CalendarQueryValidatorTest.php +++ b/dav/SabreDAV/tests/Sabre/CalDAV/CalendarQueryValidatorTest.php @@ -1,5 +1,7 @@ null, ); - $vObject = Sabre_VObject_Reader::read($icalObject); + $vObject = VObject\Reader::read($icalObject); switch($outcome) { case 0 : @@ -31,7 +33,7 @@ class Sabre_CalDAV_CalendarQueryValidatorTest extends PHPUnit_Framework_TestCase case -1 : try { $validator->validate($vObject, $filters); - } catch (Sabre_DAV_Exception $e) { + } catch (Exception $e) { // Success } break; diff --git a/dav/SabreDAV/tests/Sabre/CalDAV/ExpandEventsDTSTARTandDTENDTest.php b/dav/SabreDAV/tests/Sabre/CalDAV/ExpandEventsDTSTARTandDTENDTest.php index 984212aa..444dc496 100644 --- a/dav/SabreDAV/tests/Sabre/CalDAV/ExpandEventsDTSTARTandDTENDTest.php +++ b/dav/SabreDAV/tests/Sabre/CalDAV/ExpandEventsDTSTARTandDTENDTest.php @@ -1,5 +1,7 @@ VEVENT as $vevent) { - /** @var $vevent Sabre_VObject_Component_VEvent */ + /** @var $vevent Sabre\VObject\Component_VEvent */ foreach ($vevent->children as $child) { - /** @var $child Sabre_VObject_Property */ + /** @var $child Sabre\VObject\Property */ if ($child->name == 'DTSTART') { // DTSTART has to be one of three valid values diff --git a/dav/SabreDAV/tests/Sabre/CalDAV/ExpandEventsDTSTARTandDTENDbyDayTest.php b/dav/SabreDAV/tests/Sabre/CalDAV/ExpandEventsDTSTARTandDTENDbyDayTest.php index a2c2fc27..a183082b 100644 --- a/dav/SabreDAV/tests/Sabre/CalDAV/ExpandEventsDTSTARTandDTENDbyDayTest.php +++ b/dav/SabreDAV/tests/Sabre/CalDAV/ExpandEventsDTSTARTandDTENDbyDayTest.php @@ -1,5 +1,7 @@ assertEquals(2, count($vObject->VEVENT)); // check if DTSTARTs and DTENDs are correct foreach ($vObject->VEVENT as $vevent) { - /** @var $vevent Sabre_VObject_Component_VEvent */ + /** @var $vevent Sabre\VObject\Component\VEvent */ foreach ($vevent->children as $child) { - /** @var $child Sabre_VObject_Property */ + /** @var $child Sabre\VObject\Property */ if ($child->name == 'DTSTART') { // DTSTART has to be one of two valid values diff --git a/dav/SabreDAV/tests/Sabre/CalDAV/ExpandEventsDoubleEventsTest.php b/dav/SabreDAV/tests/Sabre/CalDAV/ExpandEventsDoubleEventsTest.php index 55d06b23..087c384f 100644 --- a/dav/SabreDAV/tests/Sabre/CalDAV/ExpandEventsDoubleEventsTest.php +++ b/dav/SabreDAV/tests/Sabre/CalDAV/ExpandEventsDoubleEventsTest.php @@ -1,5 +1,7 @@ assertEquals(3, count($vObject->VEVENT),'We got 6 events instead of 3. Output: ' . $body); diff --git a/dav/SabreDAV/tests/Sabre/CalDAV/GetEventsByTimerangeTest.php b/dav/SabreDAV/tests/Sabre/CalDAV/GetEventsByTimerangeTest.php index b8a97ca1..d9a6d586 100644 --- a/dav/SabreDAV/tests/Sabre/CalDAV/GetEventsByTimerangeTest.php +++ b/dav/SabreDAV/tests/Sabre/CalDAV/GetEventsByTimerangeTest.php @@ -1,5 +1,7 @@ assertEquals(1, count($vObject->VEVENT), 'We got 0 events instead of 1. Output: ' . $body); diff --git a/dav/SabreDAV/tests/Sabre/CalDAV/ICSExportPluginTest.php b/dav/SabreDAV/tests/Sabre/CalDAV/ICSExportPluginTest.php index d23b8123..c569da8f 100644 --- a/dav/SabreDAV/tests/Sabre/CalDAV/ICSExportPluginTest.php +++ b/dav/SabreDAV/tests/Sabre/CalDAV/ICSExportPluginTest.php @@ -1,5 +1,7 @@ 'text/calendar', ), $s->httpResponse->headers); - $obj = Sabre_VObject_Reader::read($s->httpResponse->body); + $obj = VObject\Reader::read($s->httpResponse->body); $this->assertEquals(5,count($obj->children())); $this->assertEquals(1,count($obj->VERSION)); @@ -98,7 +100,7 @@ class Sabre_CalDAV_ICSExportPluginTest extends PHPUnit_Framework_TestCase { 'Content-Type' => 'text/calendar', ), $s->httpResponse->headers); - $obj = Sabre_VObject_Reader::read($s->httpResponse->body); + $obj = VObject\Reader::read($s->httpResponse->body); $this->assertEquals(5,count($obj->children())); $this->assertEquals(1,count($obj->VERSION)); @@ -211,7 +213,7 @@ class Sabre_CalDAV_ICSExportPluginTest extends PHPUnit_Framework_TestCase { 'Content-Type' => 'text/calendar', ), $s->httpResponse->headers); - $obj = Sabre_VObject_Reader::read($s->httpResponse->body); + $obj = VObject\Reader::read($s->httpResponse->body); $this->assertEquals(5,count($obj->children())); $this->assertEquals(1,count($obj->VERSION)); diff --git a/dav/SabreDAV/tests/Sabre/CalDAV/Issue166Test.php b/dav/SabreDAV/tests/Sabre/CalDAV/Issue166Test.php index 3a61663e..11d2f21c 100644 --- a/dav/SabreDAV/tests/Sabre/CalDAV/Issue166Test.php +++ b/dav/SabreDAV/tests/Sabre/CalDAV/Issue166Test.php @@ -1,5 +1,7 @@ false, 'time-range' => null, ); - $input = Sabre_VObject_Reader::read($input); + $input = VObject\Reader::read($input); $this->assertTrue($validator->validate($input,$filters)); } diff --git a/dav/SabreDAV/tests/Sabre/CalDAV/Issue172Test.php b/dav/SabreDAV/tests/Sabre/CalDAV/Issue172Test.php index 024b2557..90e13fd8 100644 --- a/dav/SabreDAV/tests/Sabre/CalDAV/Issue172Test.php +++ b/dav/SabreDAV/tests/Sabre/CalDAV/Issue172Test.php @@ -1,5 +1,7 @@ array(), ); - $input = Sabre_VObject_Reader::read($input); + $input = VObject\Reader::read($input); $this->assertTrue($validator->validate($input,$filters)); } @@ -77,7 +79,7 @@ HI; ), 'prop-filters' => array(), ); - $input = Sabre_VObject_Reader::read($input); + $input = VObject\Reader::read($input); $this->assertTrue($validator->validate($input,$filters)); } @@ -125,7 +127,7 @@ HI; ), 'prop-filters' => array(), ); - $input = Sabre_VObject_Reader::read($input); + $input = VObject\Reader::read($input); $this->assertTrue($validator->validate($input,$filters)); } } diff --git a/dav/SabreDAV/tests/Sabre/CalDAV/Issue203Test.php b/dav/SabreDAV/tests/Sabre/CalDAV/Issue203Test.php index e9eaecab..4cb8eec9 100644 --- a/dav/SabreDAV/tests/Sabre/CalDAV/Issue203Test.php +++ b/dav/SabreDAV/tests/Sabre/CalDAV/Issue203Test.php @@ -1,5 +1,7 @@ assertEquals(2, count($vObject->VEVENT)); @@ -113,10 +115,10 @@ END:VCALENDAR $matching = false; foreach ($vObject->VEVENT as $vevent) { - /** @var $vevent Sabre_VObject_Component_VEvent */ + /** @var $vevent Sabre\VObject\Component\VEvent */ foreach ($vevent->children as $child) { - /** @var $child Sabre_VObject_Property */ + /** @var $child Sabre\VObject\Property */ if (isset($expectedEvent[$child->name])) { if ($expectedEvent[$child->name] != $child->value) { diff --git a/dav/SabreDAV/tests/Sabre/CalDAV/Issue205Test.php b/dav/SabreDAV/tests/Sabre/CalDAV/Issue205Test.php index 20098252..6e9e497c 100644 --- a/dav/SabreDAV/tests/Sabre/CalDAV/Issue205Test.php +++ b/dav/SabreDAV/tests/Sabre/CalDAV/Issue205Test.php @@ -1,5 +1,7 @@ assertEquals(1, count($vObject->VEVENT)); diff --git a/dav/SabreDAV/tests/Sabre/CalDAV/Issue228Test.php b/dav/SabreDAV/tests/Sabre/CalDAV/Issue228Test.php new file mode 100644 index 00000000..f251ab13 --- /dev/null +++ b/dav/SabreDAV/tests/Sabre/CalDAV/Issue228Test.php @@ -0,0 +1,75 @@ + 1, + 'name' => 'Calendar', + 'principaluri' => 'principals/user1', + 'uri' => 'calendar1', + ) + ); + + protected $caldavCalendarObjects = array( + 1 => array( + 'event.ics' => array( + 'calendardata' => 'BEGIN:VCALENDAR +VERSION:2.0 +BEGIN:VEVENT +UID:20120730T113415CEST-6804EGphkd@xxxxxx.de +DTSTAMP:20120730T093415Z +DTSTART;VALUE=DATE:20120729 +DTEND;VALUE=DATE:20120730 +SUMMARY:sunday event +TRANSP:TRANSPARENT +END:VEVENT +END:VCALENDAR +', + ), + ), + ); + + function testIssue228() { + + $request = new Sabre_HTTP_Request(array( + 'REQUEST_METHOD' => 'REPORT', + 'HTTP_CONTENT_TYPE' => 'application/xml', + 'REQUEST_URI' => '/calendars/user1/calendar1', + 'HTTP_DEPTH' => '1', + )); + + $request->setBody(' + + + + + + + + + + + + + + +'); + + $response = $this->request($request); + + // We must check if absolutely nothing was returned from this query. + $this->assertFalse(strpos($response->body, 'BEGIN:VCALENDAR')); + + } +} diff --git a/dav/SabreDAV/tests/Sabre/VObject/Component/VAlarmTest.php b/dav/SabreDAV/tests/Sabre/VObject/Component/VAlarmTest.php deleted file mode 100644 index 5229de72..00000000 --- a/dav/SabreDAV/tests/Sabre/VObject/Component/VAlarmTest.php +++ /dev/null @@ -1,141 +0,0 @@ -assertEquals($outcome, $valarm->isInTimeRange($start, $end)); - - } - - public function timeRangeTestData() { - - $tests = array(); - - // Hard date and time - $valarm1 = Sabre_VObject_Component::create('VALARM'); - $valarm1->TRIGGER = '20120312T130000Z'; - $valarm1->TRIGGER['VALUE'] = 'DATE-TIME'; - - $tests[] = array($valarm1, new DateTime('2012-03-01 01:00:00'), new DateTime('2012-04-01 01:00:00'), true); - $tests[] = array($valarm1, new DateTime('2012-03-01 01:00:00'), new DateTime('2012-03-10 01:00:00'), false); - - // Relation to start time of event - $valarm2 = Sabre_VObject_Component::create('VALARM'); - $valarm2->TRIGGER = '-P1D'; - $valarm2->TRIGGER['VALUE'] = 'DURATION'; - - $vevent2 = Sabre_VObject_Component::create('VEVENT'); - $vevent2->DTSTART = '20120313T130000Z'; - $vevent2->add($valarm2); - - $tests[] = array($valarm2, new DateTime('2012-03-01 01:00:00'), new DateTime('2012-04-01 01:00:00'), true); - $tests[] = array($valarm2, new DateTime('2012-03-01 01:00:00'), new DateTime('2012-03-10 01:00:00'), false); - - // Relation to end time of event - $valarm3 = Sabre_VObject_Component::create('VALARM'); - $valarm3->TRIGGER = '-P1D'; - $valarm3->TRIGGER['VALUE'] = 'DURATION'; - $valarm3->TRIGGER['RELATED']= 'END'; - - $vevent3 = Sabre_VObject_Component::create('VEVENT'); - $vevent3->DTSTART = '20120301T130000Z'; - $vevent3->DTEND = '20120401T130000Z'; - $vevent3->add($valarm3); - - $tests[] = array($valarm3, new DateTime('2012-02-25 01:00:00'), new DateTime('2012-03-05 01:00:00'), false); - $tests[] = array($valarm3, new DateTime('2012-03-25 01:00:00'), new DateTime('2012-04-05 01:00:00'), true); - - // Relation to end time of todo - $valarm4 = Sabre_VObject_Component::create('VALARM'); - $valarm4->TRIGGER = '-P1D'; - $valarm4->TRIGGER['VALUE'] = 'DURATION'; - $valarm4->TRIGGER['RELATED']= 'END'; - - $vtodo4 = Sabre_VObject_Component::create('VTODO'); - $vtodo4->DTSTART = '20120301T130000Z'; - $vtodo4->DUE = '20120401T130000Z'; - $vtodo4->add($valarm4); - - $tests[] = array($valarm4, new DateTime('2012-02-25 01:00:00'), new DateTime('2012-03-05 01:00:00'), false); - $tests[] = array($valarm4, new DateTime('2012-03-25 01:00:00'), new DateTime('2012-04-05 01:00:00'), true); - - // Relation to start time of event + repeat - $valarm5 = Sabre_VObject_Component::create('VALARM'); - $valarm5->TRIGGER = '-P1D'; - $valarm5->TRIGGER['VALUE'] = 'DURATION'; - $valarm5->REPEAT = 10; - $valarm5->DURATION = 'P1D'; - - $vevent5 = Sabre_VObject_Component::create('VEVENT'); - $vevent5->DTSTART = '20120301T130000Z'; - $vevent5->add($valarm5); - - $tests[] = array($valarm5, new DateTime('2012-03-09 01:00:00'), new DateTime('2012-03-10 01:00:00'), true); - - // Relation to start time of event + duration, but no repeat - $valarm6 = Sabre_VObject_Component::create('VALARM'); - $valarm6->TRIGGER = '-P1D'; - $valarm6->TRIGGER['VALUE'] = 'DURATION'; - $valarm6->DURATION = 'P1D'; - - $vevent6 = Sabre_VObject_Component::create('VEVENT'); - $vevent6->DTSTART = '20120313T130000Z'; - $vevent6->add($valarm6); - - $tests[] = array($valarm6, new DateTime('2012-03-01 01:00:00'), new DateTime('2012-04-01 01:00:00'), true); - $tests[] = array($valarm6, new DateTime('2012-03-01 01:00:00'), new DateTime('2012-03-10 01:00:00'), false); - - - // Relation to end time of event (DURATION instead of DTEND) - $valarm7 = Sabre_VObject_Component::create('VALARM'); - $valarm7->TRIGGER = '-P1D'; - $valarm7->TRIGGER['VALUE'] = 'DURATION'; - $valarm7->TRIGGER['RELATED']= 'END'; - - $vevent7 = Sabre_VObject_Component::create('VEVENT'); - $vevent7->DTSTART = '20120301T130000Z'; - $vevent7->DURATION = 'P30D'; - $vevent7->add($valarm7); - - $tests[] = array($valarm7, new DateTime('2012-02-25 01:00:00'), new DateTime('2012-03-05 01:00:00'), false); - $tests[] = array($valarm7, new DateTime('2012-03-25 01:00:00'), new DateTime('2012-04-05 01:00:00'), true); - - // Relation to end time of event (No DTEND or DURATION) - $valarm7 = Sabre_VObject_Component::create('VALARM'); - $valarm7->TRIGGER = '-P1D'; - $valarm7->TRIGGER['VALUE'] = 'DURATION'; - $valarm7->TRIGGER['RELATED']= 'END'; - - $vevent7 = Sabre_VObject_Component::create('VEVENT'); - $vevent7->DTSTART = '20120301T130000Z'; - $vevent7->add($valarm7); - - $tests[] = array($valarm7, new DateTime('2012-02-25 01:00:00'), new DateTime('2012-03-05 01:00:00'), true); - $tests[] = array($valarm7, new DateTime('2012-03-25 01:00:00'), new DateTime('2012-04-05 01:00:00'), false); - - - return $tests; - } - - /** - * @expectedException Sabre_DAV_Exception - */ - public function testInTimeRangeInvalidComponent() { - - $valarm = Sabre_VObject_Component::create('VALARM'); - $valarm->TRIGGER = '-P1D'; - $valarm->TRIGGER['RELATED'] = 'END'; - - $vjournal = Sabre_VObject_Component::create('VJOURNAL'); - $vjournal->add($valarm); - - $valarm->isInTimeRange(new DateTime('2012-02-25 01:00:00'), new DateTime('2012-03-05 01:00:00')); - - } - -} - diff --git a/dav/SabreDAV/tests/Sabre/VObject/Component/VCalendarTest.php b/dav/SabreDAV/tests/Sabre/VObject/Component/VCalendarTest.php deleted file mode 100644 index b1b503b4..00000000 --- a/dav/SabreDAV/tests/Sabre/VObject/Component/VCalendarTest.php +++ /dev/null @@ -1,240 +0,0 @@ -expand( - new DateTime('2011-12-01'), - new DateTime('2011-12-31') - ); - - // This will normalize the output - $output = Sabre_VObject_Reader::read($output)->serialize(); - - $this->assertEquals($output, $vcal->serialize()); - - } - - public function expandData() { - - $tests = array(); - - // No data - $input = 'BEGIN:VCALENDAR -CALSCALE:GREGORIAN -VERSION:2.0 -END:VCALENDAR -'; - - $output = $input; - $tests[] = array($input,$output); - - - // Simple events - $input = 'BEGIN:VCALENDAR -CALSCALE:GREGORIAN -VERSION:2.0 -BEGIN:VEVENT -UID:bla -SUMMARY:InExpand -DTSTART;VALUE=DATE:20111202 -END:VEVENT -BEGIN:VEVENT -UID:bla2 -SUMMARY:NotInExpand -DTSTART;VALUE=DATE:20120101 -END:VEVENT -END:VCALENDAR -'; - - $output = 'BEGIN:VCALENDAR -CALSCALE:GREGORIAN -VERSION:2.0 -BEGIN:VEVENT -UID:bla -SUMMARY:InExpand -DTSTART;VALUE=DATE:20111202 -END:VEVENT -END:VCALENDAR -'; - - $tests[] = array($input, $output); - - // Removing timezone info - $input = 'BEGIN:VCALENDAR -CALSCALE:GREGORIAN -VERSION:2.0 -BEGIN:VTIMEZONE -TZID:Europe/Paris -END:VTIMEZONE -BEGIN:VEVENT -UID:bla4 -SUMMARY:RemoveTZ info -DTSTART;TZID=Europe/Paris:20111203T130102 -END:VEVENT -END:VCALENDAR -'; - - $output = 'BEGIN:VCALENDAR -CALSCALE:GREGORIAN -VERSION:2.0 -BEGIN:VEVENT -UID:bla4 -SUMMARY:RemoveTZ info -DTSTART;VALUE=DATE-TIME:20111203T120102Z -END:VEVENT -END:VCALENDAR -'; - - $tests[] = array($input, $output); - - // Recurrence rule - $input = 'BEGIN:VCALENDAR -CALSCALE:GREGORIAN -VERSION:2.0 -BEGIN:VEVENT -UID:bla6 -SUMMARY:Testing RRule -DTSTART:20111125T120000Z -DTEND:20111125T130000Z -RRULE:FREQ=WEEKLY -END:VEVENT -END:VCALENDAR -'; - - $output = 'BEGIN:VCALENDAR -CALSCALE:GREGORIAN -VERSION:2.0 -BEGIN:VEVENT -UID:bla6 -SUMMARY:Testing RRule -DTSTART;VALUE=DATE-TIME:20111202T120000Z -DTEND;VALUE=DATE-TIME:20111202T130000Z -RECURRENCE-ID:20111202T120000Z -END:VEVENT -BEGIN:VEVENT -UID:bla6 -SUMMARY:Testing RRule -DTSTART;VALUE=DATE-TIME:20111209T120000Z -DTEND;VALUE=DATE-TIME:20111209T130000Z -RECURRENCE-ID:20111209T120000Z -END:VEVENT -BEGIN:VEVENT -UID:bla6 -SUMMARY:Testing RRule -DTSTART;VALUE=DATE-TIME:20111216T120000Z -DTEND;VALUE=DATE-TIME:20111216T130000Z -RECURRENCE-ID:20111216T120000Z -END:VEVENT -BEGIN:VEVENT -UID:bla6 -SUMMARY:Testing RRule -DTSTART;VALUE=DATE-TIME:20111223T120000Z -DTEND;VALUE=DATE-TIME:20111223T130000Z -RECURRENCE-ID:20111223T120000Z -END:VEVENT -BEGIN:VEVENT -UID:bla6 -SUMMARY:Testing RRule -DTSTART;VALUE=DATE-TIME:20111230T120000Z -DTEND;VALUE=DATE-TIME:20111230T130000Z -RECURRENCE-ID:20111230T120000Z -END:VEVENT -END:VCALENDAR -'; - - // Recurrence rule + override - $input = 'BEGIN:VCALENDAR -CALSCALE:GREGORIAN -VERSION:2.0 -BEGIN:VEVENT -UID:bla6 -SUMMARY:Testing RRule2 -DTSTART:20111125T120000Z -DTEND:20111125T130000Z -RRULE:FREQ=WEEKLY -END:VEVENT -BEGIN:VEVENT -UID:bla6 -RECURRENCE-ID:20111209T120000Z -DTSTART:20111209T140000Z -DTEND:20111209T150000Z -SUMMARY:Override! -END:VEVENT -END:VCALENDAR -'; - - $output = 'BEGIN:VCALENDAR -CALSCALE:GREGORIAN -VERSION:2.0 -BEGIN:VEVENT -UID:bla6 -SUMMARY:Testing RRule2 -DTSTART;VALUE=DATE-TIME:20111202T120000Z -DTEND;VALUE=DATE-TIME:20111202T130000Z -RECURRENCE-ID:20111202T120000Z -END:VEVENT -BEGIN:VEVENT -UID:bla6 -RECURRENCE-ID:20111209T120000Z -DTSTART:20111209T140000Z -DTEND:20111209T150000Z -SUMMARY:Override! -END:VEVENT -BEGIN:VEVENT -UID:bla6 -SUMMARY:Testing RRule2 -DTSTART;VALUE=DATE-TIME:20111216T120000Z -DTEND;VALUE=DATE-TIME:20111216T130000Z -RECURRENCE-ID:20111216T120000Z -END:VEVENT -BEGIN:VEVENT -UID:bla6 -SUMMARY:Testing RRule2 -DTSTART;VALUE=DATE-TIME:20111223T120000Z -DTEND;VALUE=DATE-TIME:20111223T130000Z -RECURRENCE-ID:20111223T120000Z -END:VEVENT -BEGIN:VEVENT -UID:bla6 -SUMMARY:Testing RRule2 -DTSTART;VALUE=DATE-TIME:20111230T120000Z -DTEND;VALUE=DATE-TIME:20111230T130000Z -RECURRENCE-ID:20111230T120000Z -END:VEVENT -END:VCALENDAR -'; - - $tests[] = array($input, $output); - return $tests; - - } - - /** - * @expectedException LogicException - */ - public function testBrokenEventExpand() { - - $input = 'BEGIN:VCALENDAR -CALSCALE:GREGORIAN -VERSION:2.0 -BEGIN:VEVENT -RRULE:FREQ=WEEKLY -DTSTART;VALUE=DATE:20111202 -END:VEVENT -END:VCALENDAR -'; - $vcal = Sabre_VObject_Reader::read($input); - $vcal->expand( - new DateTime('2011-12-01'), - new DateTime('2011-12-31') - ); - - } - -} diff --git a/dav/SabreDAV/tests/Sabre/VObject/Component/VEventTest.php b/dav/SabreDAV/tests/Sabre/VObject/Component/VEventTest.php deleted file mode 100644 index 90579cb4..00000000 --- a/dav/SabreDAV/tests/Sabre/VObject/Component/VEventTest.php +++ /dev/null @@ -1,69 +0,0 @@ -assertEquals($outcome, $vevent->isInTimeRange($start, $end)); - - } - - public function timeRangeTestData() { - - $tests = array(); - - $vevent = new Sabre_VObject_Component_VEvent('VEVENT'); - $vevent->DTSTART = '20111223T120000Z'; - $tests[] = array($vevent, new DateTime('2011-01-01'), new DateTime('2012-01-01'), true); - $tests[] = array($vevent, new DateTime('2011-01-01'), new DateTime('2011-11-01'), false); - - $vevent2 = clone $vevent; - $vevent2->DTEND = '20111225T120000Z'; - $tests[] = array($vevent2, new DateTime('2011-01-01'), new DateTime('2012-01-01'), true); - $tests[] = array($vevent2, new DateTime('2011-01-01'), new DateTime('2011-11-01'), false); - - $vevent3 = clone $vevent; - $vevent3->DURATION = 'P1D'; - $tests[] = array($vevent3, new DateTime('2011-01-01'), new DateTime('2012-01-01'), true); - $tests[] = array($vevent3, new DateTime('2011-01-01'), new DateTime('2011-11-01'), false); - - $vevent4 = clone $vevent; - $vevent4->DTSTART = '20111225'; - $vevent4->DTSTART['VALUE'] = 'DATE'; - $tests[] = array($vevent4, new DateTime('2011-01-01'), new DateTime('2012-01-01'), true); - $tests[] = array($vevent4, new DateTime('2011-01-01'), new DateTime('2011-11-01'), false); - // Event with no end date should be treated as lasting the entire day. - $tests[] = array($vevent4, new DateTime('2011-12-25 16:00:00'), new DateTime('2011-12-25 17:00:00'), true); - - - $vevent5 = clone $vevent; - $vevent5->DURATION = 'P1D'; - $vevent5->RRULE = 'FREQ=YEARLY'; - $tests[] = array($vevent5, new DateTime('2011-01-01'), new DateTime('2012-01-01'), true); - $tests[] = array($vevent5, new DateTime('2011-01-01'), new DateTime('2011-11-01'), false); - $tests[] = array($vevent5, new DateTime('2013-12-01'), new DateTime('2013-12-31'), true); - - $vevent6 = clone $vevent; - $vevent6->DTSTART = '20111225'; - $vevent6->DTSTART['VALUE'] = 'DATE'; - $vevent6->DTEND = '20111225'; - $vevent6->DTEND['VALUE'] = 'DATE'; - $tests[] = array($vevent6, new DateTime('2011-01-01'), new DateTime('2012-01-01'), true); - $tests[] = array($vevent6, new DateTime('2011-01-01'), new DateTime('2011-11-01'), false); - - // Added this test to ensure that recurrence rules with no DTEND also - // get checked for the entire day. - $vevent7 = clone $vevent; - $vevent7->DTSTART = '20120101'; - $vevent7->DTSTART['VALUE'] = 'DATE'; - $vevent7->RRULE = 'FREQ=MONTHLY'; - $tests[] = array($vevent7, new DateTime('2012-02-01 15:00:00'), new DateTime('2012-02-02'), true); - return $tests; - - } - -} - diff --git a/dav/SabreDAV/tests/Sabre/VObject/Component/VJournalTest.php b/dav/SabreDAV/tests/Sabre/VObject/Component/VJournalTest.php deleted file mode 100644 index 04fcc9db..00000000 --- a/dav/SabreDAV/tests/Sabre/VObject/Component/VJournalTest.php +++ /dev/null @@ -1,37 +0,0 @@ -assertEquals($outcome, $vtodo->isInTimeRange($start, $end)); - - } - - public function timeRangeTestData() { - - $tests = array(); - - $vjournal = Sabre_VObject_Component::create('VJOURNAL'); - $vjournal->DTSTART = '20111223T120000Z'; - $tests[] = array($vjournal, new DateTime('2011-01-01'), new DateTime('2012-01-01'), true); - $tests[] = array($vjournal, new DateTime('2011-01-01'), new DateTime('2011-11-01'), false); - - $vjournal2 = Sabre_VObject_Component::create('VJOURNAL'); - $vjournal2->DTSTART = '20111223'; - $vjournal2->DTSTART['VALUE'] = 'DATE'; - $tests[] = array($vjournal2, new DateTime('2011-01-01'), new DateTime('2012-01-01'), true); - $tests[] = array($vjournal2, new DateTime('2011-01-01'), new DateTime('2011-11-01'), false); - - $vjournal3 = Sabre_VObject_Component::create('VJOURNAL'); - $tests[] = array($vjournal3, new DateTime('2011-01-01'), new DateTime('2012-01-01'), false); - $tests[] = array($vjournal3, new DateTime('2011-01-01'), new DateTime('2011-11-01'), false); - - return $tests; - } - -} - diff --git a/dav/SabreDAV/tests/Sabre/VObject/Component/VTodoTest.php b/dav/SabreDAV/tests/Sabre/VObject/Component/VTodoTest.php deleted file mode 100644 index a8bd619a..00000000 --- a/dav/SabreDAV/tests/Sabre/VObject/Component/VTodoTest.php +++ /dev/null @@ -1,63 +0,0 @@ -assertEquals($outcome, $vtodo->isInTimeRange($start, $end)); - - } - - public function timeRangeTestData() { - - $tests = array(); - - $vtodo = Sabre_VObject_Component::create('VTODO'); - $vtodo->DTSTART = '20111223T120000Z'; - $tests[] = array($vtodo, new DateTime('2011-01-01'), new DateTime('2012-01-01'), true); - $tests[] = array($vtodo, new DateTime('2011-01-01'), new DateTime('2011-11-01'), false); - - $vtodo2 = clone $vtodo; - $vtodo2->DURATION = 'P1D'; - $tests[] = array($vtodo2, new DateTime('2011-01-01'), new DateTime('2012-01-01'), true); - $tests[] = array($vtodo2, new DateTime('2011-01-01'), new DateTime('2011-11-01'), false); - - $vtodo3 = clone $vtodo; - $vtodo3->DUE = '20111225'; - $tests[] = array($vtodo3, new DateTime('2011-01-01'), new DateTime('2012-01-01'), true); - $tests[] = array($vtodo3, new DateTime('2011-01-01'), new DateTime('2011-11-01'), false); - - $vtodo4 = Sabre_VObject_Component::create('VTODO'); - $vtodo4->DUE = '20111225'; - $tests[] = array($vtodo4, new DateTime('2011-01-01'), new DateTime('2012-01-01'), true); - $tests[] = array($vtodo4, new DateTime('2011-01-01'), new DateTime('2011-11-01'), false); - - $vtodo5 = Sabre_VObject_Component::create('VTODO'); - $vtodo5->COMPLETED = '20111225'; - $tests[] = array($vtodo5, new DateTime('2011-01-01'), new DateTime('2012-01-01'), true); - $tests[] = array($vtodo5, new DateTime('2011-01-01'), new DateTime('2011-11-01'), false); - - $vtodo6 = Sabre_VObject_Component::create('VTODO'); - $vtodo6->CREATED = '20111225'; - $tests[] = array($vtodo6, new DateTime('2011-01-01'), new DateTime('2012-01-01'), true); - $tests[] = array($vtodo6, new DateTime('2011-01-01'), new DateTime('2011-11-01'), false); - - $vtodo7 = Sabre_VObject_Component::create('VTODO'); - $vtodo7->CREATED = '20111225'; - $vtodo7->COMPLETED = '20111226'; - $tests[] = array($vtodo7, new DateTime('2011-01-01'), new DateTime('2012-01-01'), true); - $tests[] = array($vtodo7, new DateTime('2011-01-01'), new DateTime('2011-11-01'), false); - - $vtodo7 = Sabre_VObject_Component::create('VTODO'); - $tests[] = array($vtodo7, new DateTime('2011-01-01'), new DateTime('2012-01-01'), true); - $tests[] = array($vtodo7, new DateTime('2011-01-01'), new DateTime('2011-11-01'), true); - - return $tests; - - } - -} - diff --git a/dav/SabreDAV/tests/Sabre/VObject/ComponentTest.php b/dav/SabreDAV/tests/Sabre/VObject/ComponentTest.php deleted file mode 100644 index 42f836db..00000000 --- a/dav/SabreDAV/tests/Sabre/VObject/ComponentTest.php +++ /dev/null @@ -1,390 +0,0 @@ -children[] = $sub; - - $sub = new Sabre_VObject_Component('VTODO'); - $comp->children[] = $sub; - - $count = 0; - foreach($comp->children() as $key=>$subcomponent) { - - $count++; - $this->assertInstanceOf('Sabre_VObject_Component',$subcomponent); - - } - $this->assertEquals(2,$count); - $this->assertEquals(1,$key); - - } - - function testMagicGet() { - - $comp = new Sabre_VObject_Component('VCALENDAR'); - - $sub = new Sabre_VObject_Component('VEVENT'); - $comp->children[] = $sub; - - $sub = new Sabre_VObject_Component('VTODO'); - $comp->children[] = $sub; - - $event = $comp->vevent; - $this->assertInstanceOf('Sabre_VObject_Component', $event); - $this->assertEquals('VEVENT', $event->name); - - $this->assertInternalType('null', $comp->vjournal); - - } - - function testMagicGetGroups() { - - $comp = new Sabre_VObject_Component('VCARD'); - - $sub = new Sabre_VObject_Property('GROUP1.EMAIL','1@1.com'); - $comp->children[] = $sub; - - $sub = new Sabre_VObject_Property('GROUP2.EMAIL','2@2.com'); - $comp->children[] = $sub; - - $sub = new Sabre_VObject_Property('EMAIL','3@3.com'); - $comp->children[] = $sub; - - $emails = $comp->email; - $this->assertEquals(3, count($emails)); - - $email1 = $comp->{"group1.email"}; - $this->assertEquals('EMAIL', $email1[0]->name); - $this->assertEquals('GROUP1', $email1[0]->group); - - $email3 = $comp->{".email"}; - $this->assertEquals('EMAIL', $email3[0]->name); - $this->assertEquals(null, $email3[0]->group); - - } - - function testMagicIsset() { - - $comp = new Sabre_VObject_Component('VCALENDAR'); - - $sub = new Sabre_VObject_Component('VEVENT'); - $comp->children[] = $sub; - - $sub = new Sabre_VObject_Component('VTODO'); - $comp->children[] = $sub; - - $this->assertTrue(isset($comp->vevent)); - $this->assertTrue(isset($comp->vtodo)); - $this->assertFalse(isset($comp->vjournal)); - - } - - function testMagicSetScalar() { - - $comp = new Sabre_VObject_Component('VCALENDAR'); - $comp->myProp = 'myValue'; - - $this->assertInstanceOf('Sabre_VObject_Property',$comp->MYPROP); - $this->assertEquals('myValue',$comp->MYPROP->value); - - - } - - function testMagicSetScalarTwice() { - - $comp = new Sabre_VObject_Component('VCALENDAR'); - $comp->myProp = 'myValue'; - $comp->myProp = 'myValue'; - - $this->assertEquals(1,count($comp->children)); - $this->assertInstanceOf('Sabre_VObject_Property',$comp->MYPROP); - $this->assertEquals('myValue',$comp->MYPROP->value); - - } - - function testMagicSetComponent() { - - $comp = new Sabre_VObject_Component('VCALENDAR'); - - // Note that 'myProp' is ignored here. - $comp->myProp = new Sabre_VObject_Component('VEVENT'); - - $this->assertEquals(1, count($comp->children)); - - $this->assertEquals('VEVENT',$comp->VEVENT->name); - - } - - function testMagicSetTwice() { - - $comp = new Sabre_VObject_Component('VCALENDAR'); - - $comp->VEVENT = new Sabre_VObject_Component('VEVENT'); - $comp->VEVENT = new Sabre_VObject_Component('VEVENT'); - - $this->assertEquals(1, count($comp->children)); - - $this->assertEquals('VEVENT',$comp->VEVENT->name); - - } - - function testArrayAccessGet() { - - $comp = new Sabre_VObject_Component('VCALENDAR'); - - $event = new Sabre_VObject_Component('VEVENT'); - $event->summary = 'Event 1'; - - $comp->add($event); - - $event2 = clone $event; - $event2->summary = 'Event 2'; - - $comp->add($event2); - - $this->assertEquals(2,count($comp->children())); - $this->assertTrue($comp->vevent[1] instanceof Sabre_VObject_Component); - $this->assertEquals('Event 2', (string)$comp->vevent[1]->summary); - - } - - function testArrayAccessExists() { - - $comp = new Sabre_VObject_Component('VCALENDAR'); - - $event = new Sabre_VObject_Component('VEVENT'); - $event->summary = 'Event 1'; - - $comp->add($event); - - $event2 = clone $event; - $event2->summary = 'Event 2'; - - $comp->add($event2); - - $this->assertTrue(isset($comp->vevent[0])); - $this->assertTrue(isset($comp->vevent[1])); - - } - - /** - * @expectedException LogicException - */ - function testArrayAccessSet() { - - $comp = new Sabre_VObject_Component('VCALENDAR'); - $comp['hey'] = 'hi there'; - - } - /** - * @expectedException LogicException - */ - function testArrayAccessUnset() { - - $comp = new Sabre_VObject_Component('VCALENDAR'); - unset($comp[0]); - - } - - function testAddScalar() { - - $comp = new Sabre_VObject_Component('VCALENDAR'); - - $comp->add('myprop','value'); - - $this->assertEquals(1, count($comp->children)); - - $this->assertTrue($comp->children[0] instanceof Sabre_VObject_Property); - $this->assertEquals('MYPROP',$comp->children[0]->name); - $this->assertEquals('value',$comp->children[0]->value); - - } - - function testAddComponent() { - - $comp = new Sabre_VObject_Component('VCALENDAR'); - - $comp->add(new Sabre_VObject_Component('VEVENT')); - - $this->assertEquals(1, count($comp->children)); - - $this->assertEquals('VEVENT',$comp->VEVENT->name); - - } - - function testAddComponentTwice() { - - $comp = new Sabre_VObject_Component('VCALENDAR'); - - $comp->add(new Sabre_VObject_Component('VEVENT')); - $comp->add(new Sabre_VObject_Component('VEVENT')); - - $this->assertEquals(2, count($comp->children)); - - $this->assertEquals('VEVENT',$comp->VEVENT->name); - - } - - /** - * @expectedException InvalidArgumentException - */ - function testAddArgFail() { - - $comp = new Sabre_VObject_Component('VCALENDAR'); - $comp->add(new Sabre_VObject_Component('VEVENT'),'hello'); - - } - - /** - * @expectedException InvalidArgumentException - */ - function testAddArgFail2() { - - $comp = new Sabre_VObject_Component('VCALENDAR'); - $comp->add(array()); - - } - - /** - * @expectedException InvalidArgumentException - */ - function testAddArgFail3() { - - $comp = new Sabre_VObject_Component('VCALENDAR'); - $comp->add('hello',array()); - - } - - /** - * @expectedException InvalidArgumentException - */ - function testMagicSetInvalid() { - - $comp = new Sabre_VObject_Component('VCALENDAR'); - - // Note that 'myProp' is ignored here. - $comp->myProp = new StdClass(); - - $this->assertEquals(1, count($comp->children)); - - $this->assertEquals('VEVENT',$comp->VEVENT->name); - - } - - function testMagicUnset() { - - $comp = new Sabre_VObject_Component('VCALENDAR'); - $comp->add(new Sabre_VObject_Component('VEVENT')); - - unset($comp->vevent); - - $this->assertEquals(array(), $comp->children); - - } - - - function testCount() { - - $comp = new Sabre_VObject_Component('VCALENDAR'); - $this->assertEquals(1,$comp->count()); - - } - - function testChildren() { - - $comp = new Sabre_VObject_Component('VCALENDAR'); - - // Note that 'myProp' is ignored here. - $comp->children = array( - new Sabre_VObject_Component('VEVENT'), - new Sabre_VObject_Component('VTODO') - ); - - $r = $comp->children(); - $this->assertTrue($r instanceof Sabre_VObject_ElementList); - $this->assertEquals(2,count($r)); - } - - function testGetComponents() { - - $comp = new Sabre_VObject_Component('VCALENDAR'); - - // Note that 'myProp' is ignored here. - $comp->children = array( - new Sabre_VObject_Property('FOO','BAR'), - new Sabre_VObject_Component('VTODO') - ); - - $r = $comp->getComponents(); - $this->assertInternalType('array', $r); - $this->assertEquals(1, count($r)); - $this->assertEquals('VTODO', $r[0]->name); - } - - function testSerialize() { - - $comp = new Sabre_VObject_Component('VCALENDAR'); - $this->assertEquals("BEGIN:VCALENDAR\r\nEND:VCALENDAR\r\n", $comp->serialize()); - - } - - function testSerializeChildren() { - - $comp = new Sabre_VObject_Component('VCALENDAR'); - $comp->children = array( - new Sabre_VObject_Component('VEVENT'), - new Sabre_VObject_Component('VTODO') - ); - - $str = $comp->serialize(); - - $this->assertEquals("BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nEND:VEVENT\r\nBEGIN:VTODO\r\nEND:VTODO\r\nEND:VCALENDAR\r\n", $str); - - } - - function testSerializeOrderCompAndProp() { - - $comp = new Sabre_VObject_Component('VCALENDAR'); - $comp->add(new Sabre_VObject_Component('VEVENT')); - $comp->add('PROP1','BLABLA'); - $comp->add('VERSION','2.0'); - $comp->add(new Sabre_VObject_Component('VTIMEZONE')); - - $str = $comp->serialize(); - - $this->assertEquals("BEGIN:VCALENDAR\r\nVERSION:2.0\r\nPROP1:BLABLA\r\nBEGIN:VTIMEZONE\r\nEND:VTIMEZONE\r\nBEGIN:VEVENT\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n", $str); - - } - - function testAnotherSerializeOrderProp() { - - $prop4s=array('1', '2', '3', '4', '5', '6', '7', '8', '9', '10'); - - $comp = new Sabre_VObject_Component('VCARD'); - $comp->__set('SOMEPROP','FOO'); - $comp->__set('ANOTHERPROP','FOO'); - $comp->__set('THIRDPROP','FOO'); - foreach ($prop4s as $prop4) { - $comp->add('PROP4', 'FOO '.$prop4); - } - $comp->__set('PROPNUMBERFIVE', 'FOO'); - $comp->__set('PROPNUMBERSIX', 'FOO'); - $comp->__set('PROPNUMBERSEVEN', 'FOO'); - $comp->__set('PROPNUMBEREIGHT', 'FOO'); - $comp->__set('PROPNUMBERNINE', 'FOO'); - $comp->__set('PROPNUMBERTEN', 'FOO'); - $comp->__set('VERSION','2.0'); - $comp->__set('UID', 'FOO'); - - $str = $comp->serialize(); - - $this->assertEquals("BEGIN:VCARD\r\nVERSION:2.0\r\nSOMEPROP:FOO\r\nANOTHERPROP:FOO\r\nTHIRDPROP:FOO\r\nPROP4:FOO 1\r\nPROP4:FOO 2\r\nPROP4:FOO 3\r\nPROP4:FOO 4\r\nPROP4:FOO 5\r\nPROP4:FOO 6\r\nPROP4:FOO 7\r\nPROP4:FOO 8\r\nPROP4:FOO 9\r\nPROP4:FOO 10\r\nPROPNUMBERFIVE:FOO\r\nPROPNUMBERSIX:FOO\r\nPROPNUMBERSEVEN:FOO\r\nPROPNUMBEREIGHT:FOO\r\nPROPNUMBERNINE:FOO\r\nPROPNUMBERTEN:FOO\r\nUID:FOO\r\nEND:VCARD\r\n", $str); - - } - -} diff --git a/dav/SabreDAV/tests/Sabre/VObject/DateTimeParserTest.php b/dav/SabreDAV/tests/Sabre/VObject/DateTimeParserTest.php deleted file mode 100644 index 83e4c429..00000000 --- a/dav/SabreDAV/tests/Sabre/VObject/DateTimeParserTest.php +++ /dev/null @@ -1,117 +0,0 @@ -assertEquals('+1 weeks', Sabre_VObject_DateTimeParser::parseDuration('P1W',true)); - $this->assertEquals('+5 days', Sabre_VObject_DateTimeParser::parseDuration('P5D',true)); - $this->assertEquals('+5 days 3 hours 50 minutes 12 seconds', Sabre_VObject_DateTimeParser::parseDuration('P5DT3H50M12S',true)); - $this->assertEquals('-1 weeks 50 minutes', Sabre_VObject_DateTimeParser::parseDuration('-P1WT50M',true)); - $this->assertEquals('+50 days 3 hours 2 seconds', Sabre_VObject_DateTimeParser::parseDuration('+P50DT3H2S',true)); - $this->assertEquals(new DateInterval('PT0S'), Sabre_VObject_DateTimeParser::parseDuration('PT0S')); - - } - - function testParseICalendarDurationDateInterval() { - - $expected = new DateInterval('P7D'); - $this->assertEquals($expected, Sabre_VObject_DateTimeParser::parseDuration('P1W')); - $this->assertEquals($expected, Sabre_VObject_DateTimeParser::parse('P1W')); - - $expected = new DateInterval('PT3M'); - $expected->invert = true; - $this->assertEquals($expected, Sabre_VObject_DateTimeParser::parseDuration('-PT3M')); - - } - - /** - * @expectedException Sabre_DAV_Exception_BadRequest - */ - function testParseICalendarDurationFail() { - - Sabre_VObject_DateTimeParser::parseDuration('P1X',true); - - } - - function testParseICalendarDateTime() { - - $dateTime = Sabre_VObject_DateTimeParser::parseDateTime('20100316T141405'); - - $compare = new DateTime('2010-03-16 14:14:05',new DateTimeZone('UTC')); - - $this->assertEquals($compare, $dateTime); - - } - - /** - * @depends testParseICalendarDateTime - * @expectedException Sabre_DAV_Exception_BadRequest - */ - function testParseICalendarDateTimeBadFormat() { - - $dateTime = Sabre_VObject_DateTimeParser::parseDateTime('20100316T141405 '); - - } - - /** - * @depends testParseICalendarDateTime - */ - function testParseICalendarDateTimeUTC() { - - $dateTime = Sabre_VObject_DateTimeParser::parseDateTime('20100316T141405Z'); - - $compare = new DateTime('2010-03-16 14:14:05',new DateTimeZone('UTC')); - $this->assertEquals($compare, $dateTime); - - } - - /** - * @depends testParseICalendarDateTime - */ - function testParseICalendarDateTimeUTC2() { - - $dateTime = Sabre_VObject_DateTimeParser::parseDateTime('20101211T160000Z'); - - $compare = new DateTime('2010-12-11 16:00:00',new DateTimeZone('UTC')); - $this->assertEquals($compare, $dateTime); - - } - - /** - * @depends testParseICalendarDateTime - */ - function testParseICalendarDateTimeCustomTimeZone() { - - $dateTime = Sabre_VObject_DateTimeParser::parseDateTime('20100316T141405', new DateTimeZone('Europe/Amsterdam')); - - $compare = new DateTime('2010-03-16 13:14:05',new DateTimeZone('UTC')); - $this->assertEquals($compare, $dateTime); - - } - - function testParseICalendarDate() { - - $dateTime = Sabre_VObject_DateTimeParser::parseDate('20100316'); - - $expected = new DateTime('2010-03-16 00:00:00',new DateTimeZone('UTC')); - - $this->assertEquals($expected, $dateTime); - - $dateTime = Sabre_VObject_DateTimeParser::parse('20100316'); - $this->assertEquals($expected, $dateTime); - - } - - /** - * @depends testParseICalendarDate - * @expectedException Sabre_DAV_Exception_BadRequest - */ - function testParseICalendarDateBadFormat() { - - $dateTime = Sabre_VObject_DateTimeParser::parseDate('20100316T141405'); - - } -} diff --git a/dav/SabreDAV/tests/Sabre/VObject/ElementListTest.php b/dav/SabreDAV/tests/Sabre/VObject/ElementListTest.php deleted file mode 100644 index 5bc8b43c..00000000 --- a/dav/SabreDAV/tests/Sabre/VObject/ElementListTest.php +++ /dev/null @@ -1,30 +0,0 @@ -$subcomponent) { - - $count++; - $this->assertInstanceOf('Sabre_VObject_Component',$subcomponent); - - } - $this->assertEquals(3,$count); - $this->assertEquals(2,$key); - - } - - -} diff --git a/dav/SabreDAV/tests/Sabre/VObject/EmClientTest.php b/dav/SabreDAV/tests/Sabre/VObject/EmClientTest.php deleted file mode 100644 index 69330230..00000000 --- a/dav/SabreDAV/tests/Sabre/VObject/EmClientTest.php +++ /dev/null @@ -1,53 +0,0 @@ -VEVENT->DTSTART->getDateTime(); - $this->assertEquals(new DateTime('2011-10-08 19:30:00', new DateTimeZone('America/Chicago')), $dt); - - } - -} - diff --git a/dav/SabreDAV/tests/Sabre/VObject/FreeBusyGeneratorTest.php b/dav/SabreDAV/tests/Sabre/VObject/FreeBusyGeneratorTest.php deleted file mode 100644 index d84f5a48..00000000 --- a/dav/SabreDAV/tests/Sabre/VObject/FreeBusyGeneratorTest.php +++ /dev/null @@ -1,256 +0,0 @@ -setObjects($this->getInput()); - $gen->setTimeRange( - new DateTime('20110101T110000Z'), - new DateTime('20110103T110000Z') - ); - - $result = $gen->getResult(); - - $expected = array( - '20110101T120000Z/20110101T130000Z', - '20110101T130000Z/20110101T140000Z', - '20110101T180000Z/20110101T190000Z', - '20110101T190000Z/20110101T200000Z', - '20110102T000000Z/20110103T000000Z', - '20110101T210000Z/20110101T220000Z', - - '20110103T010000Z/20110103T020000Z', - '20110103T030000Z/20110103T040000Z', - '20110103T040000Z/20110103T050000Z', - '20110103T050000Z/20110103T060000Z', - - '20110101T220000Z/20110101T230000Z', - '20110101T230000Z/20110102T000000Z', - ); - - foreach($result->VFREEBUSY->FREEBUSY as $fb) { - - $this->assertContains((string)$fb, $expected); - - $k = array_search((string)$fb, $expected); - unset($expected[$k]); - - } - if (count($expected)>0) { - $this->fail('There were elements in the expected array that were not found in the output: ' . "\n" . print_r($expected,true) . "\n" . $result->serialize()); - - } - - } - - function testGeneratorBaseObject() { - - $obj = new Sabre_VObject_Component('VCALENDAR'); - $obj->METHOD = 'PUBLISH'; - - $gen = new Sabre_VObject_FreeBusyGenerator(); - $gen->setObjects(array()); - $gen->setBaseObject($obj); - - $result = $gen->getResult(); - - $this->assertEquals('PUBLISH', $result->METHOD->value); - - } - function testGeneratorNoVersion() { - - $v = Sabre_DAV_Server::$exposeVersion; - Sabre_DAV_Server::$exposeVersion = false; - - $gen = new Sabre_VObject_FreeBusyGenerator(); - $gen->setObjects(array()); - - $result = $gen->getResult(); - Sabre_DAV_Server::$exposeVersion = $v; - - $this->assertFalse(strpos($result->PRODID->value, Sabre_VObject_Version::VERSION)); - - } - - /** - * @expectedException InvalidArgumentException - */ - function testInvalidArg() { - - $gen = new Sabre_VObject_FreeBusyGenerator(); - $gen->setObjects(array(new StdClass())); - - } - -} diff --git a/dav/SabreDAV/tests/Sabre/VObject/Issue153Test.php b/dav/SabreDAV/tests/Sabre/VObject/Issue153Test.php deleted file mode 100644 index 16557c52..00000000 --- a/dav/SabreDAV/tests/Sabre/VObject/Issue153Test.php +++ /dev/null @@ -1,12 +0,0 @@ -assertEquals('Test Benutzer', (string)$obj->fn); - - } - -} diff --git a/dav/SabreDAV/tests/Sabre/VObject/Issue154Test.php b/dav/SabreDAV/tests/Sabre/VObject/Issue154Test.php deleted file mode 100644 index f5136be1..00000000 --- a/dav/SabreDAV/tests/Sabre/VObject/Issue154Test.php +++ /dev/null @@ -1,27 +0,0 @@ -VERSION = '3.0'; - $vcard->PHOTO = base64_encode('random_stuff'); - $vcard->PHOTO->add('BASE64',null); - $vcard->UID = 'foo-bar'; - - $result = $vcard->serialize(); - $expected = array( - "BEGIN:VCARD", - "VERSION:3.0", - "PHOTO;BASE64:" . base64_encode('random_stuff'), - "UID:foo-bar", - "END:VCARD", - "", - ); - - $this->assertEquals(implode("\r\n", $expected), $result); - - } - -} diff --git a/dav/SabreDAV/tests/Sabre/VObject/ParameterTest.php b/dav/SabreDAV/tests/Sabre/VObject/ParameterTest.php deleted file mode 100644 index ea309971..00000000 --- a/dav/SabreDAV/tests/Sabre/VObject/ParameterTest.php +++ /dev/null @@ -1,21 +0,0 @@ -assertEquals('NAME',$param->name); - $this->assertEquals('value',$param->value); - - } - - function testCastToString() { - - $param = new Sabre_VObject_Parameter('name','value'); - $this->assertEquals('value',$param->__toString()); - $this->assertEquals('value',(string)$param); - - } - -} diff --git a/dav/SabreDAV/tests/Sabre/VObject/Property/DateTimeTest.php b/dav/SabreDAV/tests/Sabre/VObject/Property/DateTimeTest.php deleted file mode 100644 index d6a9830d..00000000 --- a/dav/SabreDAV/tests/Sabre/VObject/Property/DateTimeTest.php +++ /dev/null @@ -1,231 +0,0 @@ -setTimeZone($tz); - - $elem = new Sabre_VObject_Property_DateTime('DTSTART'); - $elem->setDateTime($dt); - - $this->assertEquals('19850704T013000', $elem->value); - $this->assertEquals('Europe/Amsterdam', (string)$elem['TZID']); - $this->assertEquals('DATE-TIME', (string)$elem['VALUE']); - - } - - function testSetDateTimeLOCAL() { - - $tz = new DateTimeZone('Europe/Amsterdam'); - $dt = new DateTime('1985-07-04 01:30:00', $tz); - $dt->setTimeZone($tz); - - $elem = new Sabre_VObject_Property_DateTime('DTSTART'); - $elem->setDateTime($dt, Sabre_VObject_Property_DateTime::LOCAL); - - $this->assertEquals('19850704T013000', $elem->value); - $this->assertNull($elem['TZID']); - $this->assertEquals('DATE-TIME', (string)$elem['VALUE']); - - } - - function testSetDateTimeUTC() { - - $tz = new DateTimeZone('GMT'); - $dt = new DateTime('1985-07-04 01:30:00', $tz); - $dt->setTimeZone($tz); - - $elem = new Sabre_VObject_Property_DateTime('DTSTART'); - $elem->setDateTime($dt, Sabre_VObject_Property_DateTime::UTC); - - $this->assertEquals('19850704T013000Z', $elem->value); - $this->assertNull($elem['TZID']); - $this->assertEquals('DATE-TIME', (string)$elem['VALUE']); - - } - - function testSetDateTimeLOCALTZ() { - - $tz = new DateTimeZone('Europe/Amsterdam'); - $dt = new DateTime('1985-07-04 01:30:00', $tz); - $dt->setTimeZone($tz); - - $elem = new Sabre_VObject_Property_DateTime('DTSTART'); - $elem->setDateTime($dt, Sabre_VObject_Property_DateTime::LOCALTZ); - - $this->assertEquals('19850704T013000', $elem->value); - $this->assertEquals('Europe/Amsterdam', (string)$elem['TZID']); - $this->assertEquals('DATE-TIME', (string)$elem['VALUE']); - - } - - function testSetDateTimeDATE() { - - $tz = new DateTimeZone('Europe/Amsterdam'); - $dt = new DateTime('1985-07-04 01:30:00', $tz); - $dt->setTimeZone($tz); - - $elem = new Sabre_VObject_Property_DateTime('DTSTART'); - $elem->setDateTime($dt, Sabre_VObject_Property_DateTime::DATE); - - $this->assertEquals('19850704', $elem->value); - $this->assertNull($elem['TZID']); - $this->assertEquals('DATE', (string)$elem['VALUE']); - - } - - /** - * @expectedException InvalidArgumentException - */ - function testSetDateTimeInvalid() { - - $tz = new DateTimeZone('Europe/Amsterdam'); - $dt = new DateTime('1985-07-04 01:30:00', $tz); - $dt->setTimeZone($tz); - - $elem = new Sabre_VObject_Property_DateTime('DTSTART'); - $elem->setDateTime($dt, 7); - - } - - function testGetDateTimeCached() { - - $tz = new DateTimeZone('Europe/Amsterdam'); - $dt = new DateTime('1985-07-04 01:30:00', $tz); - $dt->setTimeZone($tz); - - $elem = new Sabre_VObject_Property_DateTime('DTSTART'); - $elem->setDateTime($dt); - - $this->assertEquals($elem->getDateTime(), $dt); - - } - - function testGetDateTimeDateNULL() { - - $elem = new Sabre_VObject_Property_DateTime('DTSTART'); - $dt = $elem->getDateTime(); - - $this->assertNull($dt); - $this->assertNull($elem->getDateType()); - - } - - function testGetDateTimeDateDATE() { - - $elem = new Sabre_VObject_Property_DateTime('DTSTART','19850704'); - $dt = $elem->getDateTime(); - - $this->assertInstanceOf('DateTime', $dt); - $this->assertEquals('1985-07-04 00:00:00', $dt->format('Y-m-d H:i:s')); - $this->assertEquals(Sabre_VObject_Property_DateTime::DATE, $elem->getDateType()); - - } - - - function testGetDateTimeDateLOCAL() { - - $elem = new Sabre_VObject_Property_DateTime('DTSTART','19850704T013000'); - $dt = $elem->getDateTime(); - - $this->assertInstanceOf('DateTime', $dt); - $this->assertEquals('1985-07-04 01:30:00', $dt->format('Y-m-d H:i:s')); - $this->assertEquals(Sabre_VObject_Property_DateTime::LOCAL, $elem->getDateType()); - - } - - function testGetDateTimeDateUTC() { - - $elem = new Sabre_VObject_Property_DateTime('DTSTART','19850704T013000Z'); - $dt = $elem->getDateTime(); - - $this->assertInstanceOf('DateTime', $dt); - $this->assertEquals('1985-07-04 01:30:00', $dt->format('Y-m-d H:i:s')); - $this->assertEquals('UTC', $dt->getTimeZone()->getName()); - $this->assertEquals(Sabre_VObject_Property_DateTime::UTC, $elem->getDateType()); - - } - - function testGetDateTimeDateLOCALTZ() { - - $elem = new Sabre_VObject_Property_DateTime('DTSTART','19850704T013000'); - $elem['TZID'] = 'Europe/Amsterdam'; - - $dt = $elem->getDateTime(); - - $this->assertInstanceOf('DateTime', $dt); - $this->assertEquals('1985-07-04 01:30:00', $dt->format('Y-m-d H:i:s')); - $this->assertEquals('Europe/Amsterdam', $dt->getTimeZone()->getName()); - $this->assertEquals(Sabre_VObject_Property_DateTime::LOCALTZ, $elem->getDateType()); - - } - - /** - * @expectedException InvalidArgumentException - */ - function testGetDateTimeDateInvalid() { - - $elem = new Sabre_VObject_Property_DateTime('DTSTART','bla'); - $dt = $elem->getDateTime(); - - } - - function testGetDateTimeWeirdTZ() { - - $elem = new Sabre_VObject_Property_DateTime('DTSTART','19850704T013000'); - $elem['TZID'] = '/freeassociation.sourceforge.net/Tzfile/Europe/Amsterdam'; - - - $event = new Sabre_VObject_Component('VEVENT'); - $event->add($elem); - - $timezone = new Sabre_VObject_Component('VTIMEZONE'); - $timezone->TZID = '/freeassociation.sourceforge.net/Tzfile/Europe/Amsterdam'; - $timezone->{'X-LIC-LOCATION'} = 'Europe/Amsterdam'; - - $calendar = new Sabre_VObject_Component('VCALENDAR'); - $calendar->add($event); - $calendar->add($timezone); - - $dt = $elem->getDateTime(); - - $this->assertInstanceOf('DateTime', $dt); - $this->assertEquals('1985-07-04 01:30:00', $dt->format('Y-m-d H:i:s')); - $this->assertEquals('Europe/Amsterdam', $dt->getTimeZone()->getName()); - $this->assertEquals(Sabre_VObject_Property_DateTime::LOCALTZ, $elem->getDateType()); - - } - - function testGetDateTimeBadTimeZone() { - - $default = date_default_timezone_get(); - date_default_timezone_set('Canada/Eastern'); - - $elem = new Sabre_VObject_Property_DateTime('DTSTART','19850704T013000'); - $elem['TZID'] = 'Moon'; - - - $event = new Sabre_VObject_Component('VEVENT'); - $event->add($elem); - - $timezone = new Sabre_VObject_Component('VTIMEZONE'); - $timezone->TZID = 'Moon'; - $timezone->{'X-LIC-LOCATION'} = 'Moon'; - - $calendar = new Sabre_VObject_Component('VCALENDAR'); - $calendar->add($event); - $calendar->add($timezone); - - $dt = $elem->getDateTime(); - - $this->assertInstanceOf('DateTime', $dt); - $this->assertEquals('1985-07-04 01:30:00', $dt->format('Y-m-d H:i:s')); - $this->assertEquals('Canada/Eastern', $dt->getTimeZone()->getName()); - $this->assertEquals(Sabre_VObject_Property_DateTime::LOCALTZ, $elem->getDateType()); - date_default_timezone_set($default); - - } -} diff --git a/dav/SabreDAV/tests/Sabre/VObject/Property/MultiDateTimeTest.php b/dav/SabreDAV/tests/Sabre/VObject/Property/MultiDateTimeTest.php deleted file mode 100644 index 4d70ed3d..00000000 --- a/dav/SabreDAV/tests/Sabre/VObject/Property/MultiDateTimeTest.php +++ /dev/null @@ -1,200 +0,0 @@ -setTimeZone($tz); - $dt2->setTimeZone($tz); - - $elem = new Sabre_VObject_Property_MultiDateTime('DTSTART'); - $elem->setDateTimes(array($dt1,$dt2)); - - $this->assertEquals('19850704T013000,19860704T013000', $elem->value); - $this->assertEquals('Europe/Amsterdam', (string)$elem['TZID']); - $this->assertEquals('DATE-TIME', (string)$elem['VALUE']); - - } - - function testSetDateTimeLOCAL() { - - $tz = new DateTimeZone('Europe/Amsterdam'); - $dt1 = new DateTime('1985-07-04 01:30:00', $tz); - $dt2 = new DateTime('1986-07-04 01:30:00', $tz); - $dt1->setTimeZone($tz); - $dt2->setTimeZone($tz); - - $elem = new Sabre_VObject_Property_MultiDateTime('DTSTART'); - $elem->setDateTimes(array($dt1,$dt2), Sabre_VObject_Property_DateTime::LOCAL); - - $this->assertEquals('19850704T013000,19860704T013000', $elem->value); - $this->assertNull($elem['TZID']); - $this->assertEquals('DATE-TIME', (string)$elem['VALUE']); - - } - - function testSetDateTimeUTC() { - - $tz = new DateTimeZone('GMT'); - $dt1 = new DateTime('1985-07-04 01:30:00', $tz); - $dt2 = new DateTime('1986-07-04 01:30:00', $tz); - $dt1->setTimeZone($tz); - $dt2->setTimeZone($tz); - - $elem = new Sabre_VObject_Property_MultiDateTime('DTSTART'); - $elem->setDateTimes(array($dt1,$dt2), Sabre_VObject_Property_DateTime::UTC); - - $this->assertEquals('19850704T013000Z,19860704T013000Z', $elem->value); - $this->assertNull($elem['TZID']); - $this->assertEquals('DATE-TIME', (string)$elem['VALUE']); - - } - - function testSetDateTimeLOCALTZ() { - - $tz = new DateTimeZone('Europe/Amsterdam'); - $dt1 = new DateTime('1985-07-04 01:30:00', $tz); - $dt2 = new DateTime('1986-07-04 01:30:00', $tz); - $dt1->setTimeZone($tz); - $dt2->setTimeZone($tz); - - $elem = new Sabre_VObject_Property_MultiDateTime('DTSTART'); - $elem->setDateTimes(array($dt1,$dt2), Sabre_VObject_Property_DateTime::LOCALTZ); - - $this->assertEquals('19850704T013000,19860704T013000', $elem->value); - $this->assertEquals('Europe/Amsterdam', (string)$elem['TZID']); - $this->assertEquals('DATE-TIME', (string)$elem['VALUE']); - - } - - function testSetDateTimeDATE() { - - $tz = new DateTimeZone('Europe/Amsterdam'); - $dt1 = new datetime('1985-07-04 01:30:00', $tz); - $dt2 = new datetime('1986-07-04 01:30:00', $tz); - $dt1->settimezone($tz); - $dt2->settimezone($tz); - - $elem = new Sabre_VObject_Property_MultiDateTime('DTSTART'); - $elem->setDateTimes(array($dt1,$dt2), Sabre_VObject_Property_DateTime::DATE); - - $this->assertEquals('19850704,19860704', $elem->value); - $this->assertNull($elem['TZID']); - $this->assertEquals('DATE', (string)$elem['VALUE']); - - } - - /** - * @expectedException InvalidArgumentException - */ - function testSetDateTimeInvalid() { - - $tz = new DateTimeZone('Europe/Amsterdam'); - $dt = new DateTime('1985-07-04 01:30:00', $tz); - $dt->setTimeZone($tz); - - $elem = new Sabre_VObject_Property_MultiDateTime('DTSTART'); - $elem->setDateTimes(array($dt), 7); - - } - - function testGetDateTimeCached() { - - $tz = new DateTimeZone('Europe/Amsterdam'); - $dt1 = new datetime('1985-07-04 01:30:00', $tz); - $dt2 = new datetime('1986-07-04 01:30:00', $tz); - $dt1->settimezone($tz); - $dt2->settimezone($tz); - - $elem = new Sabre_VObject_Property_MultiDateTime('DTSTART'); - $elem->setDateTimes(array($dt1,$dt2)); - - $this->assertEquals($elem->getDateTimes(), array($dt1,$dt2)); - - } - - function testGetDateTimeDateNULL() { - - $elem = new Sabre_VObject_Property_MultiDateTime('DTSTART'); - $dt = $elem->getDateTimes(); - - $this->assertNull($dt); - $this->assertNull($elem->getDateType()); - - } - - function testGetDateTimeDateDATE() { - - $elem = new Sabre_VObject_Property_MultiDateTime('DTSTART','19850704,19860704'); - $dt = $elem->getDateTimes(); - - $this->assertEquals('1985-07-04 00:00:00', $dt[0]->format('Y-m-d H:i:s')); - $this->assertEquals('1986-07-04 00:00:00', $dt[1]->format('Y-m-d H:i:s')); - $this->assertEquals(Sabre_VObject_Property_DateTime::DATE, $elem->getDateType()); - - } - - function testGetDateTimeDateDATEReverse() { - - $elem = new Sabre_VObject_Property_MultiDateTime('DTSTART','19850704,19860704'); - - $this->assertEquals(Sabre_VObject_Property_DateTime::DATE, $elem->getDateType()); - - $dt = $elem->getDateTimes(); - $this->assertEquals('1985-07-04 00:00:00', $dt[0]->format('Y-m-d H:i:s')); - $this->assertEquals('1986-07-04 00:00:00', $dt[1]->format('Y-m-d H:i:s')); - - } - - - function testGetDateTimeDateLOCAL() { - - $elem = new Sabre_VObject_Property_DateTime('DTSTART','19850704T013000'); - $dt = $elem->getDateTime(); - - $this->assertInstanceOf('DateTime', $dt); - $this->assertEquals('1985-07-04 01:30:00', $dt->format('Y-m-d H:i:s')); - $this->assertEquals(Sabre_VObject_Property_DateTime::LOCAL, $elem->getDateType()); - - } - - function testGetDateTimeDateUTC() { - - $elem = new Sabre_VObject_Property_DateTime('DTSTART','19850704T013000Z'); - $dt = $elem->getDateTime(); - - $this->assertInstanceOf('DateTime', $dt); - $this->assertEquals('1985-07-04 01:30:00', $dt->format('Y-m-d H:i:s')); - $this->assertEquals('UTC', $dt->getTimeZone()->getName()); - $this->assertEquals(Sabre_VObject_Property_DateTime::UTC, $elem->getDateType()); - - } - - function testGetDateTimeDateLOCALTZ() { - - $elem = new Sabre_VObject_Property_DateTime('DTSTART','19850704T013000'); - $elem['TZID'] = 'Europe/Amsterdam'; - - $dt = $elem->getDateTime(); - - $this->assertInstanceOf('DateTime', $dt); - $this->assertEquals('1985-07-04 01:30:00', $dt->format('Y-m-d H:i:s')); - $this->assertEquals('Europe/Amsterdam', $dt->getTimeZone()->getName()); - $this->assertEquals(Sabre_VObject_Property_DateTime::LOCALTZ, $elem->getDateType()); - - } - - /** - * @expectedException InvalidArgumentException - */ - function testGetDateTimeDateInvalid() { - - $elem = new Sabre_VObject_Property_DateTime('DTSTART','bla'); - $dt = $elem->getDateTime(); - - } - -} diff --git a/dav/SabreDAV/tests/Sabre/VObject/PropertyTest.php b/dav/SabreDAV/tests/Sabre/VObject/PropertyTest.php deleted file mode 100644 index 40fb1468..00000000 --- a/dav/SabreDAV/tests/Sabre/VObject/PropertyTest.php +++ /dev/null @@ -1,278 +0,0 @@ -assertEquals('PROPNAME', $property->name); - $this->assertEquals('propvalue', $property->value); - $this->assertEquals('propvalue', $property->__toString()); - $this->assertEquals('propvalue', (string)$property); - - } - - public function testParameterExists() { - - $property = new Sabre_VObject_Property('propname','propvalue'); - $property->parameters[] = new Sabre_VObject_Parameter('paramname','paramvalue'); - - $this->assertTrue(isset($property['PARAMNAME'])); - $this->assertTrue(isset($property['paramname'])); - $this->assertFalse(isset($property['foo'])); - - } - - public function testParameterGet() { - - $property = new Sabre_VObject_Property('propname','propvalue'); - $property->parameters[] = new Sabre_VObject_Parameter('paramname','paramvalue'); - - $this->assertInstanceOf('Sabre_VObject_Parameter',$property['paramname']); - - } - - public function testParameterNotExists() { - - $property = new Sabre_VObject_Property('propname','propvalue'); - $property->parameters[] = new Sabre_VObject_Parameter('paramname','paramvalue'); - - $this->assertInternalType('null',$property['foo']); - - } - - public function testParameterMultiple() { - - $property = new Sabre_VObject_Property('propname','propvalue'); - $property->parameters[] = new Sabre_VObject_Parameter('paramname','paramvalue'); - $property->parameters[] = new Sabre_VObject_Parameter('paramname','paramvalue'); - - $this->assertInstanceOf('Sabre_VObject_Parameter',$property['paramname']); - $this->assertEquals(2,count($property['paramname'])); - - } - - public function testSetParameterAsString() { - - $property = new Sabre_VObject_Property('propname','propvalue'); - $property['paramname'] = 'paramvalue'; - - $this->assertEquals(1,count($property->parameters)); - $this->assertInstanceOf('Sabre_VObject_Parameter', $property->parameters[0]); - $this->assertEquals('PARAMNAME',$property->parameters[0]->name); - $this->assertEquals('paramvalue',$property->parameters[0]->value); - - } - - /** - * @expectedException InvalidArgumentException - */ - public function testSetParameterAsStringNoKey() { - - $property = new Sabre_VObject_Property('propname','propvalue'); - $property[] = 'paramvalue'; - - } - - public function testSetParameterObject() { - - $property = new Sabre_VObject_Property('propname','propvalue'); - $param = new Sabre_VObject_Parameter('paramname','paramvalue'); - - $property[] = $param; - - $this->assertEquals(1,count($property->parameters)); - $this->assertEquals($param, $property->parameters[0]); - - } - - /** - * @expectedException InvalidArgumentException - */ - public function testSetParameterObjectWithKey() { - - $property = new Sabre_VObject_Property('propname','propvalue'); - $param = new Sabre_VObject_Parameter('paramname','paramvalue'); - - $property['key'] = $param; - - } - - - /** - * @expectedException InvalidArgumentException - */ - public function testSetParameterObjectRandomObject() { - - $property = new Sabre_VObject_Property('propname','propvalue'); - $property[] = new StdClass(); - - } - - public function testUnsetParameter() { - - $property = new Sabre_VObject_Property('propname','propvalue'); - $param = new Sabre_VObject_Parameter('paramname','paramvalue'); - $property->parameters[] = $param; - - unset($property['PARAMNAME']); - $this->assertEquals(0,count($property->parameters)); - - } - - public function testParamCount() { - - $property = new Sabre_VObject_Property('propname','propvalue'); - $param = new Sabre_VObject_Parameter('paramname','paramvalue'); - $property->parameters[] = $param; - $property->parameters[] = clone $param; - - $this->assertEquals(2,count($property->parameters)); - - } - - public function testSerialize() { - - $property = new Sabre_VObject_Property('propname','propvalue'); - - $this->assertEquals("PROPNAME:propvalue\r\n",$property->serialize()); - - } - - public function testSerializeParam() { - - $property = new Sabre_VObject_Property('propname','propvalue'); - $property->parameters[] = new Sabre_VObject_Parameter('paramname','paramvalue'); - $property->parameters[] = new Sabre_VObject_Parameter('paramname2','paramvalue2'); - - $this->assertEquals("PROPNAME;PARAMNAME=paramvalue;PARAMNAME2=paramvalue2:propvalue\r\n",$property->serialize()); - - } - - public function testSerializeNewLine() { - - $property = new Sabre_VObject_Property('propname',"line1\nline2"); - - $this->assertEquals("PROPNAME:line1\\nline2\r\n",$property->serialize()); - - } - - public function testSerializeLongLine() { - - $value = str_repeat('!',200); - $property = new Sabre_VObject_Property('propname',$value); - - $expected = "PROPNAME:" . str_repeat('!',66) . "\r\n " . str_repeat('!',74) . "\r\n " . str_repeat('!',60) . "\r\n"; - - $this->assertEquals($expected,$property->serialize()); - - } - - public function testSerializeUTF8LineFold() { - - $value = str_repeat('!',65) . "\xc3\xa4bla"; // inserted umlaut-a - $property = new Sabre_VObject_Property('propname', $value); - $expected = "PROPNAME:" . str_repeat('!',65) . "\r\n \xc3\xa4bla\r\n"; - $this->assertEquals($expected, $property->serialize()); - - } - - public function testGetIterator() { - - $it = new Sabre_VObject_ElementList(array()); - $property = new Sabre_VObject_Property('propname','propvalue', $it); - $this->assertEquals($it,$property->getIterator()); - - } - - - public function testGetIteratorDefault() { - - $property = new Sabre_VObject_Property('propname','propvalue'); - $it = $property->getIterator(); - $this->assertTrue($it instanceof Sabre_VObject_ElementList); - $this->assertEquals(1,count($it)); - - } - - function testAddScalar() { - - $property = new Sabre_VObject_Property('EMAIL'); - - $property->add('myparam','value'); - - $this->assertEquals(1, count($property->parameters)); - - $this->assertTrue($property->parameters[0] instanceof Sabre_VObject_Parameter); - $this->assertEquals('MYPARAM',$property->parameters[0]->name); - $this->assertEquals('value',$property->parameters[0]->value); - - } - - function testAddParameter() { - - $prop = new Sabre_VObject_Property('EMAIL'); - - $prop->add(new Sabre_VObject_Parameter('MYPARAM','value')); - - $this->assertEquals(1, count($prop->parameters)); - $this->assertEquals('MYPARAM',$prop['myparam']->name); - - } - - function testAddParameterTwice() { - - $prop = new Sabre_VObject_Property('EMAIL'); - - $prop->add(new Sabre_VObject_Parameter('MYPARAM', 'value1')); - $prop->add(new Sabre_VObject_Parameter('MYPARAM', 'value2')); - - $this->assertEquals(2, count($prop->parameters)); - - $this->assertEquals('MYPARAM',$prop['MYPARAM']->name); - - } - - /** - * @expectedException InvalidArgumentException - */ - function testAddArgFail() { - - $prop = new Sabre_VObject_Property('EMAIL'); - $prop->add(new Sabre_VObject_Parameter('MPARAM'),'hello'); - - } - - /** - * @expectedException InvalidArgumentException - */ - function testAddArgFail2() { - - $property = new Sabre_VObject_Property('EMAIL','value'); - $property->add(array()); - - } - - /** - * @expectedException InvalidArgumentException - */ - function testAddArgFail3() { - - $property = new Sabre_VObject_Property('EMAIL','value'); - $property->add('hello',array()); - - } - - function testClone() { - - $property = new Sabre_VObject_Property('EMAIL','value'); - $property['FOO'] = 'BAR'; - - $property2 = clone $property; - - $property['FOO'] = 'BAZ'; - $this->assertEquals('BAR', (string)$property2['FOO']); - - } - -} diff --git a/dav/SabreDAV/tests/Sabre/VObject/ReaderTest.php b/dav/SabreDAV/tests/Sabre/VObject/ReaderTest.php deleted file mode 100644 index a87651cd..00000000 --- a/dav/SabreDAV/tests/Sabre/VObject/ReaderTest.php +++ /dev/null @@ -1,263 +0,0 @@ -assertInstanceOf('Sabre_VObject_Component', $result); - $this->assertEquals('VCALENDAR', $result->name); - $this->assertEquals(0, count($result->children)); - - } - - function testReadComponentUnixNewLine() { - - $data = "BEGIN:VCALENDAR\nEND:VCALENDAR"; - - $result = Sabre_VObject_Reader::read($data); - - $this->assertInstanceOf('Sabre_VObject_Component', $result); - $this->assertEquals('VCALENDAR', $result->name); - $this->assertEquals(0, count($result->children)); - - } - - function testReadComponentMacNewLine() { - - $data = "BEGIN:VCALENDAR\rEND:VCALENDAR"; - - $result = Sabre_VObject_Reader::read($data); - - $this->assertInstanceOf('Sabre_VObject_Component', $result); - $this->assertEquals('VCALENDAR', $result->name); - $this->assertEquals(0, count($result->children)); - - } - - function testReadComponentLineFold() { - - $data = "BEGIN:\r\n\tVCALENDAR\r\nE\r\n ND:VCALENDAR"; - - $result = Sabre_VObject_Reader::read($data); - - $this->assertInstanceOf('Sabre_VObject_Component', $result); - $this->assertEquals('VCALENDAR', $result->name); - $this->assertEquals(0, count($result->children)); - - } - - /** - * @expectedException Sabre_VObject_ParseException - */ - function testReadCorruptComponent() { - - $data = "BEGIN:VCALENDAR\r\nEND:FOO"; - - $result = Sabre_VObject_Reader::read($data); - - } - - function testReadProperty() { - - $data = "PROPNAME:propValue"; - $result = Sabre_VObject_Reader::read($data); - - $this->assertInstanceOf('Sabre_VObject_Property', $result); - $this->assertEquals('PROPNAME', $result->name); - $this->assertEquals('propValue', $result->value); - - } - - function testReadPropertyWithNewLine() { - - $data = 'PROPNAME:Line1\\nLine2\\NLine3\\\\Not the 4th line!'; - $result = Sabre_VObject_Reader::read($data); - - $this->assertInstanceOf('Sabre_VObject_Property', $result); - $this->assertEquals('PROPNAME', $result->name); - $this->assertEquals("Line1\nLine2\nLine3\\Not the 4th line!", $result->value); - - } - - function testReadMappedProperty() { - - $data = "DTSTART:20110529"; - $result = Sabre_VObject_Reader::read($data); - - $this->assertInstanceOf('Sabre_VObject_Property_DateTime', $result); - $this->assertEquals('DTSTART', $result->name); - $this->assertEquals('20110529', $result->value); - - } - - function testReadMappedPropertyGrouped() { - - $data = "foo.DTSTART:20110529"; - $result = Sabre_VObject_Reader::read($data); - - $this->assertInstanceOf('Sabre_VObject_Property_DateTime', $result); - $this->assertEquals('DTSTART', $result->name); - $this->assertEquals('20110529', $result->value); - - } - - - /** - * @expectedException Sabre_VObject_ParseException - */ - function testReadBrokenLine() { - - $data = "PROPNAME;propValue"; - $result = Sabre_VObject_Reader::read($data); - - } - - function testReadPropertyInComponent() { - - $data = array( - "BEGIN:VCALENDAR", - "PROPNAME:propValue", - "END:VCALENDAR" - ); - - $result = Sabre_VObject_Reader::read(implode("\r\n",$data)); - - $this->assertInstanceOf('Sabre_VObject_Component', $result); - $this->assertEquals('VCALENDAR', $result->name); - $this->assertEquals(1, count($result->children)); - $this->assertInstanceOf('Sabre_VObject_Property', $result->children[0]); - $this->assertEquals('PROPNAME', $result->children[0]->name); - $this->assertEquals('propValue', $result->children[0]->value); - - - } - function testReadNestedComponent() { - - $data = array( - "BEGIN:VCALENDAR", - "BEGIN:VTIMEZONE", - "BEGIN:DAYLIGHT", - "END:DAYLIGHT", - "END:VTIMEZONE", - "END:VCALENDAR" - ); - - $result = Sabre_VObject_Reader::read(implode("\r\n",$data)); - - $this->assertInstanceOf('Sabre_VObject_Component', $result); - $this->assertEquals('VCALENDAR', $result->name); - $this->assertEquals(1, count($result->children)); - $this->assertInstanceOf('Sabre_VObject_Component', $result->children[0]); - $this->assertEquals('VTIMEZONE', $result->children[0]->name); - $this->assertEquals(1, count($result->children[0]->children)); - $this->assertInstanceOf('Sabre_VObject_Component', $result->children[0]->children[0]); - $this->assertEquals('DAYLIGHT', $result->children[0]->children[0]->name); - - - } - - function testReadPropertyParameter() { - - $data = "PROPNAME;PARAMNAME=paramvalue:propValue"; - $result = Sabre_VObject_Reader::read($data); - - $this->assertInstanceOf('Sabre_VObject_Property', $result); - $this->assertEquals('PROPNAME', $result->name); - $this->assertEquals('propValue', $result->value); - $this->assertEquals(1, count($result->parameters)); - $this->assertEquals('PARAMNAME', $result->parameters[0]->name); - $this->assertEquals('paramvalue', $result->parameters[0]->value); - - } - - function testReadPropertyNoValue() { - - $data = "PROPNAME;PARAMNAME:propValue"; - $result = Sabre_VObject_Reader::read($data); - - $this->assertInstanceOf('Sabre_VObject_Property', $result); - $this->assertEquals('PROPNAME', $result->name); - $this->assertEquals('propValue', $result->value); - $this->assertEquals(1, count($result->parameters)); - $this->assertEquals('PARAMNAME', $result->parameters[0]->name); - $this->assertEquals('', $result->parameters[0]->value); - - } - - function testReadPropertyParameterExtraColon() { - - $data = "PROPNAME;PARAMNAME=paramvalue:propValue:anotherrandomstring"; - $result = Sabre_VObject_Reader::read($data); - - $this->assertInstanceOf('Sabre_VObject_Property', $result); - $this->assertEquals('PROPNAME', $result->name); - $this->assertEquals('propValue:anotherrandomstring', $result->value); - $this->assertEquals(1, count($result->parameters)); - $this->assertEquals('PARAMNAME', $result->parameters[0]->name); - $this->assertEquals('paramvalue', $result->parameters[0]->value); - - } - - function testReadProperty2Parameters() { - - $data = "PROPNAME;PARAMNAME=paramvalue;PARAMNAME2=paramvalue2:propValue"; - $result = Sabre_VObject_Reader::read($data); - - $this->assertInstanceOf('Sabre_VObject_Property', $result); - $this->assertEquals('PROPNAME', $result->name); - $this->assertEquals('propValue', $result->value); - $this->assertEquals(2, count($result->parameters)); - $this->assertEquals('PARAMNAME', $result->parameters[0]->name); - $this->assertEquals('paramvalue', $result->parameters[0]->value); - $this->assertEquals('PARAMNAME2', $result->parameters[1]->name); - $this->assertEquals('paramvalue2', $result->parameters[1]->value); - - } - - function testReadPropertyParameterQuoted() { - - $data = "PROPNAME;PARAMNAME=\"paramvalue\":propValue"; - $result = Sabre_VObject_Reader::read($data); - - $this->assertInstanceOf('Sabre_VObject_Property', $result); - $this->assertEquals('PROPNAME', $result->name); - $this->assertEquals('propValue', $result->value); - $this->assertEquals(1, count($result->parameters)); - $this->assertEquals('PARAMNAME', $result->parameters[0]->name); - $this->assertEquals('paramvalue', $result->parameters[0]->value); - - } - function testReadPropertyParameterNewLines() { - - $data = "PROPNAME;PARAMNAME=paramvalue1\\nvalue2\\\\nvalue3:propValue"; - $result = Sabre_VObject_Reader::read($data); - - $this->assertInstanceOf('Sabre_VObject_Property', $result); - $this->assertEquals('PROPNAME', $result->name); - $this->assertEquals('propValue', $result->value); - - $this->assertEquals(1, count($result->parameters)); - $this->assertEquals('PARAMNAME', $result->parameters[0]->name); - $this->assertEquals("paramvalue1\nvalue2\\nvalue3", $result->parameters[0]->value); - - } - - function testReadPropertyParameterQuotedColon() { - - $data = "PROPNAME;PARAMNAME=\"param:value\":propValue"; - $result = Sabre_VObject_Reader::read($data); - - $this->assertInstanceOf('Sabre_VObject_Property', $result); - $this->assertEquals('PROPNAME', $result->name); - $this->assertEquals('propValue', $result->value); - $this->assertEquals(1, count($result->parameters)); - $this->assertEquals('PARAMNAME', $result->parameters[0]->name); - $this->assertEquals('param:value', $result->parameters[0]->value); - - } - -} diff --git a/dav/SabreDAV/tests/Sabre/VObject/RecurrenceIteratorFifthTuesdayProblemTest.php b/dav/SabreDAV/tests/Sabre/VObject/RecurrenceIteratorFifthTuesdayProblemTest.php deleted file mode 100644 index 75972c2a..00000000 --- a/dav/SabreDAV/tests/Sabre/VObject/RecurrenceIteratorFifthTuesdayProblemTest.php +++ /dev/null @@ -1,44 +0,0 @@ -VEVENT->UID); - - while($it->valid()) { - $it->next(); - } - - // If we got here, it means we were successful. The bug that was in teh - // system before would fail on the 5th tuesday of the month, if the 5th - // tuesday did not exist. - - } - -} - -?> diff --git a/dav/SabreDAV/tests/Sabre/VObject/RecurrenceIteratorInfiniteLoopProblemTest.php b/dav/SabreDAV/tests/Sabre/VObject/RecurrenceIteratorInfiniteLoopProblemTest.php deleted file mode 100644 index 15062509..00000000 --- a/dav/SabreDAV/tests/Sabre/VObject/RecurrenceIteratorInfiniteLoopProblemTest.php +++ /dev/null @@ -1,63 +0,0 @@ -DTSTART = '20090420T180000Z'; - $ev->RRULE = 'FREQ=WEEKLY;BYDAY=MO;UNTIL=20090704T205959Z;INTERVAL=1'; - - $this->assertFalse($ev->isInTimeRange(new DateTime('2012-01-01 12:00:00'),new DateTime('3000-01-01 00:00:00'))); - - } - - /** - * Different bug, also likely an infinite loop. - */ - function testYearlyByMonthLoop() { - - $ev = Sabre_VObject_Component::create('VEVENT'); - $ev->UID = 'uuid'; - $ev->DTSTART = '20120101T154500'; - $ev->DTSTART['TZID'] = 'Europe/Berlin'; - $ev->RRULE = 'FREQ=YEARLY;INTERVAL=1;UNTIL=20120203T225959Z;BYMONTH=2;BYSETPOS=1;BYDAY=SU,MO,TU,WE,TH,FR,SA'; - $ev->DTEND = '20120101T164500'; - $ev->DTEND['TZID'] = 'Europe/Berlin'; - - // This recurrence rule by itself is a yearly rule that should happen - // every february. - // - // The BYDAY part expands this to every day of the month, but the - // BYSETPOS limits this to only the 1st day of the month. Very crazy - // way to specify this, and could have certainly been a lot easier. - $cal = Sabre_VObject_Component::create('VCALENDAR'); - $cal->add($ev); - - $it = new Sabre_VObject_RecurrenceIterator($cal,'uuid'); - $it->fastForward(new DateTime('2012-01-29 23:00:00', new DateTimeZone('UTC'))); - - $collect = array(); - - while($it->valid()) { - $collect[] = $it->getDTSTART(); - if ($it->getDTSTART() > new DateTime('2013-02-05 22:59:59', new DateTimeZone('UTC'))) { - break; - } - $it->next(); - - } - - $this->assertEquals( - array(new DateTime('2012-02-01 15:45:00', new DateTimeZone('Europe/Berlin'))), - $collect - ); - - } - - -} diff --git a/dav/SabreDAV/tests/Sabre/VObject/RecurrenceIteratorTest.php b/dav/SabreDAV/tests/Sabre/VObject/RecurrenceIteratorTest.php deleted file mode 100644 index 0bb42bb8..00000000 --- a/dav/SabreDAV/tests/Sabre/VObject/RecurrenceIteratorTest.php +++ /dev/null @@ -1,1132 +0,0 @@ -UID = 'bla'; - $ev->RRULE = 'FREQ=DAILY;BYHOUR=10;BYMINUTE=5;BYSECOND=16;BYWEEKNO=32;BYYEARDAY=100,200'; - $dtStart = new Sabre_VObject_Property_DateTime('DTSTART'); - $dtStart->setDateTime(new DateTime('2011-10-07'),Sabre_VObject_Property_DateTime::UTC); - - $ev->add($dtStart); - - $vcal = Sabre_VObject_Component::create('VCALENDAR'); - $vcal->add($ev); - - $it = new Sabre_VObject_RecurrenceIterator($vcal,(string)$ev->uid); - - $this->assertEquals(array(10), $it->byHour); - $this->assertEquals(array(5), $it->byMinute); - $this->assertEquals(array(16), $it->bySecond); - $this->assertEquals(array(32), $it->byWeekNo); - $this->assertEquals(array(100,200), $it->byYearDay); - - } - - /** - * @expectedException InvalidArgumentException - * @depends testValues - */ - function testInvalidFreq() { - - $ev = new Sabre_VObject_Component('VEVENT'); - $ev->RRULE = 'FREQ=SMONTHLY;INTERVAL=3;UNTIL=20111025T000000Z'; - $dtStart = new Sabre_VObject_Property_DateTime('DTSTART'); - $dtStart->setDateTime(new DateTime('2011-10-07'),Sabre_VObject_Property_DateTime::UTC); - - $ev->add($dtStart); - - $vcal = Sabre_VObject_Component::create('VCALENDAR'); - $vcal->add($ev); - - $it = new Sabre_VObject_RecurrenceIterator($vcal,(string)$ev->uid); - - } - - /** - * @expectedException InvalidArgumentException - */ - function testVCalendarNoUID() { - - $vcal = new Sabre_VObject_Component('VCALENDAR'); - $it = new Sabre_VObject_RecurrenceIterator($vcal); - - } - - /** - * @expectedException InvalidArgumentException - */ - function testVCalendarInvalidUID() { - - $vcal = new Sabre_VObject_Component('VCALENDAR'); - $it = new Sabre_VObject_RecurrenceIterator($vcal,'foo'); - - } - - /** - * @depends testValues - */ - function testDaily() { - - $ev = new Sabre_VObject_Component('VEVENT'); - $ev->UID = 'bla'; - $ev->RRULE = 'FREQ=DAILY;INTERVAL=3;UNTIL=20111025T000000Z'; - $dtStart = new Sabre_VObject_Property_DateTime('DTSTART'); - $dtStart->setDateTime(new DateTime('2011-10-07'),Sabre_VObject_Property_DateTime::UTC); - - $ev->add($dtStart); - - $vcal = Sabre_VObject_Component::create('VCALENDAR'); - $vcal->add($ev); - - $it = new Sabre_VObject_RecurrenceIterator($vcal,$ev->uid); - - $this->assertEquals('daily', $it->frequency); - $this->assertEquals(3, $it->interval); - $this->assertEquals(new DateTime('2011-10-25', new DateTimeZone('UTC')), $it->until); - - // Max is to prevent overflow - $max = 12; - $result = array(); - foreach($it as $item) { - - $result[] = $item; - $max--; - - if (!$max) break; - - } - - $tz = new DateTimeZone('UTC'); - - $this->assertEquals( - array( - new DateTime('2011-10-07', $tz), - new DateTime('2011-10-10', $tz), - new DateTime('2011-10-13', $tz), - new DateTime('2011-10-16', $tz), - new DateTime('2011-10-19', $tz), - new DateTime('2011-10-22', $tz), - new DateTime('2011-10-25', $tz), - ), - $result - ); - - } - - /** - * @depends testValues - */ - function testNoRRULE() { - - $ev = new Sabre_VObject_Component('VEVENT'); - $ev->UID = 'bla'; - $dtStart = new Sabre_VObject_Property_DateTime('DTSTART'); - $dtStart->setDateTime(new DateTime('2011-10-07'),Sabre_VObject_Property_DateTime::UTC); - - $ev->add($dtStart); - - $vcal = Sabre_VObject_Component::create('VCALENDAR'); - $vcal->add($ev); - - $it = new Sabre_VObject_RecurrenceIterator($vcal,$ev->uid); - - $this->assertEquals('daily', $it->frequency); - $this->assertEquals(1, $it->interval); - - // Max is to prevent overflow - $max = 12; - $result = array(); - foreach($it as $item) { - - $result[] = $item; - $max--; - - if (!$max) break; - - } - - $tz = new DateTimeZone('UTC'); - - $this->assertEquals( - array( - new DateTime('2011-10-07', $tz), - ), - $result - ); - - } - - /** - * @depends testValues - */ - function testDailyByDay() { - - $ev = new Sabre_VObject_Component('VEVENT'); - $ev->UID = 'bla'; - $ev->RRULE = 'FREQ=DAILY;INTERVAL=2;BYDAY=TU,WE,FR'; - $dtStart = new Sabre_VObject_Property_DateTime('DTSTART'); - $dtStart->setDateTime(new DateTime('2011-10-07'),Sabre_VObject_Property_DateTime::UTC); - - $ev->add($dtStart); - - $vcal = Sabre_VObject_Component::create('VCALENDAR'); - $vcal->add($ev); - - $it = new Sabre_VObject_RecurrenceIterator($vcal,(string)$ev->uid); - - $this->assertEquals('daily', $it->frequency); - $this->assertEquals(2, $it->interval); - $this->assertEquals(array('TU','WE','FR'), $it->byDay); - - // Grabbing the next 12 items - $max = 12; - $result = array(); - foreach($it as $item) { - - $result[] = $item; - $max--; - - if (!$max) break; - - } - - $tz = new DateTimeZone('UTC'); - - $this->assertEquals( - array( - new DateTime('2011-10-07', $tz), - new DateTime('2011-10-11', $tz), - new DateTime('2011-10-19', $tz), - new DateTime('2011-10-21', $tz), - new DateTime('2011-10-25', $tz), - new DateTime('2011-11-02', $tz), - new DateTime('2011-11-04', $tz), - new DateTime('2011-11-08', $tz), - new DateTime('2011-11-16', $tz), - new DateTime('2011-11-18', $tz), - new DateTime('2011-11-22', $tz), - new DateTime('2011-11-30', $tz), - ), - $result - ); - - } - - /** - * @depends testValues - */ - function testWeekly() { - - $ev = new Sabre_VObject_Component('VEVENT'); - $ev->UID = 'bla'; - $ev->RRULE = 'FREQ=WEEKLY;INTERVAL=2;COUNT=10'; - $dtStart = new Sabre_VObject_Property_DateTime('DTSTART'); - $dtStart->setDateTime(new DateTime('2011-10-07'),Sabre_VObject_Property_DateTime::UTC); - - $ev->add($dtStart); - - $vcal = Sabre_VObject_Component::create('VCALENDAR'); - $vcal->add($ev); - - $it = new Sabre_VObject_RecurrenceIterator($vcal,(string)$ev->uid); - - $this->assertEquals('weekly', $it->frequency); - $this->assertEquals(2, $it->interval); - $this->assertEquals(10, $it->count); - - // Max is to prevent overflow - $max = 12; - $result = array(); - foreach($it as $item) { - - $result[] = $item; - $max--; - - if (!$max) break; - - } - - $tz = new DateTimeZone('UTC'); - - $this->assertEquals( - array( - new DateTime('2011-10-07', $tz), - new DateTime('2011-10-21', $tz), - new DateTime('2011-11-04', $tz), - new DateTime('2011-11-18', $tz), - new DateTime('2011-12-02', $tz), - new DateTime('2011-12-16', $tz), - new DateTime('2011-12-30', $tz), - new DateTime('2012-01-13', $tz), - new DateTime('2012-01-27', $tz), - new DateTime('2012-02-10', $tz), - ), - $result - ); - - } - - /** - * @depends testValues - */ - function testWeeklyByDay() { - - $ev = new Sabre_VObject_Component('VEVENT'); - $ev->UID = 'bla'; - $ev->RRULE = 'FREQ=WEEKLY;INTERVAL=2;BYDAY=TU,WE,FR;WKST=SU'; - $dtStart = new Sabre_VObject_Property_DateTime('DTSTART'); - $dtStart->setDateTime(new DateTime('2011-10-07'),Sabre_VObject_Property_DateTime::UTC); - - $ev->add($dtStart); - - $vcal = Sabre_VObject_Component::create('VCALENDAR'); - $vcal->add($ev); - - $it = new Sabre_VObject_RecurrenceIterator($vcal,(string)$ev->uid); - - $this->assertEquals('weekly', $it->frequency); - $this->assertEquals(2, $it->interval); - $this->assertEquals(array('TU','WE','FR'), $it->byDay); - $this->assertEquals('SU', $it->weekStart); - - // Grabbing the next 12 items - $max = 12; - $result = array(); - foreach($it as $item) { - - $result[] = $item; - $max--; - - if (!$max) break; - - } - - $tz = new DateTimeZone('UTC'); - - $this->assertEquals( - array( - new DateTime('2011-10-07', $tz), - new DateTime('2011-10-18', $tz), - new DateTime('2011-10-19', $tz), - new DateTime('2011-10-21', $tz), - new DateTime('2011-11-01', $tz), - new DateTime('2011-11-02', $tz), - new DateTime('2011-11-04', $tz), - new DateTime('2011-11-15', $tz), - new DateTime('2011-11-16', $tz), - new DateTime('2011-11-18', $tz), - new DateTime('2011-11-29', $tz), - new DateTime('2011-11-30', $tz), - ), - $result - ); - - } - - /** - * @depends testValues - */ - function testMonthly() { - - $ev = new Sabre_VObject_Component('VEVENT'); - $ev->UID = 'bla'; - $ev->RRULE = 'FREQ=MONTHLY;INTERVAL=3;COUNT=5'; - $dtStart = new Sabre_VObject_Property_DateTime('DTSTART'); - $dtStart->setDateTime(new DateTime('2011-12-05'),Sabre_VObject_Property_DateTime::UTC); - - $ev->add($dtStart); - - $vcal = Sabre_VObject_Component::create('VCALENDAR'); - $vcal->add($ev); - - $it = new Sabre_VObject_RecurrenceIterator($vcal,(string)$ev->uid); - - $this->assertEquals('monthly', $it->frequency); - $this->assertEquals(3, $it->interval); - $this->assertEquals(5, $it->count); - - $max = 14; - $result = array(); - foreach($it as $item) { - - $result[] = $item; - $max--; - - if (!$max) break; - - } - - $tz = new DateTimeZone('UTC'); - - $this->assertEquals( - array( - new DateTime('2011-12-05', $tz), - new DateTime('2012-03-05', $tz), - new DateTime('2012-06-05', $tz), - new DateTime('2012-09-05', $tz), - new DateTime('2012-12-05', $tz), - ), - $result - ); - - - } - - /** - * @depends testValues - */ - function testMonthlyEndOfMonth() { - - $ev = new Sabre_VObject_Component('VEVENT'); - $ev->UID = 'bla'; - $ev->RRULE = 'FREQ=MONTHLY;INTERVAL=2;COUNT=12'; - $dtStart = new Sabre_VObject_Property_DateTime('DTSTART'); - $dtStart->setDateTime(new DateTime('2011-12-31'),Sabre_VObject_Property_DateTime::UTC); - - $ev->add($dtStart); - - $vcal = Sabre_VObject_Component::create('VCALENDAR'); - $vcal->add($ev); - - $it = new Sabre_VObject_RecurrenceIterator($vcal,(string)$ev->uid); - - $this->assertEquals('monthly', $it->frequency); - $this->assertEquals(2, $it->interval); - $this->assertEquals(12, $it->count); - - $max = 14; - $result = array(); - foreach($it as $item) { - - $result[] = $item; - $max--; - - if (!$max) break; - - } - - $tz = new DateTimeZone('UTC'); - - $this->assertEquals( - array( - new DateTime('2011-12-31', $tz), - new DateTime('2012-08-31', $tz), - new DateTime('2012-10-31', $tz), - new DateTime('2012-12-31', $tz), - new DateTime('2013-08-31', $tz), - new DateTime('2013-10-31', $tz), - new DateTime('2013-12-31', $tz), - new DateTime('2014-08-31', $tz), - new DateTime('2014-10-31', $tz), - new DateTime('2014-12-31', $tz), - new DateTime('2015-08-31', $tz), - new DateTime('2015-10-31', $tz), - ), - $result - ); - - - } - - /** - * @depends testValues - */ - function testMonthlyByMonthDay() { - - $ev = new Sabre_VObject_Component('VEVENT'); - $ev->UID = 'bla'; - $ev->RRULE = 'FREQ=MONTHLY;INTERVAL=5;COUNT=9;BYMONTHDAY=1,31,-7'; - $dtStart = new Sabre_VObject_Property_DateTime('DTSTART'); - $dtStart->setDateTime(new DateTime('2011-01-01'),Sabre_VObject_Property_DateTime::UTC); - - $ev->add($dtStart); - - $vcal = Sabre_VObject_Component::create('VCALENDAR'); - $vcal->add($ev); - - $it = new Sabre_VObject_RecurrenceIterator($vcal,(string)$ev->uid); - - $this->assertEquals('monthly', $it->frequency); - $this->assertEquals(5, $it->interval); - $this->assertEquals(9, $it->count); - $this->assertEquals(array(1, 31, -7), $it->byMonthDay); - - $max = 14; - $result = array(); - foreach($it as $item) { - - $result[] = $item; - $max--; - - if (!$max) break; - - } - - $tz = new DateTimeZone('UTC'); - - $this->assertEquals( - array( - new DateTime('2011-01-01', $tz), - new DateTime('2011-01-25', $tz), - new DateTime('2011-01-31', $tz), - new DateTime('2011-06-01', $tz), - new DateTime('2011-06-24', $tz), - new DateTime('2011-11-01', $tz), - new DateTime('2011-11-24', $tz), - new DateTime('2012-04-01', $tz), - new DateTime('2012-04-24', $tz), - ), - $result - ); - - } - - /** - * @depends testValues - */ - function testMonthlyByDay() { - - $ev = new Sabre_VObject_Component('VEVENT'); - $ev->UID = 'bla'; - $ev->RRULE = 'FREQ=MONTHLY;INTERVAL=2;COUNT=16;BYDAY=MO,-2TU,+1WE,3TH'; - $dtStart = new Sabre_VObject_Property_DateTime('DTSTART'); - $dtStart->setDateTime(new DateTime('2011-01-03'),Sabre_VObject_Property_DateTime::UTC); - - $ev->add($dtStart); - - $vcal = Sabre_VObject_Component::create('VCALENDAR'); - $vcal->add($ev); - - $it = new Sabre_VObject_RecurrenceIterator($vcal,(string)$ev->uid); - - $this->assertEquals('monthly', $it->frequency); - $this->assertEquals(2, $it->interval); - $this->assertEquals(16, $it->count); - $this->assertEquals(array('MO','-2TU','+1WE','3TH'), $it->byDay); - - $max = 20; - $result = array(); - foreach($it as $k=>$item) { - - $result[] = $item; - $max--; - - if (!$max) break; - - } - - $tz = new DateTimeZone('UTC'); - - $this->assertEquals( - array( - new DateTime('2011-01-03', $tz), - new DateTime('2011-01-05', $tz), - new DateTime('2011-01-10', $tz), - new DateTime('2011-01-17', $tz), - new DateTime('2011-01-18', $tz), - new DateTime('2011-01-20', $tz), - new DateTime('2011-01-24', $tz), - new DateTime('2011-01-31', $tz), - new DateTime('2011-03-02', $tz), - new DateTime('2011-03-07', $tz), - new DateTime('2011-03-14', $tz), - new DateTime('2011-03-17', $tz), - new DateTime('2011-03-21', $tz), - new DateTime('2011-03-22', $tz), - new DateTime('2011-03-28', $tz), - new DateTime('2011-05-02', $tz), - ), - $result - ); - - } - - /** - * @depends testValues - */ - function testMonthlyByDayByMonthDay() { - - $ev = new Sabre_VObject_Component('VEVENT'); - $ev->UID = 'bla'; - $ev->RRULE = 'FREQ=MONTHLY;COUNT=10;BYDAY=MO;BYMONTHDAY=1'; - $dtStart = new Sabre_VObject_Property_DateTime('DTSTART'); - $dtStart->setDateTime(new DateTime('2011-08-01'),Sabre_VObject_Property_DateTime::UTC); - - $ev->add($dtStart); - - $vcal = Sabre_VObject_Component::create('VCALENDAR'); - $vcal->add($ev); - - $it = new Sabre_VObject_RecurrenceIterator($vcal,(string)$ev->uid); - - $this->assertEquals('monthly', $it->frequency); - $this->assertEquals(1, $it->interval); - $this->assertEquals(10, $it->count); - $this->assertEquals(array('MO'), $it->byDay); - $this->assertEquals(array(1), $it->byMonthDay); - - $max = 20; - $result = array(); - foreach($it as $k=>$item) { - - $result[] = $item; - $max--; - - if (!$max) break; - - } - - $tz = new DateTimeZone('UTC'); - - $this->assertEquals( - array( - new DateTime('2011-08-01', $tz), - new DateTime('2012-10-01', $tz), - new DateTime('2013-04-01', $tz), - new DateTime('2013-07-01', $tz), - new DateTime('2014-09-01', $tz), - new DateTime('2014-12-01', $tz), - new DateTime('2015-06-01', $tz), - new DateTime('2016-02-01', $tz), - new DateTime('2016-08-01', $tz), - new DateTime('2017-05-01', $tz), - ), - $result - ); - - } - - /** - * @depends testValues - */ - function testMonthlyByDayBySetPos() { - - $ev = new Sabre_VObject_Component('VEVENT'); - $ev->UID = 'bla'; - $ev->RRULE = 'FREQ=MONTHLY;COUNT=10;BYDAY=MO,TU,WE,TH,FR;BYSETPOS=1,-1'; - $dtStart = new Sabre_VObject_Property_DateTime('DTSTART'); - $dtStart->setDateTime(new DateTime('2011-01-03'),Sabre_VObject_Property_DateTime::UTC); - - $ev->add($dtStart); - - $vcal = Sabre_VObject_Component::create('VCALENDAR'); - $vcal->add($ev); - - $it = new Sabre_VObject_RecurrenceIterator($vcal,(string)$ev->uid); - - $this->assertEquals('monthly', $it->frequency); - $this->assertEquals(1, $it->interval); - $this->assertEquals(10, $it->count); - $this->assertEquals(array('MO','TU','WE','TH','FR'), $it->byDay); - $this->assertEquals(array(1,-1), $it->bySetPos); - - $max = 20; - $result = array(); - foreach($it as $k=>$item) { - - $result[] = $item; - $max--; - - if (!$max) break; - - } - - $tz = new DateTimeZone('UTC'); - - $this->assertEquals( - array( - new DateTime('2011-01-03', $tz), - new DateTime('2011-01-31', $tz), - new DateTime('2011-02-01', $tz), - new DateTime('2011-02-28', $tz), - new DateTime('2011-03-01', $tz), - new DateTime('2011-03-31', $tz), - new DateTime('2011-04-01', $tz), - new DateTime('2011-04-29', $tz), - new DateTime('2011-05-02', $tz), - new DateTime('2011-05-31', $tz), - ), - $result - ); - - } - - /** - * @depends testValues - */ - function testYearly() { - - $ev = new Sabre_VObject_Component('VEVENT'); - $ev->UID = 'bla'; - $ev->RRULE = 'FREQ=YEARLY;COUNT=10;INTERVAL=3'; - $dtStart = new Sabre_VObject_Property_DateTime('DTSTART'); - $dtStart->setDateTime(new DateTime('2011-01-01'),Sabre_VObject_Property_DateTime::UTC); - - $ev->add($dtStart); - - $vcal = Sabre_VObject_Component::create('VCALENDAR'); - $vcal->add($ev); - - $it = new Sabre_VObject_RecurrenceIterator($vcal,(string)$ev->uid); - - $this->assertEquals('yearly', $it->frequency); - $this->assertEquals(3, $it->interval); - $this->assertEquals(10, $it->count); - - $max = 20; - $result = array(); - foreach($it as $k=>$item) { - - $result[] = $item; - $max--; - - if (!$max) break; - - } - - $tz = new DateTimeZone('UTC'); - - $this->assertEquals( - array( - new DateTime('2011-01-01', $tz), - new DateTime('2014-01-01', $tz), - new DateTime('2017-01-01', $tz), - new DateTime('2020-01-01', $tz), - new DateTime('2023-01-01', $tz), - new DateTime('2026-01-01', $tz), - new DateTime('2029-01-01', $tz), - new DateTime('2032-01-01', $tz), - new DateTime('2035-01-01', $tz), - new DateTime('2038-01-01', $tz), - ), - $result - ); - - } - - /** - * @depends testValues - */ - function testYearlyLeapYear() { - - $ev = new Sabre_VObject_Component('VEVENT'); - $ev->UID = 'bla'; - $ev->RRULE = 'FREQ=YEARLY;COUNT=3'; - $dtStart = new Sabre_VObject_Property_DateTime('DTSTART'); - $dtStart->setDateTime(new DateTime('2012-02-29'),Sabre_VObject_Property_DateTime::UTC); - - $ev->add($dtStart); - - $vcal = Sabre_VObject_Component::create('VCALENDAR'); - $vcal->add($ev); - - $it = new Sabre_VObject_RecurrenceIterator($vcal,(string)$ev->uid); - - $this->assertEquals('yearly', $it->frequency); - $this->assertEquals(3, $it->count); - - $max = 20; - $result = array(); - foreach($it as $k=>$item) { - - $result[] = $item; - $max--; - - if (!$max) break; - - } - - $tz = new DateTimeZone('UTC'); - - $this->assertEquals( - array( - new DateTime('2012-02-29', $tz), - new DateTime('2016-02-29', $tz), - new DateTime('2020-02-29', $tz), - ), - $result - ); - - } - - /** - * @depends testValues - */ - function testYearlyByMonth() { - - $ev = new Sabre_VObject_Component('VEVENT'); - $ev->UID = 'bla'; - $ev->RRULE = 'FREQ=YEARLY;COUNT=8;INTERVAL=4;BYMONTH=4,10'; - $dtStart = new Sabre_VObject_Property_DateTime('DTSTART'); - $dtStart->setDateTime(new DateTime('2011-04-07'),Sabre_VObject_Property_DateTime::UTC); - - $ev->add($dtStart); - - $vcal = Sabre_VObject_Component::create('VCALENDAR'); - $vcal->add($ev); - - $it = new Sabre_VObject_RecurrenceIterator($vcal,(string)$ev->uid); - - $this->assertEquals('yearly', $it->frequency); - $this->assertEquals(4, $it->interval); - $this->assertEquals(8, $it->count); - $this->assertEquals(array(4,10), $it->byMonth); - - $max = 20; - $result = array(); - foreach($it as $k=>$item) { - - $result[] = $item; - $max--; - - if (!$max) break; - - } - - $tz = new DateTimeZone('UTC'); - - $this->assertEquals( - array( - new DateTime('2011-04-07', $tz), - new DateTime('2011-10-07', $tz), - new DateTime('2015-04-07', $tz), - new DateTime('2015-10-07', $tz), - new DateTime('2019-04-07', $tz), - new DateTime('2019-10-07', $tz), - new DateTime('2023-04-07', $tz), - new DateTime('2023-10-07', $tz), - ), - $result - ); - - } - - /** - * @depends testValues - */ - function testYearlyByMonthByDay() { - - $ev = new Sabre_VObject_Component('VEVENT'); - $ev->UID = 'bla'; - $ev->RRULE = 'FREQ=YEARLY;COUNT=8;INTERVAL=5;BYMONTH=4,10;BYDAY=1MO,-1SU'; - $dtStart = new Sabre_VObject_Property_DateTime('DTSTART'); - $dtStart->setDateTime(new DateTime('2011-04-04'),Sabre_VObject_Property_DateTime::UTC); - - $ev->add($dtStart); - - $vcal = Sabre_VObject_Component::create('VCALENDAR'); - $vcal->add($ev); - - $it = new Sabre_VObject_RecurrenceIterator($vcal,(string)$ev->uid); - - $this->assertEquals('yearly', $it->frequency); - $this->assertEquals(5, $it->interval); - $this->assertEquals(8, $it->count); - $this->assertEquals(array(4,10), $it->byMonth); - $this->assertEquals(array('1MO','-1SU'), $it->byDay); - - $max = 20; - $result = array(); - foreach($it as $k=>$item) { - - $result[] = $item; - $max--; - - if (!$max) break; - - } - - $tz = new DateTimeZone('UTC'); - - $this->assertEquals( - array( - new DateTime('2011-04-04', $tz), - new DateTime('2011-04-24', $tz), - new DateTime('2011-10-03', $tz), - new DateTime('2011-10-30', $tz), - new DateTime('2016-04-04', $tz), - new DateTime('2016-04-24', $tz), - new DateTime('2016-10-03', $tz), - new DateTime('2016-10-30', $tz), - ), - $result - ); - - } - - /** - * @depends testValues - */ - function testFastForward() { - - $ev = new Sabre_VObject_Component('VEVENT'); - $ev->UID = 'bla'; - $ev->RRULE = 'FREQ=YEARLY;COUNT=8;INTERVAL=5;BYMONTH=4,10;BYDAY=1MO,-1SU'; - $dtStart = new Sabre_VObject_Property_DateTime('DTSTART'); - $dtStart->setDateTime(new DateTime('2011-04-04'),Sabre_VObject_Property_DateTime::UTC); - - $ev->add($dtStart); - - $vcal = Sabre_VObject_Component::create('VCALENDAR'); - $vcal->add($ev); - - $it = new Sabre_VObject_RecurrenceIterator($vcal,(string)$ev->uid); - - // The idea is that we're fast-forwarding too far in the future, so - // there will be no results left. - $it->fastForward(new DateTime('2020-05-05')); - - $max = 20; - $result = array(); - while($item = $it->current()) { - - $result[] = $item; - $max--; - - if (!$max) break; - $it->next(); - - } - - $tz = new DateTimeZone('UTC'); - $this->assertEquals(array(), $result); - - } - - /** - * @depends testValues - */ - function testComplexExclusions() { - - $ev = new Sabre_VObject_Component('VEVENT'); - $ev->UID = 'bla'; - $ev->RRULE = 'FREQ=YEARLY;COUNT=10'; - $dtStart = new Sabre_VObject_Property_DateTime('DTSTART'); - - $tz = new DateTimeZone('Canada/Eastern'); - $dtStart->setDateTime(new DateTime('2011-01-01 13:50:20', $tz),Sabre_VObject_Property_DateTime::LOCALTZ); - - $exDate1 = new Sabre_VObject_Property_MultiDateTime('EXDATE'); - $exDate1->setDateTimes(array(new DateTime('2012-01-01 13:50:20', $tz), new DateTime('2014-01-01 13:50:20', $tz)), Sabre_VObject_Property_DateTime::LOCALTZ); - $exDate2 = new Sabre_VObject_Property_MultiDateTime('EXDATE'); - $exDate2->setDateTimes(array(new DateTime('2016-01-01 13:50:20', $tz)), Sabre_VObject_Property_DateTime::LOCALTZ); - - $ev->add($dtStart); - $ev->add($exDate1); - $ev->add($exDate2); - - $vcal = Sabre_VObject_Component::create('VCALENDAR'); - $vcal->add($ev); - - $it = new Sabre_VObject_RecurrenceIterator($vcal,(string)$ev->uid); - - $this->assertEquals('yearly', $it->frequency); - $this->assertEquals(1, $it->interval); - $this->assertEquals(10, $it->count); - - $max = 20; - $result = array(); - foreach($it as $k=>$item) { - - $result[] = $item; - $max--; - - if (!$max) break; - - } - - $this->assertEquals( - array( - new DateTime('2011-01-01 13:50:20', $tz), - new DateTime('2013-01-01 13:50:20', $tz), - new DateTime('2015-01-01 13:50:20', $tz), - new DateTime('2017-01-01 13:50:20', $tz), - new DateTime('2018-01-01 13:50:20', $tz), - new DateTime('2019-01-01 13:50:20', $tz), - new DateTime('2020-01-01 13:50:20', $tz), - ), - $result - ); - - } - - /** - * @depends testValues - */ - function testOverridenEvent() { - - $vcal = Sabre_VObject_Component::create('VCALENDAR'); - - $ev1 = Sabre_VObject_Component::create('VEVENT'); - $ev1->UID = 'overridden'; - $ev1->RRULE = 'FREQ=DAILY;COUNT=10'; - $ev1->DTSTART = '20120107T120000Z'; - $ev1->SUMMARY = 'baseEvent'; - - $vcal->add($ev1); - - // ev2 overrides an event, and puts it on 2pm instead. - $ev2 = Sabre_VObject_Component::create('VEVENT'); - $ev2->UID = 'overridden'; - $ev2->{'RECURRENCE-ID'} = '20120110T120000Z'; - $ev2->DTSTART = '20120110T140000Z'; - $ev2->SUMMARY = 'Event 2'; - - $vcal->add($ev2); - - // ev3 overrides an event, and puts it 2 days and 2 hours later - $ev3 = Sabre_VObject_Component::create('VEVENT'); - $ev3->UID = 'overridden'; - $ev3->{'RECURRENCE-ID'} = '20120113T120000Z'; - $ev3->DTSTART = '20120115T140000Z'; - $ev3->SUMMARY = 'Event 3'; - - $vcal->add($ev3); - - $it = new Sabre_VObject_RecurrenceIterator($vcal,'overridden'); - - $dates = array(); - $summaries = array(); - while($it->valid()) { - - $dates[] = $it->getDTStart(); - $summaries[] = (string)$it->getEventObject()->SUMMARY; - $it->next(); - - } - - $tz = new DateTimeZone('GMT'); - $this->assertEquals(array( - new DateTime('2012-01-07 12:00:00',$tz), - new DateTime('2012-01-08 12:00:00',$tz), - new DateTime('2012-01-09 12:00:00',$tz), - new DateTime('2012-01-10 14:00:00',$tz), - new DateTime('2012-01-11 12:00:00',$tz), - new DateTime('2012-01-12 12:00:00',$tz), - new DateTime('2012-01-14 12:00:00',$tz), - new DateTime('2012-01-15 12:00:00',$tz), - new DateTime('2012-01-15 14:00:00',$tz), - new DateTime('2012-01-16 12:00:00',$tz), - ), $dates); - - $this->assertEquals(array( - 'baseEvent', - 'baseEvent', - 'baseEvent', - 'Event 2', - 'baseEvent', - 'baseEvent', - 'baseEvent', - 'baseEvent', - 'Event 3', - 'baseEvent', - ), $summaries); - - } - - /** - * @depends testValues - */ - function testOverridenEvent2() { - - $vcal = Sabre_VObject_Component::create('VCALENDAR'); - - $ev1 = Sabre_VObject_Component::create('VEVENT'); - $ev1->UID = 'overridden'; - $ev1->RRULE = 'FREQ=WEEKLY;COUNT=3'; - $ev1->DTSTART = '20120112T120000Z'; - $ev1->SUMMARY = 'baseEvent'; - - $vcal->add($ev1); - - // ev2 overrides an event, and puts it 6 days earlier instead. - $ev2 = Sabre_VObject_Component::create('VEVENT'); - $ev2->UID = 'overridden'; - $ev2->{'RECURRENCE-ID'} = '20120119T120000Z'; - $ev2->DTSTART = '20120113T120000Z'; - $ev2->SUMMARY = 'Override!'; - - $vcal->add($ev2); - - $it = new Sabre_VObject_RecurrenceIterator($vcal,'overridden'); - - $dates = array(); - $summaries = array(); - while($it->valid()) { - - $dates[] = $it->getDTStart(); - $summaries[] = (string)$it->getEventObject()->SUMMARY; - $it->next(); - - } - - $tz = new DateTimeZone('GMT'); - $this->assertEquals(array( - new DateTime('2012-01-12 12:00:00',$tz), - new DateTime('2012-01-13 12:00:00',$tz), - new DateTime('2012-01-26 12:00:00',$tz), - - ), $dates); - - $this->assertEquals(array( - 'baseEvent', - 'Override!', - 'baseEvent', - ), $summaries); - - } - - /** - * @depends testValues - */ - function testOverridenEventNoValuesExpected() { - - $vcal = Sabre_VObject_Component::create('VCALENDAR'); - - $ev1 = Sabre_VObject_Component::create('VEVENT'); - $ev1->UID = 'overridden'; - $ev1->RRULE = 'FREQ=WEEKLY;COUNT=3'; - $ev1->DTSTART = '20120124T120000Z'; - $ev1->SUMMARY = 'baseEvent'; - - $vcal->add($ev1); - - // ev2 overrides an event, and puts it 6 days earlier instead. - $ev2 = Sabre_VObject_Component::create('VEVENT'); - $ev2->UID = 'overridden'; - $ev2->{'RECURRENCE-ID'} = '20120131T120000Z'; - $ev2->DTSTART = '20120125T120000Z'; - $ev2->SUMMARY = 'Override!'; - - $vcal->add($ev2); - - $it = new Sabre_VObject_RecurrenceIterator($vcal,'overridden'); - - $dates = array(); - $summaries = array(); - - // The reported problem was specifically related to the VCALENDAR - // expansion. In this parcitular case, we had to forward to the 28th of - // january. - $it->fastForward(new DateTime('2012-01-28 23:00:00')); - - // We stop the loop when it hits the 6th of februari. Normally this - // iterator would hit 24, 25 (overriden from 31) and 7 feb but because - // we 'filter' from the 28th till the 6th, we should get 0 results. - while($it->valid() && $it->getDTSTart() < new DateTime('2012-02-06 23:00:00')) { - - $dates[] = $it->getDTStart(); - $summaries[] = (string)$it->getEventObject()->SUMMARY; - $it->next(); - - } - - $this->assertEquals(array(), $dates); - $this->assertEquals(array(), $summaries); - - } -} - diff --git a/dav/SabreDAV/tests/Sabre/VObject/TimeZoneUtilTest.php b/dav/SabreDAV/tests/Sabre/VObject/TimeZoneUtilTest.php deleted file mode 100644 index be8cd49c..00000000 --- a/dav/SabreDAV/tests/Sabre/VObject/TimeZoneUtilTest.php +++ /dev/null @@ -1,153 +0,0 @@ -assertEquals(new DateTimeZone('Europe/Sarajevo'), $tz); - - } - - function testUnknownExchangeId() { - - $vobj = <<assertEquals(new DateTimeZone(date_default_timezone_get()), $tz); - - } - - function testWindowsTimeZone() { - - $tz = Sabre_VObject_TimeZoneUtil::getTimeZone('Eastern Standard Time'); - $this->assertEquals(new DateTimeZone('America/New_York'), $tz); - - } - - function testFallBack() { - - $vobj = <<assertEquals(new DateTimeZone(date_default_timezone_get()), $tz); - - } - -} diff --git a/dav/SabreDAV/tests/Sabre/VObject/VersionTest.php b/dav/SabreDAV/tests/Sabre/VObject/VersionTest.php deleted file mode 100644 index ea2a4b28..00000000 --- a/dav/SabreDAV/tests/Sabre/VObject/VersionTest.php +++ /dev/null @@ -1,15 +0,0 @@ -assertEquals(-1, version_compare('0.9.0',$v)); - - $s = Sabre_VObject_Version::STABILITY; - $this->assertTrue($s == 'alpha' || $s == 'beta' || $s =='stable'); - - } - -} diff --git a/dav/SabreDAV/tests/Sabre/VObject/issue153.vcf b/dav/SabreDAV/tests/Sabre/VObject/issue153.vcf deleted file mode 100644 index 5fb0fa29..00000000 --- a/dav/SabreDAV/tests/Sabre/VObject/issue153.vcf +++ /dev/null @@ -1,352 +0,0 @@ -BEGIN:VCARD -VERSION:3.0 -N:Benutzer;Test;;; -FN:Test Benutzer -PHOTO;BASE64: - /9j/4AAQSkZJRgABAQAAAQABAAD/4QBYRXhpZgAATU0AKgAAAAgAAgESAAMAAAABAAEAAIdpAAQA - AAABAAAAJgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAABQKADAAQAAAABAAABQAAAAAD/2wBD - AAIBAQIBAQICAQICAgICAwUDAwMDAwYEBAMFBwYHBwcGBgYHCAsJBwgKCAYGCQ0JCgsLDAwMBwkN - Dg0MDgsMDAv/2wBDAQICAgMCAwUDAwULCAYICwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsL - CwsLCwsLCwsLCwsLCwsLCwsLCwv/wAARCAFAAUADASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAA - AAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKB - kaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZn - aGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT - 1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcI - CQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAV - YnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6 - goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk - 5ebn6Onq8vP09fb3+P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rqLfWIfEvhg2muKzQoN4CnBJHT9cVyU5hEjNbB0CHABPNAGTPa - fZriQONjqcZ6flUtqqB1SRmMr/dJzWlDaLrEUh1Qbnx+628ZNZE1s9nfctxEccjpQBO9tLcy7Zjw - vfNQ31q9oee3A75qe2Yyzby5OKiutRMsjKQDg4FG4EVvEyfM5xnsD1q5bbzKHBAB9KrCJN4YMd3p - V+wt8szRZUCnYDXsWSGPz7jGI+SMVVuvErXKEWuRk9QMYqXVyLXTUyRmRcmsSC4EAO8D2pAXxbma - IMR8w7+tVdRtkUAT9ew71as7wsF2nFGsKodDOMzHo/YU0rgULe7j098qW545Gaki1FIbwzeYyzfw - EdvyqkyGSfaw+bvRcQLayqyEnAyaQHR6gi6/pXnBER0IGFHzN15rnmlXyTGRuQHByeQau2GrS20G - 9OhO3H1//VWhf6RprXbXmnrMtuYsOjNk78DkfiDQBi2rpHIVQjb1otHPnBZAMAdRVUQiW6Bgyis2 - Buq29q2nXJjn/eDsycUAOLCG8yg9zkcVCzeVIZY+cenekN0LqYRSHAHA9aLMCOTy5BlTyPegCxa6 - ltkL2+ORzxjFWbTXpLSV3Y84+XFVJvLilKjgVFMpAyBxQBq6prEF7bQSzA+ZJ97jpVRGjDbUJAB+ - U+tUywlJUdE6VteHLK3kuoDqQZ0zyAcYFAG3feVo+io90u2d13R/LyR35rm77VZNSmzC5SEj5hnH - 14/Otu+hv/FN3gTWywW4KRqQM4/OsUeFZp5miaVAc9R0oAaXWa0EUWCIjuA9PeqEMbCYM3G77oAr - bi8Gz2YDmeLc3ygev61X1CxnnuTE8TvPb9fKXigDMuIJFlBdtzHnAPSrEF0IwDCm5hw2VNRzxTWt - 0BeKVMnTIxj8KZ/ahtgY49uT7UAX7VH1K63oERVOTxiuu0ex0nS7L7chJkm+R1kwwyPQZrh4JJDw - zbVbk4/OrNpefLsnyyg5UUAf/9k= -END:VCARD diff --git a/dav/SabreDAV/tests/bootstrap.php b/dav/SabreDAV/tests/bootstrap.php index 8dcae248..c3be7366 100644 --- a/dav/SabreDAV/tests/bootstrap.php +++ b/dav/SabreDAV/tests/bootstrap.php @@ -4,9 +4,9 @@ define('SABRE_MYSQLDSN','mysql:host=127.0.0.1;dbname=sabredav'); define('SABRE_MYSQLUSER','root'); define('SABRE_MYSQLPASS',''); -set_include_path(dirname(__FILE__) . PATH_SEPARATOR . dirname(__FILE__) . '/../lib/' . PATH_SEPARATOR . get_include_path()); +set_include_path(__DIR__ . '/../lib/' . PATH_SEPARATOR . __DIR__ . PATH_SEPARATOR . get_include_path()); -include 'Sabre/autoload.php'; +include __DIR__ . '/../vendor/autoload.php'; include 'Sabre/DAVServerTest.php'; date_default_timezone_set('GMT'); diff --git a/dav/common/calendar.fnk.php b/dav/common/calendar.fnk.php index cd5efa57..13d2cdbb 100644 --- a/dav/common/calendar.fnk.php +++ b/dav/common/calendar.fnk.php @@ -298,7 +298,7 @@ function dav_get_current_user_calendars(&$server, $with_privilege = "") * @param Sabre_CalDAV_Calendar $calendar * @param string $calendarobject_uri * @param string $with_privilege - * @return null|Sabre_VObject_Component_VCalendar + * @return null|Sabre\VObject\Component\VCalendar */ function dav_get_current_user_calendarobject(&$server, &$calendar, $calendarobject_uri, $with_privilege = "") { @@ -314,7 +314,7 @@ function dav_get_current_user_calendarobject(&$server, &$calendar, $calendarobje if (!$aclplugin->checkPrivileges($uri, $with_privilege, Sabre_DAVACL_Plugin::R_PARENT, false)) return null; $data = $obj->get(); - $vObject = Sabre_VObject_Reader::read($data); + $vObject = Sabre\VObject\Reader::read($data); return $vObject; } @@ -342,20 +342,20 @@ function dav_get_current_user_calendar_by_id(&$server, $id, $with_privilege = "" /** * @param string $uid - * @return Sabre_VObject_Component_VCalendar $vObject + * @return Sabre\VObject\Component\VCalendar $vObject */ function dav_create_empty_vevent($uid = "") { $a = get_app(); if ($uid == "") $uid = uniqid(); - return Sabre_VObject_Reader::read("BEGIN:VCALENDAR\r\nVERSION:2.0\r\nPRODID:-//" . DAV_APPNAME . "//DAV-Plugin//EN\r\nBEGIN:VEVENT\r\nUID:" . $uid . "@" . dav_compat_get_hostname() . + return Sabre\VObject\Reader::read("BEGIN:VCALENDAR\r\nVERSION:2.0\r\nPRODID:-//" . DAV_APPNAME . "//DAV-Plugin//EN\r\nBEGIN:VEVENT\r\nUID:" . $uid . "@" . dav_compat_get_hostname() . "\r\nDTSTAMP:" . date("Ymd") . "T" . date("His") . "Z\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n"); } /** - * @param Sabre_VObject_Component_VCalendar $vObject - * @return Sabre_VObject_Component_VEvent|null + * @param Sabre\VObject\Component\VCalendar $vObject + * @return Sabre\VObject\Component\VEvent|null */ function dav_get_eventComponent(&$vObject) { diff --git a/dav/common/calendar_rendering.fnk.php b/dav/common/calendar_rendering.fnk.php index f8224795..d80892f7 100644 --- a/dav/common/calendar_rendering.fnk.php +++ b/dav/common/calendar_rendering.fnk.php @@ -3,8 +3,8 @@ /** - * @param Sabre_VObject_Component_VAlarm $alarm - * @param Sabre_VObject_Component_VEvent|Sabre_VObject_Component_VTodo $parent + * @param Sabre\VObject\Component\VAlarm $alarm + * @param Sabre\VObject\Component\VEvent|Sabre\VObject\Component\VTodo $parent * @return DateTime|null * @throws Sabre_DAV_Exception */ @@ -12,12 +12,12 @@ function renderCalDavEntry_calcalarm(&$alarm, &$parent) { $trigger = $alarm->__get("TRIGGER"); if (!isset($trigger['VALUE']) || strtoupper($trigger['VALUE']) === 'DURATION') { - $triggerDuration = Sabre_VObject_DateTimeParser::parseDuration($trigger->value); + $triggerDuration = Sabre\VObject\DateTimeParser::parseDuration($trigger->value); $related = (isset($trigger['RELATED']) && strtoupper($trigger['RELATED']) == 'END') ? 'END' : 'START'; if ($related === 'START') { - /** @var Sabre_VObject_Property_DateTime $dtstart */ + /** @var Sabre\VObject\Property\DateTime $dtstart */ $dtstart = $parent->__get("DTSTART"); $effectiveTrigger = $dtstart->getDateTime(); $effectiveTrigger->add($triggerDuration); @@ -28,14 +28,14 @@ function renderCalDavEntry_calcalarm(&$alarm, &$parent) $endProp = 'DTEND'; } - /** @var Sabre_VObject_Property_DateTime $dtstart */ + /** @var Sabre\VObject\Property\DateTime $dtstart */ $dtstart = $parent->__get("DTSTART"); if (isset($parent->$endProp)) { $effectiveTrigger = clone $parent->$endProp->getDateTime(); $effectiveTrigger->add($triggerDuration); } elseif ($parent->__get("DURATION") != "") { $effectiveTrigger = clone $dtstart->getDateTime(); - $duration = Sabre_VObject_DateTimeParser::parseDuration($parent->__get("DURATION")); + $duration = Sabre\VObject\DateTimeParser::parseDuration($parent->__get("DURATION")); $effectiveTrigger->add($duration); $effectiveTrigger->add($triggerDuration); } else { @@ -58,10 +58,10 @@ function renderCalDavEntry_calcalarm(&$alarm, &$parent) */ function renderCalDavEntry_data(&$calendar, &$calendarobject) { - /** @var Sabre_VObject_Component_VCalendar $vObject */ - $vObject = Sabre_VObject_Reader::read($calendarobject["calendardata"]); + /** @var Sabre\VObject\Component\VCalendar $vObject */ + $vObject = Sabre\VObject\Reader::read($calendarobject["calendardata"]); $componentType = null; - /** @var Sabre_VObject_Component_VEvent $component */ + /** @var Sabre\VObject\Component\VEvent $component */ $component = null; foreach ($vObject->getComponents() as $component) { if ($component->name !== 'VTIMEZONE') { @@ -86,18 +86,18 @@ function renderCalDavEntry_data(&$calendar, &$calendarobject) ); $recurring = ($component->__get("RRULE") ? 1 : 0); - /** @var Sabre_VObject_Property_DateTime $dtstart */ + /** @var Sabre\VObject\Property\DateTime $dtstart */ $dtstart = $component->__get("DTSTART"); - $allday = ($dtstart->getDateType() == Sabre_VObject_Property_DateTime::DATE ? 1 : 0); + $allday = ($dtstart->getDateType() == Sabre\VObject\Property\DateTime::DATE ? 1 : 0); - /** @var array|Sabre_VObject_Component_VAlarm[] $alarms */ + /** @var array|Sabre\VObject\Component\VAlarm[] $alarms */ $alarms = array(); foreach ($component->getComponents() as $a_component) if ($a_component->name == "VALARM") { - /** var Sabre_VObject_Component_VAlarm $component */ + /** var Sabre\VObject\Component\VAlarm $component */ $alarms[] = $a_component; } - $it = new Sabre_VObject_RecurrenceIterator($vObject, (string)$component->__get("UID")); + $it = new Sabre\VObject\RecurrenceIterator($vObject, (string)$component->__get("UID")); $last_end = 0; $max_ts = mktime(0, 0, 0, 1, 1, CALDAV_MAX_YEAR * 1); $first = true; diff --git a/dav/common/dav_caldav_backend_common.inc.php b/dav/common/dav_caldav_backend_common.inc.php index 99fcb6c1..97d5722a 100644 --- a/dav/common/dav_caldav_backend_common.inc.php +++ b/dav/common/dav_caldav_backend_common.inc.php @@ -81,22 +81,22 @@ abstract class Sabre_CalDAV_Backend_Common extends Sabre_CalDAV_Backend_Abstract /** * @static - * @param Sabre_VObject_Component_VEvent $component + * @param Sabre\VObject\Component\VEvent $component * @return int */ public static function getDtEndTimeStamp(&$component) { - /** @var Sabre_VObject_Property_DateTime $dtstart */ + /** @var Sabre\VObject\Property\DateTime $dtstart */ $dtstart = $component->__get("DTSTART"); if ($component->__get("DTEND")) { - /** @var Sabre_VObject_Property_DateTime $dtend */ + /** @var Sabre\VObject\Property\DateTime $dtend */ $dtend = $component->__get("DTEND"); return $dtend->getDateTime()->getTimeStamp(); } elseif ($component->__get("DURATION")) { $endDate = clone $dtstart->getDateTime(); - $endDate->add(Sabre_VObject_DateTimeParser::parse($component->__get("DURATION")->value)); + $endDate->add(Sabre\VObject\DateTimeParser::parse($component->__get("DURATION")->value)); return $endDate->getTimeStamp(); - } elseif ($dtstart->getDateType() === Sabre_VObject_Property_DateTime::DATE) { + } elseif ($dtstart->getDateType() === Sabre\VObject\Property\DateTime::DATE) { $endDate = clone $dtstart->getDateTime(); $endDate->modify('+1 day'); return $endDate->getTimeStamp(); @@ -124,8 +124,8 @@ abstract class Sabre_CalDAV_Backend_Common extends Sabre_CalDAV_Backend_Abstract */ protected function getDenormalizedData($calendarData) { - /** @var Sabre_VObject_Component_VEvent $vObject */ - $vObject = Sabre_VObject_Reader::read($calendarData); + /** @var Sabre\VObject\Component\VEvent $vObject */ + $vObject = Sabre\VObject\Reader::read($calendarData); $componentType = null; $component = null; $firstOccurence = null; @@ -141,15 +141,15 @@ abstract class Sabre_CalDAV_Backend_Common extends Sabre_CalDAV_Backend_Abstract throw new Sabre_DAV_Exception_BadRequest('Calendar objects must have a VJOURNAL, VEVENT or VTODO component'); } if ($componentType === 'VEVENT') { - /** @var Sabre_VObject_Component_VEvent $component */ - /** @var Sabre_VObject_Property_DateTime $dtstart */ + /** @var Sabre\VObject\Component\VEvent $component */ + /** @var Sabre\VObject\Property\DateTime $dtstart */ $dtstart = $component->__get("DTSTART"); $firstOccurence = $dtstart->getDateTime()->getTimeStamp(); // Finding the last occurence is a bit harder if (!$component->__get("RRULE")) { $lastOccurence = self::getDtEndTimeStamp($component); } else { - $it = new Sabre_VObject_RecurrenceIterator($vObject, (string)$component->__get("UID")); + $it = new Sabre\VObject\RecurrenceIterator($vObject, (string)$component->__get("UID")); $maxDate = new DateTime(CALDAV_MAX_YEAR . "-01-01"); if ($it->isInfinite()) { $lastOccurence = $maxDate->getTimeStamp(); diff --git a/dav/common/wdcal_backend.inc.php b/dav/common/wdcal_backend.inc.php index 9233da6e..330f2988 100644 --- a/dav/common/wdcal_backend.inc.php +++ b/dav/common/wdcal_backend.inc.php @@ -97,12 +97,12 @@ function wdcal_print_feed($base_path = "") $component = dav_get_eventComponent($item); $component->add("SUMMARY", icalendar_sanitize_string(dav_compat_parse_text_serverside("CalendarTitle"))); - if (isset($_REQUEST["allday"])) $type = Sabre_VObject_Property_DateTime::DATE; - else $type = Sabre_VObject_Property_DateTime::LOCALTZ; + if (isset($_REQUEST["allday"])) $type = Sabre\VObject\Property\DateTime::DATE; + else $type = Sabre\VObject\Property\DateTime::LOCALTZ; - $datetime_start = new Sabre_VObject_Property_DateTime("DTSTART"); + $datetime_start = new Sabre\VObject\Property\DateTime("DTSTART"); $datetime_start->setDateTime(new DateTime(date("Y-m-d H:i:s", IntVal($_REQUEST["CalendarStartTime"]))), $type); - $datetime_end = new Sabre_VObject_Property_DateTime("DTEND"); + $datetime_end = new Sabre\VObject\Property\DateTime("DTEND"); $datetime_end->setDateTime(new DateTime(date("Y-m-d H:i:s", IntVal($_REQUEST["CalendarEndTime"]))), $type); $component->add($datetime_start); @@ -179,12 +179,12 @@ function wdcal_print_feed($base_path = "") killme(); } - if (isset($_REQUEST["allday"])) $type = Sabre_VObject_Property_DateTime::DATE; - else $type = Sabre_VObject_Property_DateTime::LOCALTZ; + if (isset($_REQUEST["allday"])) $type = Sabre\VObject\Property\DateTime::DATE; + else $type = Sabre\VObject\Property\DateTime::LOCALTZ; - $datetime_start = new Sabre_VObject_Property_DateTime("DTSTART"); + $datetime_start = new Sabre\VObject\Property\DateTime("DTSTART"); $datetime_start->setDateTime(new DateTime(date("Y-m-d H:i:s", IntVal($_REQUEST["CalendarStartTime"]))), $type); - $datetime_end = new Sabre_VObject_Property_DateTime("DTEND"); + $datetime_end = new Sabre\VObject\Property\DateTime("DTEND"); $datetime_end->setDateTime(new DateTime(date("Y-m-d H:i:s", IntVal($_REQUEST["CalendarEndTime"]))), $type); $component->__unset("DTSTART"); diff --git a/dav/friendica/dav_caldav_backend_virtual_friendica.inc.php b/dav/friendica/dav_caldav_backend_virtual_friendica.inc.php index d2810b4f..0afc03bd 100644 --- a/dav/friendica/dav_caldav_backend_virtual_friendica.inc.php +++ b/dav/friendica/dav_caldav_backend_virtual_friendica.inc.php @@ -82,11 +82,11 @@ class Sabre_CalDAV_Backend_Friendica extends Sabre_CalDAV_Backend_Virtual $ts_end = wdcal_mySql2PhpTime($start); $allday = (strpos($start, "00:00:00") !== false && strpos($finish, "00:00:00") !== false); - $type = ($allday ? Sabre_VObject_Property_DateTime::DATE : Sabre_VObject_Property_DateTime::LOCALTZ); + $type = ($allday ? Sabre\VObject\Property\DateTime::DATE : Sabre\VObject\Property\DateTime::LOCALTZ); - $datetime_start = new Sabre_VObject_Property_DateTime("DTSTART"); + $datetime_start = new Sabre\VObject\Property\DateTime("DTSTART"); $datetime_start->setDateTime(new DateTime(date("Y-m-d H:i:s", $ts_start)), $type); - $datetime_end = new Sabre_VObject_Property_DateTime("DTEND"); + $datetime_end = new Sabre\VObject\Property\DateTime("DTEND"); $datetime_end->setDateTime(new DateTime(date("Y-m-d H:i:s", $ts_end)), $type); $component->add($datetime_start); diff --git a/dav/friendica/layout.fnk.php b/dav/friendica/layout.fnk.php index 5b65ec24..80a9ae2d 100644 --- a/dav/friendica/layout.fnk.php +++ b/dav/friendica/layout.fnk.php @@ -86,12 +86,12 @@ function wdcal_import_user_ics($calendar_id) { if ($_FILES["ics_file"]["tmp_name"] != "" && is_uploaded_file($_FILES["ics_file"]["tmp_name"])) try { $text = file_get_contents($_FILES["ics_file"]["tmp_name"]); - /** @var Sabre_VObject_Component_VCalendar $vObject */ - $vObject = Sabre_VObject_Reader::read($text); + /** @var Sabre\VObject\Component\VCalendar $vObject */ + $vObject = Sabre\VObject\Reader::read($text); $comp = $vObject->getComponents(); $imported = array(); foreach ($comp as $c) try { - /** @var Sabre_VObject_Component_VEvent $c */ + /** @var Sabre\VObject\Component\VEvent $c */ $uid = $c->__get("UID")->value; if (!isset($imported[$uid])) $imported[$uid] = ""; $imported[$uid] .= $c->serialize(); diff --git a/dav/friendica/main.php b/dav/friendica/main.php index 602bda6d..712b6c7b 100644 --- a/dav/friendica/main.php +++ b/dav/friendica/main.php @@ -28,6 +28,27 @@ function dav_include_files() { require_once (__DIR__ . "/../SabreDAV/lib/Sabre/autoload.php"); + require_once (__DIR__ . "/../sabre-vobject/lib/Sabre/VObject/Node.php"); + require_once (__DIR__ . "/../sabre-vobject/lib/Sabre/VObject/Element.php"); + require_once (__DIR__ . "/../sabre-vobject/lib/Sabre/VObject/Component.php"); + require_once (__DIR__ . "/../sabre-vobject/lib/Sabre/VObject/DateTimeParser.php"); + require_once (__DIR__ . "/../sabre-vobject/lib/Sabre/VObject/ElementList.php"); + require_once (__DIR__ . "/../sabre-vobject/lib/Sabre/VObject/FreeBusyGenerator.php"); + require_once (__DIR__ . "/../sabre-vobject/lib/Sabre/VObject/Parameter.php"); + require_once (__DIR__ . "/../sabre-vobject/lib/Sabre/VObject/ParseException.php"); + require_once (__DIR__ . "/../sabre-vobject/lib/Sabre/VObject/Property.php"); + require_once (__DIR__ . "/../sabre-vobject/lib/Sabre/VObject/Reader.php"); + require_once (__DIR__ . "/../sabre-vobject/lib/Sabre/VObject/RecurrenceIterator.php"); + require_once (__DIR__ . "/../sabre-vobject/lib/Sabre/VObject/TimeZoneUtil.php"); + require_once (__DIR__ . "/../sabre-vobject/lib/Sabre/VObject/Version.php"); + require_once (__DIR__ . "/../sabre-vobject/lib/Sabre/VObject/Property/DateTime.php"); + require_once (__DIR__ . "/../sabre-vobject/lib/Sabre/VObject/Property/MultiDateTime.php"); + require_once (__DIR__ . "/../sabre-vobject/lib/Sabre/VObject/Component/VAlarm.php"); + require_once (__DIR__ . "/../sabre-vobject/lib/Sabre/VObject/Component/VCalendar.php"); + require_once (__DIR__ . "/../sabre-vobject/lib/Sabre/VObject/Component/VEvent.php"); + require_once (__DIR__ . "/../sabre-vobject/lib/Sabre/VObject/Component/VJournal.php"); + require_once (__DIR__ . "/../sabre-vobject/lib/Sabre/VObject/Component/VTodo.php"); + require_once (__DIR__ . "/../common/calendar.fnk.php"); require_once (__DIR__ . "/../common/calendar_rendering.fnk.php"); @@ -109,7 +130,7 @@ function dav_init(&$a) } - $server = dav_create_server(); + $server = dav_create_server(); $browser = new Sabre_DAV_Browser_Plugin(); $server->addPlugin($browser); @@ -293,8 +314,7 @@ function dav_plugin_admin_post(&$a = null, &$o = null) if (count($errs) == 0) { renderAllCalDavEntries(); info(t('The database tables have been updated.') . EOL); - } - else notice(t("An error occurred during the update.") . EOL); + } else notice(t("An error occurred during the update.") . EOL); } } diff --git a/dav/sabre-vobject/.travis.yml b/dav/sabre-vobject/.travis.yml new file mode 100644 index 00000000..aca128bc --- /dev/null +++ b/dav/sabre-vobject/.travis.yml @@ -0,0 +1,8 @@ +language: php +php: + - 5.3 + - 5.4 + +script: phpunit --configuration tests/phpunit.xml + +before_script: composer install diff --git a/dav/sabre-vobject/ChangeLog b/dav/sabre-vobject/ChangeLog new file mode 100644 index 00000000..0f26abbb --- /dev/null +++ b/dav/sabre-vobject/ChangeLog @@ -0,0 +1,7 @@ +2.0.0-stable (2012-08-08) + * VObject is now a separate project from SabreDAV. See the SabreDAV + changelog for version information before 2.0. + * New: VObject library now uses PHP 5.3 namespaces. + * New: It's possible to specify lists of parameters when constructing + properties. + * New: made it easier to construct the FreeBusyGenerator. diff --git a/dav/sabre-vobject/LICENSE b/dav/sabre-vobject/LICENSE new file mode 100644 index 00000000..8e09aec6 --- /dev/null +++ b/dav/sabre-vobject/LICENSE @@ -0,0 +1,27 @@ +Copyright (C) 2007-2012 Rooftop Solutions. + +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of the Sabre nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. diff --git a/dav/sabre-vobject/README.md b/dav/sabre-vobject/README.md new file mode 100644 index 00000000..13107039 --- /dev/null +++ b/dav/sabre-vobject/README.md @@ -0,0 +1,388 @@ +# SabreTooth VObject library + +[![Build Status](https://secure.travis-ci.org/evert/sabre-vobject.png?branch=master)](http://travis-ci.org/evert/sabre-vobject) + +The VObject library allows you to easily parse and manipulate [iCalendar](https://tools.ietf.org/html/rfc5545) +and [vCard](https://tools.ietf.org/html/rfc6350) objects using PHP. +The goal of the VObject library is to create a very complete library, with an easy to use API. + +This project is a spin-off from [SabreDAV](http://code.google.com/p/sabredav/), where it has +been used for several years. The VObject library has 100% unittest coverage. + +# Installation + +VObject requires PHP 5.3, and should be installed using composer. +The general composer instructions can be found on the [composer website](http://getcomposer.org/doc/00-intro.md composer website). + +After that, just declare the vobject dependency as follows: + +``` +"require" : { + "sabre/vobject" : "dev-master" +} +``` + +Then, run `composer.phar update` and you should be good. As soon as the first release is out, you should switch `dev-master` to `2.0.*` though. + +# Usage + +## Parsing + +For our example, we will be using the following vcard: + +``` +BEGIN:VCARD +VERSION:3.0 +PRODID:-//Sabre//Sabre VObject 2.0//EN +N:Planck;Max;;; +FN:Max Planck +EMAIL;TYPE=WORK:mplanck@example.org +item1.TEL;TYPE=CELL:(+49)3144435678 +item1.X-ABLabel:Private cell +item2.TEL;TYPE=WORK:(+49)5554564744 +item2.X-ABLabel:Work +END:VCARD +``` + + +If we want to just print out Max' full name, you can just use property access: + + +```php + +use Sabre\VObject; + +$card = VObject\Reader::read($data); +echo $card->FN; + +``` + +## Changing properties + +Creating properties is pretty similar. If we like to add his birthday, we just +set the property: + +```php + +$card->BDAY = '1858-04-23'; + +``` + +Note that in the previous example, we're actually updating any existing BDAY that +may already exist. If we want to add a new property, without overwriting the previous +we can do this with the `add` method. + +```php + +$card->add('EMAIL','max@example.org'); + +``` + +## Parameters + +If we want to also specify that this is max' home email addresses, we can do this with +a third parameter: + +``` + +$card->add('EMAIL', 'max@example'org', array('type' => 'HOME')); + +``` + +If we want to read out all the email addresses and their type, this would look something +like this: + +``` +foreach($card->EMAIL as $email) { + + echo $email['TYPE'], ' - ', $email; + +} +``` + +## Groups + +In our example, you can see that the TEL properties are prefixed. These are 'groups' and +allow you to group multiple related properties together. The group can be any user-defined +name. + +This particular example as generated by the OS X addressbook, which uses the `X-ABLabel` +to allow the user to specify custom labels for properties. OS X addressbook uses groups +to tie the label to the property. + +The VObject library simply ignores the group if you don't specify it, so this will work: + +```php + +foreach($card->TEL as $tel) { + echo $tel, "\n"; +} +``` + +But if you would like to target a specific group + property, this is possible too: + +```php + +echo $card->{'ITEM1.TEL'}; + +``` + +So if you would like to show all the phone numbers, along with their custom label, the +following syntax is used: + +``` +foreach($card->TEL as $tel) { + + echo $card->{$tel->group . '.X-ABLABEL'}, ": "; + echo $tel, "\n"; + +} +``` + +## Serializing / Saving + +If you want to generate your updated VObject, you can simply call the serialize() method. + +``` + +echo $card->serialize(); + +``` + +## Components + +iCalendar, unlike vCards always have sub-components. Where vCards are often just a flat +list, iCalendar objects tend to have a tree-like structure. For the following paragraphs, +we will use the following object as the example: + +``` +BEGIN:VCALENDAR +VERSION:2.0 +PRODID:-//Sabre//Sabre VObject 2.0//EN +BEGIN:VEVENT +SUMMARY:Curiosity landing +DTSTART:20120806T051439Z +LOCATION:Mars +END:VEVENT +END:VCALENDAR +``` + +Since events, tasks and journals are always in a sub component, this is also how we +access them. + +```php + +use Sabre\VObject; + +$calendar = VObject\Reader::read($data); +echo $calendar->VEVENT->SUMMARY; + +``` + +Adding components to a calendar is done with a factory method: + +```php + +$event = VObject\Component::create('VEVENT'); +$calendar->add($event); + +$event->SUMMARY = 'Curiosity launch'; +$event->DTSTART = '20111126T150202Z'; +$event->LOCATION = 'Cape Carnival'; + +``` + +By the way.. cloning also works as expected, as the entire structure is cloned along with it: + +```php + +$clonedEvent = clone $calendar->VEVENT[0]; +$calendar->add($clonedEvent); + +``` + +## Date and time handling + +If you ever had to deal with iCalendar timezones, you know it can be complicated. +The way timezones are specified is flawed, which is something I may write an essay about some +day. VObject does its best to determine the correct timezone. Many standard formats +have been tested and verified, and special code has been implemented for special-casing +microsoft generated timezone information, and others. + +To get a real php `DateTime` object, you can request this as follows: + +``` +$event = $calendar->VEVENT; +$start = $event->DTSTART->getDateTime(); +echo $start->format(\DateTime::W3C); +``` + +To set the property with a DateTime object, you can use the following syntax: + +``` +$dateTime = new \DateTime('2012-08-07 23:53:00', new DateTimeZone('Europe/Amsterdam')); +$event->DTSTART->setDateTime($dateTime, VObject\Property\DateTime::DATE); +``` + +The second argument specifies the type of date you're setting. The following three +options exist: + +1. `LOCAL` This is a floating time, with no timezone information. This basically specifies that the event happens in whatever the timezone's currently in. This would be encoded as `DTSTART;VALUE=DATE-TIME:20120807235300` +2. `UTC` This specifies that the time should be encoded as a UTC time. This is encoded as `DTSTART;VALUE=DATE-TIME:20120807205300Z`. Note the extra Z and the fact that it's two hours 'earlier'. +3. `LOCALTZ` specifies that it's supposed to be encoded in its local timezone. For example `DTSTART;VALUE=DATE-TIME;TZID=Europe/Amsterdam:20120807235300`. +4. `DATE` This is a date-only, and does not contain the time. In this case this would be encoded as `DTSTART;VALUE=DATE:20120807`. + +A few important notes: + +* When a `TZID` is specified, there should also be a matching `VTIMEZONE` object with all the timezone information. VObject cannot currently automatically embed this. However, in reality other clients seem to do fine without this information. Yet, for completeness, this will be added in the future. +* As mentioned, the timezone-determination process may sometimes fail. Report any issues you find, and I'll be quick to add workarounds! + +## Recurrence rules + +Recurrence rules allow events to recur, for example for a weekly meeting, or an anniversary. +This is done with the `RRULE` property. The `RRULE` property allows for a LOT of different +rules. VObject only implements the ones that actually appear in calendar software. + +To read more about `RRULE` and all the options, check out [RFC5545](https://tools.ietf.org/html/rfc5545#section-3.8.5). +VObject supports the following options: + +1. `UNTIL` for an end date. +2. `INTERVAL` for for example "every 2 days". +3. `COUNT` to stop recurring after x items. +4. `FREQ=DAILY` to recur every day, and `BYDAY` to limit it to certain days. +5. `FREQ=WEEKLY` to recur every week, `BYDAY` to expand this to multiple weekdays in every week and `WKST` to specify on which day the week starts. +6. `FREQ=MONTHLY` to recur every month, `BYMONTHDAY` to expand this to certain days in a month, `BYDAY` to expand it to certain weekdays occuring in a month, and `BYSETPOS` to limit the last two expansions. +7. `FREQ=YEARLY` to recur every year, `BYMONTH` to expand that to certain months in a year, and `BYDAY` and `BYWEEKDAY` to expand the `BYMONTH` rule even further. + +VObject supports the `EXDATE` property for exclusions, but not yet the `RDATE` and `EXRULE` +properties. If you're interested in this, please file a github issue, as this will put it +on my radar. + +This is a bit of a complex subject to go in excruciating detail. The +[RFC](https://tools.ietf.org/html/rfc5545#section-3.8.5) has a lot of examples though. + +The hard part is not to write the RRULE, it is to expand them. The most complex and +hard-to-read code is hidden in this component. Dragons be here. + +So, if we have a meeting every 2nd monday of the month, this would be specified as such: + +``` +BEGIN:VCALENDAR + VERSION:2.0 + BEGIN:VEVENT + UID:1102c450-e0d7-11e1-9b23-0800200c9a66 + DTSTART:20120109T140000Z + RRULE:FREQ=MONTHLY;BYDAY=MO;BYSETPOS=2 + END:VEVENT +END:VCALENDAR +``` + +Note that normally it's not allowed to indent the object like this, but it does make +it easier to read. This is also the first time I added in a UID, which is required +for all VEVENT, VTODO and VJOURNAL objects! + +To figure out all the meetings for this year, we can use the following syntax: + +```php +use Sabre\VObject; + +$calendar = VObject\Reader::read($data); +$calendar->expand(new DateTime('2012-01-01'), new DateTime('2012-12-31')); +``` + +What the expand method does, is look at its inner events, and expand the recurring +rule. Our calendar now contains 12 events. The first will have its RRULE stripped, +and every subsequent VEVENT has the correct meeting date and a `RECURRENCE-ID` set. + +This results in something like this: + +``` +BEGIN:VCALENDAR + VERSION:2.0 + BEGIN:VEVENT + UID:1102c450-e0d7-11e1-9b23-0800200c9a66 + DTSTART:20120109T140000Z + END:VEVENT + BEGIN:VEVENT + UID:1102c450-e0d7-11e1-9b23-0800200c9a66 + RECURRENCE-ID:20120213T140000Z + DTSTART:20120213T140000Z + END:VEVENT + BEGIN:VEVENT + UID:1102c450-e0d7-11e1-9b23-0800200c9a66 + RECURRENCE-ID:20120312T140000Z + DTSTART:20120312T140000Z + END:VEVENT + ..etc.. +END:VCALENDAR +``` + +To show the list of dates, we would do this as such: + +``` +foreach($calendar->VEVENT as $event) { + echo $event->DTSTART->getDateTime()->format(\DateTime::ATOM); +} +``` + +In a recurring event, single instances can also be overriden. VObject also takes these +into consideration. The reason we needed to specify a start and end-date, is because +some recurrence rules can be 'never ending'. + +You should make sure you pick a sane date-range. Because if you pick a 50 year +time-range, for a daily recurring event; this would result in over 18K objects. + +# Free-busy report generation + +Some calendaring software can make use of FREEBUSY reports to show when people are +available. + +You can automatically generate these reports from calendars using the `FreeBusyGenerator`. + +Example based on our last event: + +``` + +// We're giving it the calendar object. It's also possible to specify multiple objects, +// by setting them as an array. +// +// We must also specify a start and end date, because recurring events are expanded. +$fbGenerator = new VObject\FreeBusyGenerator( + new DateTime('2012-01-01'), + new DateTime('2012-12-31'), + $calendar +); + +// Grabbing the report +$freebusy = $fbGenerator->result(); + +// The freebusy report is another VCALENDAR object, so we can serialize it as usual: +echo $freebusy->serialize(); +``` + +The output of this script will look like this: + +``` +BEGIN:VCALENDAR +VERSION:2.0 +PRODID:-//Sabre//Sabre VObject 2.0//EN +CALSCALE:GREGORIAN +BEGIN:VFREEBUSY +DTSTART;VALUE=DATE-TIME:20111231T230000Z +DTEND;VALUE=DATE-TIME:20111231T230000Z +DTSTAMP;VALUE=DATE-TIME:20120808T131628Z +FREEBUSY;FBTYPE=BUSY:20120109T140000Z/20120109T140000Z +FREEBUSY;FBTYPE=BUSY:20120213T140000Z/20120213T140000Z +FREEBUSY;FBTYPE=BUSY:20120312T140000Z/20120312T140000Z +FREEBUSY;FBTYPE=BUSY:20120409T140000Z/20120409T140000Z +FREEBUSY;FBTYPE=BUSY:20120514T140000Z/20120514T140000Z +FREEBUSY;FBTYPE=BUSY:20120611T140000Z/20120611T140000Z +FREEBUSY;FBTYPE=BUSY:20120709T140000Z/20120709T140000Z +FREEBUSY;FBTYPE=BUSY:20120813T140000Z/20120813T140000Z +FREEBUSY;FBTYPE=BUSY:20120910T140000Z/20120910T140000Z +FREEBUSY;FBTYPE=BUSY:20121008T140000Z/20121008T140000Z +FREEBUSY;FBTYPE=BUSY:20121112T140000Z/20121112T140000Z +FREEBUSY;FBTYPE=BUSY:20121210T140000Z/20121210T140000Z +END:VFREEBUSY +END:VCALENDAR +``` diff --git a/dav/sabre-vobject/composer.json b/dav/sabre-vobject/composer.json new file mode 100644 index 00000000..9ecdf455 --- /dev/null +++ b/dav/sabre-vobject/composer.json @@ -0,0 +1,27 @@ +{ + "name": "sabre/vobject", + "description" : "The VObject library for PHP allows you to easily parse and manipulate iCalendar and vCard objects", + "keywords" : [ "VObject", "iCalendar", "vCard" ], + "homepage" : "https://github.com/evert/sabre-vobject", + "license" : "BSD-3-Clause", + "require" : { + "php" : ">=5.3.1" + }, + "authors" : [ + { + "name" : "Evert Pot", + "email" : "evert@rooftopsolutions.nl", + "homepage" : "http://www.rooftopsolutions.nl/", + "role" : "Developer" + } + ], + "support" : { + "forum" : "https://groups.google.com/group/sabredav-discuss", + "source" : "https://github.com/evert/sabre-vobject" + }, + "autoload" : { + "psr-0" : { + "Sabre\\VObject" : "lib/" + } + } +} diff --git a/dav/sabre-vobject/lib/Sabre/VObject/Component.php b/dav/sabre-vobject/lib/Sabre/VObject/Component.php new file mode 100644 index 00000000..d17cb895 --- /dev/null +++ b/dav/sabre-vobject/lib/Sabre/VObject/Component.php @@ -0,0 +1,412 @@ + 'Sabre\\VObject\\Component\\VAlarm', + 'VCALENDAR' => 'Sabre\\VObject\\Component\\VCalendar', + 'VCARD' => 'Sabre\\VObject\\Component\\VCard', + 'VEVENT' => 'Sabre\\VObject\\Component\\VEvent', + 'VJOURNAL' => 'Sabre\\VObject\\Component\\VJournal', + 'VTODO' => 'Sabre\\VObject\\Component\\VTodo', + ); + + /** + * Creates the new component by name, but in addition will also see if + * there's a class mapped to the property name. + * + * @param string $name + * @param string $value + * @return Component + */ + static public function create($name, $value = null) { + + $name = strtoupper($name); + + if (isset(self::$classMap[$name])) { + return new self::$classMap[$name]($name, $value); + } else { + return new self($name, $value); + } + + } + + /** + * Creates a new component. + * + * By default this object will iterate over its own children, but this can + * be overridden with the iterator argument + * + * @param string $name + * @param ElementList $iterator + */ + public function __construct($name, ElementList $iterator = null) { + + $this->name = strtoupper($name); + if (!is_null($iterator)) $this->iterator = $iterator; + + } + + /** + * Turns the object back into a serialized blob. + * + * @return string + */ + public function serialize() { + + $str = "BEGIN:" . $this->name . "\r\n"; + + /** + * Gives a component a 'score' for sorting purposes. + * + * This is solely used by the childrenSort method. + * + * A higher score means the item will be lower in the list. + * To avoid score collisions, each "score category" has a reasonable + * space to accomodate elements. The $key is added to the $score to + * preserve the original relative order of elements. + * + * @param int $key + * @param array $array + * @return int + */ + $sortScore = function($key, $array) { + + if ($array[$key] instanceof Component) { + + // We want to encode VTIMEZONE first, this is a personal + // preference. + if ($array[$key]->name === 'VTIMEZONE') { + $score=300000000; + return $score+$key; + } else { + $score=400000000; + return $score+$key; + } + } else { + // Properties get encoded first + // VCARD version 4.0 wants the VERSION property to appear first + if ($array[$key] instanceof Property) { + if ($array[$key]->name === 'VERSION') { + $score=100000000; + return $score+$key; + } else { + // All other properties + $score=200000000; + return $score+$key; + } + } + } + + }; + + $tmp = $this->children; + uksort($this->children, function($a, $b) use ($sortScore, $tmp) { + + $sA = $sortScore($a, $tmp); + $sB = $sortScore($b, $tmp); + + if ($sA === $sB) return 0; + + return ($sA < $sB) ? -1 : 1; + + }); + + foreach($this->children as $child) $str.=$child->serialize(); + $str.= "END:" . $this->name . "\r\n"; + + return $str; + + } + + /** + * Adds a new component or element + * + * You can call this method with the following syntaxes: + * + * add(Element $element) + * add(string $name, $value, array $parameters = array()) + * + * The first version adds an Element + * The second adds a property as a string. + * + * @param mixed $item + * @param mixed $itemValue + * @return void + */ + public function add($item, $itemValue = null, array $parameters = array()) { + + if ($item instanceof Element) { + if (!is_null($itemValue)) { + throw new \InvalidArgumentException('The second argument must not be specified, when passing a VObject'); + } + $item->parent = $this; + $this->children[] = $item; + } elseif(is_string($item)) { + + if (!is_scalar($itemValue)) { + throw new \InvalidArgumentException('The second argument must be scalar'); + } + $item = Property::create($item,$itemValue, $parameters); + $item->parent = $this; + $this->children[] = $item; + + } else { + + throw new \InvalidArgumentException('The first argument must either be a \\Sabre\\VObject\\Element or a string'); + + } + + } + + /** + * Returns an iterable list of children + * + * @return ElementList + */ + public function children() { + + return new ElementList($this->children); + + } + + /** + * Returns an array with elements that match the specified name. + * + * This function is also aware of MIME-Directory groups (as they appear in + * vcards). This means that if a property is grouped as "HOME.EMAIL", it + * will also be returned when searching for just "EMAIL". If you want to + * search for a property in a specific group, you can select on the entire + * string ("HOME.EMAIL"). If you want to search on a specific property that + * has not been assigned a group, specify ".EMAIL". + * + * Keys are retained from the 'children' array, which may be confusing in + * certain cases. + * + * @param string $name + * @return array + */ + public function select($name) { + + $group = null; + $name = strtoupper($name); + if (strpos($name,'.')!==false) { + list($group,$name) = explode('.', $name, 2); + } + + $result = array(); + foreach($this->children as $key=>$child) { + + if ( + strtoupper($child->name) === $name && + (is_null($group) || ( $child instanceof Property && strtoupper($child->group) === $group)) + ) { + + $result[$key] = $child; + + } + } + + reset($result); + return $result; + + } + + /** + * This method only returns a list of sub-components. Properties are + * ignored. + * + * @return array + */ + public function getComponents() { + + $result = array(); + foreach($this->children as $child) { + if ($child instanceof Component) { + $result[] = $child; + } + } + + return $result; + + } + + /** + * Validates the node for correctness. + * + * The following options are supported: + * - Component::REPAIR - If something is broken, and automatic repair may + * be attempted. + * + * An array is returned with warnings. + * + * Every item in the array has the following properties: + * * level - (number between 1 and 3 with severity information) + * * message - (human readable message) + * * node - (reference to the offending node) + * + * @param int $options + * @return array + */ + public function validate($options = 0) { + + $result = array(); + foreach($this->children as $child) { + $result = array_merge($result, $child->validate()); + } + return $result; + + } + + /* Magic property accessors {{{ */ + + /** + * Using 'get' you will either get a property or component, + * + * If there were no child-elements found with the specified name, + * null is returned. + * + * @param string $name + * @return Property + */ + public function __get($name) { + + $matches = $this->select($name); + if (count($matches)===0) { + return null; + } else { + $firstMatch = current($matches); + /** @var $firstMatch Property */ + $firstMatch->setIterator(new ElementList(array_values($matches))); + return $firstMatch; + } + + } + + /** + * This method checks if a sub-element with the specified name exists. + * + * @param string $name + * @return bool + */ + public function __isset($name) { + + $matches = $this->select($name); + return count($matches)>0; + + } + + /** + * Using the setter method you can add properties or subcomponents + * + * You can either pass a Component, Property + * object, or a string to automatically create a Property. + * + * If the item already exists, it will be removed. If you want to add + * a new item with the same name, always use the add() method. + * + * @param string $name + * @param mixed $value + * @return void + */ + public function __set($name, $value) { + + $matches = $this->select($name); + $overWrite = count($matches)?key($matches):null; + + if ($value instanceof Component || $value instanceof Property) { + $value->parent = $this; + if (!is_null($overWrite)) { + $this->children[$overWrite] = $value; + } else { + $this->children[] = $value; + } + } elseif (is_scalar($value)) { + $property = Property::create($name,$value); + $property->parent = $this; + if (!is_null($overWrite)) { + $this->children[$overWrite] = $property; + } else { + $this->children[] = $property; + } + } else { + throw new \InvalidArgumentException('You must pass a \\Sabre\\VObject\\Component, \\Sabre\\VObject\\Property or scalar type'); + } + + } + + /** + * Removes all properties and components within this component. + * + * @param string $name + * @return void + */ + public function __unset($name) { + + $matches = $this->select($name); + foreach($matches as $k=>$child) { + + unset($this->children[$k]); + $child->parent = null; + + } + + } + + /* }}} */ + + /** + * This method is automatically called when the object is cloned. + * Specifically, this will ensure all child elements are also cloned. + * + * @return void + */ + public function __clone() { + + foreach($this->children as $key=>$child) { + $this->children[$key] = clone $child; + $this->children[$key]->parent = $this; + } + + } + +} diff --git a/dav/sabre-vobject/lib/Sabre/VObject/Component/VAlarm.php b/dav/sabre-vobject/lib/Sabre/VObject/Component/VAlarm.php new file mode 100644 index 00000000..6bf7f5a2 --- /dev/null +++ b/dav/sabre-vobject/lib/Sabre/VObject/Component/VAlarm.php @@ -0,0 +1,101 @@ +TRIGGER; + if(!isset($trigger['VALUE']) || strtoupper($trigger['VALUE']) === 'DURATION') { + $triggerDuration = VObject\DateTimeParser::parseDuration($this->TRIGGER); + $related = (isset($trigger['RELATED']) && strtoupper($trigger['RELATED']) == 'END') ? 'END' : 'START'; + + $parentComponent = $this->parent; + if ($related === 'START') { + $effectiveTrigger = clone $parentComponent->DTSTART->getDateTime(); + $effectiveTrigger->add($triggerDuration); + } else { + if ($parentComponent->name === 'VTODO') { + $endProp = 'DUE'; + } elseif ($parentComponent->name === 'VEVENT') { + $endProp = 'DTEND'; + } else { + throw new \LogicException('time-range filters on VALARM components are only supported when they are a child of VTODO or VEVENT'); + } + + if (isset($parentComponent->$endProp)) { + $effectiveTrigger = clone $parentComponent->$endProp->getDateTime(); + $effectiveTrigger->add($triggerDuration); + } elseif (isset($parentComponent->DURATION)) { + $effectiveTrigger = clone $parentComponent->DTSTART->getDateTime(); + $duration = VObject\DateTimeParser::parseDuration($parentComponent->DURATION); + $effectiveTrigger->add($duration); + $effectiveTrigger->add($triggerDuration); + } else { + $effectiveTrigger = clone $parentComponent->DTSTART->getDateTime(); + $effectiveTrigger->add($triggerDuration); + } + } + } else { + $effectiveTrigger = $trigger->getDateTime(); + } + return $effectiveTrigger; + + } + + /** + * Returns true or false depending on if the event falls in the specified + * time-range. This is used for filtering purposes. + * + * The rules used to determine if an event falls within the specified + * time-range is based on the CalDAV specification. + * + * @param \DateTime $start + * @param \DateTime $end + * @return bool + */ + public function isInTimeRange(\DateTime $start, \DateTime $end) { + + $effectiveTrigger = $this->getEffectiveTriggerTime(); + + if (isset($this->DURATION)) { + $duration = VObject\DateTimeParser::parseDuration($this->DURATION); + $repeat = (string)$this->repeat; + if (!$repeat) { + $repeat = 1; + } + + $period = new \DatePeriod($effectiveTrigger, $duration, (int)$repeat); + + foreach($period as $occurrence) { + + if ($start <= $occurrence && $end > $occurrence) { + return true; + } + } + return false; + } else { + return ($start <= $effectiveTrigger && $end > $effectiveTrigger); + } + + } + +} diff --git a/dav/sabre-vobject/lib/Sabre/VObject/Component/VCalendar.php b/dav/sabre-vobject/lib/Sabre/VObject/Component/VCalendar.php new file mode 100644 index 00000000..73f2f6d3 --- /dev/null +++ b/dav/sabre-vobject/lib/Sabre/VObject/Component/VCalendar.php @@ -0,0 +1,242 @@ +children as $component) { + + if (!$component instanceof VObject\Component) + continue; + + if (isset($component->{'RECURRENCE-ID'})) + continue; + + if ($componentName && $component->name !== strtoupper($componentName)) + continue; + + if ($component->name === 'VTIMEZONE') + continue; + + $components[] = $component; + + } + + return $components; + + } + + /** + * If this calendar object, has events with recurrence rules, this method + * can be used to expand the event into multiple sub-events. + * + * Each event will be stripped from it's recurrence information, and only + * the instances of the event in the specified timerange will be left + * alone. + * + * In addition, this method will cause timezone information to be stripped, + * and normalized to UTC. + * + * This method will alter the VCalendar. This cannot be reversed. + * + * This functionality is specifically used by the CalDAV standard. It is + * possible for clients to request expand events, if they are rather simple + * clients and do not have the possibility to calculate recurrences. + * + * @param DateTime $start + * @param DateTime $end + * @return void + */ + public function expand(\DateTime $start, \DateTime $end) { + + $newEvents = array(); + + foreach($this->select('VEVENT') as $key=>$vevent) { + + if (isset($vevent->{'RECURRENCE-ID'})) { + unset($this->children[$key]); + continue; + } + + + if (!$vevent->rrule) { + unset($this->children[$key]); + if ($vevent->isInTimeRange($start, $end)) { + $newEvents[] = $vevent; + } + continue; + } + + $uid = (string)$vevent->uid; + if (!$uid) { + throw new \LogicException('Event did not have a UID!'); + } + + $it = new VObject\RecurrenceIterator($this, $vevent->uid); + $it->fastForward($start); + + while($it->valid() && $it->getDTStart() < $end) { + + if ($it->getDTEnd() > $start) { + + $newEvents[] = $it->getEventObject(); + + } + $it->next(); + + } + unset($this->children[$key]); + + } + + foreach($newEvents as $newEvent) { + + foreach($newEvent->children as $child) { + if ($child instanceof VObject\Property\DateTime && + $child->getDateType() == VObject\Property\DateTime::LOCALTZ) { + $child->setDateTime($child->getDateTime(),VObject\Property\DateTime::UTC); + } + } + + $this->add($newEvent); + + } + + // Removing all VTIMEZONE components + unset($this->VTIMEZONE); + + } + + /** + * Validates the node for correctness. + * An array is returned with warnings. + * + * Every item in the array has the following properties: + * * level - (number between 1 and 3 with severity information) + * * message - (human readable message) + * * node - (reference to the offending node) + * + * @return array + */ + /* + public function validate() { + + $warnings = array(); + + $version = $this->select('VERSION'); + if (count($version)!==1) { + $warnings[] = array( + 'level' => 1, + 'message' => 'The VERSION property must appear in the VCALENDAR component exactly 1 time', + 'node' => $this, + ); + } else { + if ((string)$this->VERSION !== '2.0') { + $warnings[] = array( + 'level' => 1, + 'message' => 'Only iCalendar version 2.0 as defined in rfc5545 is supported.', + 'node' => $this, + ); + } + } + $version = $this->select('PRODID'); + if (count($version)!==1) { + $warnings[] = array( + 'level' => 2, + 'message' => 'The PRODID property must appear in the VCALENDAR component exactly 1 time', + 'node' => $this, + ); + } + if (count($this->CALSCALE) > 1) { + $warnings[] = array( + 'level' => 2, + 'message' => 'The CALSCALE property must not be specified more than once.', + 'node' => $this, + ); + } + if (count($this->METHOD) > 1) { + $warnings[] = array( + 'level' => 2, + 'message' => 'The METHOD property must not be specified more than once.', + 'node' => $this, + ); + } + + $allowedComponents = array( + 'VEVENT', + 'VTODO', + 'VJOURNAL', + 'VFREEBUSY', + 'VTIMEZONE', + ); + $allowedProperties = array( + 'PRODID', + 'VERSION', + 'CALSCALE', + 'METHOD', + ); + $componentsFound = 0; + foreach($this->children as $child) { + if($child instanceof Component) { + $componentsFound++; + if (!in_array($child->name, $allowedComponents)) { + $warnings[] = array( + 'level' => 1, + 'message' => 'The ' . $child->name . " component is not allowed in the VCALENDAR component", + 'node' => $this, + ); + } + } + if ($child instanceof Property) { + if (!in_array($child->name, $allowedProperties)) { + $warnings[] = array( + 'level' => 2, + 'message' => 'The ' . $child->name . " property is not allowed in the VCALENDAR component", + 'node' => $this, + ); + } + } + } + + if ($componentsFound===0) { + $warnings[] = array( + 'level' => 1, + 'message' => 'An iCalendar object must have at least 1 component.', + 'node' => $this, + ); + } + + return array_merge( + $warnings, + parent::validate() + ); + + } + */ + +} + diff --git a/dav/sabre-vobject/lib/Sabre/VObject/Component/VCard.php b/dav/sabre-vobject/lib/Sabre/VObject/Component/VCard.php new file mode 100644 index 00000000..002c4db2 --- /dev/null +++ b/dav/sabre-vobject/lib/Sabre/VObject/Component/VCard.php @@ -0,0 +1,105 @@ +select('VERSION'); + if (count($version)!==1) { + $warnings[] = array( + 'level' => 1, + 'message' => 'The VERSION property must appear in the VCARD component exactly 1 time', + 'node' => $this, + ); + if ($options & self::REPAIR) { + $this->VERSION = self::DEFAULT_VERSION; + } + } else { + $version = (string)$this->VERSION; + if ($version!=='2.1' && $version!=='3.0' && $version!=='4.0') { + $warnings[] = array( + 'level' => 1, + 'message' => 'Only vcard version 4.0 (RFC6350), version 3.0 (RFC2426) or version 2.1 (icm-vcard-2.1) are supported.', + 'node' => $this, + ); + if ($options & self::REPAIR) { + $this->VERSION = '4.0'; + } + } + + } + $version = $this->select('FN'); + if (count($version)!==1) { + $warnings[] = array( + 'level' => 1, + 'message' => 'The FN property must appear in the VCARD component exactly 1 time', + 'node' => $this, + ); + if (($options & self::REPAIR) && count($version) === 0) { + // We're going to try to see if we can use the contents of the + // N property. + if (isset($this->N)) { + $value = explode(';', (string)$this->N); + if (isset($value[1]) && $value[1]) { + $this->FN = $value[1] . ' ' . $value[0]; + } else { + $this->FN = $value[0]; + } + + // Otherwise, the ORG property may work + } elseif (isset($this->ORG)) { + $this->FN = (string)$this->ORG; + } + + } + } + + return array_merge( + parent::validate($options), + $warnings + ); + + } + +} + diff --git a/dav/sabre-vobject/lib/Sabre/VObject/Component/VEvent.php b/dav/sabre-vobject/lib/Sabre/VObject/Component/VEvent.php new file mode 100644 index 00000000..9d10966e --- /dev/null +++ b/dav/sabre-vobject/lib/Sabre/VObject/Component/VEvent.php @@ -0,0 +1,70 @@ +RRULE) { + $it = new VObject\RecurrenceIterator($this); + $it->fastForward($start); + + // We fast-forwarded to a spot where the end-time of the + // recurrence instance exceeded the start of the requested + // time-range. + // + // If the starttime of the recurrence did not exceed the + // end of the time range as well, we have a match. + return ($it->getDTStart() < $end && $it->getDTEnd() > $start); + + } + + $effectiveStart = $this->DTSTART->getDateTime(); + if (isset($this->DTEND)) { + + // The DTEND property is considered non inclusive. So for a 3 day + // event in july, dtstart and dtend would have to be July 1st and + // July 4th respectively. + // + // See: + // http://tools.ietf.org/html/rfc5545#page-54 + $effectiveEnd = $this->DTEND->getDateTime(); + + } elseif (isset($this->DURATION)) { + $effectiveEnd = clone $effectiveStart; + $effectiveEnd->add( VObject\DateTimeParser::parseDuration($this->DURATION) ); + } elseif ($this->DTSTART->getDateType() == VObject\Property\DateTime::DATE) { + $effectiveEnd = clone $effectiveStart; + $effectiveEnd->modify('+1 day'); + } else { + $effectiveEnd = clone $effectiveStart; + } + return ( + ($start <= $effectiveEnd) && ($end > $effectiveStart) + ); + + } + +} diff --git a/dav/sabre-vobject/lib/Sabre/VObject/Component/VJournal.php b/dav/sabre-vobject/lib/Sabre/VObject/Component/VJournal.php new file mode 100644 index 00000000..f104a1f6 --- /dev/null +++ b/dav/sabre-vobject/lib/Sabre/VObject/Component/VJournal.php @@ -0,0 +1,46 @@ +DTSTART)?$this->DTSTART->getDateTime():null; + if ($dtstart) { + $effectiveEnd = clone $dtstart; + if ($this->DTSTART->getDateType() == VObject\Property\DateTime::DATE) { + $effectiveEnd->modify('+1 day'); + } + + return ($start <= $effectiveEnd && $end > $dtstart); + + } + return false; + + + } + +} diff --git a/dav/sabre-vobject/lib/Sabre/VObject/Component/VTodo.php b/dav/sabre-vobject/lib/Sabre/VObject/Component/VTodo.php new file mode 100644 index 00000000..5f879aea --- /dev/null +++ b/dav/sabre-vobject/lib/Sabre/VObject/Component/VTodo.php @@ -0,0 +1,68 @@ +DTSTART)?$this->DTSTART->getDateTime():null; + $duration = isset($this->DURATION)?VObject\DateTimeParser::parseDuration($this->DURATION):null; + $due = isset($this->DUE)?$this->DUE->getDateTime():null; + $completed = isset($this->COMPLETED)?$this->COMPLETED->getDateTime():null; + $created = isset($this->CREATED)?$this->CREATED->getDateTime():null; + + if ($dtstart) { + if ($duration) { + $effectiveEnd = clone $dtstart; + $effectiveEnd->add($duration); + return $start <= $effectiveEnd && $end > $dtstart; + } elseif ($due) { + return + ($start < $due || $start <= $dtstart) && + ($end > $dtstart || $end >= $due); + } else { + return $start <= $dtstart && $end > $dtstart; + } + } + if ($due) { + return ($start < $due && $end >= $due); + } + if ($completed && $created) { + return + ($start <= $created || $start <= $completed) && + ($end >= $created || $end >= $completed); + } + if ($completed) { + return ($start <= $completed && $end >= $completed); + } + if ($created) { + return ($end > $created); + } + return true; + + } + +} diff --git a/dav/sabre-vobject/lib/Sabre/VObject/DateTimeParser.php b/dav/sabre-vobject/lib/Sabre/VObject/DateTimeParser.php new file mode 100644 index 00000000..0ef8460d --- /dev/null +++ b/dav/sabre-vobject/lib/Sabre/VObject/DateTimeParser.php @@ -0,0 +1,181 @@ +setTimeZone(new \DateTimeZone('UTC')); + return $date; + + } + + /** + * Parses an iCalendar (rfc5545) formatted date and returns a DateTime object + * + * @param string $date + * @return DateTime + */ + static public function parseDate($date) { + + // Format is YYYYMMDD + $result = preg_match('/^([1-3][0-9]{3})([0-1][0-9])([0-3][0-9])$/',$date,$matches); + + if (!$result) { + throw new \LogicException('The supplied iCalendar date value is incorrect: ' . $date); + } + + $date = new \DateTime($matches[1] . '-' . $matches[2] . '-' . $matches[3], new \DateTimeZone('UTC')); + return $date; + + } + + /** + * Parses an iCalendar (RFC5545) formatted duration value. + * + * This method will either return a DateTimeInterval object, or a string + * suitable for strtotime or DateTime::modify. + * + * @param string $duration + * @param bool $asString + * @return DateInterval|string + */ + static public function parseDuration($duration, $asString = false) { + + $result = preg_match('/^(?P\+|-)?P((?P\d+)W)?((?P\d+)D)?(T((?P\d+)H)?((?P\d+)M)?((?P\d+)S)?)?$/', $duration, $matches); + if (!$result) { + throw new \LogicException('The supplied iCalendar duration value is incorrect: ' . $duration); + } + + if (!$asString) { + $invert = false; + if ($matches['plusminus']==='-') { + $invert = true; + } + + + $parts = array( + 'week', + 'day', + 'hour', + 'minute', + 'second', + ); + foreach($parts as $part) { + $matches[$part] = isset($matches[$part])&&$matches[$part]?(int)$matches[$part]:0; + } + + + // We need to re-construct the $duration string, because weeks and + // days are not supported by DateInterval in the same string. + $duration = 'P'; + $days = $matches['day']; + if ($matches['week']) { + $days+=$matches['week']*7; + } + if ($days) + $duration.=$days . 'D'; + + if ($matches['minute'] || $matches['second'] || $matches['hour']) { + $duration.='T'; + + if ($matches['hour']) + $duration.=$matches['hour'].'H'; + + if ($matches['minute']) + $duration.=$matches['minute'].'M'; + + if ($matches['second']) + $duration.=$matches['second'].'S'; + + } + + if ($duration==='P') { + $duration = 'PT0S'; + } + $iv = new \DateInterval($duration); + if ($invert) $iv->invert = true; + + return $iv; + + } + + + + $parts = array( + 'week', + 'day', + 'hour', + 'minute', + 'second', + ); + + $newDur = ''; + foreach($parts as $part) { + if (isset($matches[$part]) && $matches[$part]) { + $newDur.=' '.$matches[$part] . ' ' . $part . 's'; + } + } + + $newDur = ($matches['plusminus']==='-'?'-':'+') . trim($newDur); + if ($newDur === '+') { $newDur = '+0 seconds'; }; + return $newDur; + + } + + /** + * Parses either a Date or DateTime, or Duration value. + * + * @param string $date + * @param DateTimeZone|string $referenceTZ + * @return DateTime|DateInterval + */ + static public function parse($date, $referenceTZ = null) { + + if ($date[0]==='P' || ($date[0]==='-' && $date[1]==='P')) { + return self::parseDuration($date); + } elseif (strlen($date)===8) { + return self::parseDate($date); + } else { + return self::parseDateTime($date, $referenceTZ); + } + + } + + +} diff --git a/dav/sabre-vobject/lib/Sabre/VObject/Element.php b/dav/sabre-vobject/lib/Sabre/VObject/Element.php new file mode 100644 index 00000000..151ae76a --- /dev/null +++ b/dav/sabre-vobject/lib/Sabre/VObject/Element.php @@ -0,0 +1,16 @@ +vevent where there's multiple VEVENT objects. + * + * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved. + * @author Evert Pot (http://www.rooftopsolutions.nl/) + * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License + */ +class ElementList implements \Iterator, \Countable, \ArrayAccess { + + /** + * Inner elements + * + * @var array + */ + protected $elements = array(); + + /** + * Creates the element list. + * + * @param array $elements + */ + public function __construct(array $elements) { + + $this->elements = $elements; + + } + + /* {{{ Iterator interface */ + + /** + * Current position + * + * @var int + */ + private $key = 0; + + /** + * Returns current item in iteration + * + * @return Element + */ + public function current() { + + return $this->elements[$this->key]; + + } + + /** + * To the next item in the iterator + * + * @return void + */ + public function next() { + + $this->key++; + + } + + /** + * Returns the current iterator key + * + * @return int + */ + public function key() { + + return $this->key; + + } + + /** + * Returns true if the current position in the iterator is a valid one + * + * @return bool + */ + public function valid() { + + return isset($this->elements[$this->key]); + + } + + /** + * Rewinds the iterator + * + * @return void + */ + public function rewind() { + + $this->key = 0; + + } + + /* }}} */ + + /* {{{ Countable interface */ + + /** + * Returns the number of elements + * + * @return int + */ + public function count() { + + return count($this->elements); + + } + + /* }}} */ + + /* {{{ ArrayAccess Interface */ + + + /** + * Checks if an item exists through ArrayAccess. + * + * @param int $offset + * @return bool + */ + public function offsetExists($offset) { + + return isset($this->elements[$offset]); + + } + + /** + * Gets an item through ArrayAccess. + * + * @param int $offset + * @return mixed + */ + public function offsetGet($offset) { + + return $this->elements[$offset]; + + } + + /** + * Sets an item through ArrayAccess. + * + * @param int $offset + * @param mixed $value + * @return void + */ + public function offsetSet($offset,$value) { + + throw new \LogicException('You can not add new objects to an ElementList'); + + } + + /** + * Sets an item through ArrayAccess. + * + * This method just forwards the request to the inner iterator + * + * @param int $offset + * @return void + */ + public function offsetUnset($offset) { + + throw new \LogicException('You can not remove objects from an ElementList'); + + } + + /* }}} */ + +} diff --git a/dav/sabre-vobject/lib/Sabre/VObject/FreeBusyGenerator.php b/dav/sabre-vobject/lib/Sabre/VObject/FreeBusyGenerator.php new file mode 100644 index 00000000..bfb89b01 --- /dev/null +++ b/dav/sabre-vobject/lib/Sabre/VObject/FreeBusyGenerator.php @@ -0,0 +1,322 @@ +setTimeRange($start, $end); + } + + if ($objects) { + $this->setObjects($objects); + } + + } + + /** + * Sets the VCALENDAR object. + * + * If this is set, it will not be generated for you. You are responsible + * for setting things like the METHOD, CALSCALE, VERSION, etc.. + * + * The VFREEBUSY object will be automatically added though. + * + * @param Component $vcalendar + * @return void + */ + public function setBaseObject(Component $vcalendar) { + + $this->baseObject = $vcalendar; + + } + + /** + * Sets the input objects + * + * You must either specify a valendar object as a strong, or as the parse + * Component. + * It's also possible to specify multiple objects as an array. + * + * @param mixed $objects + * @return void + */ + public function setObjects($objects) { + + if (!is_array($objects)) { + $objects = array($objects); + } + + $this->objects = array(); + foreach($objects as $object) { + + if (is_string($object)) { + $this->objects[] = Reader::read($object); + } elseif ($object instanceof Component) { + $this->objects[] = $object; + } else { + throw new \InvalidArgumentException('You can only pass strings or \\Sabre\\VObject\\Component arguments to setObjects'); + } + + } + + } + + /** + * Sets the time range + * + * Any freebusy object falling outside of this time range will be ignored. + * + * @param DateTime $start + * @param DateTime $end + * @return void + */ + public function setTimeRange(\DateTime $start = null, \DateTime $end = null) { + + $this->start = $start; + $this->end = $end; + + } + + /** + * Parses the input data and returns a correct VFREEBUSY object, wrapped in + * a VCALENDAR. + * + * @return Component + */ + public function getResult() { + + $busyTimes = array(); + + foreach($this->objects as $object) { + + foreach($object->getBaseComponents() as $component) { + + switch($component->name) { + + case 'VEVENT' : + + $FBTYPE = 'BUSY'; + if (isset($component->TRANSP) && (strtoupper($component->TRANSP) === 'TRANSPARENT')) { + break; + } + if (isset($component->STATUS)) { + $status = strtoupper($component->STATUS); + if ($status==='CANCELLED') { + break; + } + if ($status==='TENTATIVE') { + $FBTYPE = 'BUSY-TENTATIVE'; + } + } + + $times = array(); + + if ($component->RRULE) { + + $iterator = new RecurrenceIterator($object, (string)$component->uid); + if ($this->start) { + $iterator->fastForward($this->start); + } + + $maxRecurrences = 200; + + while($iterator->valid() && --$maxRecurrences) { + + $startTime = $iterator->getDTStart(); + if ($this->end && $startTime > $this->end) { + break; + } + $times[] = array( + $iterator->getDTStart(), + $iterator->getDTEnd(), + ); + + $iterator->next(); + + } + + } else { + + $startTime = $component->DTSTART->getDateTime(); + if ($this->end && $startTime > $this->end) { + break; + } + $endTime = null; + if (isset($component->DTEND)) { + $endTime = $component->DTEND->getDateTime(); + } elseif (isset($component->DURATION)) { + $duration = DateTimeParser::parseDuration((string)$component->DURATION); + $endTime = clone $startTime; + $endTime->add($duration); + } elseif ($component->DTSTART->getDateType() === Property\DateTime::DATE) { + $endTime = clone $startTime; + $endTime->modify('+1 day'); + } else { + // The event had no duration (0 seconds) + break; + } + + $times[] = array($startTime, $endTime); + + } + + foreach($times as $time) { + + if ($this->end && $time[0] > $this->end) break; + if ($this->start && $time[1] < $this->start) break; + + $busyTimes[] = array( + $time[0], + $time[1], + $FBTYPE, + ); + } + break; + + case 'VFREEBUSY' : + foreach($component->FREEBUSY as $freebusy) { + + $fbType = isset($freebusy['FBTYPE'])?strtoupper($freebusy['FBTYPE']):'BUSY'; + + // Skipping intervals marked as 'free' + if ($fbType==='FREE') + continue; + + $values = explode(',', $freebusy); + foreach($values as $value) { + list($startTime, $endTime) = explode('/', $value); + $startTime = DateTimeParser::parseDateTime($startTime); + + if (substr($endTime,0,1)==='P' || substr($endTime,0,2)==='-P') { + $duration = DateTimeParser::parseDuration($endTime); + $endTime = clone $startTime; + $endTime->add($duration); + } else { + $endTime = DateTimeParser::parseDateTime($endTime); + } + + if($this->start && $this->start > $endTime) continue; + if($this->end && $this->end < $startTime) continue; + $busyTimes[] = array( + $startTime, + $endTime, + $fbType + ); + + } + + + } + break; + + + + } + + + } + + } + + if ($this->baseObject) { + $calendar = $this->baseObject; + } else { + $calendar = new Component('VCALENDAR'); + $calendar->version = '2.0'; + $calendar->prodid = '-//Sabre//Sabre VObject ' . Version::VERSION . '//EN'; + $calendar->calscale = 'GREGORIAN'; + } + + $vfreebusy = new Component('VFREEBUSY'); + $calendar->add($vfreebusy); + + if ($this->start) { + $dtstart = new Property\DateTime('DTSTART'); + $dtstart->setDateTime($this->start,Property\DateTime::UTC); + $vfreebusy->add($dtstart); + } + if ($this->end) { + $dtend = new Property\DateTime('DTEND'); + $dtend->setDateTime($this->start,Property\DateTime::UTC); + $vfreebusy->add($dtend); + } + $dtstamp = new Property\DateTime('DTSTAMP'); + $dtstamp->setDateTime(new \DateTime('now'), Property\DateTime::UTC); + $vfreebusy->add($dtstamp); + + foreach($busyTimes as $busyTime) { + + $busyTime[0]->setTimeZone(new \DateTimeZone('UTC')); + $busyTime[1]->setTimeZone(new \DateTimeZone('UTC')); + + $prop = new Property( + 'FREEBUSY', + $busyTime[0]->format('Ymd\\THis\\Z') . '/' . $busyTime[1]->format('Ymd\\THis\\Z') + ); + $prop['FBTYPE'] = $busyTime[2]; + $vfreebusy->add($prop); + + } + + return $calendar; + + } + +} + diff --git a/dav/sabre-vobject/lib/Sabre/VObject/Node.php b/dav/sabre-vobject/lib/Sabre/VObject/Node.php new file mode 100644 index 00000000..88d1d8c3 --- /dev/null +++ b/dav/sabre-vobject/lib/Sabre/VObject/Node.php @@ -0,0 +1,166 @@ +iterator)) + return $this->iterator; + + return new ElementList(array($this)); + + } + + /** + * Sets the overridden iterator + * + * Note that this is not actually part of the iterator interface + * + * @param ElementList $iterator + * @return void + */ + public function setIterator(ElementList $iterator) { + + $this->iterator = $iterator; + + } + + /* }}} */ + + /* {{{ Countable interface */ + + /** + * Returns the number of elements + * + * @return int + */ + public function count() { + + $it = $this->getIterator(); + return $it->count(); + + } + + /* }}} */ + + /* {{{ ArrayAccess Interface */ + + + /** + * Checks if an item exists through ArrayAccess. + * + * This method just forwards the request to the inner iterator + * + * @param int $offset + * @return bool + */ + public function offsetExists($offset) { + + $iterator = $this->getIterator(); + return $iterator->offsetExists($offset); + + } + + /** + * Gets an item through ArrayAccess. + * + * This method just forwards the request to the inner iterator + * + * @param int $offset + * @return mixed + */ + public function offsetGet($offset) { + + $iterator = $this->getIterator(); + return $iterator->offsetGet($offset); + + } + + /** + * Sets an item through ArrayAccess. + * + * This method just forwards the request to the inner iterator + * + * @param int $offset + * @param mixed $value + * @return void + */ + public function offsetSet($offset,$value) { + + $iterator = $this->getIterator(); + $iterator->offsetSet($offset,$value); + + } + + /** + * Sets an item through ArrayAccess. + * + * This method just forwards the request to the inner iterator + * + * @param int $offset + * @return void + */ + public function offsetUnset($offset) { + + $iterator = $this->getIterator(); + $iterator->offsetUnset($offset); + + } + + /* }}} */ + +} diff --git a/dav/sabre-vobject/lib/Sabre/VObject/Parameter.php b/dav/sabre-vobject/lib/Sabre/VObject/Parameter.php new file mode 100644 index 00000000..0355b0a0 --- /dev/null +++ b/dav/sabre-vobject/lib/Sabre/VObject/Parameter.php @@ -0,0 +1,84 @@ +name = strtoupper($name); + $this->value = $value; + + } + + /** + * Turns the object back into a serialized blob. + * + * @return string + */ + public function serialize() { + + if (is_null($this->value)) { + return $this->name; + } + $src = array( + '\\', + "\n", + ';', + ',', + ); + $out = array( + '\\\\', + '\n', + '\;', + '\,', + ); + + return $this->name . '=' . str_replace($src, $out, $this->value); + + } + + /** + * Called when this object is being cast to a string + * + * @return string + */ + public function __toString() { + + return $this->value; + + } + +} diff --git a/dav/sabre-vobject/lib/Sabre/VObject/ParseException.php b/dav/sabre-vobject/lib/Sabre/VObject/ParseException.php new file mode 100644 index 00000000..91386fec --- /dev/null +++ b/dav/sabre-vobject/lib/Sabre/VObject/ParseException.php @@ -0,0 +1,12 @@ + 'Sabre\\VObject\\Property\\DateTime', + 'CREATED' => 'Sabre\\VObject\\Property\\DateTime', + 'DTEND' => 'Sabre\\VObject\\Property\\DateTime', + 'DTSTAMP' => 'Sabre\\VObject\\Property\\DateTime', + 'DTSTART' => 'Sabre\\VObject\\Property\\DateTime', + 'DUE' => 'Sabre\\VObject\\Property\\DateTime', + 'EXDATE' => 'Sabre\\VObject\\Property\\MultiDateTime', + 'LAST-MODIFIED' => 'Sabre\\VObject\\Property\\DateTime', + 'RECURRENCE-ID' => 'Sabre\\VObject\\Property\\DateTime', + 'TRIGGER' => 'Sabre\\VObject\\Property\\DateTime', + ); + + /** + * Creates the new property by name, but in addition will also see if + * there's a class mapped to the property name. + * + * Parameters can be specified with the optional third argument. Parameters + * must be a key->value map of the parameter name, and value. If the value + * is specified as an array, it is assumed that multiple parameters with + * the same name should be added. + * + * @param string $name + * @param string $value + * @param array $parameters + * @return Property + */ + static public function create($name, $value = null, array $parameters = array()) { + + $name = strtoupper($name); + $shortName = $name; + $group = null; + if (strpos($shortName,'.')!==false) { + list($group, $shortName) = explode('.', $shortName); + } + + if (isset(self::$classMap[$shortName])) { + return new self::$classMap[$shortName]($name, $value, $parameters); + } else { + return new self($name, $value, $parameters); + } + + } + + /** + * Creates a new property object + * + * Parameters can be specified with the optional third argument. Parameters + * must be a key->value map of the parameter name, and value. If the value + * is specified as an array, it is assumed that multiple parameters with + * the same name should be added. + * + * @param string $name + * @param string $value + * @param array $parameters + */ + public function __construct($name, $value = null, array $parameters = array()) { + + $name = strtoupper($name); + $group = null; + if (strpos($name,'.')!==false) { + list($group, $name) = explode('.', $name); + } + $this->name = $name; + $this->group = $group; + $this->setValue($value); + + foreach($parameters as $paramName => $paramValues) { + + if (!is_array($paramValues)) { + $paramValues = array($paramValues); + } + + foreach($paramValues as $paramValue) { + $this->add($paramName, $paramValue); + } + + } + + } + + /** + * Updates the internal value + * + * @param string $value + * @return void + */ + public function setValue($value) { + + $this->value = $value; + + } + + /** + * Turns the object back into a serialized blob. + * + * @return string + */ + public function serialize() { + + $str = $this->name; + if ($this->group) $str = $this->group . '.' . $this->name; + + if (count($this->parameters)) { + foreach($this->parameters as $param) { + + $str.=';' . $param->serialize(); + + } + } + $src = array( + '\\', + "\n", + ); + $out = array( + '\\\\', + '\n', + ); + $str.=':' . str_replace($src, $out, $this->value); + + $out = ''; + while(strlen($str)>0) { + if (strlen($str)>75) { + $out.= mb_strcut($str,0,75,'utf-8') . "\r\n"; + $str = ' ' . mb_strcut($str,75,strlen($str),'utf-8'); + } else { + $out.=$str . "\r\n"; + $str=''; + break; + } + } + + return $out; + + } + + /** + * Adds a new componenten or element + * + * You can call this method with the following syntaxes: + * + * add(Parameter $element) + * add(string $name, $value) + * + * The first version adds an Parameter + * The second adds a property as a string. + * + * @param mixed $item + * @param mixed $itemValue + * @return void + */ + public function add($item, $itemValue = null) { + + if ($item instanceof Parameter) { + if (!is_null($itemValue)) { + throw new \InvalidArgumentException('The second argument must not be specified, when passing a VObject'); + } + $item->parent = $this; + $this->parameters[] = $item; + } elseif(is_string($item)) { + + if (!is_scalar($itemValue) && !is_null($itemValue)) { + throw new \InvalidArgumentException('The second argument must be scalar'); + } + $parameter = new Parameter($item,$itemValue); + $parameter->parent = $this; + $this->parameters[] = $parameter; + + } else { + + throw new \InvalidArgumentException('The first argument must either be a Element or a string'); + + } + + } + + /* ArrayAccess interface {{{ */ + + /** + * Checks if an array element exists + * + * @param mixed $name + * @return bool + */ + public function offsetExists($name) { + + if (is_int($name)) return parent::offsetExists($name); + + $name = strtoupper($name); + + foreach($this->parameters as $parameter) { + if ($parameter->name == $name) return true; + } + return false; + + } + + /** + * Returns a parameter, or parameter list. + * + * @param string $name + * @return Element + */ + public function offsetGet($name) { + + if (is_int($name)) return parent::offsetGet($name); + $name = strtoupper($name); + + $result = array(); + foreach($this->parameters as $parameter) { + if ($parameter->name == $name) + $result[] = $parameter; + } + + if (count($result)===0) { + return null; + } elseif (count($result)===1) { + return $result[0]; + } else { + $result[0]->setIterator(new ElementList($result)); + return $result[0]; + } + + } + + /** + * Creates a new parameter + * + * @param string $name + * @param mixed $value + * @return void + */ + public function offsetSet($name, $value) { + + if (is_int($name)) parent::offsetSet($name, $value); + + if (is_scalar($value)) { + if (!is_string($name)) + throw new \InvalidArgumentException('A parameter name must be specified. This means you cannot use the $array[]="string" to add parameters.'); + + $this->offsetUnset($name); + $parameter = new Parameter($name, $value); + $parameter->parent = $this; + $this->parameters[] = $parameter; + + } elseif ($value instanceof Parameter) { + if (!is_null($name)) + throw new \InvalidArgumentException('Don\'t specify a parameter name if you\'re passing a \\Sabre\\VObject\\Parameter. Add using $array[]=$parameterObject.'); + + $value->parent = $this; + $this->parameters[] = $value; + } else { + throw new \InvalidArgumentException('You can only add parameters to the property object'); + } + + } + + /** + * Removes one or more parameters with the specified name + * + * @param string $name + * @return void + */ + public function offsetUnset($name) { + + if (is_int($name)) parent::offsetUnset($name); + $name = strtoupper($name); + + foreach($this->parameters as $key=>$parameter) { + if ($parameter->name == $name) { + $parameter->parent = null; + unset($this->parameters[$key]); + } + + } + + } + + /* }}} */ + + /** + * Called when this object is being cast to a string + * + * @return string + */ + public function __toString() { + + return (string)$this->value; + + } + + /** + * This method is automatically called when the object is cloned. + * Specifically, this will ensure all child elements are also cloned. + * + * @return void + */ + public function __clone() { + + foreach($this->parameters as $key=>$child) { + $this->parameters[$key] = clone $child; + $this->parameters[$key]->parent = $this; + } + + } + +} diff --git a/dav/sabre-vobject/lib/Sabre/VObject/Property/DateTime.php b/dav/sabre-vobject/lib/Sabre/VObject/Property/DateTime.php new file mode 100644 index 00000000..556cd441 --- /dev/null +++ b/dav/sabre-vobject/lib/Sabre/VObject/Property/DateTime.php @@ -0,0 +1,233 @@ +setValue($dt->format('Ymd\\THis')); + $this->offsetUnset('VALUE'); + $this->offsetUnset('TZID'); + $this->offsetSet('VALUE','DATE-TIME'); + break; + case self::UTC : + $dt->setTimeZone(new \DateTimeZone('UTC')); + $this->setValue($dt->format('Ymd\\THis\\Z')); + $this->offsetUnset('VALUE'); + $this->offsetUnset('TZID'); + $this->offsetSet('VALUE','DATE-TIME'); + break; + case self::LOCALTZ : + $this->setValue($dt->format('Ymd\\THis')); + $this->offsetUnset('VALUE'); + $this->offsetUnset('TZID'); + $this->offsetSet('VALUE','DATE-TIME'); + $this->offsetSet('TZID', $dt->getTimeZone()->getName()); + break; + case self::DATE : + $this->setValue($dt->format('Ymd')); + $this->offsetUnset('VALUE'); + $this->offsetUnset('TZID'); + $this->offsetSet('VALUE','DATE'); + break; + default : + throw new \InvalidArgumentException('You must pass a valid dateType constant'); + + } + $this->dateTime = $dt; + $this->dateType = $dateType; + + } + + /** + * Returns the current DateTime value. + * + * If no value was set, this method returns null. + * + * @return \DateTime|null + */ + public function getDateTime() { + + if ($this->dateTime) + return $this->dateTime; + + list( + $this->dateType, + $this->dateTime + ) = self::parseData($this->value, $this); + return $this->dateTime; + + } + + /** + * Returns the type of Date format. + * + * This method returns one of the format constants. If no date was set, + * this method will return null. + * + * @return int|null + */ + public function getDateType() { + + if ($this->dateType) + return $this->dateType; + + list( + $this->dateType, + $this->dateTime, + ) = self::parseData($this->value, $this); + return $this->dateType; + + } + + /** + * Parses the internal data structure to figure out what the current date + * and time is. + * + * The returned array contains two elements: + * 1. A 'DateType' constant (as defined on this class), or null. + * 2. A DateTime object (or null) + * + * @param string|null $propertyValue The string to parse (yymmdd or + * ymmddThhmmss, etc..) + * @param \Sabre\VObject\Property|null $property The instance of the + * property we're parsing. + * @return array + */ + static public function parseData($propertyValue, VObject\Property $property = null) { + + if (is_null($propertyValue)) { + return array(null, null); + } + + $date = '(?P[1-2][0-9]{3})(?P[0-1][0-9])(?P[0-3][0-9])'; + $time = '(?P[0-2][0-9])(?P[0-5][0-9])(?P[0-5][0-9])'; + $regex = "/^$date(T$time(?PZ)?)?$/"; + + if (!preg_match($regex, $propertyValue, $matches)) { + throw new \InvalidArgumentException($propertyValue . ' is not a valid \DateTime or Date string'); + } + + if (!isset($matches['hour'])) { + // Date-only + return array( + self::DATE, + new \DateTime($matches['year'] . '-' . $matches['month'] . '-' . $matches['date'] . ' 00:00:00', new \DateTimeZone('UTC')), + ); + } + + $dateStr = + $matches['year'] .'-' . + $matches['month'] . '-' . + $matches['date'] . ' ' . + $matches['hour'] . ':' . + $matches['minute'] . ':' . + $matches['second']; + + if (isset($matches['isutc'])) { + $dt = new \DateTime($dateStr,new \DateTimeZone('UTC')); + $dt->setTimeZone(new \DateTimeZone('UTC')); + return array( + self::UTC, + $dt + ); + } + + // Finding the timezone. + $tzid = $property['TZID']; + if (!$tzid) { + // This was a floating time string. This implies we use the + // timezone from date_default_timezone_set / date.timezone ini + // setting. + return array( + self::LOCAL, + new \DateTime($dateStr) + ); + } + + // To look up the timezone, we must first find the VCALENDAR component. + $root = $property; + while($root->parent) { + $root = $root->parent; + } + if ($root->name === 'VCALENDAR') { + $tz = VObject\TimeZoneUtil::getTimeZone((string)$tzid, $root); + } else { + $tz = VObject\TimeZoneUtil::getTimeZone((string)$tzid); + } + + $dt = new \DateTime($dateStr, $tz); + $dt->setTimeZone($tz); + + return array( + self::LOCALTZ, + $dt + ); + + } + +} diff --git a/dav/sabre-vobject/lib/Sabre/VObject/Property/MultiDateTime.php b/dav/sabre-vobject/lib/Sabre/VObject/Property/MultiDateTime.php new file mode 100644 index 00000000..629ef4a1 --- /dev/null +++ b/dav/sabre-vobject/lib/Sabre/VObject/Property/MultiDateTime.php @@ -0,0 +1,168 @@ +offsetUnset('VALUE'); + $this->offsetUnset('TZID'); + switch($dateType) { + + case DateTime::LOCAL : + $val = array(); + foreach($dt as $i) { + $val[] = $i->format('Ymd\\THis'); + } + $this->setValue(implode(',',$val)); + $this->offsetSet('VALUE','DATE-TIME'); + break; + case DateTime::UTC : + $val = array(); + foreach($dt as $i) { + $i->setTimeZone(new \DateTimeZone('UTC')); + $val[] = $i->format('Ymd\\THis\\Z'); + } + $this->setValue(implode(',',$val)); + $this->offsetSet('VALUE','DATE-TIME'); + break; + case DateTime::LOCALTZ : + $val = array(); + foreach($dt as $i) { + $val[] = $i->format('Ymd\\THis'); + } + $this->setValue(implode(',',$val)); + $this->offsetSet('VALUE','DATE-TIME'); + $this->offsetSet('TZID', $dt[0]->getTimeZone()->getName()); + break; + case DateTime::DATE : + $val = array(); + foreach($dt as $i) { + $val[] = $i->format('Ymd'); + } + $this->setValue(implode(',',$val)); + $this->offsetSet('VALUE','DATE'); + break; + default : + throw new \InvalidArgumentException('You must pass a valid dateType constant'); + + } + $this->dateTimes = $dt; + $this->dateType = $dateType; + + } + + /** + * Returns the current DateTime value. + * + * If no value was set, this method returns null. + * + * @return array|null + */ + public function getDateTimes() { + + if ($this->dateTimes) + return $this->dateTimes; + + $dts = array(); + + if (!$this->value) { + $this->dateTimes = null; + $this->dateType = null; + return null; + } + + foreach(explode(',',$this->value) as $val) { + list( + $type, + $dt + ) = DateTime::parseData($val, $this); + $dts[] = $dt; + $this->dateType = $type; + } + $this->dateTimes = $dts; + return $this->dateTimes; + + } + + /** + * Returns the type of Date format. + * + * This method returns one of the format constants. If no date was set, + * this method will return null. + * + * @return int|null + */ + public function getDateType() { + + if ($this->dateType) + return $this->dateType; + + if (!$this->value) { + $this->dateTimes = null; + $this->dateType = null; + return null; + } + + $dts = array(); + foreach(explode(',',$this->value) as $val) { + list( + $type, + $dt + ) = DateTime::parseData($val, $this); + $dts[] = $dt; + $this->dateType = $type; + } + $this->dateTimes = $dts; + return $this->dateType; + + } + +} diff --git a/dav/sabre-vobject/lib/Sabre/VObject/Reader.php b/dav/sabre-vobject/lib/Sabre/VObject/Reader.php new file mode 100644 index 00000000..8fed7e27 --- /dev/null +++ b/dav/sabre-vobject/lib/Sabre/VObject/Reader.php @@ -0,0 +1,183 @@ +add(self::readLine($lines)); + + $nextLine = current($lines); + + if ($nextLine===false) + throw new ParseException('Invalid VObject. Document ended prematurely.'); + + } + + // Checking component name of the 'END:' line. + if (substr($nextLine,4)!==$obj->name) { + throw new ParseException('Invalid VObject, expected: "END:' . $obj->name . '" got: "' . $nextLine . '"'); + } + next($lines); + + return $obj; + + } + + // Properties + //$result = preg_match('/(?P[A-Z0-9-]+)(?:;(?P^(?([^:^\"]|\"([^\"]*)\")*))?"; + $regex = "/^(?P$token)$parameters:(?P.*)$/i"; + + $result = preg_match($regex,$line,$matches); + + if (!$result) { + throw new ParseException('Invalid VObject, line ' . ($lineNr+1) . ' did not follow the icalendar/vcard format'); + } + + $propertyName = strtoupper($matches['name']); + $propertyValue = preg_replace_callback('#(\\\\(\\\\|N|n|;|,))#',function($matches) { + if ($matches[2]==='n' || $matches[2]==='N') { + return "\n"; + } else { + return $matches[2]; + } + }, $matches['value']); + + $obj = Property::create($propertyName, $propertyValue); + + if ($matches['parameters']) { + + foreach(self::readParameters($matches['parameters']) as $param) { + $obj->add($param); + } + + } + + return $obj; + + + } + + /** + * Reads a parameter list from a property + * + * This method returns an array of Parameter + * + * @param string $parameters + * @return array + */ + static private function readParameters($parameters) { + + $token = '[A-Z0-9-]+'; + + $paramValue = '(?P[^\"^;]*|"[^"]*")'; + + $regex = "/(?<=^|;)(?P$token)(=$paramValue(?=$|;))?/i"; + preg_match_all($regex, $parameters, $matches, PREG_SET_ORDER); + + $params = array(); + foreach($matches as $match) { + + $value = isset($match['paramValue'])?$match['paramValue']:null; + + if (isset($value[0])) { + // Stripping quotes, if needed + if ($value[0] === '"') $value = substr($value,1,strlen($value)-2); + } else { + $value = ''; + } + + $value = preg_replace_callback('#(\\\\(\\\\|N|n|;|,))#',function($matches) { + if ($matches[2]==='n' || $matches[2]==='N') { + return "\n"; + } else { + return $matches[2]; + } + }, $value); + + $params[] = new Parameter($match['paramName'], $value); + + } + + return $params; + + } + + +} diff --git a/dav/sabre-vobject/lib/Sabre/VObject/RecurrenceIterator.php b/dav/sabre-vobject/lib/Sabre/VObject/RecurrenceIterator.php new file mode 100644 index 00000000..374b16e8 --- /dev/null +++ b/dav/sabre-vobject/lib/Sabre/VObject/RecurrenceIterator.php @@ -0,0 +1,1058 @@ + 0, + 'MO' => 1, + 'TU' => 2, + 'WE' => 3, + 'TH' => 4, + 'FR' => 5, + 'SA' => 6, + ); + + /** + * Mappings between the day number and english day name. + * + * @var array + */ + private $dayNames = array( + 0 => 'Sunday', + 1 => 'Monday', + 2 => 'Tuesday', + 3 => 'Wednesday', + 4 => 'Thursday', + 5 => 'Friday', + 6 => 'Saturday', + ); + + /** + * If the current iteration of the event is an overriden event, this + * property will hold the VObject + * + * @var Component + */ + private $currentOverriddenEvent; + + /** + * This property may contain the date of the next not-overridden event. + * This date is calculated sometimes a bit early, before overridden events + * are evaluated. + * + * @var DateTime + */ + private $nextDate; + + /** + * Creates the iterator + * + * You should pass a VCALENDAR component, as well as the UID of the event + * we're going to traverse. + * + * @param Component $vcal + * @param string|null $uid + */ + public function __construct(Component $vcal, $uid=null) { + + if (is_null($uid)) { + if ($vcal->name === 'VCALENDAR') { + throw new \InvalidArgumentException('If you pass a VCALENDAR object, you must pass a uid argument as well'); + } + $components = array($vcal); + $uid = (string)$vcal->uid; + } else { + $components = $vcal->select('VEVENT'); + } + foreach($components as $component) { + if ((string)$component->uid == $uid) { + if (isset($component->{'RECURRENCE-ID'})) { + $this->overriddenEvents[$component->DTSTART->getDateTime()->getTimeStamp()] = $component; + $this->overriddenDates[] = $component->{'RECURRENCE-ID'}->getDateTime(); + } else { + $this->baseEvent = $component; + } + } + } + if (!$this->baseEvent) { + throw new \InvalidArgumentException('Could not find a base event with uid: ' . $uid); + } + + $this->startDate = clone $this->baseEvent->DTSTART->getDateTime(); + + $this->endDate = null; + if (isset($this->baseEvent->DTEND)) { + $this->endDate = clone $this->baseEvent->DTEND->getDateTime(); + } else { + $this->endDate = clone $this->startDate; + if (isset($this->baseEvent->DURATION)) { + $this->endDate->add(DateTimeParser::parse($this->baseEvent->DURATION->value)); + } elseif ($this->baseEvent->DTSTART->getDateType()===Property\DateTime::DATE) { + $this->endDate->modify('+1 day'); + } + } + $this->currentDate = clone $this->startDate; + + $rrule = (string)$this->baseEvent->RRULE; + + $parts = explode(';', $rrule); + + // If no rrule was specified, we create a default setting + if (!$rrule) { + $this->frequency = 'daily'; + $this->count = 1; + } else foreach($parts as $part) { + + list($key, $value) = explode('=', $part, 2); + + switch(strtoupper($key)) { + + case 'FREQ' : + if (!in_array( + strtolower($value), + array('secondly','minutely','hourly','daily','weekly','monthly','yearly') + )) { + throw new \InvalidArgumentException('Unknown value for FREQ=' . strtoupper($value)); + + } + $this->frequency = strtolower($value); + break; + + case 'UNTIL' : + $this->until = DateTimeParser::parse($value); + break; + + case 'COUNT' : + $this->count = (int)$value; + break; + + case 'INTERVAL' : + $this->interval = (int)$value; + break; + + case 'BYSECOND' : + $this->bySecond = explode(',', $value); + break; + + case 'BYMINUTE' : + $this->byMinute = explode(',', $value); + break; + + case 'BYHOUR' : + $this->byHour = explode(',', $value); + break; + + case 'BYDAY' : + $this->byDay = explode(',', strtoupper($value)); + break; + + case 'BYMONTHDAY' : + $this->byMonthDay = explode(',', $value); + break; + + case 'BYYEARDAY' : + $this->byYearDay = explode(',', $value); + break; + + case 'BYWEEKNO' : + $this->byWeekNo = explode(',', $value); + break; + + case 'BYMONTH' : + $this->byMonth = explode(',', $value); + break; + + case 'BYSETPOS' : + $this->bySetPos = explode(',', $value); + break; + + case 'WKST' : + $this->weekStart = strtoupper($value); + break; + + } + + } + + // Parsing exception dates + if (isset($this->baseEvent->EXDATE)) { + foreach($this->baseEvent->EXDATE as $exDate) { + + foreach(explode(',', (string)$exDate) as $exceptionDate) { + + $this->exceptionDates[] = + DateTimeParser::parse($exceptionDate, $this->startDate->getTimeZone()); + + } + + } + + } + + } + + /** + * Returns the current item in the list + * + * @return DateTime + */ + public function current() { + + if (!$this->valid()) return null; + return clone $this->currentDate; + + } + + /** + * This method returns the startdate for the current iteration of the + * event. + * + * @return DateTime + */ + public function getDtStart() { + + if (!$this->valid()) return null; + return clone $this->currentDate; + + } + + /** + * This method returns the enddate for the current iteration of the + * event. + * + * @return DateTime + */ + public function getDtEnd() { + + if (!$this->valid()) return null; + $dtEnd = clone $this->currentDate; + $dtEnd->add( $this->startDate->diff( $this->endDate ) ); + return clone $dtEnd; + + } + + /** + * Returns a VEVENT object with the updated start and end date. + * + * Any recurrence information is removed, and this function may return an + * 'overridden' event instead. + * + * This method always returns a cloned instance. + * + * @return Component\VEvent + */ + public function getEventObject() { + + if ($this->currentOverriddenEvent) { + return clone $this->currentOverriddenEvent; + } + $event = clone $this->baseEvent; + unset($event->RRULE); + unset($event->EXDATE); + unset($event->RDATE); + unset($event->EXRULE); + + $event->DTSTART->setDateTime($this->getDTStart(), $event->DTSTART->getDateType()); + if (isset($event->DTEND)) { + $event->DTEND->setDateTime($this->getDtEnd(), $event->DTSTART->getDateType()); + } + if ($this->counter > 0) { + $event->{'RECURRENCE-ID'} = (string)$event->DTSTART; + } + + return $event; + + } + + /** + * Returns the current item number + * + * @return int + */ + public function key() { + + return $this->counter; + + } + + /** + * Whether or not there is a 'next item' + * + * @return bool + */ + public function valid() { + + if (!is_null($this->count)) { + return $this->counter < $this->count; + } + if (!is_null($this->until)) { + return $this->currentDate <= $this->until; + } + return true; + + } + + /** + * Resets the iterator + * + * @return void + */ + public function rewind() { + + $this->currentDate = clone $this->startDate; + $this->counter = 0; + + } + + /** + * This method allows you to quickly go to the next occurrence after the + * specified date. + * + * Note that this checks the current 'endDate', not the 'stardDate'. This + * means that if you forward to January 1st, the iterator will stop at the + * first event that ends *after* January 1st. + * + * @param DateTime $dt + * @return void + */ + public function fastForward(\DateTime $dt) { + + while($this->valid() && $this->getDTEnd() <= $dt) { + $this->next(); + } + + } + + /** + * Returns true if this recurring event never ends. + * + * @return bool + */ + public function isInfinite() { + + return !$this->count && !$this->until; + + } + + /** + * Goes on to the next iteration + * + * @return void + */ + public function next() { + + /* + if (!is_null($this->count) && $this->counter >= $this->count) { + $this->currentDate = null; + }*/ + + + $previousStamp = $this->currentDate->getTimeStamp(); + + while(true) { + + $this->currentOverriddenEvent = null; + + // If we have a next date 'stored', we use that + if ($this->nextDate) { + $this->currentDate = $this->nextDate; + $currentStamp = $this->currentDate->getTimeStamp(); + $this->nextDate = null; + } else { + + // Otherwise, we calculate it + switch($this->frequency) { + + case 'daily' : + $this->nextDaily(); + break; + + case 'weekly' : + $this->nextWeekly(); + break; + + case 'monthly' : + $this->nextMonthly(); + break; + + case 'yearly' : + $this->nextYearly(); + break; + + } + $currentStamp = $this->currentDate->getTimeStamp(); + + // Checking exception dates + foreach($this->exceptionDates as $exceptionDate) { + if ($this->currentDate == $exceptionDate) { + $this->counter++; + continue 2; + } + } + foreach($this->overriddenDates as $overriddenDate) { + if ($this->currentDate == $overriddenDate) { + continue 2; + } + } + + } + + // Checking overridden events + foreach($this->overriddenEvents as $index=>$event) { + if ($index > $previousStamp && $index <= $currentStamp) { + + // We're moving the 'next date' aside, for later use. + $this->nextDate = clone $this->currentDate; + + $this->currentDate = $event->DTSTART->getDateTime(); + $this->currentOverriddenEvent = $event; + + break; + } + } + + break; + + } + + /* + if (!is_null($this->until)) { + if($this->currentDate > $this->until) { + $this->currentDate = null; + } + }*/ + + $this->counter++; + + } + + /** + * Does the processing for advancing the iterator for daily frequency. + * + * @return void + */ + protected function nextDaily() { + + if (!$this->byDay) { + $this->currentDate->modify('+' . $this->interval . ' days'); + return; + } + + $recurrenceDays = array(); + foreach($this->byDay as $byDay) { + + // The day may be preceeded with a positive (+n) or + // negative (-n) integer. However, this does not make + // sense in 'weekly' so we ignore it here. + $recurrenceDays[] = $this->dayMap[substr($byDay,-2)]; + + } + + do { + + $this->currentDate->modify('+' . $this->interval . ' days'); + + // Current day of the week + $currentDay = $this->currentDate->format('w'); + + } while (!in_array($currentDay, $recurrenceDays)); + + } + + /** + * Does the processing for advancing the iterator for weekly frequency. + * + * @return void + */ + protected function nextWeekly() { + + if (!$this->byDay) { + $this->currentDate->modify('+' . $this->interval . ' weeks'); + return; + } + + $recurrenceDays = array(); + foreach($this->byDay as $byDay) { + + // The day may be preceeded with a positive (+n) or + // negative (-n) integer. However, this does not make + // sense in 'weekly' so we ignore it here. + $recurrenceDays[] = $this->dayMap[substr($byDay,-2)]; + + } + + // Current day of the week + $currentDay = $this->currentDate->format('w'); + + // First day of the week: + $firstDay = $this->dayMap[$this->weekStart]; + + $time = array( + $this->currentDate->format('H'), + $this->currentDate->format('i'), + $this->currentDate->format('s') + ); + + // Increasing the 'current day' until we find our next + // occurrence. + while(true) { + + $currentDay++; + + if ($currentDay>6) { + $currentDay = 0; + } + + // We need to roll over to the next week + if ($currentDay === $firstDay) { + $this->currentDate->modify('+' . $this->interval . ' weeks'); + + // We need to go to the first day of this week, but only if we + // are not already on this first day of this week. + if($this->currentDate->format('w') != $firstDay) { + $this->currentDate->modify('last ' . $this->dayNames[$this->dayMap[$this->weekStart]]); + $this->currentDate->setTime($time[0],$time[1],$time[2]); + } + } + + // We have a match + if (in_array($currentDay ,$recurrenceDays)) { + $this->currentDate->modify($this->dayNames[$currentDay]); + $this->currentDate->setTime($time[0],$time[1],$time[2]); + break; + } + + } + + } + + /** + * Does the processing for advancing the iterator for monthly frequency. + * + * @return void + */ + protected function nextMonthly() { + + $currentDayOfMonth = $this->currentDate->format('j'); + if (!$this->byMonthDay && !$this->byDay) { + + // If the current day is higher than the 28th, rollover can + // occur to the next month. We Must skip these invalid + // entries. + if ($currentDayOfMonth < 29) { + $this->currentDate->modify('+' . $this->interval . ' months'); + } else { + $increase = 0; + do { + $increase++; + $tempDate = clone $this->currentDate; + $tempDate->modify('+ ' . ($this->interval*$increase) . ' months'); + } while ($tempDate->format('j') != $currentDayOfMonth); + $this->currentDate = $tempDate; + } + return; + } + + while(true) { + + $occurrences = $this->getMonthlyOccurrences(); + + foreach($occurrences as $occurrence) { + + // The first occurrence thats higher than the current + // day of the month wins. + if ($occurrence > $currentDayOfMonth) { + break 2; + } + + } + + // If we made it all the way here, it means there were no + // valid occurrences, and we need to advance to the next + // month. + $this->currentDate->modify('first day of this month'); + $this->currentDate->modify('+ ' . $this->interval . ' months'); + + // This goes to 0 because we need to start counting at hte + // beginning. + $currentDayOfMonth = 0; + + } + + $this->currentDate->setDate($this->currentDate->format('Y'), $this->currentDate->format('n'), $occurrence); + + } + + /** + * Does the processing for advancing the iterator for yearly frequency. + * + * @return void + */ + protected function nextYearly() { + + $currentMonth = $this->currentDate->format('n'); + $currentYear = $this->currentDate->format('Y'); + $currentDayOfMonth = $this->currentDate->format('j'); + + // No sub-rules, so we just advance by year + if (!$this->byMonth) { + + // Unless it was a leap day! + if ($currentMonth==2 && $currentDayOfMonth==29) { + + $counter = 0; + do { + $counter++; + // Here we increase the year count by the interval, until + // we hit a date that's also in a leap year. + // + // We could just find the next interval that's dividable by + // 4, but that would ignore the rule that there's no leap + // year every year that's dividable by a 100, but not by + // 400. (1800, 1900, 2100). So we just rely on the datetime + // functions instead. + $nextDate = clone $this->currentDate; + $nextDate->modify('+ ' . ($this->interval*$counter) . ' years'); + } while ($nextDate->format('n')!=2); + $this->currentDate = $nextDate; + + return; + + } + + // The easiest form + $this->currentDate->modify('+' . $this->interval . ' years'); + return; + + } + + $currentMonth = $this->currentDate->format('n'); + $currentYear = $this->currentDate->format('Y'); + $currentDayOfMonth = $this->currentDate->format('j'); + + $advancedToNewMonth = false; + + // If we got a byDay or getMonthDay filter, we must first expand + // further. + if ($this->byDay || $this->byMonthDay) { + + while(true) { + + $occurrences = $this->getMonthlyOccurrences(); + + foreach($occurrences as $occurrence) { + + // The first occurrence that's higher than the current + // day of the month wins. + // If we advanced to the next month or year, the first + // occurrence is always correct. + if ($occurrence > $currentDayOfMonth || $advancedToNewMonth) { + break 2; + } + + } + + // If we made it here, it means we need to advance to + // the next month or year. + $currentDayOfMonth = 1; + $advancedToNewMonth = true; + do { + + $currentMonth++; + if ($currentMonth>12) { + $currentYear+=$this->interval; + $currentMonth = 1; + } + } while (!in_array($currentMonth, $this->byMonth)); + + $this->currentDate->setDate($currentYear, $currentMonth, $currentDayOfMonth); + + } + + // If we made it here, it means we got a valid occurrence + $this->currentDate->setDate($currentYear, $currentMonth, $occurrence); + return; + + } else { + + // These are the 'byMonth' rules, if there are no byDay or + // byMonthDay sub-rules. + do { + + $currentMonth++; + if ($currentMonth>12) { + $currentYear+=$this->interval; + $currentMonth = 1; + } + } while (!in_array($currentMonth, $this->byMonth)); + $this->currentDate->setDate($currentYear, $currentMonth, $currentDayOfMonth); + + return; + + } + + } + + /** + * Returns all the occurrences for a monthly frequency with a 'byDay' or + * 'byMonthDay' expansion for the current month. + * + * The returned list is an array of integers with the day of month (1-31). + * + * @return array + */ + protected function getMonthlyOccurrences() { + + $startDate = clone $this->currentDate; + + $byDayResults = array(); + + // Our strategy is to simply go through the byDays, advance the date to + // that point and add it to the results. + if ($this->byDay) foreach($this->byDay as $day) { + + $dayName = $this->dayNames[$this->dayMap[substr($day,-2)]]; + + // Dayname will be something like 'wednesday'. Now we need to find + // all wednesdays in this month. + $dayHits = array(); + + $checkDate = clone $startDate; + $checkDate->modify('first day of this month'); + $checkDate->modify($dayName); + + do { + $dayHits[] = $checkDate->format('j'); + $checkDate->modify('next ' . $dayName); + } while ($checkDate->format('n') === $startDate->format('n')); + + // So now we have 'all wednesdays' for month. It is however + // possible that the user only really wanted the 1st, 2nd or last + // wednesday. + if (strlen($day)>2) { + $offset = (int)substr($day,0,-2); + + if ($offset>0) { + // It is possible that the day does not exist, such as a + // 5th or 6th wednesday of the month. + if (isset($dayHits[$offset-1])) { + $byDayResults[] = $dayHits[$offset-1]; + } + } else { + + // if it was negative we count from the end of the array + $byDayResults[] = $dayHits[count($dayHits) + $offset]; + } + } else { + // There was no counter (first, second, last wednesdays), so we + // just need to add the all to the list). + $byDayResults = array_merge($byDayResults, $dayHits); + + } + + } + + $byMonthDayResults = array(); + if ($this->byMonthDay) foreach($this->byMonthDay as $monthDay) { + + // Removing values that are out of range for this month + if ($monthDay > $startDate->format('t') || + $monthDay < 0-$startDate->format('t')) { + continue; + } + if ($monthDay>0) { + $byMonthDayResults[] = $monthDay; + } else { + // Negative values + $byMonthDayResults[] = $startDate->format('t') + 1 + $monthDay; + } + } + + // If there was just byDay or just byMonthDay, they just specify our + // (almost) final list. If both were provided, then byDay limits the + // list. + if ($this->byMonthDay && $this->byDay) { + $result = array_intersect($byMonthDayResults, $byDayResults); + } elseif ($this->byMonthDay) { + $result = $byMonthDayResults; + } else { + $result = $byDayResults; + } + $result = array_unique($result); + sort($result, SORT_NUMERIC); + + // The last thing that needs checking is the BYSETPOS. If it's set, it + // means only certain items in the set survive the filter. + if (!$this->bySetPos) { + return $result; + } + + $filteredResult = array(); + foreach($this->bySetPos as $setPos) { + + if ($setPos<0) { + $setPos = count($result)-($setPos+1); + } + if (isset($result[$setPos-1])) { + $filteredResult[] = $result[$setPos-1]; + } + } + + sort($filteredResult, SORT_NUMERIC); + return $filteredResult; + + } + + +} + diff --git a/dav/sabre-vobject/lib/Sabre/VObject/TimeZoneUtil.php b/dav/sabre-vobject/lib/Sabre/VObject/TimeZoneUtil.php new file mode 100644 index 00000000..8e01210b --- /dev/null +++ b/dav/sabre-vobject/lib/Sabre/VObject/TimeZoneUtil.php @@ -0,0 +1,351 @@ +'Australia/Darwin', + 'AUS Eastern Standard Time'=>'Australia/Sydney', + 'Afghanistan Standard Time'=>'Asia/Kabul', + 'Alaskan Standard Time'=>'America/Anchorage', + 'Arab Standard Time'=>'Asia/Riyadh', + 'Arabian Standard Time'=>'Asia/Dubai', + 'Arabic Standard Time'=>'Asia/Baghdad', + 'Argentina Standard Time'=>'America/Buenos_Aires', + 'Armenian Standard Time'=>'Asia/Yerevan', + 'Atlantic Standard Time'=>'America/Halifax', + 'Azerbaijan Standard Time'=>'Asia/Baku', + 'Azores Standard Time'=>'Atlantic/Azores', + 'Bangladesh Standard Time'=>'Asia/Dhaka', + 'Canada Central Standard Time'=>'America/Regina', + 'Cape Verde Standard Time'=>'Atlantic/Cape_Verde', + 'Caucasus Standard Time'=>'Asia/Yerevan', + 'Cen. Australia Standard Time'=>'Australia/Adelaide', + 'Central America Standard Time'=>'America/Guatemala', + 'Central Asia Standard Time'=>'Asia/Almaty', + 'Central Brazilian Standard Time'=>'America/Cuiaba', + 'Central Europe Standard Time'=>'Europe/Budapest', + 'Central European Standard Time'=>'Europe/Warsaw', + 'Central Pacific Standard Time'=>'Pacific/Guadalcanal', + 'Central Standard Time'=>'America/Chicago', + 'Central Standard Time (Mexico)'=>'America/Mexico_City', + 'China Standard Time'=>'Asia/Shanghai', + 'Dateline Standard Time'=>'Etc/GMT+12', + 'E. Africa Standard Time'=>'Africa/Nairobi', + 'E. Australia Standard Time'=>'Australia/Brisbane', + 'E. Europe Standard Time'=>'Europe/Minsk', + 'E. South America Standard Time'=>'America/Sao_Paulo', + 'Eastern Standard Time'=>'America/New_York', + 'Egypt Standard Time'=>'Africa/Cairo', + 'Ekaterinburg Standard Time'=>'Asia/Yekaterinburg', + 'FLE Standard Time'=>'Europe/Kiev', + 'Fiji Standard Time'=>'Pacific/Fiji', + 'GMT Standard Time'=>'Europe/London', + 'GTB Standard Time'=>'Europe/Istanbul', + 'Georgian Standard Time'=>'Asia/Tbilisi', + 'Greenland Standard Time'=>'America/Godthab', + 'Greenwich Standard Time'=>'Atlantic/Reykjavik', + 'Hawaiian Standard Time'=>'Pacific/Honolulu', + 'India Standard Time'=>'Asia/Calcutta', + 'Iran Standard Time'=>'Asia/Tehran', + 'Israel Standard Time'=>'Asia/Jerusalem', + 'Jordan Standard Time'=>'Asia/Amman', + 'Kamchatka Standard Time'=>'Asia/Kamchatka', + 'Korea Standard Time'=>'Asia/Seoul', + 'Magadan Standard Time'=>'Asia/Magadan', + 'Mauritius Standard Time'=>'Indian/Mauritius', + 'Mexico Standard Time'=>'America/Mexico_City', + 'Mexico Standard Time 2'=>'America/Chihuahua', + 'Mid-Atlantic Standard Time'=>'Etc/GMT+2', + 'Middle East Standard Time'=>'Asia/Beirut', + 'Montevideo Standard Time'=>'America/Montevideo', + 'Morocco Standard Time'=>'Africa/Casablanca', + 'Mountain Standard Time'=>'America/Denver', + 'Mountain Standard Time (Mexico)'=>'America/Chihuahua', + 'Myanmar Standard Time'=>'Asia/Rangoon', + 'N. Central Asia Standard Time'=>'Asia/Novosibirsk', + 'Namibia Standard Time'=>'Africa/Windhoek', + 'Nepal Standard Time'=>'Asia/Katmandu', + 'New Zealand Standard Time'=>'Pacific/Auckland', + 'Newfoundland Standard Time'=>'America/St_Johns', + 'North Asia East Standard Time'=>'Asia/Irkutsk', + 'North Asia Standard Time'=>'Asia/Krasnoyarsk', + 'Pacific SA Standard Time'=>'America/Santiago', + 'Pacific Standard Time'=>'America/Los_Angeles', + 'Pacific Standard Time (Mexico)'=>'America/Santa_Isabel', + 'Pakistan Standard Time'=>'Asia/Karachi', + 'Paraguay Standard Time'=>'America/Asuncion', + 'Romance Standard Time'=>'Europe/Paris', + 'Russian Standard Time'=>'Europe/Moscow', + 'SA Eastern Standard Time'=>'America/Cayenne', + 'SA Pacific Standard Time'=>'America/Bogota', + 'SA Western Standard Time'=>'America/La_Paz', + 'SE Asia Standard Time'=>'Asia/Bangkok', + 'Samoa Standard Time'=>'Pacific/Apia', + 'Singapore Standard Time'=>'Asia/Singapore', + 'South Africa Standard Time'=>'Africa/Johannesburg', + 'Sri Lanka Standard Time'=>'Asia/Colombo', + 'Syria Standard Time'=>'Asia/Damascus', + 'Taipei Standard Time'=>'Asia/Taipei', + 'Tasmania Standard Time'=>'Australia/Hobart', + 'Tokyo Standard Time'=>'Asia/Tokyo', + 'Tonga Standard Time'=>'Pacific/Tongatapu', + 'US Eastern Standard Time'=>'America/Indianapolis', + 'US Mountain Standard Time'=>'America/Phoenix', + 'UTC'=>'Etc/GMT', + 'UTC+12'=>'Etc/GMT-12', + 'UTC-02'=>'Etc/GMT+2', + 'UTC-11'=>'Etc/GMT+11', + 'Ulaanbaatar Standard Time'=>'Asia/Ulaanbaatar', + 'Venezuela Standard Time'=>'America/Caracas', + 'Vladivostok Standard Time'=>'Asia/Vladivostok', + 'W. Australia Standard Time'=>'Australia/Perth', + 'W. Central Africa Standard Time'=>'Africa/Lagos', + 'W. Europe Standard Time'=>'Europe/Berlin', + 'West Asia Standard Time'=>'Asia/Tashkent', + 'West Pacific Standard Time'=>'Pacific/Port_Moresby', + 'Yakutsk Standard Time'=>'Asia/Yakutsk', + + // Microsoft exchange timezones + // Source: + // http://msdn.microsoft.com/en-us/library/ms988620%28v=exchg.65%29.aspx + // + // Correct timezones deduced with help from: + // http://en.wikipedia.org/wiki/List_of_tz_database_time_zones + 'Universal Coordinated Time' => 'UTC', + 'Casablanca, Monrovia' => 'Africa/Casablanca', + 'Greenwich Mean Time: Dublin, Edinburgh, Lisbon, London' => 'Europe/Lisbon', + 'Greenwich Mean Time; Dublin, Edinburgh, London' => 'Europe/London', + 'Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna' => 'Europe/Berlin', + 'Belgrade, Pozsony, Budapest, Ljubljana, Prague' => 'Europe/Prague', + 'Brussels, Copenhagen, Madrid, Paris' => 'Europe/Paris', + 'Paris, Madrid, Brussels, Copenhagen' => 'Europe/Paris', + 'Prague, Central Europe' => 'Europe/Prague', + 'Sarajevo, Skopje, Sofija, Vilnius, Warsaw, Zagreb' => 'Europe/Sarajevo', + 'West Central Africa' => 'Africa/Luanda', // This was a best guess + 'Athens, Istanbul, Minsk' => 'Europe/Athens', + 'Bucharest' => 'Europe/Bucharest', + 'Cairo' => 'Africa/Cairo', + 'Harare, Pretoria' => 'Africa/Harare', + 'Helsinki, Riga, Tallinn' => 'Europe/Helsinki', + 'Israel, Jerusalem Standard Time' => 'Asia/Jerusalem', + 'Baghdad' => 'Asia/Baghdad', + 'Arab, Kuwait, Riyadh' => 'Asia/Kuwait', + 'Moscow, St. Petersburg, Volgograd' => 'Europe/Moscow', + 'East Africa, Nairobi' => 'Africa/Nairobi', + 'Tehran' => 'Asia/Tehran', + 'Abu Dhabi, Muscat' => 'Asia/Muscat', // Best guess + 'Baku, Tbilisi, Yerevan' => 'Asia/Baku', + 'Kabul' => 'Asia/Kabul', + 'Ekaterinburg' => 'Asia/Yekaterinburg', + 'Islamabad, Karachi, Tashkent' => 'Asia/Karachi', + 'Kolkata, Chennai, Mumbai, New Delhi, India Standard Time' => 'Asia/Calcutta', + 'Kathmandu, Nepal' => 'Asia/Kathmandu', + 'Almaty, Novosibirsk, North Central Asia' => 'Asia/Almaty', + 'Astana, Dhaka' => 'Asia/Dhaka', + 'Sri Jayawardenepura, Sri Lanka' => 'Asia/Colombo', + 'Rangoon' => 'Asia/Rangoon', + 'Bangkok, Hanoi, Jakarta' => 'Asia/Bangkok', + 'Krasnoyarsk' => 'Asia/Krasnoyarsk', + 'Beijing, Chongqing, Hong Kong SAR, Urumqi' => 'Asia/Shanghai', + 'Irkutsk, Ulaan Bataar' => 'Asia/Irkutsk', + 'Kuala Lumpur, Singapore' => 'Asia/Singapore', + 'Perth, Western Australia' => 'Australia/Perth', + 'Taipei' => 'Asia/Taipei', + 'Osaka, Sapporo, Tokyo' => 'Asia/Tokyo', + 'Seoul, Korea Standard time' => 'Asia/Seoul', + 'Yakutsk' => 'Asia/Yakutsk', + 'Adelaide, Central Australia' => 'Australia/Adelaide', + 'Darwin' => 'Australia/Darwin', + 'Brisbane, East Australia' => 'Australia/Brisbane', + 'Canberra, Melbourne, Sydney, Hobart (year 2000 only)' => 'Australia/Sydney', + 'Guam, Port Moresby' => 'Pacific/Guam', + 'Hobart, Tasmania' => 'Australia/Hobart', + 'Vladivostok' => 'Asia/Vladivostok', + 'Magadan, Solomon Is., New Caledonia' => 'Asia/Magadan', + 'Auckland, Wellington' => 'Pacific/Auckland', + 'Fiji Islands, Kamchatka, Marshall Is.' => 'Pacific/Fiji', + 'Nuku\'alofa, Tonga' => 'Pacific/Tongatapu', + 'Azores' => 'Atlantic/Azores', + 'Cape Verde Is.' => 'Atlantic/Cape_Verde', + 'Mid-Atlantic' => 'America/Noronha', + 'Brasilia' => 'America/Sao_Paulo', // Best guess + 'Buenos Aires' => 'America/Argentina/Buenos_Aires', + 'Greenland' => 'America/Godthab', + 'Newfoundland' => 'America/St_Johns', + 'Atlantic Time (Canada)' => 'America/Halifax', + 'Caracas, La Paz' => 'America/Caracas', + 'Santiago' => 'America/Santiago', + 'Bogota, Lima, Quito' => 'America/Bogota', + 'Eastern Time (US & Canada)' => 'America/New_York', + 'Indiana (East)' => 'America/Indiana/Indianapolis', + 'Central America' => 'America/Guatemala', + 'Central Time (US & Canada)' => 'America/Chicago', + 'Mexico City, Tegucigalpa' => 'America/Mexico_City', + 'Saskatchewan' => 'America/Edmonton', + 'Arizona' => 'America/Phoenix', + 'Mountain Time (US & Canada)' => 'America/Denver', // Best guess + 'Pacific Time (US & Canada); Tijuana' => 'America/Los_Angeles', // Best guess + 'Alaska' => 'America/Anchorage', + 'Hawaii' => 'Pacific/Honolulu', + 'Midway Island, Samoa' => 'Pacific/Midway', + 'Eniwetok, Kwajalein, Dateline Time' => 'Pacific/Kwajalein', + + ); + + public static $microsoftExchangeMap = array( + 0 => 'UTC', + 31 => 'Africa/Casablanca', + 2 => 'Europe/Lisbon', + 1 => 'Europe/London', + 4 => 'Europe/Berlin', + 6 => 'Europe/Prague', + 3 => 'Europe/Paris', + 69 => 'Africa/Luanda', // This was a best guess + 7 => 'Europe/Athens', + 5 => 'Europe/Bucharest', + 49 => 'Africa/Cairo', + 50 => 'Africa/Harare', + 59 => 'Europe/Helsinki', + 27 => 'Asia/Jerusalem', + 26 => 'Asia/Baghdad', + 74 => 'Asia/Kuwait', + 51 => 'Europe/Moscow', + 56 => 'Africa/Nairobi', + 25 => 'Asia/Tehran', + 24 => 'Asia/Muscat', // Best guess + 54 => 'Asia/Baku', + 48 => 'Asia/Kabul', + 58 => 'Asia/Yekaterinburg', + 47 => 'Asia/Karachi', + 23 => 'Asia/Calcutta', + 62 => 'Asia/Kathmandu', + 46 => 'Asia/Almaty', + 71 => 'Asia/Dhaka', + 66 => 'Asia/Colombo', + 61 => 'Asia/Rangoon', + 22 => 'Asia/Bangkok', + 64 => 'Asia/Krasnoyarsk', + 45 => 'Asia/Shanghai', + 63 => 'Asia/Irkutsk', + 21 => 'Asia/Singapore', + 73 => 'Australia/Perth', + 75 => 'Asia/Taipei', + 20 => 'Asia/Tokyo', + 72 => 'Asia/Seoul', + 70 => 'Asia/Yakutsk', + 19 => 'Australia/Adelaide', + 44 => 'Australia/Darwin', + 18 => 'Australia/Brisbane', + 76 => 'Australia/Sydney', + 43 => 'Pacific/Guam', + 42 => 'Australia/Hobart', + 68 => 'Asia/Vladivostok', + 41 => 'Asia/Magadan', + 17 => 'Pacific/Auckland', + 40 => 'Pacific/Fiji', + 67 => 'Pacific/Tongatapu', + 29 => 'Atlantic/Azores', + 53 => 'Atlantic/Cape_Verde', + 30 => 'America/Noronha', + 8 => 'America/Sao_Paulo', // Best guess + 32 => 'America/Argentina/Buenos_Aires', + 69 => 'America/Godthab', + 28 => 'America/St_Johns', + 9 => 'America/Halifax', + 33 => 'America/Caracas', + 65 => 'America/Santiago', + 35 => 'America/Bogota', + 10 => 'America/New_York', + 34 => 'America/Indiana/Indianapolis', + 55 => 'America/Guatemala', + 11 => 'America/Chicago', + 37 => 'America/Mexico_City', + 36 => 'America/Edmonton', + 38 => 'America/Phoenix', + 12 => 'America/Denver', // Best guess + 13 => 'America/Los_Angeles', // Best guess + 14 => 'America/Anchorage', + 15 => 'Pacific/Honolulu', + 16 => 'Pacific/Midway', + 39 => 'Pacific/Kwajalein', + ); + + /** + * This method will try to find out the correct timezone for an iCalendar + * date-time value. + * + * You must pass the contents of the TZID parameter, as well as the full + * calendar. + * + * If the lookup fails, this method will return UTC. + * + * @param string $tzid + * @param Sabre\VObject\Component $vcalendar + * @return DateTimeZone + */ + static public function getTimeZone($tzid, Component $vcalendar = null) { + + // First we will just see if the tzid is a support timezone identifier. + try { + return new \DateTimeZone($tzid); + } catch (\Exception $e) { + } + + // Next, we check if the tzid is somewhere in our tzid map. + if (isset(self::$map[$tzid])) { + return new \DateTimeZone(self::$map[$tzid]); + } + + if ($vcalendar) { + + // If that didn't work, we will scan VTIMEZONE objects + foreach($vcalendar->select('VTIMEZONE') as $vtimezone) { + + if ((string)$vtimezone->TZID === $tzid) { + + // Some clients add 'X-LIC-LOCATION' with the olson name. + if (isset($vtimezone->{'X-LIC-LOCATION'})) { + try { + return new \DateTimeZone($vtimezone->{'X-LIC-LOCATION'}); + } catch (\Exception $e) { + } + + } + // Microsoft may add a magic number, which we also have an + // answer for. + if (isset($vtimezone->{'X-MICROSOFT-CDO-TZID'})) { + if (isset(self::$microsoftExchangeMap[(int)$vtimezone->{'X-MICROSOFT-CDO-TZID'}->value])) { + return new \DateTimeZone(self::$microsoftExchangeMap[(int)$vtimezone->{'X-MICROSOFT-CDO-TZID'}->value]); + } + } + } + + } + + } + + // If we got all the way here, we default to UTC. + return new \DateTimeZone(date_default_timezone_get()); + + + } + + +} diff --git a/dav/sabre-vobject/lib/Sabre/VObject/Version.php b/dav/sabre-vobject/lib/Sabre/VObject/Version.php new file mode 100644 index 00000000..a35c852e --- /dev/null +++ b/dav/sabre-vobject/lib/Sabre/VObject/Version.php @@ -0,0 +1,24 @@ +assertEquals($outcome, $valarm->isInTimeRange($start, $end)); + + } + + public function timeRangeTestData() { + + $tests = array(); + + // Hard date and time + $valarm1 = Component::create('VALARM'); + $valarm1->TRIGGER = '20120312T130000Z'; + $valarm1->TRIGGER['VALUE'] = 'DATE-TIME'; + + $tests[] = array($valarm1, new DateTime('2012-03-01 01:00:00'), new DateTime('2012-04-01 01:00:00'), true); + $tests[] = array($valarm1, new DateTime('2012-03-01 01:00:00'), new DateTime('2012-03-10 01:00:00'), false); + + // Relation to start time of event + $valarm2 = Component::create('VALARM'); + $valarm2->TRIGGER = '-P1D'; + $valarm2->TRIGGER['VALUE'] = 'DURATION'; + + $vevent2 = Component::create('VEVENT'); + $vevent2->DTSTART = '20120313T130000Z'; + $vevent2->add($valarm2); + + $tests[] = array($valarm2, new DateTime('2012-03-01 01:00:00'), new DateTime('2012-04-01 01:00:00'), true); + $tests[] = array($valarm2, new DateTime('2012-03-01 01:00:00'), new DateTime('2012-03-10 01:00:00'), false); + + // Relation to end time of event + $valarm3 = Component::create('VALARM'); + $valarm3->TRIGGER = '-P1D'; + $valarm3->TRIGGER['VALUE'] = 'DURATION'; + $valarm3->TRIGGER['RELATED']= 'END'; + + $vevent3 = Component::create('VEVENT'); + $vevent3->DTSTART = '20120301T130000Z'; + $vevent3->DTEND = '20120401T130000Z'; + $vevent3->add($valarm3); + + $tests[] = array($valarm3, new DateTime('2012-02-25 01:00:00'), new DateTime('2012-03-05 01:00:00'), false); + $tests[] = array($valarm3, new DateTime('2012-03-25 01:00:00'), new DateTime('2012-04-05 01:00:00'), true); + + // Relation to end time of todo + $valarm4 = Component::create('VALARM'); + $valarm4->TRIGGER = '-P1D'; + $valarm4->TRIGGER['VALUE'] = 'DURATION'; + $valarm4->TRIGGER['RELATED']= 'END'; + + $vtodo4 = Component::create('VTODO'); + $vtodo4->DTSTART = '20120301T130000Z'; + $vtodo4->DUE = '20120401T130000Z'; + $vtodo4->add($valarm4); + + $tests[] = array($valarm4, new DateTime('2012-02-25 01:00:00'), new DateTime('2012-03-05 01:00:00'), false); + $tests[] = array($valarm4, new DateTime('2012-03-25 01:00:00'), new DateTime('2012-04-05 01:00:00'), true); + + // Relation to start time of event + repeat + $valarm5 = Component::create('VALARM'); + $valarm5->TRIGGER = '-P1D'; + $valarm5->TRIGGER['VALUE'] = 'DURATION'; + $valarm5->REPEAT = 10; + $valarm5->DURATION = 'P1D'; + + $vevent5 = Component::create('VEVENT'); + $vevent5->DTSTART = '20120301T130000Z'; + $vevent5->add($valarm5); + + $tests[] = array($valarm5, new DateTime('2012-03-09 01:00:00'), new DateTime('2012-03-10 01:00:00'), true); + + // Relation to start time of event + duration, but no repeat + $valarm6 = Component::create('VALARM'); + $valarm6->TRIGGER = '-P1D'; + $valarm6->TRIGGER['VALUE'] = 'DURATION'; + $valarm6->DURATION = 'P1D'; + + $vevent6 = Component::create('VEVENT'); + $vevent6->DTSTART = '20120313T130000Z'; + $vevent6->add($valarm6); + + $tests[] = array($valarm6, new DateTime('2012-03-01 01:00:00'), new DateTime('2012-04-01 01:00:00'), true); + $tests[] = array($valarm6, new DateTime('2012-03-01 01:00:00'), new DateTime('2012-03-10 01:00:00'), false); + + + // Relation to end time of event (DURATION instead of DTEND) + $valarm7 = Component::create('VALARM'); + $valarm7->TRIGGER = '-P1D'; + $valarm7->TRIGGER['VALUE'] = 'DURATION'; + $valarm7->TRIGGER['RELATED']= 'END'; + + $vevent7 = Component::create('VEVENT'); + $vevent7->DTSTART = '20120301T130000Z'; + $vevent7->DURATION = 'P30D'; + $vevent7->add($valarm7); + + $tests[] = array($valarm7, new DateTime('2012-02-25 01:00:00'), new DateTime('2012-03-05 01:00:00'), false); + $tests[] = array($valarm7, new DateTime('2012-03-25 01:00:00'), new DateTime('2012-04-05 01:00:00'), true); + + // Relation to end time of event (No DTEND or DURATION) + $valarm7 = Component::create('VALARM'); + $valarm7->TRIGGER = '-P1D'; + $valarm7->TRIGGER['VALUE'] = 'DURATION'; + $valarm7->TRIGGER['RELATED']= 'END'; + + $vevent7 = Component::create('VEVENT'); + $vevent7->DTSTART = '20120301T130000Z'; + $vevent7->add($valarm7); + + $tests[] = array($valarm7, new DateTime('2012-02-25 01:00:00'), new DateTime('2012-03-05 01:00:00'), true); + $tests[] = array($valarm7, new DateTime('2012-03-25 01:00:00'), new DateTime('2012-04-05 01:00:00'), false); + + + return $tests; + } + + /** + * @expectedException LogicException + */ + public function testInTimeRangeInvalidComponent() { + + $valarm = Component::create('VALARM'); + $valarm->TRIGGER = '-P1D'; + $valarm->TRIGGER['RELATED'] = 'END'; + + $vjournal = Component::create('VJOURNAL'); + $vjournal->add($valarm); + + $valarm->isInTimeRange(new DateTime('2012-02-25 01:00:00'), new DateTime('2012-03-05 01:00:00')); + + } + +} + diff --git a/dav/sabre-vobject/tests/Sabre/VObject/Component/VCalendarTest.php b/dav/sabre-vobject/tests/Sabre/VObject/Component/VCalendarTest.php new file mode 100644 index 00000000..1d7e0c60 --- /dev/null +++ b/dav/sabre-vobject/tests/Sabre/VObject/Component/VCalendarTest.php @@ -0,0 +1,244 @@ +expand( + new \DateTime('2011-12-01'), + new \DateTime('2011-12-31') + ); + + // This will normalize the output + $output = VObject\Reader::read($output)->serialize(); + + $this->assertEquals($output, $vcal->serialize()); + + } + + public function expandData() { + + $tests = array(); + + // No data + $input = 'BEGIN:VCALENDAR +CALSCALE:GREGORIAN +VERSION:2.0 +END:VCALENDAR +'; + + $output = $input; + $tests[] = array($input,$output); + + + // Simple events + $input = 'BEGIN:VCALENDAR +CALSCALE:GREGORIAN +VERSION:2.0 +BEGIN:VEVENT +UID:bla +SUMMARY:InExpand +DTSTART;VALUE=DATE:20111202 +END:VEVENT +BEGIN:VEVENT +UID:bla2 +SUMMARY:NotInExpand +DTSTART;VALUE=DATE:20120101 +END:VEVENT +END:VCALENDAR +'; + + $output = 'BEGIN:VCALENDAR +CALSCALE:GREGORIAN +VERSION:2.0 +BEGIN:VEVENT +UID:bla +SUMMARY:InExpand +DTSTART;VALUE=DATE:20111202 +END:VEVENT +END:VCALENDAR +'; + + $tests[] = array($input, $output); + + // Removing timezone info + $input = 'BEGIN:VCALENDAR +CALSCALE:GREGORIAN +VERSION:2.0 +BEGIN:VTIMEZONE +TZID:Europe/Paris +END:VTIMEZONE +BEGIN:VEVENT +UID:bla4 +SUMMARY:RemoveTZ info +DTSTART;TZID=Europe/Paris:20111203T130102 +END:VEVENT +END:VCALENDAR +'; + + $output = 'BEGIN:VCALENDAR +CALSCALE:GREGORIAN +VERSION:2.0 +BEGIN:VEVENT +UID:bla4 +SUMMARY:RemoveTZ info +DTSTART;VALUE=DATE-TIME:20111203T120102Z +END:VEVENT +END:VCALENDAR +'; + + $tests[] = array($input, $output); + + // Recurrence rule + $input = 'BEGIN:VCALENDAR +CALSCALE:GREGORIAN +VERSION:2.0 +BEGIN:VEVENT +UID:bla6 +SUMMARY:Testing RRule +DTSTART:20111125T120000Z +DTEND:20111125T130000Z +RRULE:FREQ=WEEKLY +END:VEVENT +END:VCALENDAR +'; + + $output = 'BEGIN:VCALENDAR +CALSCALE:GREGORIAN +VERSION:2.0 +BEGIN:VEVENT +UID:bla6 +SUMMARY:Testing RRule +DTSTART;VALUE=DATE-TIME:20111202T120000Z +DTEND;VALUE=DATE-TIME:20111202T130000Z +RECURRENCE-ID:20111202T120000Z +END:VEVENT +BEGIN:VEVENT +UID:bla6 +SUMMARY:Testing RRule +DTSTART;VALUE=DATE-TIME:20111209T120000Z +DTEND;VALUE=DATE-TIME:20111209T130000Z +RECURRENCE-ID:20111209T120000Z +END:VEVENT +BEGIN:VEVENT +UID:bla6 +SUMMARY:Testing RRule +DTSTART;VALUE=DATE-TIME:20111216T120000Z +DTEND;VALUE=DATE-TIME:20111216T130000Z +RECURRENCE-ID:20111216T120000Z +END:VEVENT +BEGIN:VEVENT +UID:bla6 +SUMMARY:Testing RRule +DTSTART;VALUE=DATE-TIME:20111223T120000Z +DTEND;VALUE=DATE-TIME:20111223T130000Z +RECURRENCE-ID:20111223T120000Z +END:VEVENT +BEGIN:VEVENT +UID:bla6 +SUMMARY:Testing RRule +DTSTART;VALUE=DATE-TIME:20111230T120000Z +DTEND;VALUE=DATE-TIME:20111230T130000Z +RECURRENCE-ID:20111230T120000Z +END:VEVENT +END:VCALENDAR +'; + + // Recurrence rule + override + $input = 'BEGIN:VCALENDAR +CALSCALE:GREGORIAN +VERSION:2.0 +BEGIN:VEVENT +UID:bla6 +SUMMARY:Testing RRule2 +DTSTART:20111125T120000Z +DTEND:20111125T130000Z +RRULE:FREQ=WEEKLY +END:VEVENT +BEGIN:VEVENT +UID:bla6 +RECURRENCE-ID:20111209T120000Z +DTSTART:20111209T140000Z +DTEND:20111209T150000Z +SUMMARY:Override! +END:VEVENT +END:VCALENDAR +'; + + $output = 'BEGIN:VCALENDAR +CALSCALE:GREGORIAN +VERSION:2.0 +BEGIN:VEVENT +UID:bla6 +SUMMARY:Testing RRule2 +DTSTART;VALUE=DATE-TIME:20111202T120000Z +DTEND;VALUE=DATE-TIME:20111202T130000Z +RECURRENCE-ID:20111202T120000Z +END:VEVENT +BEGIN:VEVENT +UID:bla6 +RECURRENCE-ID:20111209T120000Z +DTSTART:20111209T140000Z +DTEND:20111209T150000Z +SUMMARY:Override! +END:VEVENT +BEGIN:VEVENT +UID:bla6 +SUMMARY:Testing RRule2 +DTSTART;VALUE=DATE-TIME:20111216T120000Z +DTEND;VALUE=DATE-TIME:20111216T130000Z +RECURRENCE-ID:20111216T120000Z +END:VEVENT +BEGIN:VEVENT +UID:bla6 +SUMMARY:Testing RRule2 +DTSTART;VALUE=DATE-TIME:20111223T120000Z +DTEND;VALUE=DATE-TIME:20111223T130000Z +RECURRENCE-ID:20111223T120000Z +END:VEVENT +BEGIN:VEVENT +UID:bla6 +SUMMARY:Testing RRule2 +DTSTART;VALUE=DATE-TIME:20111230T120000Z +DTEND;VALUE=DATE-TIME:20111230T130000Z +RECURRENCE-ID:20111230T120000Z +END:VEVENT +END:VCALENDAR +'; + + $tests[] = array($input, $output); + return $tests; + + } + + /** + * @expectedException LogicException + */ + public function testBrokenEventExpand() { + + $input = 'BEGIN:VCALENDAR +CALSCALE:GREGORIAN +VERSION:2.0 +BEGIN:VEVENT +RRULE:FREQ=WEEKLY +DTSTART;VALUE=DATE:20111202 +END:VEVENT +END:VCALENDAR +'; + $vcal = VObject\Reader::read($input); + $vcal->expand( + new \DateTime('2011-12-01'), + new \DateTime('2011-12-31') + ); + + } + +} diff --git a/dav/sabre-vobject/tests/Sabre/VObject/Component/VCardTest.php b/dav/sabre-vobject/tests/Sabre/VObject/Component/VCardTest.php new file mode 100644 index 00000000..584a007d --- /dev/null +++ b/dav/sabre-vobject/tests/Sabre/VObject/Component/VCardTest.php @@ -0,0 +1,100 @@ +validate(); + + $warnMsg = array(); + foreach($warnings as $warning) { + $warnMsg[] = $warning['message']; + } + + $this->assertEquals($expectedWarnings, $warnMsg); + + $vcard->validate(VObject\Component::REPAIR); + + $this->assertEquals( + $expectedRepairedOutput, + $vcard->serialize() + ); + + } + + public function validateData() { + + $tests = array(); + + // Correct + $tests[] = array( + "BEGIN:VCARD\r\nVERSION:4.0\r\nFN:John Doe\r\nEND:VCARD\r\n", + array(), + "BEGIN:VCARD\r\nVERSION:4.0\r\nFN:John Doe\r\nEND:VCARD\r\n", + ); + + // No VERSION + $tests[] = array( + "BEGIN:VCARD\r\nFN:John Doe\r\nEND:VCARD\r\n", + array( + 'The VERSION property must appear in the VCARD component exactly 1 time', + ), + "BEGIN:VCARD\r\nVERSION:4.0\r\nFN:John Doe\r\nEND:VCARD\r\n", + ); + + // Unknown version + $tests[] = array( + "BEGIN:VCARD\r\nVERSION:2.2\r\nFN:John Doe\r\nEND:VCARD\r\n", + array( + 'Only vcard version 4.0 (RFC6350), version 3.0 (RFC2426) or version 2.1 (icm-vcard-2.1) are supported.', + ), + "BEGIN:VCARD\r\nVERSION:4.0\r\nFN:John Doe\r\nEND:VCARD\r\n", + ); + + // No FN + $tests[] = array( + "BEGIN:VCARD\r\nVERSION:4.0\r\nEND:VCARD\r\n", + array( + 'The FN property must appear in the VCARD component exactly 1 time', + ), + "BEGIN:VCARD\r\nVERSION:4.0\r\nEND:VCARD\r\n", + ); + // No FN, N fallback + $tests[] = array( + "BEGIN:VCARD\r\nVERSION:4.0\r\nN:Doe;John;;;;;\r\nEND:VCARD\r\n", + array( + 'The FN property must appear in the VCARD component exactly 1 time', + ), + "BEGIN:VCARD\r\nVERSION:4.0\r\nN:Doe;John;;;;;\r\nFN:John Doe\r\nEND:VCARD\r\n", + ); + // No FN, N fallback, no first name + $tests[] = array( + "BEGIN:VCARD\r\nVERSION:4.0\r\nN:Doe;;;;;;\r\nEND:VCARD\r\n", + array( + 'The FN property must appear in the VCARD component exactly 1 time', + ), + "BEGIN:VCARD\r\nVERSION:4.0\r\nN:Doe;;;;;;\r\nFN:Doe\r\nEND:VCARD\r\n", + ); + + // No FN, ORG fallback + $tests[] = array( + "BEGIN:VCARD\r\nVERSION:4.0\r\nORG:Acme Co.\r\nEND:VCARD\r\n", + array( + 'The FN property must appear in the VCARD component exactly 1 time', + ), + "BEGIN:VCARD\r\nVERSION:4.0\r\nORG:Acme Co.\r\nFN:Acme Co.\r\nEND:VCARD\r\n", + ); + return $tests; + + } + +} diff --git a/dav/sabre-vobject/tests/Sabre/VObject/Component/VEventTest.php b/dav/sabre-vobject/tests/Sabre/VObject/Component/VEventTest.php new file mode 100644 index 00000000..616da4ac --- /dev/null +++ b/dav/sabre-vobject/tests/Sabre/VObject/Component/VEventTest.php @@ -0,0 +1,74 @@ +assertEquals($outcome, $vevent->isInTimeRange($start, $end)); + + } + + public function timeRangeTestData() { + + $tests = array(); + + $vevent = new VEvent('VEVENT'); + $vevent->DTSTART = '20111223T120000Z'; + $tests[] = array($vevent, new \DateTime('2011-01-01'), new \DateTime('2012-01-01'), true); + $tests[] = array($vevent, new \DateTime('2011-01-01'), new \DateTime('2011-11-01'), false); + + $vevent2 = clone $vevent; + $vevent2->DTEND = '20111225T120000Z'; + $tests[] = array($vevent2, new \DateTime('2011-01-01'), new \DateTime('2012-01-01'), true); + $tests[] = array($vevent2, new \DateTime('2011-01-01'), new \DateTime('2011-11-01'), false); + + $vevent3 = clone $vevent; + $vevent3->DURATION = 'P1D'; + $tests[] = array($vevent3, new \DateTime('2011-01-01'), new \DateTime('2012-01-01'), true); + $tests[] = array($vevent3, new \DateTime('2011-01-01'), new \DateTime('2011-11-01'), false); + + $vevent4 = clone $vevent; + $vevent4->DTSTART = '20111225'; + $vevent4->DTSTART['VALUE'] = 'DATE'; + $tests[] = array($vevent4, new \DateTime('2011-01-01'), new \DateTime('2012-01-01'), true); + $tests[] = array($vevent4, new \DateTime('2011-01-01'), new \DateTime('2011-11-01'), false); + // Event with no end date should be treated as lasting the entire day. + $tests[] = array($vevent4, new \DateTime('2011-12-25 16:00:00'), new \DateTime('2011-12-25 17:00:00'), true); + + + $vevent5 = clone $vevent; + $vevent5->DURATION = 'P1D'; + $vevent5->RRULE = 'FREQ=YEARLY'; + $tests[] = array($vevent5, new \DateTime('2011-01-01'), new \DateTime('2012-01-01'), true); + $tests[] = array($vevent5, new \DateTime('2011-01-01'), new \DateTime('2011-11-01'), false); + $tests[] = array($vevent5, new \DateTime('2013-12-01'), new \DateTime('2013-12-31'), true); + + $vevent6 = clone $vevent; + $vevent6->DTSTART = '20111225'; + $vevent6->DTSTART['VALUE'] = 'DATE'; + $vevent6->DTEND = '20111225'; + $vevent6->DTEND['VALUE'] = 'DATE'; + + $tests[] = array($vevent6, new \DateTime('2011-01-01'), new \DateTime('2012-01-01'), true); + $tests[] = array($vevent6, new \DateTime('2011-01-01'), new \DateTime('2011-11-01'), false); + + // Added this test to ensure that recurrence rules with no DTEND also + // get checked for the entire day. + $vevent7 = clone $vevent; + $vevent7->DTSTART = '20120101'; + $vevent7->DTSTART['VALUE'] = 'DATE'; + $vevent7->RRULE = 'FREQ=MONTHLY'; + $tests[] = array($vevent7, new \DateTime('2012-02-01 15:00:00'), new \DateTime('2012-02-02'), true); + return $tests; + + } + +} + diff --git a/dav/sabre-vobject/tests/Sabre/VObject/Component/VJournalTest.php b/dav/sabre-vobject/tests/Sabre/VObject/Component/VJournalTest.php new file mode 100644 index 00000000..46ecb992 --- /dev/null +++ b/dav/sabre-vobject/tests/Sabre/VObject/Component/VJournalTest.php @@ -0,0 +1,41 @@ +assertEquals($outcome, $vtodo->isInTimeRange($start, $end)); + + } + + public function timeRangeTestData() { + + $tests = array(); + + $vjournal = Component::create('VJOURNAL'); + $vjournal->DTSTART = '20111223T120000Z'; + $tests[] = array($vjournal, new \DateTime('2011-01-01'), new \DateTime('2012-01-01'), true); + $tests[] = array($vjournal, new \DateTime('2011-01-01'), new \DateTime('2011-11-01'), false); + + $vjournal2 = Component::create('VJOURNAL'); + $vjournal2->DTSTART = '20111223'; + $vjournal2->DTSTART['VALUE'] = 'DATE'; + $tests[] = array($vjournal2, new \DateTime('2011-01-01'), new \DateTime('2012-01-01'), true); + $tests[] = array($vjournal2, new \DateTime('2011-01-01'), new \DateTime('2011-11-01'), false); + + $vjournal3 = Component::create('VJOURNAL'); + $tests[] = array($vjournal3, new \DateTime('2011-01-01'), new \DateTime('2012-01-01'), false); + $tests[] = array($vjournal3, new \DateTime('2011-01-01'), new \DateTime('2011-11-01'), false); + + return $tests; + } + +} + diff --git a/dav/sabre-vobject/tests/Sabre/VObject/Component/VTodoTest.php b/dav/sabre-vobject/tests/Sabre/VObject/Component/VTodoTest.php new file mode 100644 index 00000000..a84da5cd --- /dev/null +++ b/dav/sabre-vobject/tests/Sabre/VObject/Component/VTodoTest.php @@ -0,0 +1,67 @@ +assertEquals($outcome, $vtodo->isInTimeRange($start, $end)); + + } + + public function timeRangeTestData() { + + $tests = array(); + + $vtodo = Component::create('VTODO'); + $vtodo->DTSTART = '20111223T120000Z'; + $tests[] = array($vtodo, new \DateTime('2011-01-01'), new \DateTime('2012-01-01'), true); + $tests[] = array($vtodo, new \DateTime('2011-01-01'), new \DateTime('2011-11-01'), false); + + $vtodo2 = clone $vtodo; + $vtodo2->DURATION = 'P1D'; + $tests[] = array($vtodo2, new \DateTime('2011-01-01'), new \DateTime('2012-01-01'), true); + $tests[] = array($vtodo2, new \DateTime('2011-01-01'), new \DateTime('2011-11-01'), false); + + $vtodo3 = clone $vtodo; + $vtodo3->DUE = '20111225'; + $tests[] = array($vtodo3, new \DateTime('2011-01-01'), new \DateTime('2012-01-01'), true); + $tests[] = array($vtodo3, new \DateTime('2011-01-01'), new \DateTime('2011-11-01'), false); + + $vtodo4 = Component::create('VTODO'); + $vtodo4->DUE = '20111225'; + $tests[] = array($vtodo4, new \DateTime('2011-01-01'), new \DateTime('2012-01-01'), true); + $tests[] = array($vtodo4, new \DateTime('2011-01-01'), new \DateTime('2011-11-01'), false); + + $vtodo5 = Component::create('VTODO'); + $vtodo5->COMPLETED = '20111225'; + $tests[] = array($vtodo5, new \DateTime('2011-01-01'), new \DateTime('2012-01-01'), true); + $tests[] = array($vtodo5, new \DateTime('2011-01-01'), new \DateTime('2011-11-01'), false); + + $vtodo6 = Component::create('VTODO'); + $vtodo6->CREATED = '20111225'; + $tests[] = array($vtodo6, new \DateTime('2011-01-01'), new \DateTime('2012-01-01'), true); + $tests[] = array($vtodo6, new \DateTime('2011-01-01'), new \DateTime('2011-11-01'), false); + + $vtodo7 = Component::create('VTODO'); + $vtodo7->CREATED = '20111225'; + $vtodo7->COMPLETED = '20111226'; + $tests[] = array($vtodo7, new \DateTime('2011-01-01'), new \DateTime('2012-01-01'), true); + $tests[] = array($vtodo7, new \DateTime('2011-01-01'), new \DateTime('2011-11-01'), false); + + $vtodo7 = Component::create('VTODO'); + $tests[] = array($vtodo7, new \DateTime('2011-01-01'), new \DateTime('2012-01-01'), true); + $tests[] = array($vtodo7, new \DateTime('2011-01-01'), new \DateTime('2011-11-01'), true); + + return $tests; + + } + +} + diff --git a/dav/sabre-vobject/tests/Sabre/VObject/ComponentTest.php b/dav/sabre-vobject/tests/Sabre/VObject/ComponentTest.php new file mode 100644 index 00000000..07000bda --- /dev/null +++ b/dav/sabre-vobject/tests/Sabre/VObject/ComponentTest.php @@ -0,0 +1,413 @@ +children[] = $sub; + + $sub = new Component('VTODO'); + $comp->children[] = $sub; + + $count = 0; + foreach($comp->children() as $key=>$subcomponent) { + + $count++; + $this->assertInstanceOf('Sabre\\VObject\\Component',$subcomponent); + + } + $this->assertEquals(2,$count); + $this->assertEquals(1,$key); + + } + + function testMagicGet() { + + $comp = new Component('VCALENDAR'); + + $sub = new Component('VEVENT'); + $comp->children[] = $sub; + + $sub = new Component('VTODO'); + $comp->children[] = $sub; + + $event = $comp->vevent; + $this->assertInstanceOf('Sabre\\VObject\\Component', $event); + $this->assertEquals('VEVENT', $event->name); + + $this->assertInternalType('null', $comp->vjournal); + + } + + function testMagicGetGroups() { + + $comp = new Component('VCARD'); + + $sub = new Property('GROUP1.EMAIL','1@1.com'); + $comp->children[] = $sub; + + $sub = new Property('GROUP2.EMAIL','2@2.com'); + $comp->children[] = $sub; + + $sub = new Property('EMAIL','3@3.com'); + $comp->children[] = $sub; + + $emails = $comp->email; + $this->assertEquals(3, count($emails)); + + $email1 = $comp->{"group1.email"}; + $this->assertEquals('EMAIL', $email1[0]->name); + $this->assertEquals('GROUP1', $email1[0]->group); + + $email3 = $comp->{".email"}; + $this->assertEquals('EMAIL', $email3[0]->name); + $this->assertEquals(null, $email3[0]->group); + + } + + function testMagicIsset() { + + $comp = new Component('VCALENDAR'); + + $sub = new Component('VEVENT'); + $comp->children[] = $sub; + + $sub = new Component('VTODO'); + $comp->children[] = $sub; + + $this->assertTrue(isset($comp->vevent)); + $this->assertTrue(isset($comp->vtodo)); + $this->assertFalse(isset($comp->vjournal)); + + } + + function testMagicSetScalar() { + + $comp = new Component('VCALENDAR'); + $comp->myProp = 'myValue'; + + $this->assertInstanceOf('Sabre\\VObject\\Property',$comp->MYPROP); + $this->assertEquals('myValue',$comp->MYPROP->value); + + + } + + function testMagicSetScalarTwice() { + + $comp = new Component('VCALENDAR'); + $comp->myProp = 'myValue'; + $comp->myProp = 'myValue'; + + $this->assertEquals(1,count($comp->children)); + $this->assertInstanceOf('Sabre\\VObject\\Property',$comp->MYPROP); + $this->assertEquals('myValue',$comp->MYPROP->value); + + } + + function testMagicSetComponent() { + + $comp = new Component('VCALENDAR'); + + // Note that 'myProp' is ignored here. + $comp->myProp = new Component('VEVENT'); + + $this->assertEquals(1, count($comp->children)); + + $this->assertEquals('VEVENT',$comp->VEVENT->name); + + } + + function testMagicSetTwice() { + + $comp = new Component('VCALENDAR'); + + $comp->VEVENT = new Component('VEVENT'); + $comp->VEVENT = new Component('VEVENT'); + + $this->assertEquals(1, count($comp->children)); + + $this->assertEquals('VEVENT',$comp->VEVENT->name); + + } + + function testArrayAccessGet() { + + $comp = new Component('VCALENDAR'); + + $event = new Component('VEVENT'); + $event->summary = 'Event 1'; + + $comp->add($event); + + $event2 = clone $event; + $event2->summary = 'Event 2'; + + $comp->add($event2); + + $this->assertEquals(2,count($comp->children())); + $this->assertTrue($comp->vevent[1] instanceof Component); + $this->assertEquals('Event 2', (string)$comp->vevent[1]->summary); + + } + + function testArrayAccessExists() { + + $comp = new Component('VCALENDAR'); + + $event = new Component('VEVENT'); + $event->summary = 'Event 1'; + + $comp->add($event); + + $event2 = clone $event; + $event2->summary = 'Event 2'; + + $comp->add($event2); + + $this->assertTrue(isset($comp->vevent[0])); + $this->assertTrue(isset($comp->vevent[1])); + + } + + /** + * @expectedException LogicException + */ + function testArrayAccessSet() { + + $comp = new Component('VCALENDAR'); + $comp['hey'] = 'hi there'; + + } + /** + * @expectedException LogicException + */ + function testArrayAccessUnset() { + + $comp = new Component('VCALENDAR'); + unset($comp[0]); + + } + + function testAddScalar() { + + $comp = new Component('VCALENDAR'); + + $comp->add('myprop','value'); + + $this->assertEquals(1, count($comp->children)); + + $this->assertTrue($comp->children[0] instanceof Property); + $this->assertEquals('MYPROP',$comp->children[0]->name); + $this->assertEquals('value',$comp->children[0]->value); + + } + + function testAddScalarParams() { + + $comp = Component::create('VCALENDAR'); + + $comp->add('myprop','value',array('param1'=>'value1')); + + $this->assertEquals(1, count($comp->children)); + + $this->assertTrue($comp->children[0] instanceof Property); + $this->assertEquals('MYPROP',$comp->children[0]->name); + $this->assertEquals('value',$comp->children[0]->value); + + $this->assertEquals(1, count($comp->children[0]->parameters)); + + $this->assertTrue($comp->children[0]->parameters[0] instanceof Parameter); + $this->assertEquals('PARAM1',$comp->children[0]->parameters[0]->name); + $this->assertEquals('value1',$comp->children[0]->parameters[0]->value); + + } + + + function testAddComponent() { + + $comp = new Component('VCALENDAR'); + + $comp->add(new Component('VEVENT')); + + $this->assertEquals(1, count($comp->children)); + + $this->assertEquals('VEVENT',$comp->VEVENT->name); + + } + + function testAddComponentTwice() { + + $comp = new Component('VCALENDAR'); + + $comp->add(new Component('VEVENT')); + $comp->add(new Component('VEVENT')); + + $this->assertEquals(2, count($comp->children)); + + $this->assertEquals('VEVENT',$comp->VEVENT->name); + + } + + /** + * @expectedException InvalidArgumentException + */ + function testAddArgFail() { + + $comp = new Component('VCALENDAR'); + $comp->add(new Component('VEVENT'),'hello'); + + } + + /** + * @expectedException InvalidArgumentException + */ + function testAddArgFail2() { + + $comp = new Component('VCALENDAR'); + $comp->add(array()); + + } + + /** + * @expectedException InvalidArgumentException + */ + function testAddArgFail3() { + + $comp = new Component('VCALENDAR'); + $comp->add('hello',array()); + + } + + /** + * @expectedException InvalidArgumentException + */ + function testMagicSetInvalid() { + + $comp = new Component('VCALENDAR'); + + // Note that 'myProp' is ignored here. + $comp->myProp = new \StdClass(); + + $this->assertEquals(1, count($comp->children)); + + $this->assertEquals('VEVENT',$comp->VEVENT->name); + + } + + function testMagicUnset() { + + $comp = new Component('VCALENDAR'); + $comp->add(new Component('VEVENT')); + + unset($comp->vevent); + + $this->assertEquals(array(), $comp->children); + + } + + + function testCount() { + + $comp = new Component('VCALENDAR'); + $this->assertEquals(1,$comp->count()); + + } + + function testChildren() { + + $comp = new Component('VCALENDAR'); + + // Note that 'myProp' is ignored here. + $comp->children = array( + new Component('VEVENT'), + new Component('VTODO') + ); + + $r = $comp->children(); + $this->assertTrue($r instanceof ElementList); + $this->assertEquals(2,count($r)); + } + + function testGetComponents() { + + $comp = new Component('VCALENDAR'); + + // Note that 'myProp' is ignored here. + $comp->children = array( + new Property('FOO','BAR'), + new Component('VTODO') + ); + + $r = $comp->getComponents(); + $this->assertInternalType('array', $r); + $this->assertEquals(1, count($r)); + $this->assertEquals('VTODO', $r[0]->name); + } + + function testSerialize() { + + $comp = new Component('VCALENDAR'); + $this->assertEquals("BEGIN:VCALENDAR\r\nEND:VCALENDAR\r\n", $comp->serialize()); + + } + + function testSerializeChildren() { + + $comp = new Component('VCALENDAR'); + $comp->children = array( + new Component('VEVENT'), + new Component('VTODO') + ); + + $str = $comp->serialize(); + + $this->assertEquals("BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nEND:VEVENT\r\nBEGIN:VTODO\r\nEND:VTODO\r\nEND:VCALENDAR\r\n", $str); + + } + + function testSerializeOrderCompAndProp() { + + $comp = new Component('VCALENDAR'); + $comp->add(new Component('VEVENT')); + $comp->add('PROP1','BLABLA'); + $comp->add('VERSION','2.0'); + $comp->add(new Component('VTIMEZONE')); + + $str = $comp->serialize(); + + $this->assertEquals("BEGIN:VCALENDAR\r\nVERSION:2.0\r\nPROP1:BLABLA\r\nBEGIN:VTIMEZONE\r\nEND:VTIMEZONE\r\nBEGIN:VEVENT\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n", $str); + + } + + function testAnotherSerializeOrderProp() { + + $prop4s=array('1', '2', '3', '4', '5', '6', '7', '8', '9', '10'); + + $comp = new Component('VCARD'); + $comp->__set('SOMEPROP','FOO'); + $comp->__set('ANOTHERPROP','FOO'); + $comp->__set('THIRDPROP','FOO'); + foreach ($prop4s as $prop4) { + $comp->add('PROP4', 'FOO '.$prop4); + } + $comp->__set('PROPNUMBERFIVE', 'FOO'); + $comp->__set('PROPNUMBERSIX', 'FOO'); + $comp->__set('PROPNUMBERSEVEN', 'FOO'); + $comp->__set('PROPNUMBEREIGHT', 'FOO'); + $comp->__set('PROPNUMBERNINE', 'FOO'); + $comp->__set('PROPNUMBERTEN', 'FOO'); + $comp->__set('VERSION','2.0'); + $comp->__set('UID', 'FOO'); + + $str = $comp->serialize(); + + $this->assertEquals("BEGIN:VCARD\r\nVERSION:2.0\r\nSOMEPROP:FOO\r\nANOTHERPROP:FOO\r\nTHIRDPROP:FOO\r\nPROP4:FOO 1\r\nPROP4:FOO 2\r\nPROP4:FOO 3\r\nPROP4:FOO 4\r\nPROP4:FOO 5\r\nPROP4:FOO 6\r\nPROP4:FOO 7\r\nPROP4:FOO 8\r\nPROP4:FOO 9\r\nPROP4:FOO 10\r\nPROPNUMBERFIVE:FOO\r\nPROPNUMBERSIX:FOO\r\nPROPNUMBERSEVEN:FOO\r\nPROPNUMBEREIGHT:FOO\r\nPROPNUMBERNINE:FOO\r\nPROPNUMBERTEN:FOO\r\nUID:FOO\r\nEND:VCARD\r\n", $str); + + } + +} diff --git a/dav/sabre-vobject/tests/Sabre/VObject/DateTimeParserTest.php b/dav/sabre-vobject/tests/Sabre/VObject/DateTimeParserTest.php new file mode 100644 index 00000000..463e7bcc --- /dev/null +++ b/dav/sabre-vobject/tests/Sabre/VObject/DateTimeParserTest.php @@ -0,0 +1,121 @@ +assertEquals('+1 weeks', DateTimeParser::parseDuration('P1W',true)); + $this->assertEquals('+5 days', DateTimeParser::parseDuration('P5D',true)); + $this->assertEquals('+5 days 3 hours 50 minutes 12 seconds', DateTimeParser::parseDuration('P5DT3H50M12S',true)); + $this->assertEquals('-1 weeks 50 minutes', DateTimeParser::parseDuration('-P1WT50M',true)); + $this->assertEquals('+50 days 3 hours 2 seconds', DateTimeParser::parseDuration('+P50DT3H2S',true)); + $this->assertEquals(new DateInterval('PT0S'), DateTimeParser::parseDuration('PT0S')); + + } + + function testParseICalendarDurationDateInterval() { + + $expected = new DateInterval('P7D'); + $this->assertEquals($expected, DateTimeParser::parseDuration('P1W')); + $this->assertEquals($expected, DateTimeParser::parse('P1W')); + + $expected = new DateInterval('PT3M'); + $expected->invert = true; + $this->assertEquals($expected, DateTimeParser::parseDuration('-PT3M')); + + } + + /** + * @expectedException LogicException + */ + function testParseICalendarDurationFail() { + + DateTimeParser::parseDuration('P1X',true); + + } + + function testParseICalendarDateTime() { + + $dateTime = DateTimeParser::parseDateTime('20100316T141405'); + + $compare = new DateTime('2010-03-16 14:14:05',new DateTimeZone('UTC')); + + $this->assertEquals($compare, $dateTime); + + } + + /** + * @depends testParseICalendarDateTime + * @expectedException LogicException + */ + function testParseICalendarDateTimeBadFormat() { + + $dateTime = DateTimeParser::parseDateTime('20100316T141405 '); + + } + + /** + * @depends testParseICalendarDateTime + */ + function testParseICalendarDateTimeUTC() { + + $dateTime = DateTimeParser::parseDateTime('20100316T141405Z'); + + $compare = new DateTime('2010-03-16 14:14:05',new DateTimeZone('UTC')); + $this->assertEquals($compare, $dateTime); + + } + + /** + * @depends testParseICalendarDateTime + */ + function testParseICalendarDateTimeUTC2() { + + $dateTime = DateTimeParser::parseDateTime('20101211T160000Z'); + + $compare = new DateTime('2010-12-11 16:00:00',new DateTimeZone('UTC')); + $this->assertEquals($compare, $dateTime); + + } + + /** + * @depends testParseICalendarDateTime + */ + function testParseICalendarDateTimeCustomTimeZone() { + + $dateTime = DateTimeParser::parseDateTime('20100316T141405', new DateTimeZone('Europe/Amsterdam')); + + $compare = new DateTime('2010-03-16 13:14:05',new DateTimeZone('UTC')); + $this->assertEquals($compare, $dateTime); + + } + + function testParseICalendarDate() { + + $dateTime = DateTimeParser::parseDate('20100316'); + + $expected = new DateTime('2010-03-16 00:00:00',new DateTimeZone('UTC')); + + $this->assertEquals($expected, $dateTime); + + $dateTime = DateTimeParser::parse('20100316'); + $this->assertEquals($expected, $dateTime); + + } + + /** + * @depends testParseICalendarDate + * @expectedException LogicException + */ + function testParseICalendarDateBadFormat() { + + $dateTime = DateTimeParser::parseDate('20100316T141405'); + + } +} diff --git a/dav/sabre-vobject/tests/Sabre/VObject/ElementListTest.php b/dav/sabre-vobject/tests/Sabre/VObject/ElementListTest.php new file mode 100644 index 00000000..84e1bcbe --- /dev/null +++ b/dav/sabre-vobject/tests/Sabre/VObject/ElementListTest.php @@ -0,0 +1,32 @@ +$subcomponent) { + + $count++; + $this->assertInstanceOf('Sabre\\VObject\\Component',$subcomponent); + + } + $this->assertEquals(3,$count); + $this->assertEquals(2,$key); + + } + + +} diff --git a/dav/sabre-vobject/tests/Sabre/VObject/EmClientTest.php b/dav/sabre-vobject/tests/Sabre/VObject/EmClientTest.php new file mode 100644 index 00000000..69d410fe --- /dev/null +++ b/dav/sabre-vobject/tests/Sabre/VObject/EmClientTest.php @@ -0,0 +1,55 @@ +VEVENT->DTSTART->getDateTime(); + $this->assertEquals(new \DateTime('2011-10-08 19:30:00', new \DateTimeZone('America/Chicago')), $dt); + + } + +} + diff --git a/dav/sabre-vobject/tests/Sabre/VObject/FreeBusyGeneratorTest.php b/dav/sabre-vobject/tests/Sabre/VObject/FreeBusyGeneratorTest.php new file mode 100644 index 00000000..1f79e0a4 --- /dev/null +++ b/dav/sabre-vobject/tests/Sabre/VObject/FreeBusyGeneratorTest.php @@ -0,0 +1,246 @@ +getInput() + ); + + $result = $gen->getResult(); + + $expected = array( + '20110101T120000Z/20110101T130000Z', + '20110101T130000Z/20110101T140000Z', + '20110101T180000Z/20110101T190000Z', + '20110101T190000Z/20110101T200000Z', + '20110102T000000Z/20110103T000000Z', + '20110101T210000Z/20110101T220000Z', + + '20110103T010000Z/20110103T020000Z', + '20110103T030000Z/20110103T040000Z', + '20110103T040000Z/20110103T050000Z', + '20110103T050000Z/20110103T060000Z', + + '20110101T220000Z/20110101T230000Z', + '20110101T230000Z/20110102T000000Z', + ); + + foreach($result->VFREEBUSY->FREEBUSY as $fb) { + + $this->assertContains((string)$fb, $expected); + + $k = array_search((string)$fb, $expected); + unset($expected[$k]); + + } + if (count($expected)>0) { + $this->fail('There were elements in the expected array that were not found in the output: ' . "\n" . print_r($expected,true) . "\n" . $result->serialize()); + + } + + } + + function testGeneratorBaseObject() { + + $obj = new Component('VCALENDAR'); + $obj->METHOD = 'PUBLISH'; + + $gen = new FreeBusyGenerator(); + $gen->setObjects(array()); + $gen->setBaseObject($obj); + + $result = $gen->getResult(); + + $this->assertEquals('PUBLISH', $result->METHOD->value); + + } + + /** + * @expectedException InvalidArgumentException + */ + function testInvalidArg() { + + $gen = new FreeBusyGenerator( + new \DateTime('2012-01-01'), + new \DateTime('2012-12-31'), + new \StdClass() + ); + + } + +} diff --git a/dav/sabre-vobject/tests/Sabre/VObject/Issue153Test.php b/dav/sabre-vobject/tests/Sabre/VObject/Issue153Test.php new file mode 100644 index 00000000..1cc14c16 --- /dev/null +++ b/dav/sabre-vobject/tests/Sabre/VObject/Issue153Test.php @@ -0,0 +1,14 @@ +assertEquals('Test Benutzer', (string)$obj->fn); + + } + +} diff --git a/dav/sabre-vobject/tests/Sabre/VObject/Issue154Test.php b/dav/sabre-vobject/tests/Sabre/VObject/Issue154Test.php new file mode 100644 index 00000000..ed9c7c3f --- /dev/null +++ b/dav/sabre-vobject/tests/Sabre/VObject/Issue154Test.php @@ -0,0 +1,29 @@ +VERSION = '3.0'; + $vcard->PHOTO = base64_encode('random_stuff'); + $vcard->PHOTO->add('BASE64',null); + $vcard->UID = 'foo-bar'; + + $result = $vcard->serialize(); + $expected = array( + "BEGIN:VCARD", + "VERSION:3.0", + "PHOTO;BASE64:" . base64_encode('random_stuff'), + "UID:foo-bar", + "END:VCARD", + "", + ); + + $this->assertEquals(implode("\r\n", $expected), $result); + + } + +} diff --git a/dav/sabre-vobject/tests/Sabre/VObject/ParameterTest.php b/dav/sabre-vobject/tests/Sabre/VObject/ParameterTest.php new file mode 100644 index 00000000..15083045 --- /dev/null +++ b/dav/sabre-vobject/tests/Sabre/VObject/ParameterTest.php @@ -0,0 +1,23 @@ +assertEquals('NAME',$param->name); + $this->assertEquals('value',$param->value); + + } + + function testCastToString() { + + $param = new Parameter('name','value'); + $this->assertEquals('value',$param->__toString()); + $this->assertEquals('value',(string)$param); + + } + +} diff --git a/dav/sabre-vobject/tests/Sabre/VObject/Property/DateTimeTest.php b/dav/sabre-vobject/tests/Sabre/VObject/Property/DateTimeTest.php new file mode 100644 index 00000000..9dc7e861 --- /dev/null +++ b/dav/sabre-vobject/tests/Sabre/VObject/Property/DateTimeTest.php @@ -0,0 +1,234 @@ +setTimeZone($tz); + + $elem = new DateTime('DTSTART'); + $elem->setDateTime($dt); + + $this->assertEquals('19850704T013000', $elem->value); + $this->assertEquals('Europe/Amsterdam', (string)$elem['TZID']); + $this->assertEquals('DATE-TIME', (string)$elem['VALUE']); + + } + + function testSetDateTimeLOCAL() { + + $tz = new \DateTimeZone('Europe/Amsterdam'); + $dt = new \DateTime('1985-07-04 01:30:00', $tz); + $dt->setTimeZone($tz); + + $elem = new DateTime('DTSTART'); + $elem->setDateTime($dt, DateTime::LOCAL); + + $this->assertEquals('19850704T013000', $elem->value); + $this->assertNull($elem['TZID']); + $this->assertEquals('DATE-TIME', (string)$elem['VALUE']); + + } + + function testSetDateTimeUTC() { + + $tz = new \DateTimeZone('GMT'); + $dt = new \DateTime('1985-07-04 01:30:00', $tz); + $dt->setTimeZone($tz); + + $elem = new DateTime('DTSTART'); + $elem->setDateTime($dt, DateTime::UTC); + + $this->assertEquals('19850704T013000Z', $elem->value); + $this->assertNull($elem['TZID']); + $this->assertEquals('DATE-TIME', (string)$elem['VALUE']); + + } + + function testSetDateTimeLOCALTZ() { + + $tz = new \DateTimeZone('Europe/Amsterdam'); + $dt = new \DateTime('1985-07-04 01:30:00', $tz); + $dt->setTimeZone($tz); + + $elem = new DateTime('DTSTART'); + $elem->setDateTime($dt, DateTime::LOCALTZ); + + $this->assertEquals('19850704T013000', $elem->value); + $this->assertEquals('Europe/Amsterdam', (string)$elem['TZID']); + $this->assertEquals('DATE-TIME', (string)$elem['VALUE']); + + } + + function testSetDateTimeDATE() { + + $tz = new \DateTimeZone('Europe/Amsterdam'); + $dt = new \DateTime('1985-07-04 01:30:00', $tz); + $dt->setTimeZone($tz); + + $elem = new DateTime('DTSTART'); + $elem->setDateTime($dt, DateTime::DATE); + + $this->assertEquals('19850704', $elem->value); + $this->assertNull($elem['TZID']); + $this->assertEquals('DATE', (string)$elem['VALUE']); + + } + + /** + * @expectedException InvalidArgumentException + */ + function testSetDateTimeInvalid() { + + $tz = new \DateTimeZone('Europe/Amsterdam'); + $dt = new \DateTime('1985-07-04 01:30:00', $tz); + $dt->setTimeZone($tz); + + $elem = new DateTime('DTSTART'); + $elem->setDateTime($dt, 7); + + } + + function testGetDateTimeCached() { + + $tz = new \DateTimeZone('Europe/Amsterdam'); + $dt = new \DateTime('1985-07-04 01:30:00', $tz); + $dt->setTimeZone($tz); + + $elem = new DateTime('DTSTART'); + $elem->setDateTime($dt); + + $this->assertEquals($elem->getDateTime(), $dt); + + } + + function testGetDateTimeDateNULL() { + + $elem = new DateTime('DTSTART'); + $dt = $elem->getDateTime(); + + $this->assertNull($dt); + $this->assertNull($elem->getDateType()); + + } + + function testGetDateTimeDateDATE() { + + $elem = new DateTime('DTSTART','19850704'); + $dt = $elem->getDateTime(); + + $this->assertInstanceOf('DateTime', $dt); + $this->assertEquals('1985-07-04 00:00:00', $dt->format('Y-m-d H:i:s')); + $this->assertEquals(DateTime::DATE, $elem->getDateType()); + + } + + + function testGetDateTimeDateLOCAL() { + + $elem = new DateTime('DTSTART','19850704T013000'); + $dt = $elem->getDateTime(); + + $this->assertInstanceOf('DateTime', $dt); + $this->assertEquals('1985-07-04 01:30:00', $dt->format('Y-m-d H:i:s')); + $this->assertEquals(DateTime::LOCAL, $elem->getDateType()); + + } + + function testGetDateTimeDateUTC() { + + $elem = new DateTime('DTSTART','19850704T013000Z'); + $dt = $elem->getDateTime(); + + $this->assertInstanceOf('DateTime', $dt); + $this->assertEquals('1985-07-04 01:30:00', $dt->format('Y-m-d H:i:s')); + $this->assertEquals('UTC', $dt->getTimeZone()->getName()); + $this->assertEquals(DateTime::UTC, $elem->getDateType()); + + } + + function testGetDateTimeDateLOCALTZ() { + + $elem = new DateTime('DTSTART','19850704T013000'); + $elem['TZID'] = 'Europe/Amsterdam'; + + $dt = $elem->getDateTime(); + + $this->assertInstanceOf('DateTime', $dt); + $this->assertEquals('1985-07-04 01:30:00', $dt->format('Y-m-d H:i:s')); + $this->assertEquals('Europe/Amsterdam', $dt->getTimeZone()->getName()); + $this->assertEquals(DateTime::LOCALTZ, $elem->getDateType()); + + } + + /** + * @expectedException InvalidArgumentException + */ + function testGetDateTimeDateInvalid() { + + $elem = new DateTime('DTSTART','bla'); + $dt = $elem->getDateTime(); + + } + + function testGetDateTimeWeirdTZ() { + + $elem = new DateTime('DTSTART','19850704T013000'); + $elem['TZID'] = '/freeassociation.sourceforge.net/Tzfile/Europe/Amsterdam'; + + + $event = new Component('VEVENT'); + $event->add($elem); + + $timezone = new Component('VTIMEZONE'); + $timezone->TZID = '/freeassociation.sourceforge.net/Tzfile/Europe/Amsterdam'; + $timezone->{'X-LIC-LOCATION'} = 'Europe/Amsterdam'; + + $calendar = new Component('VCALENDAR'); + $calendar->add($event); + $calendar->add($timezone); + + $dt = $elem->getDateTime(); + + $this->assertInstanceOf('DateTime', $dt); + $this->assertEquals('1985-07-04 01:30:00', $dt->format('Y-m-d H:i:s')); + $this->assertEquals('Europe/Amsterdam', $dt->getTimeZone()->getName()); + $this->assertEquals(DateTime::LOCALTZ, $elem->getDateType()); + + } + + function testGetDateTimeBadTimeZone() { + + $default = date_default_timezone_get(); + date_default_timezone_set('Canada/Eastern'); + + $elem = new DateTime('DTSTART','19850704T013000'); + $elem['TZID'] = 'Moon'; + + + $event = new Component('VEVENT'); + $event->add($elem); + + $timezone = new Component('VTIMEZONE'); + $timezone->TZID = 'Moon'; + $timezone->{'X-LIC-LOCATION'} = 'Moon'; + + $calendar = new Component('VCALENDAR'); + $calendar->add($event); + $calendar->add($timezone); + + $dt = $elem->getDateTime(); + + $this->assertInstanceOf('DateTime', $dt); + $this->assertEquals('1985-07-04 01:30:00', $dt->format('Y-m-d H:i:s')); + $this->assertEquals('Canada/Eastern', $dt->getTimeZone()->getName()); + $this->assertEquals(DateTime::LOCALTZ, $elem->getDateType()); + date_default_timezone_set($default); + + } +} diff --git a/dav/sabre-vobject/tests/Sabre/VObject/Property/MultiDateTimeTest.php b/dav/sabre-vobject/tests/Sabre/VObject/Property/MultiDateTimeTest.php new file mode 100644 index 00000000..eae3e2bb --- /dev/null +++ b/dav/sabre-vobject/tests/Sabre/VObject/Property/MultiDateTimeTest.php @@ -0,0 +1,202 @@ +setTimeZone($tz); + $dt2->setTimeZone($tz); + + $elem = new MultiDateTime('DTSTART'); + $elem->setDateTimes(array($dt1,$dt2)); + + $this->assertEquals('19850704T013000,19860704T013000', $elem->value); + $this->assertEquals('Europe/Amsterdam', (string)$elem['TZID']); + $this->assertEquals('DATE-TIME', (string)$elem['VALUE']); + + } + + function testSetDateTimeLOCAL() { + + $tz = new \DateTimeZone('Europe/Amsterdam'); + $dt1 = new \DateTime('1985-07-04 01:30:00', $tz); + $dt2 = new \DateTime('1986-07-04 01:30:00', $tz); + $dt1->setTimeZone($tz); + $dt2->setTimeZone($tz); + + $elem = new MultiDateTime('DTSTART'); + $elem->setDateTimes(array($dt1,$dt2), DateTime::LOCAL); + + $this->assertEquals('19850704T013000,19860704T013000', $elem->value); + $this->assertNull($elem['TZID']); + $this->assertEquals('DATE-TIME', (string)$elem['VALUE']); + + } + + function testSetDateTimeUTC() { + + $tz = new \DateTimeZone('GMT'); + $dt1 = new \DateTime('1985-07-04 01:30:00', $tz); + $dt2 = new \DateTime('1986-07-04 01:30:00', $tz); + $dt1->setTimeZone($tz); + $dt2->setTimeZone($tz); + + $elem = new MultiDateTime('DTSTART'); + $elem->setDateTimes(array($dt1,$dt2), DateTime::UTC); + + $this->assertEquals('19850704T013000Z,19860704T013000Z', $elem->value); + $this->assertNull($elem['TZID']); + $this->assertEquals('DATE-TIME', (string)$elem['VALUE']); + + } + + function testSetDateTimeLOCALTZ() { + + $tz = new \DateTimeZone('Europe/Amsterdam'); + $dt1 = new \DateTime('1985-07-04 01:30:00', $tz); + $dt2 = new \DateTime('1986-07-04 01:30:00', $tz); + $dt1->setTimeZone($tz); + $dt2->setTimeZone($tz); + + $elem = new MultiDateTime('DTSTART'); + $elem->setDateTimes(array($dt1,$dt2), DateTime::LOCALTZ); + + $this->assertEquals('19850704T013000,19860704T013000', $elem->value); + $this->assertEquals('Europe/Amsterdam', (string)$elem['TZID']); + $this->assertEquals('DATE-TIME', (string)$elem['VALUE']); + + } + + function testSetDateTimeDATE() { + + $tz = new \DateTimeZone('Europe/Amsterdam'); + $dt1 = new \DateTime('1985-07-04 01:30:00', $tz); + $dt2 = new \DateTime('1986-07-04 01:30:00', $tz); + $dt1->settimezone($tz); + $dt2->settimezone($tz); + + $elem = new MultiDateTime('DTSTART'); + $elem->setDateTimes(array($dt1,$dt2), DateTime::DATE); + + $this->assertEquals('19850704,19860704', $elem->value); + $this->assertNull($elem['TZID']); + $this->assertEquals('DATE', (string)$elem['VALUE']); + + } + + /** + * @expectedException InvalidArgumentException + */ + function testSetDateTimeInvalid() { + + $tz = new \DateTimeZone('Europe/Amsterdam'); + $dt = new \DateTime('1985-07-04 01:30:00', $tz); + $dt->setTimeZone($tz); + + $elem = new MultiDateTime('DTSTART'); + $elem->setDateTimes(array($dt), 7); + + } + + function testGetDateTimeCached() { + + $tz = new \DateTimeZone('Europe/Amsterdam'); + $dt1 = new \DateTime('1985-07-04 01:30:00', $tz); + $dt2 = new \DateTime('1986-07-04 01:30:00', $tz); + $dt1->settimezone($tz); + $dt2->settimezone($tz); + + $elem = new MultiDateTime('DTSTART'); + $elem->setDateTimes(array($dt1,$dt2)); + + $this->assertEquals($elem->getDateTimes(), array($dt1,$dt2)); + + } + + function testGetDateTimeDateNULL() { + + $elem = new MultiDateTime('DTSTART'); + $dt = $elem->getDateTimes(); + + $this->assertNull($dt); + $this->assertNull($elem->getDateType()); + + } + + function testGetDateTimeDateDATE() { + + $elem = new MultiDateTime('DTSTART','19850704,19860704'); + $dt = $elem->getDateTimes(); + + $this->assertEquals('1985-07-04 00:00:00', $dt[0]->format('Y-m-d H:i:s')); + $this->assertEquals('1986-07-04 00:00:00', $dt[1]->format('Y-m-d H:i:s')); + $this->assertEquals(DateTime::DATE, $elem->getDateType()); + + } + + function testGetDateTimeDateDATEReverse() { + + $elem = new MultiDateTime('DTSTART','19850704,19860704'); + + $this->assertEquals(DateTime::DATE, $elem->getDateType()); + + $dt = $elem->getDateTimes(); + $this->assertEquals('1985-07-04 00:00:00', $dt[0]->format('Y-m-d H:i:s')); + $this->assertEquals('1986-07-04 00:00:00', $dt[1]->format('Y-m-d H:i:s')); + + } + + + function testGetDateTimeDateLOCAL() { + + $elem = new DateTime('DTSTART','19850704T013000'); + $dt = $elem->getDateTime(); + + $this->assertInstanceOf('DateTime', $dt); + $this->assertEquals('1985-07-04 01:30:00', $dt->format('Y-m-d H:i:s')); + $this->assertEquals(DateTime::LOCAL, $elem->getDateType()); + + } + + function testGetDateTimeDateUTC() { + + $elem = new DateTime('DTSTART','19850704T013000Z'); + $dt = $elem->getDateTime(); + + $this->assertInstanceOf('DateTime', $dt); + $this->assertEquals('1985-07-04 01:30:00', $dt->format('Y-m-d H:i:s')); + $this->assertEquals('UTC', $dt->getTimeZone()->getName()); + $this->assertEquals(DateTime::UTC, $elem->getDateType()); + + } + + function testGetDateTimeDateLOCALTZ() { + + $elem = new DateTime('DTSTART','19850704T013000'); + $elem['TZID'] = 'Europe/Amsterdam'; + + $dt = $elem->getDateTime(); + + $this->assertInstanceOf('DateTime', $dt); + $this->assertEquals('1985-07-04 01:30:00', $dt->format('Y-m-d H:i:s')); + $this->assertEquals('Europe/Amsterdam', $dt->getTimeZone()->getName()); + $this->assertEquals(DateTime::LOCALTZ, $elem->getDateType()); + + } + + /** + * @expectedException InvalidArgumentException + */ + function testGetDateTimeDateInvalid() { + + $elem = new DateTime('DTSTART','bla'); + $dt = $elem->getDateTime(); + + } + +} diff --git a/dav/sabre-vobject/tests/Sabre/VObject/PropertyTest.php b/dav/sabre-vobject/tests/Sabre/VObject/PropertyTest.php new file mode 100644 index 00000000..201646bb --- /dev/null +++ b/dav/sabre-vobject/tests/Sabre/VObject/PropertyTest.php @@ -0,0 +1,293 @@ +assertEquals('PROPNAME', $property->name); + $this->assertEquals('propvalue', $property->value); + $this->assertEquals('propvalue', $property->__toString()); + $this->assertEquals('propvalue', (string)$property); + + } + + public function testParameterExists() { + + $property = new Property('propname','propvalue'); + $property->parameters[] = new Parameter('paramname','paramvalue'); + + $this->assertTrue(isset($property['PARAMNAME'])); + $this->assertTrue(isset($property['paramname'])); + $this->assertFalse(isset($property['foo'])); + + } + + public function testParameterGet() { + + $property = new Property('propname','propvalue'); + $property->parameters[] = new Parameter('paramname','paramvalue'); + + $this->assertInstanceOf('Sabre\\VObject\\Parameter',$property['paramname']); + + } + + public function testParameterNotExists() { + + $property = new Property('propname','propvalue'); + $property->parameters[] = new Parameter('paramname','paramvalue'); + + $this->assertInternalType('null',$property['foo']); + + } + + public function testParameterMultiple() { + + $property = new Property('propname','propvalue'); + $property->parameters[] = new Parameter('paramname','paramvalue'); + $property->parameters[] = new Parameter('paramname','paramvalue'); + + $this->assertInstanceOf('Sabre\\VObject\\Parameter',$property['paramname']); + $this->assertEquals(2,count($property['paramname'])); + + } + + public function testSetParameterAsString() { + + $property = new Property('propname','propvalue'); + $property['paramname'] = 'paramvalue'; + + $this->assertEquals(1,count($property->parameters)); + $this->assertInstanceOf('Sabre\\VObject\\Parameter', $property->parameters[0]); + $this->assertEquals('PARAMNAME',$property->parameters[0]->name); + $this->assertEquals('paramvalue',$property->parameters[0]->value); + + } + + /** + * @expectedException InvalidArgumentException + */ + public function testSetParameterAsStringNoKey() { + + $property = new Property('propname','propvalue'); + $property[] = 'paramvalue'; + + } + + public function testSetParameterObject() { + + $property = new Property('propname','propvalue'); + $param = new Parameter('paramname','paramvalue'); + + $property[] = $param; + + $this->assertEquals(1,count($property->parameters)); + $this->assertEquals($param, $property->parameters[0]); + + } + + /** + * @expectedException InvalidArgumentException + */ + public function testSetParameterObjectWithKey() { + + $property = new Property('propname','propvalue'); + $param = new Parameter('paramname','paramvalue'); + + $property['key'] = $param; + + } + + + /** + * @expectedException InvalidArgumentException + */ + public function testSetParameterObjectRandomObject() { + + $property = new Property('propname','propvalue'); + $property[] = new \StdClass(); + + } + + public function testUnsetParameter() { + + $property = new Property('propname','propvalue'); + $param = new Parameter('paramname','paramvalue'); + $property->parameters[] = $param; + + unset($property['PARAMNAME']); + $this->assertEquals(0,count($property->parameters)); + + } + + public function testParamCount() { + + $property = new Property('propname','propvalue'); + $param = new Parameter('paramname','paramvalue'); + $property->parameters[] = $param; + $property->parameters[] = clone $param; + + $this->assertEquals(2,count($property->parameters)); + + } + + public function testSerialize() { + + $property = new Property('propname','propvalue'); + + $this->assertEquals("PROPNAME:propvalue\r\n",$property->serialize()); + + } + + public function testSerializeParam() { + + $property = new Property('propname','propvalue'); + $property->parameters[] = new Parameter('paramname','paramvalue'); + $property->parameters[] = new Parameter('paramname2','paramvalue2'); + + $this->assertEquals("PROPNAME;PARAMNAME=paramvalue;PARAMNAME2=paramvalue2:propvalue\r\n",$property->serialize()); + + } + + public function testSerializeNewLine() { + + $property = new Property('propname',"line1\nline2"); + + $this->assertEquals("PROPNAME:line1\\nline2\r\n",$property->serialize()); + + } + + public function testSerializeLongLine() { + + $value = str_repeat('!',200); + $property = new Property('propname',$value); + + $expected = "PROPNAME:" . str_repeat('!',66) . "\r\n " . str_repeat('!',74) . "\r\n " . str_repeat('!',60) . "\r\n"; + + $this->assertEquals($expected,$property->serialize()); + + } + + public function testSerializeUTF8LineFold() { + + $value = str_repeat('!',65) . "\xc3\xa4bla"; // inserted umlaut-a + $property = new Property('propname', $value); + $expected = "PROPNAME:" . str_repeat('!',65) . "\r\n \xc3\xa4bla\r\n"; + $this->assertEquals($expected, $property->serialize()); + + } + + public function testGetIterator() { + + $it = new ElementList(array()); + $property = new Property('propname','propvalue'); + $property->setIterator($it); + $this->assertEquals($it,$property->getIterator()); + + } + + + public function testGetIteratorDefault() { + + $property = new Property('propname','propvalue'); + $it = $property->getIterator(); + $this->assertTrue($it instanceof ElementList); + $this->assertEquals(1,count($it)); + + } + + function testAddScalar() { + + $property = new Property('EMAIL'); + + $property->add('myparam','value'); + + $this->assertEquals(1, count($property->parameters)); + + $this->assertTrue($property->parameters[0] instanceof Parameter); + $this->assertEquals('MYPARAM',$property->parameters[0]->name); + $this->assertEquals('value',$property->parameters[0]->value); + + } + + function testAddParameter() { + + $prop = new Property('EMAIL'); + + $prop->add(new Parameter('MYPARAM','value')); + + $this->assertEquals(1, count($prop->parameters)); + $this->assertEquals('MYPARAM',$prop['myparam']->name); + + } + + function testAddParameterTwice() { + + $prop = new Property('EMAIL'); + + $prop->add(new Parameter('MYPARAM', 'value1')); + $prop->add(new Parameter('MYPARAM', 'value2')); + + $this->assertEquals(2, count($prop->parameters)); + + $this->assertEquals('MYPARAM',$prop['MYPARAM']->name); + + } + + /** + * @expectedException InvalidArgumentException + */ + function testAddArgFail() { + + $prop = new Property('EMAIL'); + $prop->add(new Parameter('MPARAM'),'hello'); + + } + + /** + * @expectedException InvalidArgumentException + */ + function testAddArgFail2() { + + $property = new Property('EMAIL','value'); + $property->add(array()); + + } + + /** + * @expectedException InvalidArgumentException + */ + function testAddArgFail3() { + + $property = new Property('EMAIL','value'); + $property->add('hello',array()); + + } + + function testClone() { + + $property = new Property('EMAIL','value'); + $property['FOO'] = 'BAR'; + + $property2 = clone $property; + + $property['FOO'] = 'BAZ'; + $this->assertEquals('BAR', (string)$property2['FOO']); + + } + + function testCreateParams() { + + $property = Property::create('X-PROP', 'value', array( + 'param1' => 'value1', + 'param2' => array('value2', 'value3') + )); + + $this->assertEquals(1, count($property['PARAM1'])); + $this->assertEquals(2, count($property['PARAM2'])); + + } + +} diff --git a/dav/sabre-vobject/tests/Sabre/VObject/ReaderTest.php b/dav/sabre-vobject/tests/Sabre/VObject/ReaderTest.php new file mode 100644 index 00000000..998ff620 --- /dev/null +++ b/dav/sabre-vobject/tests/Sabre/VObject/ReaderTest.php @@ -0,0 +1,265 @@ +assertInstanceOf('Sabre\\VObject\\Component', $result); + $this->assertEquals('VCALENDAR', $result->name); + $this->assertEquals(0, count($result->children)); + + } + + function testReadComponentUnixNewLine() { + + $data = "BEGIN:VCALENDAR\nEND:VCALENDAR"; + + $result = Reader::read($data); + + $this->assertInstanceOf('Sabre\\VObject\\Component', $result); + $this->assertEquals('VCALENDAR', $result->name); + $this->assertEquals(0, count($result->children)); + + } + + function testReadComponentMacNewLine() { + + $data = "BEGIN:VCALENDAR\rEND:VCALENDAR"; + + $result = Reader::read($data); + + $this->assertInstanceOf('Sabre\\VObject\\Component', $result); + $this->assertEquals('VCALENDAR', $result->name); + $this->assertEquals(0, count($result->children)); + + } + + function testReadComponentLineFold() { + + $data = "BEGIN:\r\n\tVCALENDAR\r\nE\r\n ND:VCALENDAR"; + + $result = Reader::read($data); + + $this->assertInstanceOf('Sabre\\VObject\\Component', $result); + $this->assertEquals('VCALENDAR', $result->name); + $this->assertEquals(0, count($result->children)); + + } + + /** + * @expectedException Sabre\VObject\ParseException + */ + function testReadCorruptComponent() { + + $data = "BEGIN:VCALENDAR\r\nEND:FOO"; + + $result = Reader::read($data); + + } + + function testReadProperty() { + + $data = "PROPNAME:propValue"; + $result = Reader::read($data); + + $this->assertInstanceOf('Sabre\\VObject\\Property', $result); + $this->assertEquals('PROPNAME', $result->name); + $this->assertEquals('propValue', $result->value); + + } + + function testReadPropertyWithNewLine() { + + $data = 'PROPNAME:Line1\\nLine2\\NLine3\\\\Not the 4th line!'; + $result = Reader::read($data); + + $this->assertInstanceOf('Sabre\\VObject\\Property', $result); + $this->assertEquals('PROPNAME', $result->name); + $this->assertEquals("Line1\nLine2\nLine3\\Not the 4th line!", $result->value); + + } + + function testReadMappedProperty() { + + $data = "DTSTART:20110529"; + $result = Reader::read($data); + + $this->assertInstanceOf('Sabre\\VObject\\Property\\DateTime', $result); + $this->assertEquals('DTSTART', $result->name); + $this->assertEquals('20110529', $result->value); + + } + + function testReadMappedPropertyGrouped() { + + $data = "foo.DTSTART:20110529"; + $result = Reader::read($data); + + $this->assertInstanceOf('Sabre\\VObject\\Property\\DateTime', $result); + $this->assertEquals('DTSTART', $result->name); + $this->assertEquals('20110529', $result->value); + + } + + + /** + * @expectedException Sabre\VObject\ParseException + */ + function testReadBrokenLine() { + + $data = "PROPNAME;propValue"; + $result = Reader::read($data); + + } + + function testReadPropertyInComponent() { + + $data = array( + "BEGIN:VCALENDAR", + "PROPNAME:propValue", + "END:VCALENDAR" + ); + + $result = Reader::read(implode("\r\n",$data)); + + $this->assertInstanceOf('Sabre\\VObject\\Component', $result); + $this->assertEquals('VCALENDAR', $result->name); + $this->assertEquals(1, count($result->children)); + $this->assertInstanceOf('Sabre\\VObject\\Property', $result->children[0]); + $this->assertEquals('PROPNAME', $result->children[0]->name); + $this->assertEquals('propValue', $result->children[0]->value); + + + } + function testReadNestedComponent() { + + $data = array( + "BEGIN:VCALENDAR", + "BEGIN:VTIMEZONE", + "BEGIN:DAYLIGHT", + "END:DAYLIGHT", + "END:VTIMEZONE", + "END:VCALENDAR" + ); + + $result = Reader::read(implode("\r\n",$data)); + + $this->assertInstanceOf('Sabre\\VObject\\Component', $result); + $this->assertEquals('VCALENDAR', $result->name); + $this->assertEquals(1, count($result->children)); + $this->assertInstanceOf('Sabre\\VObject\\Component', $result->children[0]); + $this->assertEquals('VTIMEZONE', $result->children[0]->name); + $this->assertEquals(1, count($result->children[0]->children)); + $this->assertInstanceOf('Sabre\\VObject\\Component', $result->children[0]->children[0]); + $this->assertEquals('DAYLIGHT', $result->children[0]->children[0]->name); + + + } + + function testReadPropertyParameter() { + + $data = "PROPNAME;PARAMNAME=paramvalue:propValue"; + $result = Reader::read($data); + + $this->assertInstanceOf('Sabre\\VObject\\Property', $result); + $this->assertEquals('PROPNAME', $result->name); + $this->assertEquals('propValue', $result->value); + $this->assertEquals(1, count($result->parameters)); + $this->assertEquals('PARAMNAME', $result->parameters[0]->name); + $this->assertEquals('paramvalue', $result->parameters[0]->value); + + } + + function testReadPropertyNoValue() { + + $data = "PROPNAME;PARAMNAME:propValue"; + $result = Reader::read($data); + + $this->assertInstanceOf('Sabre\\VObject\\Property', $result); + $this->assertEquals('PROPNAME', $result->name); + $this->assertEquals('propValue', $result->value); + $this->assertEquals(1, count($result->parameters)); + $this->assertEquals('PARAMNAME', $result->parameters[0]->name); + $this->assertEquals('', $result->parameters[0]->value); + + } + + function testReadPropertyParameterExtraColon() { + + $data = "PROPNAME;PARAMNAME=paramvalue:propValue:anotherrandomstring"; + $result = Reader::read($data); + + $this->assertInstanceOf('Sabre\\VObject\\Property', $result); + $this->assertEquals('PROPNAME', $result->name); + $this->assertEquals('propValue:anotherrandomstring', $result->value); + $this->assertEquals(1, count($result->parameters)); + $this->assertEquals('PARAMNAME', $result->parameters[0]->name); + $this->assertEquals('paramvalue', $result->parameters[0]->value); + + } + + function testReadProperty2Parameters() { + + $data = "PROPNAME;PARAMNAME=paramvalue;PARAMNAME2=paramvalue2:propValue"; + $result = Reader::read($data); + + $this->assertInstanceOf('Sabre\\VObject\\Property', $result); + $this->assertEquals('PROPNAME', $result->name); + $this->assertEquals('propValue', $result->value); + $this->assertEquals(2, count($result->parameters)); + $this->assertEquals('PARAMNAME', $result->parameters[0]->name); + $this->assertEquals('paramvalue', $result->parameters[0]->value); + $this->assertEquals('PARAMNAME2', $result->parameters[1]->name); + $this->assertEquals('paramvalue2', $result->parameters[1]->value); + + } + + function testReadPropertyParameterQuoted() { + + $data = "PROPNAME;PARAMNAME=\"paramvalue\":propValue"; + $result = Reader::read($data); + + $this->assertInstanceOf('Sabre\\VObject\\Property', $result); + $this->assertEquals('PROPNAME', $result->name); + $this->assertEquals('propValue', $result->value); + $this->assertEquals(1, count($result->parameters)); + $this->assertEquals('PARAMNAME', $result->parameters[0]->name); + $this->assertEquals('paramvalue', $result->parameters[0]->value); + + } + function testReadPropertyParameterNewLines() { + + $data = "PROPNAME;PARAMNAME=paramvalue1\\nvalue2\\\\nvalue3:propValue"; + $result = Reader::read($data); + + $this->assertInstanceOf('Sabre\\VObject\\Property', $result); + $this->assertEquals('PROPNAME', $result->name); + $this->assertEquals('propValue', $result->value); + + $this->assertEquals(1, count($result->parameters)); + $this->assertEquals('PARAMNAME', $result->parameters[0]->name); + $this->assertEquals("paramvalue1\nvalue2\\nvalue3", $result->parameters[0]->value); + + } + + function testReadPropertyParameterQuotedColon() { + + $data = "PROPNAME;PARAMNAME=\"param:value\":propValue"; + $result = Reader::read($data); + + $this->assertInstanceOf('Sabre\\VObject\\Property', $result); + $this->assertEquals('PROPNAME', $result->name); + $this->assertEquals('propValue', $result->value); + $this->assertEquals(1, count($result->parameters)); + $this->assertEquals('PARAMNAME', $result->parameters[0]->name); + $this->assertEquals('param:value', $result->parameters[0]->value); + + } + +} diff --git a/dav/sabre-vobject/tests/Sabre/VObject/RecurrenceIteratorFifthTuesdayProblemTest.php b/dav/sabre-vobject/tests/Sabre/VObject/RecurrenceIteratorFifthTuesdayProblemTest.php new file mode 100644 index 00000000..ffcb6ee7 --- /dev/null +++ b/dav/sabre-vobject/tests/Sabre/VObject/RecurrenceIteratorFifthTuesdayProblemTest.php @@ -0,0 +1,46 @@ +VEVENT->UID); + + while($it->valid()) { + $it->next(); + } + + // If we got here, it means we were successful. The bug that was in teh + // system before would fail on the 5th tuesday of the month, if the 5th + // tuesday did not exist. + + } + +} + +?> diff --git a/dav/sabre-vobject/tests/Sabre/VObject/RecurrenceIteratorInfiniteLoopProblemTest.php b/dav/sabre-vobject/tests/Sabre/VObject/RecurrenceIteratorInfiniteLoopProblemTest.php new file mode 100644 index 00000000..3976388b --- /dev/null +++ b/dav/sabre-vobject/tests/Sabre/VObject/RecurrenceIteratorInfiniteLoopProblemTest.php @@ -0,0 +1,68 @@ +DTSTART = '20090420T180000Z'; + $ev->RRULE = 'FREQ=WEEKLY;BYDAY=MO;UNTIL=20090704T205959Z;INTERVAL=1'; + + $this->assertFalse($ev->isInTimeRange(new DateTime('2012-01-01 12:00:00'),new DateTime('3000-01-01 00:00:00'))); + + } + + /** + * Different bug, also likely an infinite loop. + */ + function testYearlyByMonthLoop() { + + $ev = Component::create('VEVENT'); + $ev->UID = 'uuid'; + $ev->DTSTART = '20120101T154500'; + $ev->DTSTART['TZID'] = 'Europe/Berlin'; + $ev->RRULE = 'FREQ=YEARLY;INTERVAL=1;UNTIL=20120203T225959Z;BYMONTH=2;BYSETPOS=1;BYDAY=SU,MO,TU,WE,TH,FR,SA'; + $ev->DTEND = '20120101T164500'; + $ev->DTEND['TZID'] = 'Europe/Berlin'; + + // This recurrence rule by itself is a yearly rule that should happen + // every february. + // + // The BYDAY part expands this to every day of the month, but the + // BYSETPOS limits this to only the 1st day of the month. Very crazy + // way to specify this, and could have certainly been a lot easier. + $cal = Component::create('VCALENDAR'); + $cal->add($ev); + + $it = new RecurrenceIterator($cal,'uuid'); + $it->fastForward(new DateTime('2012-01-29 23:00:00', new DateTimeZone('UTC'))); + + $collect = array(); + + while($it->valid()) { + $collect[] = $it->getDTSTART(); + if ($it->getDTSTART() > new DateTime('2013-02-05 22:59:59', new DateTimeZone('UTC'))) { + break; + } + $it->next(); + + } + + $this->assertEquals( + array(new DateTime('2012-02-01 15:45:00', new DateTimeZone('Europe/Berlin'))), + $collect + ); + + } + + +} diff --git a/dav/sabre-vobject/tests/Sabre/VObject/RecurrenceIteratorTest.php b/dav/sabre-vobject/tests/Sabre/VObject/RecurrenceIteratorTest.php new file mode 100644 index 00000000..c79ac689 --- /dev/null +++ b/dav/sabre-vobject/tests/Sabre/VObject/RecurrenceIteratorTest.php @@ -0,0 +1,1137 @@ +UID = 'bla'; + $ev->RRULE = 'FREQ=DAILY;BYHOUR=10;BYMINUTE=5;BYSECOND=16;BYWEEKNO=32;BYYEARDAY=100,200'; + $dtStart = new Property\DateTime('DTSTART'); + $dtStart->setDateTime(new DateTime('2011-10-07'),Property\DateTime::UTC); + + $ev->add($dtStart); + + $vcal = Component::create('VCALENDAR'); + $vcal->add($ev); + + $it = new RecurrenceIterator($vcal,(string)$ev->uid); + + $this->assertEquals(array(10), $it->byHour); + $this->assertEquals(array(5), $it->byMinute); + $this->assertEquals(array(16), $it->bySecond); + $this->assertEquals(array(32), $it->byWeekNo); + $this->assertEquals(array(100,200), $it->byYearDay); + + } + + /** + * @expectedException InvalidArgumentException + * @depends testValues + */ + function testInvalidFreq() { + + $ev = new Component('VEVENT'); + $ev->RRULE = 'FREQ=SMONTHLY;INTERVAL=3;UNTIL=20111025T000000Z'; + $dtStart = new Property\DateTime('DTSTART'); + $dtStart->setDateTime(new DateTime('2011-10-07'),Property\DateTime::UTC); + + $ev->add($dtStart); + + $vcal = Component::create('VCALENDAR'); + $vcal->add($ev); + + $it = new RecurrenceIterator($vcal,(string)$ev->uid); + + } + + /** + * @expectedException InvalidArgumentException + */ + function testVCalendarNoUID() { + + $vcal = new Component('VCALENDAR'); + $it = new RecurrenceIterator($vcal); + + } + + /** + * @expectedException InvalidArgumentException + */ + function testVCalendarInvalidUID() { + + $vcal = new Component('VCALENDAR'); + $it = new RecurrenceIterator($vcal,'foo'); + + } + + /** + * @depends testValues + */ + function testDaily() { + + $ev = new Component('VEVENT'); + $ev->UID = 'bla'; + $ev->RRULE = 'FREQ=DAILY;INTERVAL=3;UNTIL=20111025T000000Z'; + $dtStart = new Property\DateTime('DTSTART'); + $dtStart->setDateTime(new DateTime('2011-10-07', new DateTimeZone('UTC')),Property\DateTime::UTC); + + $ev->add($dtStart); + + $vcal = Component::create('VCALENDAR'); + $vcal->add($ev); + + $it = new RecurrenceIterator($vcal,$ev->uid); + + $this->assertEquals('daily', $it->frequency); + $this->assertEquals(3, $it->interval); + $this->assertEquals(new DateTime('2011-10-25', new DateTimeZone('UTC')), $it->until); + + // Max is to prevent overflow + $max = 12; + $result = array(); + foreach($it as $item) { + + $result[] = $item; + $max--; + + if (!$max) break; + + } + + $tz = new DateTimeZone('UTC'); + + $this->assertEquals( + array( + new DateTime('2011-10-07', $tz), + new DateTime('2011-10-10', $tz), + new DateTime('2011-10-13', $tz), + new DateTime('2011-10-16', $tz), + new DateTime('2011-10-19', $tz), + new DateTime('2011-10-22', $tz), + new DateTime('2011-10-25', $tz), + ), + $result + ); + + } + + /** + * @depends testValues + */ + function testNoRRULE() { + + $ev = new Component('VEVENT'); + $ev->UID = 'bla'; + $dtStart = new Property\DateTime('DTSTART'); + $dtStart->setDateTime(new DateTime('2011-10-07', new DateTimeZone('UTC')),Property\DateTime::UTC); + + $ev->add($dtStart); + + $vcal = Component::create('VCALENDAR'); + $vcal->add($ev); + + $it = new RecurrenceIterator($vcal,$ev->uid); + + $this->assertEquals('daily', $it->frequency); + $this->assertEquals(1, $it->interval); + + // Max is to prevent overflow + $max = 12; + $result = array(); + foreach($it as $item) { + + $result[] = $item; + $max--; + + if (!$max) break; + + } + + $tz = new DateTimeZone('UTC'); + + $this->assertEquals( + array( + new DateTime('2011-10-07', $tz), + ), + $result + ); + + } + + /** + * @depends testValues + */ + function testDailyByDay() { + + $ev = new Component('VEVENT'); + $ev->UID = 'bla'; + $ev->RRULE = 'FREQ=DAILY;INTERVAL=2;BYDAY=TU,WE,FR'; + $dtStart = new Property\DateTime('DTSTART'); + $dtStart->setDateTime(new DateTime('2011-10-07', new DateTimeZone('UTC')),Property\DateTime::UTC); + + $ev->add($dtStart); + + $vcal = Component::create('VCALENDAR'); + $vcal->add($ev); + + $it = new RecurrenceIterator($vcal,(string)$ev->uid); + + $this->assertEquals('daily', $it->frequency); + $this->assertEquals(2, $it->interval); + $this->assertEquals(array('TU','WE','FR'), $it->byDay); + + // Grabbing the next 12 items + $max = 12; + $result = array(); + foreach($it as $item) { + + $result[] = $item; + $max--; + + if (!$max) break; + + } + + $tz = new DateTimeZone('UTC'); + + $this->assertEquals( + array( + new DateTime('2011-10-07', $tz), + new DateTime('2011-10-11', $tz), + new DateTime('2011-10-19', $tz), + new DateTime('2011-10-21', $tz), + new DateTime('2011-10-25', $tz), + new DateTime('2011-11-02', $tz), + new DateTime('2011-11-04', $tz), + new DateTime('2011-11-08', $tz), + new DateTime('2011-11-16', $tz), + new DateTime('2011-11-18', $tz), + new DateTime('2011-11-22', $tz), + new DateTime('2011-11-30', $tz), + ), + $result + ); + + } + + /** + * @depends testValues + */ + function testWeekly() { + + $ev = new Component('VEVENT'); + $ev->UID = 'bla'; + $ev->RRULE = 'FREQ=WEEKLY;INTERVAL=2;COUNT=10'; + $dtStart = new Property\DateTime('DTSTART'); + $dtStart->setDateTime(new DateTime('2011-10-07', new DateTimeZone('UTC')),Property\DateTime::UTC); + + $ev->add($dtStart); + + $vcal = Component::create('VCALENDAR'); + $vcal->add($ev); + + $it = new RecurrenceIterator($vcal,(string)$ev->uid); + + $this->assertEquals('weekly', $it->frequency); + $this->assertEquals(2, $it->interval); + $this->assertEquals(10, $it->count); + + // Max is to prevent overflow + $max = 12; + $result = array(); + foreach($it as $item) { + + $result[] = $item; + $max--; + + if (!$max) break; + + } + + $tz = new DateTimeZone('UTC'); + + $this->assertEquals( + array( + new DateTime('2011-10-07', $tz), + new DateTime('2011-10-21', $tz), + new DateTime('2011-11-04', $tz), + new DateTime('2011-11-18', $tz), + new DateTime('2011-12-02', $tz), + new DateTime('2011-12-16', $tz), + new DateTime('2011-12-30', $tz), + new DateTime('2012-01-13', $tz), + new DateTime('2012-01-27', $tz), + new DateTime('2012-02-10', $tz), + ), + $result + ); + + } + + /** + * @depends testValues + */ + function testWeeklyByDay() { + + $ev = new Component('VEVENT'); + $ev->UID = 'bla'; + $ev->RRULE = 'FREQ=WEEKLY;INTERVAL=2;BYDAY=TU,WE,FR;WKST=SU'; + $dtStart = new Property\DateTime('DTSTART'); + $dtStart->setDateTime(new DateTime('2011-10-07', new DateTimeZone('UTC')),Property\DateTime::UTC); + + $ev->add($dtStart); + + $vcal = Component::create('VCALENDAR'); + $vcal->add($ev); + + $it = new RecurrenceIterator($vcal,(string)$ev->uid); + + $this->assertEquals('weekly', $it->frequency); + $this->assertEquals(2, $it->interval); + $this->assertEquals(array('TU','WE','FR'), $it->byDay); + $this->assertEquals('SU', $it->weekStart); + + // Grabbing the next 12 items + $max = 12; + $result = array(); + foreach($it as $item) { + + $result[] = $item; + $max--; + + if (!$max) break; + + } + + $tz = new DateTimeZone('UTC'); + + $this->assertEquals( + array( + new DateTime('2011-10-07', $tz), + new DateTime('2011-10-18', $tz), + new DateTime('2011-10-19', $tz), + new DateTime('2011-10-21', $tz), + new DateTime('2011-11-01', $tz), + new DateTime('2011-11-02', $tz), + new DateTime('2011-11-04', $tz), + new DateTime('2011-11-15', $tz), + new DateTime('2011-11-16', $tz), + new DateTime('2011-11-18', $tz), + new DateTime('2011-11-29', $tz), + new DateTime('2011-11-30', $tz), + ), + $result + ); + + } + + /** + * @depends testValues + */ + function testMonthly() { + + $ev = new Component('VEVENT'); + $ev->UID = 'bla'; + $ev->RRULE = 'FREQ=MONTHLY;INTERVAL=3;COUNT=5'; + $dtStart = new Property\DateTime('DTSTART'); + $dtStart->setDateTime(new DateTime('2011-12-05', new DateTimeZone('UTC')),Property\DateTime::UTC); + + $ev->add($dtStart); + + $vcal = Component::create('VCALENDAR'); + $vcal->add($ev); + + $it = new RecurrenceIterator($vcal,(string)$ev->uid); + + $this->assertEquals('monthly', $it->frequency); + $this->assertEquals(3, $it->interval); + $this->assertEquals(5, $it->count); + + $max = 14; + $result = array(); + foreach($it as $item) { + + $result[] = $item; + $max--; + + if (!$max) break; + + } + + $tz = new DateTimeZone('UTC'); + + $this->assertEquals( + array( + new DateTime('2011-12-05', $tz), + new DateTime('2012-03-05', $tz), + new DateTime('2012-06-05', $tz), + new DateTime('2012-09-05', $tz), + new DateTime('2012-12-05', $tz), + ), + $result + ); + + + } + + /** + * @depends testValues + */ + function testMonthlyEndOfMonth() { + + $ev = new Component('VEVENT'); + $ev->UID = 'bla'; + $ev->RRULE = 'FREQ=MONTHLY;INTERVAL=2;COUNT=12'; + $dtStart = new Property\DateTime('DTSTART'); + $dtStart->setDateTime(new DateTime('2011-12-31', new DateTimeZone('UTC')),Property\DateTime::UTC); + + $ev->add($dtStart); + + $vcal = Component::create('VCALENDAR'); + $vcal->add($ev); + + $it = new RecurrenceIterator($vcal,(string)$ev->uid); + + $this->assertEquals('monthly', $it->frequency); + $this->assertEquals(2, $it->interval); + $this->assertEquals(12, $it->count); + + $max = 14; + $result = array(); + foreach($it as $item) { + + $result[] = $item; + $max--; + + if (!$max) break; + + } + + $tz = new DateTimeZone('UTC'); + + $this->assertEquals( + array( + new DateTime('2011-12-31', $tz), + new DateTime('2012-08-31', $tz), + new DateTime('2012-10-31', $tz), + new DateTime('2012-12-31', $tz), + new DateTime('2013-08-31', $tz), + new DateTime('2013-10-31', $tz), + new DateTime('2013-12-31', $tz), + new DateTime('2014-08-31', $tz), + new DateTime('2014-10-31', $tz), + new DateTime('2014-12-31', $tz), + new DateTime('2015-08-31', $tz), + new DateTime('2015-10-31', $tz), + ), + $result + ); + + + } + + /** + * @depends testValues + */ + function testMonthlyByMonthDay() { + + $ev = new Component('VEVENT'); + $ev->UID = 'bla'; + $ev->RRULE = 'FREQ=MONTHLY;INTERVAL=5;COUNT=9;BYMONTHDAY=1,31,-7'; + $dtStart = new Property\DateTime('DTSTART'); + $dtStart->setDateTime(new DateTime('2011-01-01', new DateTimeZone('UTC')),Property\DateTime::UTC); + + $ev->add($dtStart); + + $vcal = Component::create('VCALENDAR'); + $vcal->add($ev); + + $it = new RecurrenceIterator($vcal,(string)$ev->uid); + + $this->assertEquals('monthly', $it->frequency); + $this->assertEquals(5, $it->interval); + $this->assertEquals(9, $it->count); + $this->assertEquals(array(1, 31, -7), $it->byMonthDay); + + $max = 14; + $result = array(); + foreach($it as $item) { + + $result[] = $item; + $max--; + + if (!$max) break; + + } + + $tz = new DateTimeZone('UTC'); + + $this->assertEquals( + array( + new DateTime('2011-01-01', $tz), + new DateTime('2011-01-25', $tz), + new DateTime('2011-01-31', $tz), + new DateTime('2011-06-01', $tz), + new DateTime('2011-06-24', $tz), + new DateTime('2011-11-01', $tz), + new DateTime('2011-11-24', $tz), + new DateTime('2012-04-01', $tz), + new DateTime('2012-04-24', $tz), + ), + $result + ); + + } + + /** + * @depends testValues + */ + function testMonthlyByDay() { + + $ev = new Component('VEVENT'); + $ev->UID = 'bla'; + $ev->RRULE = 'FREQ=MONTHLY;INTERVAL=2;COUNT=16;BYDAY=MO,-2TU,+1WE,3TH'; + $dtStart = new Property\DateTime('DTSTART'); + $dtStart->setDateTime(new DateTime('2011-01-03', new DateTimeZone('UTC')),Property\DateTime::UTC); + + $ev->add($dtStart); + + $vcal = Component::create('VCALENDAR'); + $vcal->add($ev); + + $it = new RecurrenceIterator($vcal,(string)$ev->uid); + + $this->assertEquals('monthly', $it->frequency); + $this->assertEquals(2, $it->interval); + $this->assertEquals(16, $it->count); + $this->assertEquals(array('MO','-2TU','+1WE','3TH'), $it->byDay); + + $max = 20; + $result = array(); + foreach($it as $k=>$item) { + + $result[] = $item; + $max--; + + if (!$max) break; + + } + + $tz = new DateTimeZone('UTC'); + + $this->assertEquals( + array( + new DateTime('2011-01-03', $tz), + new DateTime('2011-01-05', $tz), + new DateTime('2011-01-10', $tz), + new DateTime('2011-01-17', $tz), + new DateTime('2011-01-18', $tz), + new DateTime('2011-01-20', $tz), + new DateTime('2011-01-24', $tz), + new DateTime('2011-01-31', $tz), + new DateTime('2011-03-02', $tz), + new DateTime('2011-03-07', $tz), + new DateTime('2011-03-14', $tz), + new DateTime('2011-03-17', $tz), + new DateTime('2011-03-21', $tz), + new DateTime('2011-03-22', $tz), + new DateTime('2011-03-28', $tz), + new DateTime('2011-05-02', $tz), + ), + $result + ); + + } + + /** + * @depends testValues + */ + function testMonthlyByDayByMonthDay() { + + $ev = new Component('VEVENT'); + $ev->UID = 'bla'; + $ev->RRULE = 'FREQ=MONTHLY;COUNT=10;BYDAY=MO;BYMONTHDAY=1'; + $dtStart = new Property\DateTime('DTSTART'); + $dtStart->setDateTime(new DateTime('2011-08-01', new DateTimeZone('UTC')),Property\DateTime::UTC); + + $ev->add($dtStart); + + $vcal = Component::create('VCALENDAR'); + $vcal->add($ev); + + $it = new RecurrenceIterator($vcal,(string)$ev->uid); + + $this->assertEquals('monthly', $it->frequency); + $this->assertEquals(1, $it->interval); + $this->assertEquals(10, $it->count); + $this->assertEquals(array('MO'), $it->byDay); + $this->assertEquals(array(1), $it->byMonthDay); + + $max = 20; + $result = array(); + foreach($it as $k=>$item) { + + $result[] = $item; + $max--; + + if (!$max) break; + + } + + $tz = new DateTimeZone('UTC'); + + $this->assertEquals( + array( + new DateTime('2011-08-01', $tz), + new DateTime('2012-10-01', $tz), + new DateTime('2013-04-01', $tz), + new DateTime('2013-07-01', $tz), + new DateTime('2014-09-01', $tz), + new DateTime('2014-12-01', $tz), + new DateTime('2015-06-01', $tz), + new DateTime('2016-02-01', $tz), + new DateTime('2016-08-01', $tz), + new DateTime('2017-05-01', $tz), + ), + $result + ); + + } + + /** + * @depends testValues + */ + function testMonthlyByDayBySetPos() { + + $ev = new Component('VEVENT'); + $ev->UID = 'bla'; + $ev->RRULE = 'FREQ=MONTHLY;COUNT=10;BYDAY=MO,TU,WE,TH,FR;BYSETPOS=1,-1'; + $dtStart = new Property\DateTime('DTSTART'); + $dtStart->setDateTime(new DateTime('2011-01-03', new DateTimeZone('UTC')),Property\DateTime::UTC); + + $ev->add($dtStart); + + $vcal = Component::create('VCALENDAR'); + $vcal->add($ev); + + $it = new RecurrenceIterator($vcal,(string)$ev->uid); + + $this->assertEquals('monthly', $it->frequency); + $this->assertEquals(1, $it->interval); + $this->assertEquals(10, $it->count); + $this->assertEquals(array('MO','TU','WE','TH','FR'), $it->byDay); + $this->assertEquals(array(1,-1), $it->bySetPos); + + $max = 20; + $result = array(); + foreach($it as $k=>$item) { + + $result[] = $item; + $max--; + + if (!$max) break; + + } + + $tz = new DateTimeZone('UTC'); + + $this->assertEquals( + array( + new DateTime('2011-01-03', $tz), + new DateTime('2011-01-31', $tz), + new DateTime('2011-02-01', $tz), + new DateTime('2011-02-28', $tz), + new DateTime('2011-03-01', $tz), + new DateTime('2011-03-31', $tz), + new DateTime('2011-04-01', $tz), + new DateTime('2011-04-29', $tz), + new DateTime('2011-05-02', $tz), + new DateTime('2011-05-31', $tz), + ), + $result + ); + + } + + /** + * @depends testValues + */ + function testYearly() { + + $ev = new Component('VEVENT'); + $ev->UID = 'bla'; + $ev->RRULE = 'FREQ=YEARLY;COUNT=10;INTERVAL=3'; + $dtStart = new Property\DateTime('DTSTART'); + $dtStart->setDateTime(new DateTime('2011-01-01', new DateTimeZone('UTC')),Property\DateTime::UTC); + + $ev->add($dtStart); + + $vcal = Component::create('VCALENDAR'); + $vcal->add($ev); + + $it = new RecurrenceIterator($vcal,(string)$ev->uid); + + $this->assertEquals('yearly', $it->frequency); + $this->assertEquals(3, $it->interval); + $this->assertEquals(10, $it->count); + + $max = 20; + $result = array(); + foreach($it as $k=>$item) { + + $result[] = $item; + $max--; + + if (!$max) break; + + } + + $tz = new DateTimeZone('UTC'); + + $this->assertEquals( + array( + new DateTime('2011-01-01', $tz), + new DateTime('2014-01-01', $tz), + new DateTime('2017-01-01', $tz), + new DateTime('2020-01-01', $tz), + new DateTime('2023-01-01', $tz), + new DateTime('2026-01-01', $tz), + new DateTime('2029-01-01', $tz), + new DateTime('2032-01-01', $tz), + new DateTime('2035-01-01', $tz), + new DateTime('2038-01-01', $tz), + ), + $result + ); + + } + + /** + * @depends testValues + */ + function testYearlyLeapYear() { + + $ev = new Component('VEVENT'); + $ev->UID = 'bla'; + $ev->RRULE = 'FREQ=YEARLY;COUNT=3'; + $dtStart = new Property\DateTime('DTSTART'); + $dtStart->setDateTime(new DateTime('2012-02-29', new DateTimeZone('UTC')),Property\DateTime::UTC); + + $ev->add($dtStart); + + $vcal = Component::create('VCALENDAR'); + $vcal->add($ev); + + $it = new RecurrenceIterator($vcal,(string)$ev->uid); + + $this->assertEquals('yearly', $it->frequency); + $this->assertEquals(3, $it->count); + + $max = 20; + $result = array(); + foreach($it as $k=>$item) { + + $result[] = $item; + $max--; + + if (!$max) break; + + } + + $tz = new DateTimeZone('UTC'); + + $this->assertEquals( + array( + new DateTime('2012-02-29', $tz), + new DateTime('2016-02-29', $tz), + new DateTime('2020-02-29', $tz), + ), + $result + ); + + } + + /** + * @depends testValues + */ + function testYearlyByMonth() { + + $ev = new Component('VEVENT'); + $ev->UID = 'bla'; + $ev->RRULE = 'FREQ=YEARLY;COUNT=8;INTERVAL=4;BYMONTH=4,10'; + $dtStart = new Property\DateTime('DTSTART'); + $dtStart->setDateTime(new DateTime('2011-04-07', new DateTimeZone('UTC')),Property\DateTime::UTC); + + $ev->add($dtStart); + + $vcal = Component::create('VCALENDAR'); + $vcal->add($ev); + + $it = new RecurrenceIterator($vcal,(string)$ev->uid); + + $this->assertEquals('yearly', $it->frequency); + $this->assertEquals(4, $it->interval); + $this->assertEquals(8, $it->count); + $this->assertEquals(array(4,10), $it->byMonth); + + $max = 20; + $result = array(); + foreach($it as $k=>$item) { + + $result[] = $item; + $max--; + + if (!$max) break; + + } + + $tz = new DateTimeZone('UTC'); + + $this->assertEquals( + array( + new DateTime('2011-04-07', $tz), + new DateTime('2011-10-07', $tz), + new DateTime('2015-04-07', $tz), + new DateTime('2015-10-07', $tz), + new DateTime('2019-04-07', $tz), + new DateTime('2019-10-07', $tz), + new DateTime('2023-04-07', $tz), + new DateTime('2023-10-07', $tz), + ), + $result + ); + + } + + /** + * @depends testValues + */ + function testYearlyByMonthByDay() { + + $ev = new Component('VEVENT'); + $ev->UID = 'bla'; + $ev->RRULE = 'FREQ=YEARLY;COUNT=8;INTERVAL=5;BYMONTH=4,10;BYDAY=1MO,-1SU'; + $dtStart = new Property\DateTime('DTSTART'); + $dtStart->setDateTime(new DateTime('2011-04-04', new DateTimeZone('UTC')),Property\DateTime::UTC); + + $ev->add($dtStart); + + $vcal = Component::create('VCALENDAR'); + $vcal->add($ev); + + $it = new RecurrenceIterator($vcal,(string)$ev->uid); + + $this->assertEquals('yearly', $it->frequency); + $this->assertEquals(5, $it->interval); + $this->assertEquals(8, $it->count); + $this->assertEquals(array(4,10), $it->byMonth); + $this->assertEquals(array('1MO','-1SU'), $it->byDay); + + $max = 20; + $result = array(); + foreach($it as $k=>$item) { + + $result[] = $item; + $max--; + + if (!$max) break; + + } + + $tz = new DateTimeZone('UTC'); + + $this->assertEquals( + array( + new DateTime('2011-04-04', $tz), + new DateTime('2011-04-24', $tz), + new DateTime('2011-10-03', $tz), + new DateTime('2011-10-30', $tz), + new DateTime('2016-04-04', $tz), + new DateTime('2016-04-24', $tz), + new DateTime('2016-10-03', $tz), + new DateTime('2016-10-30', $tz), + ), + $result + ); + + } + + /** + * @depends testValues + */ + function testFastForward() { + + $ev = new Component('VEVENT'); + $ev->UID = 'bla'; + $ev->RRULE = 'FREQ=YEARLY;COUNT=8;INTERVAL=5;BYMONTH=4,10;BYDAY=1MO,-1SU'; + $dtStart = new Property\DateTime('DTSTART'); + $dtStart->setDateTime(new DateTime('2011-04-04', new DateTimeZone('UTC')),Property\DateTime::UTC); + + $ev->add($dtStart); + + $vcal = Component::create('VCALENDAR'); + $vcal->add($ev); + + $it = new RecurrenceIterator($vcal,(string)$ev->uid); + + // The idea is that we're fast-forwarding too far in the future, so + // there will be no results left. + $it->fastForward(new DateTime('2020-05-05', new DateTimeZone('UTC'))); + + $max = 20; + $result = array(); + while($item = $it->current()) { + + $result[] = $item; + $max--; + + if (!$max) break; + $it->next(); + + } + + $tz = new DateTimeZone('UTC'); + $this->assertEquals(array(), $result); + + } + + /** + * @depends testValues + */ + function testComplexExclusions() { + + $ev = new Component('VEVENT'); + $ev->UID = 'bla'; + $ev->RRULE = 'FREQ=YEARLY;COUNT=10'; + $dtStart = new Property\DateTime('DTSTART'); + + $tz = new DateTimeZone('Canada/Eastern'); + $dtStart->setDateTime(new DateTime('2011-01-01 13:50:20', $tz),Property\DateTime::LOCALTZ); + + $exDate1 = new Property\MultiDateTime('EXDATE'); + $exDate1->setDateTimes(array(new DateTime('2012-01-01 13:50:20', $tz), new DateTime('2014-01-01 13:50:20', $tz)), Property\DateTime::LOCALTZ); + $exDate2 = new Property\MultiDateTime('EXDATE'); + $exDate2->setDateTimes(array(new DateTime('2016-01-01 13:50:20', $tz)), Property\DateTime::LOCALTZ); + + $ev->add($dtStart); + $ev->add($exDate1); + $ev->add($exDate2); + + $vcal = Component::create('VCALENDAR'); + $vcal->add($ev); + + $it = new RecurrenceIterator($vcal,(string)$ev->uid); + + $this->assertEquals('yearly', $it->frequency); + $this->assertEquals(1, $it->interval); + $this->assertEquals(10, $it->count); + + $max = 20; + $result = array(); + foreach($it as $k=>$item) { + + $result[] = $item; + $max--; + + if (!$max) break; + + } + + $this->assertEquals( + array( + new DateTime('2011-01-01 13:50:20', $tz), + new DateTime('2013-01-01 13:50:20', $tz), + new DateTime('2015-01-01 13:50:20', $tz), + new DateTime('2017-01-01 13:50:20', $tz), + new DateTime('2018-01-01 13:50:20', $tz), + new DateTime('2019-01-01 13:50:20', $tz), + new DateTime('2020-01-01 13:50:20', $tz), + ), + $result + ); + + } + + /** + * @depends testValues + */ + function testOverridenEvent() { + + $vcal = Component::create('VCALENDAR'); + + $ev1 = Component::create('VEVENT'); + $ev1->UID = 'overridden'; + $ev1->RRULE = 'FREQ=DAILY;COUNT=10'; + $ev1->DTSTART = '20120107T120000Z'; + $ev1->SUMMARY = 'baseEvent'; + + $vcal->add($ev1); + + // ev2 overrides an event, and puts it on 2pm instead. + $ev2 = Component::create('VEVENT'); + $ev2->UID = 'overridden'; + $ev2->{'RECURRENCE-ID'} = '20120110T120000Z'; + $ev2->DTSTART = '20120110T140000Z'; + $ev2->SUMMARY = 'Event 2'; + + $vcal->add($ev2); + + // ev3 overrides an event, and puts it 2 days and 2 hours later + $ev3 = Component::create('VEVENT'); + $ev3->UID = 'overridden'; + $ev3->{'RECURRENCE-ID'} = '20120113T120000Z'; + $ev3->DTSTART = '20120115T140000Z'; + $ev3->SUMMARY = 'Event 3'; + + $vcal->add($ev3); + + $it = new RecurrenceIterator($vcal,'overridden'); + + $dates = array(); + $summaries = array(); + while($it->valid()) { + + $dates[] = $it->getDTStart(); + $summaries[] = (string)$it->getEventObject()->SUMMARY; + $it->next(); + + } + + $tz = new DateTimeZone('GMT'); + $this->assertEquals(array( + new DateTime('2012-01-07 12:00:00',$tz), + new DateTime('2012-01-08 12:00:00',$tz), + new DateTime('2012-01-09 12:00:00',$tz), + new DateTime('2012-01-10 14:00:00',$tz), + new DateTime('2012-01-11 12:00:00',$tz), + new DateTime('2012-01-12 12:00:00',$tz), + new DateTime('2012-01-14 12:00:00',$tz), + new DateTime('2012-01-15 12:00:00',$tz), + new DateTime('2012-01-15 14:00:00',$tz), + new DateTime('2012-01-16 12:00:00',$tz), + ), $dates); + + $this->assertEquals(array( + 'baseEvent', + 'baseEvent', + 'baseEvent', + 'Event 2', + 'baseEvent', + 'baseEvent', + 'baseEvent', + 'baseEvent', + 'Event 3', + 'baseEvent', + ), $summaries); + + } + + /** + * @depends testValues + */ + function testOverridenEvent2() { + + $vcal = Component::create('VCALENDAR'); + + $ev1 = Component::create('VEVENT'); + $ev1->UID = 'overridden'; + $ev1->RRULE = 'FREQ=WEEKLY;COUNT=3'; + $ev1->DTSTART = '20120112T120000Z'; + $ev1->SUMMARY = 'baseEvent'; + + $vcal->add($ev1); + + // ev2 overrides an event, and puts it 6 days earlier instead. + $ev2 = Component::create('VEVENT'); + $ev2->UID = 'overridden'; + $ev2->{'RECURRENCE-ID'} = '20120119T120000Z'; + $ev2->DTSTART = '20120113T120000Z'; + $ev2->SUMMARY = 'Override!'; + + $vcal->add($ev2); + + $it = new RecurrenceIterator($vcal,'overridden'); + + $dates = array(); + $summaries = array(); + while($it->valid()) { + + $dates[] = $it->getDTStart(); + $summaries[] = (string)$it->getEventObject()->SUMMARY; + $it->next(); + + } + + $tz = new DateTimeZone('GMT'); + $this->assertEquals(array( + new DateTime('2012-01-12 12:00:00',$tz), + new DateTime('2012-01-13 12:00:00',$tz), + new DateTime('2012-01-26 12:00:00',$tz), + + ), $dates); + + $this->assertEquals(array( + 'baseEvent', + 'Override!', + 'baseEvent', + ), $summaries); + + } + + /** + * @depends testValues + */ + function testOverridenEventNoValuesExpected() { + + $vcal = Component::create('VCALENDAR'); + + $ev1 = Component::create('VEVENT'); + $ev1->UID = 'overridden'; + $ev1->RRULE = 'FREQ=WEEKLY;COUNT=3'; + $ev1->DTSTART = '20120124T120000Z'; + $ev1->SUMMARY = 'baseEvent'; + + $vcal->add($ev1); + + // ev2 overrides an event, and puts it 6 days earlier instead. + $ev2 = Component::create('VEVENT'); + $ev2->UID = 'overridden'; + $ev2->{'RECURRENCE-ID'} = '20120131T120000Z'; + $ev2->DTSTART = '20120125T120000Z'; + $ev2->SUMMARY = 'Override!'; + + $vcal->add($ev2); + + $it = new RecurrenceIterator($vcal,'overridden'); + + $dates = array(); + $summaries = array(); + + // The reported problem was specifically related to the VCALENDAR + // expansion. In this parcitular case, we had to forward to the 28th of + // january. + $it->fastForward(new DateTime('2012-01-28 23:00:00')); + + // We stop the loop when it hits the 6th of februari. Normally this + // iterator would hit 24, 25 (overriden from 31) and 7 feb but because + // we 'filter' from the 28th till the 6th, we should get 0 results. + while($it->valid() && $it->getDTSTart() < new DateTime('2012-02-06 23:00:00')) { + + $dates[] = $it->getDTStart(); + $summaries[] = (string)$it->getEventObject()->SUMMARY; + $it->next(); + + } + + $this->assertEquals(array(), $dates); + $this->assertEquals(array(), $summaries); + + } +} + diff --git a/dav/sabre-vobject/tests/Sabre/VObject/TimeZoneUtilTest.php b/dav/sabre-vobject/tests/Sabre/VObject/TimeZoneUtilTest.php new file mode 100644 index 00000000..1f13ccbc --- /dev/null +++ b/dav/sabre-vobject/tests/Sabre/VObject/TimeZoneUtilTest.php @@ -0,0 +1,155 @@ +assertEquals(new \DateTimeZone('Europe/Sarajevo'), $tz); + + } + + function testUnknownExchangeId() { + + $vobj = <<assertEquals(new \DateTimeZone(date_default_timezone_get()), $tz); + + } + + function testWindowsTimeZone() { + + $tz = TimeZoneUtil::getTimeZone('Eastern Standard Time'); + $this->assertEquals(new \DateTimeZone('America/New_York'), $tz); + + } + + function testFallBack() { + + $vobj = <<assertEquals(new \DateTimeZone(date_default_timezone_get()), $tz); + + } + +} diff --git a/dav/sabre-vobject/tests/Sabre/VObject/VersionTest.php b/dav/sabre-vobject/tests/Sabre/VObject/VersionTest.php new file mode 100644 index 00000000..ae6855e8 --- /dev/null +++ b/dav/sabre-vobject/tests/Sabre/VObject/VersionTest.php @@ -0,0 +1,17 @@ +assertEquals(-1, version_compare('0.9.0',$v)); + + $s = Version::STABILITY; + $this->assertTrue($s == 'alpha' || $s == 'beta' || $s =='stable'); + + } + +} diff --git a/dav/sabre-vobject/tests/Sabre/VObject/issue153.vcf b/dav/sabre-vobject/tests/Sabre/VObject/issue153.vcf new file mode 100644 index 00000000..5fb0fa29 --- /dev/null +++ b/dav/sabre-vobject/tests/Sabre/VObject/issue153.vcf @@ -0,0 +1,352 @@ +BEGIN:VCARD +VERSION:3.0 +N:Benutzer;Test;;; +FN:Test Benutzer +PHOTO;BASE64: + /9j/4AAQSkZJRgABAQAAAQABAAD/4QBYRXhpZgAATU0AKgAAAAgAAgESAAMAAAABAAE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rCJN4YMd3p + V+wt8szRZUCnYDXsWSGPz7jGI+SMVVuvErXKEWuRk9QMYqXVyLXTUyRmRcmsSC4EAO8D2pAXxbma + IMR8w7+tVdRtkUAT9ew71as7wsF2nFGsKodDOMzHo/YU0rgULe7j098qW545Gaki1FIbwzeYyzfw + EdvyqkyGSfaw+bvRcQLayqyEnAyaQHR6gi6/pXnBER0IGFHzN15rnmlXyTGRuQHByeQau2GrS20G + 9OhO3H1//VWhf6RprXbXmnrMtuYsOjNk78DkfiDQBi2rpHIVQjb1otHPnBZAMAdRVUQiW6Bgyis2 + Buq29q2nXJjn/eDsycUAOLCG8yg9zkcVCzeVIZY+cenekN0LqYRSHAHA9aLMCOTy5BlTyPegCxa6 + ltkL2+ORzxjFWbTXpLSV3Y84+XFVJvLilKjgVFMpAyBxQBq6prEF7bQSzA+ZJ97jpVRGjDbUJAB+ + U+tUywlJUdE6VteHLK3kuoDqQZ0zyAcYFAG3feVo+io90u2d13R/LyR35rm77VZNSmzC5SEj5hnH + 14/Otu+hv/FN3gTWywW4KRqQM4/OsUeFZp5miaVAc9R0oAaXWa0EUWCIjuA9PeqEMbCYM3G77oAr + bi8Gz2YDmeLc3ygev61X1CxnnuTE8TvPb9fKXigDMuIJFlBdtzHnAPSrEF0IwDCm5hw2VNRzxTWt + 0BeKVMnTIxj8KZ/ahtgY49uT7UAX7VH1K63oERVOTxiuu0ex0nS7L7chJkm+R1kwwyPQZrh4JJDw + zbVbk4/OrNpefLsnyyg5UUAf/9k= +END:VCARD diff --git a/dav/sabre-vobject/tests/bootstrap.php b/dav/sabre-vobject/tests/bootstrap.php new file mode 100644 index 00000000..ee071ea7 --- /dev/null +++ b/dav/sabre-vobject/tests/bootstrap.php @@ -0,0 +1,4 @@ + + + Sabre/ + + + + + ../lib/ + + +