summaryrefslogtreecommitdiffstats
path: root/3rdparty/Sabre/VObject
diff options
context:
space:
mode:
Diffstat (limited to '3rdparty/Sabre/VObject')
-rw-r--r--[-rwxr-xr-x]3rdparty/Sabre/VObject/Component.php136
-rw-r--r--[-rwxr-xr-x]3rdparty/Sabre/VObject/Component/VAlarm.php34
-rw-r--r--[-rwxr-xr-x]3rdparty/Sabre/VObject/Component/VCalendar.php129
-rw-r--r--3rdparty/Sabre/VObject/Component/VCard.php105
-rw-r--r--[-rwxr-xr-x]3rdparty/Sabre/VObject/Component/VEvent.php21
-rw-r--r--3rdparty/Sabre/VObject/Component/VFreeBusy.php68
-rw-r--r--[-rwxr-xr-x]3rdparty/Sabre/VObject/Component/VJournal.php14
-rw-r--r--[-rwxr-xr-x]3rdparty/Sabre/VObject/Component/VTodo.php14
-rw-r--r--[-rwxr-xr-x]3rdparty/Sabre/VObject/DateTimeParser.php28
-rwxr-xr-x3rdparty/Sabre/VObject/Element.php16
-rwxr-xr-x3rdparty/Sabre/VObject/Element/DateTime.php37
-rwxr-xr-x3rdparty/Sabre/VObject/Element/MultiDateTime.php17
-rw-r--r--[-rwxr-xr-x]3rdparty/Sabre/VObject/ElementList.php12
-rw-r--r--[-rwxr-xr-x]3rdparty/Sabre/VObject/FreeBusyGenerator.php97
-rw-r--r--[-rwxr-xr-x]3rdparty/Sabre/VObject/Node.php60
-rw-r--r--[-rwxr-xr-x]3rdparty/Sabre/VObject/Parameter.php10
-rw-r--r--[-rwxr-xr-x]3rdparty/Sabre/VObject/ParseException.php8
-rw-r--r--[-rwxr-xr-x]3rdparty/Sabre/VObject/Property.php170
-rw-r--r--3rdparty/Sabre/VObject/Property/Compound.php129
-rw-r--r--[-rwxr-xr-x]3rdparty/Sabre/VObject/Property/DateTime.php91
-rw-r--r--[-rwxr-xr-x]3rdparty/Sabre/VObject/Property/MultiDateTime.php32
-rw-r--r--[-rwxr-xr-x]3rdparty/Sabre/VObject/Reader.php78
-rw-r--r--[-rwxr-xr-x]3rdparty/Sabre/VObject/RecurrenceIterator.php58
-rw-r--r--3rdparty/Sabre/VObject/Splitter/ICalendar.php111
-rw-r--r--3rdparty/Sabre/VObject/Splitter/SplitterInterface.php39
-rw-r--r--3rdparty/Sabre/VObject/Splitter/VCard.php76
-rw-r--r--3rdparty/Sabre/VObject/StringUtil.php61
-rw-r--r--3rdparty/Sabre/VObject/TimeZoneUtil.php351
-rw-r--r--[-rwxr-xr-x]3rdparty/Sabre/VObject/Version.php8
-rwxr-xr-x3rdparty/Sabre/VObject/WindowsTimezoneMap.php128
-rw-r--r--[-rwxr-xr-x]3rdparty/Sabre/VObject/includes.php23
31 files changed, 1616 insertions, 545 deletions
diff --git a/3rdparty/Sabre/VObject/Component.php b/3rdparty/Sabre/VObject/Component.php
index b78a26133fa..7604e3a9bb8 100755..100644
--- a/3rdparty/Sabre/VObject/Component.php
+++ b/3rdparty/Sabre/VObject/Component.php
@@ -1,5 +1,7 @@
<?php
+namespace Sabre\VObject;
+
/**
* VObject Component
*
@@ -7,13 +9,11 @@
* VEVENT, VTODO and also VCALENDAR. It starts with BEGIN:COMPONENTNAME and
* ends with END:COMPONENTNAME
*
- * @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_Component extends Sabre_VObject_Element {
+class Component extends Node {
/**
* Name, for example VEVENT
@@ -30,18 +30,20 @@ class Sabre_VObject_Component extends Sabre_VObject_Element {
public $children = array();
/**
- * If coponents are added to this map, they will be automatically mapped
+ * If components are added to this map, they will be automatically mapped
* to their respective classes, if parsed by the reader or constructed with
* the 'create' method.
*
* @var array
*/
static public $classMap = array(
- 'VCALENDAR' => 'Sabre_VObject_Component_VCalendar',
- 'VEVENT' => 'Sabre_VObject_Component_VEvent',
- 'VTODO' => 'Sabre_VObject_Component_VTodo',
- 'VJOURNAL' => 'Sabre_VObject_Component_VJournal',
- 'VALARM' => 'Sabre_VObject_Component_VAlarm',
+ 'VALARM' => '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',
+ 'VFREEBUSY' => 'Sabre\\VObject\\Component\\VFreeBusy',
);
/**
@@ -50,7 +52,7 @@ class Sabre_VObject_Component extends Sabre_VObject_Element {
*
* @param string $name
* @param string $value
- * @return Sabre_VObject_Component
+ * @return Component
*/
static public function create($name, $value = null) {
@@ -71,9 +73,9 @@ class Sabre_VObject_Component extends Sabre_VObject_Element {
* be overridden with the iterator argument
*
* @param string $name
- * @param Sabre_VObject_ElementList $iterator
+ * @param ElementList $iterator
*/
- public function __construct($name, Sabre_VObject_ElementList $iterator = null) {
+ public function __construct($name, ElementList $iterator = null) {
$this->name = strtoupper($name);
if (!is_null($iterator)) $this->iterator = $iterator;
@@ -94,40 +96,54 @@ class Sabre_VObject_Component extends Sabre_VObject_Element {
*
* This is solely used by the childrenSort method.
*
- * A higher score means the item will be higher in the list
+ * 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 Sabre_VObject_Node $n
+ * @param int $key
+ * @param array $array
* @return int
*/
- $sortScore = function($n) {
+ $sortScore = function($key, $array) {
+
+ if ($array[$key] instanceof Component) {
- if ($n instanceof Sabre_VObject_Component) {
// We want to encode VTIMEZONE first, this is a personal
// preference.
- if ($n->name === 'VTIMEZONE') {
- return 1;
+ if ($array[$key]->name === 'VTIMEZONE') {
+ $score=300000000;
+ return $score+$key;
} else {
- return 0;
+ $score=400000000;
+ return $score+$key;
}
} else {
+ // Properties get encoded first
// VCARD version 4.0 wants the VERSION property to appear first
- if ($n->name === 'VERSION') {
- return 3;
- } else {
- return 2;
+ if ($array[$key] instanceof Property) {
+ if ($array[$key]->name === 'VERSION') {
+ $score=100000000;
+ return $score+$key;
+ } else {
+ // All other properties
+ $score=200000000;
+ return $score+$key;
+ }
}
}
};
- usort($this->children, function($a, $b) use ($sortScore) {
+ $tmp = $this->children;
+ uksort($this->children, function($a, $b) use ($sortScore, $tmp) {
- $sA = $sortScore($a);
- $sB = $sortScore($b);
+ $sA = $sortScore($a, $tmp);
+ $sB = $sortScore($b, $tmp);
if ($sA === $sB) return 0;
- return ($sA > $sB) ? -1 : 1;
+ return ($sA < $sB) ? -1 : 1;
});
@@ -143,8 +159,8 @@ class Sabre_VObject_Component extends Sabre_VObject_Element {
*
* You can call this method with the following syntaxes:
*
- * add(Sabre_VObject_Element $element)
- * add(string $name, $value)
+ * add(Node $node)
+ * add(string $name, $value, array $parameters = array())
*
* The first version adds an Element
* The second adds a property as a string.
@@ -153,26 +169,23 @@ class Sabre_VObject_Component extends Sabre_VObject_Element {
* @param mixed $itemValue
* @return void
*/
- public function add($item, $itemValue = null) {
+ public function add($item, $itemValue = null, array $parameters = array()) {
- if ($item instanceof Sabre_VObject_Element) {
+ if ($item instanceof Node) {
if (!is_null($itemValue)) {
- throw new InvalidArgumentException('The second argument must not be specified, when passing a VObject');
+ throw new \InvalidArgumentException('The second argument must not be specified, when passing a VObject Node');
}
$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 = 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');
+ throw new \InvalidArgumentException('The first argument must either be a \\Sabre\\VObject\\Node or a string');
}
@@ -181,11 +194,11 @@ class Sabre_VObject_Component extends Sabre_VObject_Element {
/**
* Returns an iterable list of children
*
- * @return Sabre_VObject_ElementList
+ * @return ElementList
*/
public function children() {
- return new Sabre_VObject_ElementList($this->children);
+ return new ElementList($this->children);
}
@@ -218,7 +231,7 @@ class Sabre_VObject_Component extends Sabre_VObject_Element {
if (
strtoupper($child->name) === $name &&
- (is_null($group) || ( $child instanceof Sabre_VObject_Property && strtoupper($child->group) === $group))
+ (is_null($group) || ( $child instanceof Property && strtoupper($child->group) === $group))
) {
$result[$key] = $child;
@@ -241,7 +254,7 @@ class Sabre_VObject_Component extends Sabre_VObject_Element {
$result = array();
foreach($this->children as $child) {
- if ($child instanceof Sabre_VObject_Component) {
+ if ($child instanceof Component) {
$result[] = $child;
}
}
@@ -250,6 +263,33 @@ class Sabre_VObject_Component extends Sabre_VObject_Element {
}
+ /**
+ * Validates the node for correctness.
+ *
+ * The following options are supported:
+ * - Node::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($options));
+ }
+ return $result;
+
+ }
+
/* Magic property accessors {{{ */
/**
@@ -259,7 +299,7 @@ class Sabre_VObject_Component extends Sabre_VObject_Element {
* null is returned.
*
* @param string $name
- * @return Sabre_VObject_Property
+ * @return Property
*/
public function __get($name) {
@@ -268,8 +308,8 @@ class Sabre_VObject_Component extends Sabre_VObject_Element {
return null;
} else {
$firstMatch = current($matches);
- /** @var $firstMatch Sabre_VObject_Property */
- $firstMatch->setIterator(new Sabre_VObject_ElementList(array_values($matches)));
+ /** @var $firstMatch Property */
+ $firstMatch->setIterator(new ElementList(array_values($matches)));
return $firstMatch;
}
@@ -291,7 +331,7 @@ class Sabre_VObject_Component extends Sabre_VObject_Element {
/**
* Using the setter method you can add properties or subcomponents
*
- * You can either pass a Sabre_VObject_Component, Sabre_VObject_Property
+ * 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
@@ -306,7 +346,7 @@ class Sabre_VObject_Component extends Sabre_VObject_Element {
$matches = $this->select($name);
$overWrite = count($matches)?key($matches):null;
- if ($value instanceof Sabre_VObject_Component || $value instanceof Sabre_VObject_Property) {
+ if ($value instanceof Component || $value instanceof Property) {
$value->parent = $this;
if (!is_null($overWrite)) {
$this->children[$overWrite] = $value;
@@ -314,7 +354,7 @@ class Sabre_VObject_Component extends Sabre_VObject_Element {
$this->children[] = $value;
}
} elseif (is_scalar($value)) {
- $property = Sabre_VObject_Property::create($name,$value);
+ $property = Property::create($name,$value);
$property->parent = $this;
if (!is_null($overWrite)) {
$this->children[$overWrite] = $property;
@@ -322,7 +362,7 @@ class Sabre_VObject_Component extends Sabre_VObject_Element {
$this->children[] = $property;
}
} else {
- throw new InvalidArgumentException('You must pass a Sabre_VObject_Component, Sabre_VObject_Property or scalar type');
+ throw new \InvalidArgumentException('You must pass a \\Sabre\\VObject\\Component, \\Sabre\\VObject\\Property or scalar type');
}
}
diff --git a/3rdparty/Sabre/VObject/Component/VAlarm.php b/3rdparty/Sabre/VObject/Component/VAlarm.php
index ebb4a9b18f6..383e16eef14 100755..100644
--- a/3rdparty/Sabre/VObject/Component/VAlarm.php
+++ b/3rdparty/Sabre/VObject/Component/VAlarm.php
@@ -1,17 +1,18 @@
<?php
+namespace Sabre\VObject\Component;
+use Sabre\VObject;
+
/**
* VAlarm component
*
* This component contains some additional functionality specific for VALARMs.
*
- * @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_Component_VAlarm extends Sabre_VObject_Component {
+class VAlarm extends VObject\Component {
/**
* Returns a DateTime object when this alarm is going to trigger.
@@ -24,12 +25,19 @@ class Sabre_VObject_Component_VAlarm extends Sabre_VObject_Component {
$trigger = $this->TRIGGER;
if(!isset($trigger['VALUE']) || strtoupper($trigger['VALUE']) === 'DURATION') {
- $triggerDuration = Sabre_VObject_DateTimeParser::parseDuration($this->TRIGGER);
+ $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();
+
+ if ($parentComponent->name === 'VTODO') {
+ $propName = 'DUE';
+ } else {
+ $propName = 'DTSTART';
+ }
+
+ $effectiveTrigger = clone $parentComponent->$propName->getDateTime();
$effectiveTrigger->add($triggerDuration);
} else {
if ($parentComponent->name === 'VTODO') {
@@ -37,7 +45,7 @@ class Sabre_VObject_Component_VAlarm extends Sabre_VObject_Component {
} 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');
+ 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)) {
@@ -45,7 +53,7 @@ class Sabre_VObject_Component_VAlarm extends Sabre_VObject_Component {
$effectiveTrigger->add($triggerDuration);
} elseif (isset($parentComponent->DURATION)) {
$effectiveTrigger = clone $parentComponent->DTSTART->getDateTime();
- $duration = Sabre_VObject_DateTimeParser::parseDuration($parentComponent->DURATION);
+ $duration = VObject\DateTimeParser::parseDuration($parentComponent->DURATION);
$effectiveTrigger->add($duration);
$effectiveTrigger->add($triggerDuration);
} else {
@@ -67,22 +75,22 @@ class Sabre_VObject_Component_VAlarm extends Sabre_VObject_Component {
* 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
+ * @param \DateTime $start
+ * @param \DateTime $end
* @return bool
*/
- public function isInTimeRange(DateTime $start, DateTime $end) {
+ public function isInTimeRange(\DateTime $start, \DateTime $end) {
$effectiveTrigger = $this->getEffectiveTriggerTime();
if (isset($this->DURATION)) {
- $duration = Sabre_VObject_DateTimeParser::parseDuration($this->DURATION);
+ $duration = VObject\DateTimeParser::parseDuration($this->DURATION);
$repeat = (string)$this->repeat;
if (!$repeat) {
$repeat = 1;
}
- $period = new DatePeriod($effectiveTrigger, $duration, (int)$repeat);
+ $period = new \DatePeriod($effectiveTrigger, $duration, (int)$repeat);
foreach($period as $occurrence) {
@@ -98,5 +106,3 @@ class Sabre_VObject_Component_VAlarm extends Sabre_VObject_Component {
}
}
-
-?>
diff --git a/3rdparty/Sabre/VObject/Component/VCalendar.php b/3rdparty/Sabre/VObject/Component/VCalendar.php
index f3be29afdbb..73f2f6d34fc 100755..100644
--- a/3rdparty/Sabre/VObject/Component/VCalendar.php
+++ b/3rdparty/Sabre/VObject/Component/VCalendar.php
@@ -1,17 +1,19 @@
<?php
+namespace Sabre\VObject\Component;
+
+use Sabre\VObject;
+
/**
* The VCalendar component
*
* This component adds functionality to a component, specific for a VCALENDAR.
*
- * @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_Component_VCalendar extends Sabre_VObject_Component {
+class VCalendar extends VObject\Component {
/**
* Returns a list of all 'base components'. For instance, if an Event has
@@ -28,7 +30,7 @@ class Sabre_VObject_Component_VCalendar extends Sabre_VObject_Component {
$components = array();
foreach($this->children as $component) {
- if (!$component instanceof Sabre_VObject_Component)
+ if (!$component instanceof VObject\Component)
continue;
if (isset($component->{'RECURRENCE-ID'}))
@@ -69,7 +71,7 @@ class Sabre_VObject_Component_VCalendar extends Sabre_VObject_Component {
* @param DateTime $end
* @return void
*/
- public function expand(DateTime $start, DateTime $end) {
+ public function expand(\DateTime $start, \DateTime $end) {
$newEvents = array();
@@ -91,10 +93,10 @@ class Sabre_VObject_Component_VCalendar extends Sabre_VObject_Component {
$uid = (string)$vevent->uid;
if (!$uid) {
- throw new LogicException('Event did not have a UID!');
+ throw new \LogicException('Event did not have a UID!');
}
- $it = new Sabre_VObject_RecurrenceIterator($this, $vevent->uid);
+ $it = new VObject\RecurrenceIterator($this, $vevent->uid);
$it->fastForward($start);
while($it->valid() && $it->getDTStart() < $end) {
@@ -114,9 +116,9 @@ class Sabre_VObject_Component_VCalendar extends Sabre_VObject_Component {
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);
+ if ($child instanceof VObject\Property\DateTime &&
+ $child->getDateType() == VObject\Property\DateTime::LOCALTZ) {
+ $child->setDateTime($child->getDateTime(),VObject\Property\DateTime::UTC);
}
}
@@ -129,5 +131,112 @@ class Sabre_VObject_Component_VCalendar extends Sabre_VObject_Component {
}
+ /**
+ * 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/3rdparty/Sabre/VObject/Component/VCard.php b/3rdparty/Sabre/VObject/Component/VCard.php
new file mode 100644
index 00000000000..b2926985550
--- /dev/null
+++ b/3rdparty/Sabre/VObject/Component/VCard.php
@@ -0,0 +1,105 @@
+<?php
+
+namespace Sabre\VObject\Component;
+
+use Sabre\VObject;
+
+/**
+ * The VCard component
+ *
+ * This component represents the BEGIN:VCARD and END:VCARD found in every
+ * vcard.
+ *
+ * @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 VCard extends VObject\Component {
+
+ /**
+ * VCards with version 2.1, 3.0 and 4.0 are found.
+ *
+ * If the VCARD doesn't know its version, 4.0 is assumed.
+ */
+ const DEFAULT_VERSION = '4.0';
+
+ /**
+ * Validates the node for correctness.
+ *
+ * The following options are supported:
+ * - Node::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) {
+
+ $warnings = array();
+
+ $version = $this->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/3rdparty/Sabre/VObject/Component/VEvent.php b/3rdparty/Sabre/VObject/Component/VEvent.php
index d6b910874d0..9d10966e203 100755..100644
--- a/3rdparty/Sabre/VObject/Component/VEvent.php
+++ b/3rdparty/Sabre/VObject/Component/VEvent.php
@@ -1,17 +1,18 @@
<?php
+namespace Sabre\VObject\Component;
+use Sabre\VObject;
+
/**
* VEvent component
*
* This component contains some additional functionality specific for VEVENT's.
*
- * @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_Component_VEvent extends Sabre_VObject_Component {
+class VEvent extends VObject\Component {
/**
* Returns true or false depending on if the event falls in the specified
@@ -20,14 +21,14 @@ class Sabre_VObject_Component_VEvent extends Sabre_VObject_Component {
* 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
+ * @param \DateTime $start
+ * @param \DateTime $end
* @return bool
*/
- public function isInTimeRange(DateTime $start, DateTime $end) {
+ public function isInTimeRange(\DateTime $start, \DateTime $end) {
if ($this->RRULE) {
- $it = new Sabre_VObject_RecurrenceIterator($this);
+ $it = new VObject\RecurrenceIterator($this);
$it->fastForward($start);
// We fast-forwarded to a spot where the end-time of the
@@ -53,8 +54,8 @@ class Sabre_VObject_Component_VEvent extends Sabre_VObject_Component {
} elseif (isset($this->DURATION)) {
$effectiveEnd = clone $effectiveStart;
- $effectiveEnd->add( Sabre_VObject_DateTimeParser::parseDuration($this->DURATION) );
- } elseif ($this->DTSTART->getDateType() == Sabre_VObject_Element_DateTime::DATE) {
+ $effectiveEnd->add( VObject\DateTimeParser::parseDuration($this->DURATION) );
+ } elseif ($this->DTSTART->getDateType() == VObject\Property\DateTime::DATE) {
$effectiveEnd = clone $effectiveStart;
$effectiveEnd->modify('+1 day');
} else {
@@ -67,5 +68,3 @@ class Sabre_VObject_Component_VEvent extends Sabre_VObject_Component {
}
}
-
-?>
diff --git a/3rdparty/Sabre/VObject/Component/VFreeBusy.php b/3rdparty/Sabre/VObject/Component/VFreeBusy.php
new file mode 100644
index 00000000000..d6da52cbd77
--- /dev/null
+++ b/3rdparty/Sabre/VObject/Component/VFreeBusy.php
@@ -0,0 +1,68 @@
+<?php
+
+namespace Sabre\VObject\Component;
+
+use Sabre\VObject;
+
+/**
+ * The VFreeBusy component
+ *
+ * This component adds functionality to a component, specific for VFREEBUSY
+ * components.
+ *
+ * @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 VFreeBusy extends VObject\Component {
+
+ /**
+ * Checks based on the contained FREEBUSY information, if a timeslot is
+ * available.
+ *
+ * @param DateTime $start
+ * @param Datetime $end
+ * @return bool
+ */
+ public function isFree(\DateTime $start, \Datetime $end) {
+
+ foreach($this->select('FREEBUSY') as $freebusy) {
+
+ // We are only interested in FBTYPE=BUSY (the default),
+ // FBTYPE=BUSY-TENTATIVE or FBTYPE=BUSY-UNAVAILABLE.
+ if (isset($freebusy['FBTYPE']) && strtoupper(substr((string)$freebusy['FBTYPE'],0,4))!=='BUSY') {
+ continue;
+ }
+
+ // The freebusy component can hold more than 1 value, separated by
+ // commas.
+ $periods = explode(',', (string)$freebusy);
+
+ foreach($periods as $period) {
+ // Every period is formatted as [start]/[end]. The start is an
+ // absolute UTC time, the end may be an absolute UTC time, or
+ // duration (relative) value.
+ list($busyStart, $busyEnd) = explode('/', $period);
+
+ $busyStart = VObject\DateTimeParser::parse($busyStart);
+ $busyEnd = VObject\DateTimeParser::parse($busyEnd);
+ if ($busyEnd instanceof \DateInterval) {
+ $tmp = clone $busyStart;
+ $tmp->add($busyEnd);
+ $busyEnd = $tmp;
+ }
+
+ if($start < $busyEnd && $end > $busyStart) {
+ return false;
+ }
+
+ }
+
+ }
+
+ return true;
+
+ }
+
+}
+
diff --git a/3rdparty/Sabre/VObject/Component/VJournal.php b/3rdparty/Sabre/VObject/Component/VJournal.php
index 22b3ec921e5..f104a1f66ed 100755..100644
--- a/3rdparty/Sabre/VObject/Component/VJournal.php
+++ b/3rdparty/Sabre/VObject/Component/VJournal.php
@@ -1,17 +1,19 @@
<?php
+namespace Sabre\VObject\Component;
+
+use Sabre\VObject;
+
/**
* VJournal component
*
* This component contains some additional functionality specific for VJOURNALs.
*
- * @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_Component_VJournal extends Sabre_VObject_Component {
+class VJournal extends VObject\Component {
/**
* Returns true or false depending on if the event falls in the specified
@@ -24,12 +26,12 @@ class Sabre_VObject_Component_VJournal extends Sabre_VObject_Component {
* @param DateTime $end
* @return bool
*/
- public function isInTimeRange(DateTime $start, DateTime $end) {
+ public function isInTimeRange(\DateTime $start, \DateTime $end) {
$dtstart = isset($this->DTSTART)?$this->DTSTART->getDateTime():null;
if ($dtstart) {
$effectiveEnd = clone $dtstart;
- if ($this->DTSTART->getDateType() == Sabre_VObject_Element_DateTime::DATE) {
+ if ($this->DTSTART->getDateType() == VObject\Property\DateTime::DATE) {
$effectiveEnd->modify('+1 day');
}
@@ -42,5 +44,3 @@ class Sabre_VObject_Component_VJournal extends Sabre_VObject_Component {
}
}
-
-?>
diff --git a/3rdparty/Sabre/VObject/Component/VTodo.php b/3rdparty/Sabre/VObject/Component/VTodo.php
index 79d06298d7f..5f879aea435 100755..100644
--- a/3rdparty/Sabre/VObject/Component/VTodo.php
+++ b/3rdparty/Sabre/VObject/Component/VTodo.php
@@ -1,17 +1,19 @@
<?php
+namespace Sabre\VObject\Component;
+
+use Sabre\VObject;
+
/**
* VTodo component
*
* This component contains some additional functionality specific for VTODOs.
*
- * @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_Component_VTodo extends Sabre_VObject_Component {
+class VTodo extends VObject\Component {
/**
* Returns true or false depending on if the event falls in the specified
@@ -24,10 +26,10 @@ class Sabre_VObject_Component_VTodo extends Sabre_VObject_Component {
* @param DateTime $end
* @return bool
*/
- public function isInTimeRange(DateTime $start, DateTime $end) {
+ public function isInTimeRange(\DateTime $start, \DateTime $end) {
$dtstart = isset($this->DTSTART)?$this->DTSTART->getDateTime():null;
- $duration = isset($this->DURATION)?Sabre_VObject_DateTimeParser::parseDuration($this->DURATION):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;
@@ -64,5 +66,3 @@ class Sabre_VObject_Component_VTodo extends Sabre_VObject_Component {
}
}
-
-?>
diff --git a/3rdparty/Sabre/VObject/DateTimeParser.php b/3rdparty/Sabre/VObject/DateTimeParser.php
index 23a4bb69916..d09ded96768 100755..100644
--- a/3rdparty/Sabre/VObject/DateTimeParser.php
+++ b/3rdparty/Sabre/VObject/DateTimeParser.php
@@ -1,18 +1,18 @@
<?php
+namespace Sabre\VObject;
+
/**
* DateTimeParser
*
* This class is responsible for parsing the several different date and time
* formats iCalendar and vCards have.
*
- * @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_DateTimeParser {
+class DateTimeParser {
/**
* Parses an iCalendar (rfc5545) formatted datetime and returns a DateTime object
@@ -25,22 +25,22 @@ class Sabre_VObject_DateTimeParser {
* @param DateTimeZone $tz
* @return DateTime
*/
- static public function parseDateTime($dt,DateTimeZone $tz = null) {
+ static public function parseDateTime($dt,\DateTimeZone $tz = null) {
// Format is YYYYMMDD + "T" + hhmmss
- $result = preg_match('/^([1-3][0-9]{3})([0-1][0-9])([0-3][0-9])T([0-2][0-9])([0-5][0-9])([0-5][0-9])([Z]?)$/',$dt,$matches);
+ $result = preg_match('/^([1-4][0-9]{3})([0-1][0-9])([0-3][0-9])T([0-2][0-9])([0-5][0-9])([0-5][0-9])([Z]?)$/',$dt,$matches);
if (!$result) {
- throw new Sabre_DAV_Exception_BadRequest('The supplied iCalendar datetime value is incorrect: ' . $dt);
+ throw new \LogicException('The supplied iCalendar datetime value is incorrect: ' . $dt);
}
if ($matches[7]==='Z' || is_null($tz)) {
- $tz = new DateTimeZone('UTC');
+ $tz = new \DateTimeZone('UTC');
}
- $date = new DateTime($matches[1] . '-' . $matches[2] . '-' . $matches[3] . ' ' . $matches[4] . ':' . $matches[5] .':' . $matches[6], $tz);
+ $date = new \DateTime($matches[1] . '-' . $matches[2] . '-' . $matches[3] . ' ' . $matches[4] . ':' . $matches[5] .':' . $matches[6], $tz);
// Still resetting the timezone, to normalize everything to UTC
- $date->setTimeZone(new DateTimeZone('UTC'));
+ $date->setTimeZone(new \DateTimeZone('UTC'));
return $date;
}
@@ -54,13 +54,13 @@ class Sabre_VObject_DateTimeParser {
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);
+ $result = preg_match('/^([1-4][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);
+ throw new \LogicException('The supplied iCalendar date value is incorrect: ' . $date);
}
- $date = new DateTime($matches[1] . '-' . $matches[2] . '-' . $matches[3], new DateTimeZone('UTC'));
+ $date = new \DateTime($matches[1] . '-' . $matches[2] . '-' . $matches[3], new \DateTimeZone('UTC'));
return $date;
}
@@ -79,7 +79,7 @@ class Sabre_VObject_DateTimeParser {
$result = preg_match('/^(?P<plusminus>\+|-)?P((?P<week>\d+)W)?((?P<day>\d+)D)?(T((?P<hour>\d+)H)?((?P<minute>\d+)M)?((?P<second>\d+)S)?)?$/', $duration, $matches);
if (!$result) {
- throw new Sabre_DAV_Exception_BadRequest('The supplied iCalendar duration value is incorrect: ' . $duration);
+ throw new \LogicException('The supplied iCalendar duration value is incorrect: ' . $duration);
}
if (!$asString) {
@@ -128,7 +128,7 @@ class Sabre_VObject_DateTimeParser {
if ($duration==='P') {
$duration = 'PT0S';
}
- $iv = new DateInterval($duration);
+ $iv = new \DateInterval($duration);
if ($invert) $iv->invert = true;
return $iv;
diff --git a/3rdparty/Sabre/VObject/Element.php b/3rdparty/Sabre/VObject/Element.php
deleted file mode 100755
index e20ff0b353c..00000000000
--- a/3rdparty/Sabre/VObject/Element.php
+++ /dev/null
@@ -1,16 +0,0 @@
-<?php
-
-/**
- * Base class for all elements
- *
- * @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
- */
-abstract class Sabre_VObject_Element extends Sabre_VObject_Node {
-
- public $parent = null;
-
-}
diff --git a/3rdparty/Sabre/VObject/Element/DateTime.php b/3rdparty/Sabre/VObject/Element/DateTime.php
deleted file mode 100755
index 5e5eb7ab6f2..00000000000
--- a/3rdparty/Sabre/VObject/Element/DateTime.php
+++ /dev/null
@@ -1,37 +0,0 @@
-<?php
-
-/**
- * DateTime property
- *
- * this class got renamed to Sabre_VObject_Property_DateTime
- *
- * @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
- * @deprecated
- */
-class Sabre_VObject_Element_DateTime extends Sabre_VObject_Property_DateTime {
-
- /**
- * Local 'floating' time
- */
- const LOCAL = 1;
-
- /**
- * UTC-based time
- */
- const UTC = 2;
-
- /**
- * Local time plus timezone
- */
- const LOCALTZ = 3;
-
- /**
- * Only a date, time is ignored
- */
- const DATE = 4;
-
-}
diff --git a/3rdparty/Sabre/VObject/Element/MultiDateTime.php b/3rdparty/Sabre/VObject/Element/MultiDateTime.php
deleted file mode 100755
index 8a12ced94a8..00000000000
--- a/3rdparty/Sabre/VObject/Element/MultiDateTime.php
+++ /dev/null
@@ -1,17 +0,0 @@
-<?php
-
-/**
- * Multi-DateTime property
- *
- * This class got renamed to Sabre_VObject_Property_MultiDateTime
- *
- * @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
- * @deprecated
- */
-class Sabre_VObject_Element_MultiDateTime extends Sabre_VObject_Property_MultiDateTime {
-
-}
diff --git a/3rdparty/Sabre/VObject/ElementList.php b/3rdparty/Sabre/VObject/ElementList.php
index 7e508db20f0..b7f1c8eee22 100755..100644
--- a/3rdparty/Sabre/VObject/ElementList.php
+++ b/3rdparty/Sabre/VObject/ElementList.php
@@ -1,18 +1,18 @@
<?php
+namespace Sabre\VObject;
+
/**
* VObject ElementList
*
* This class represents a list of elements. Lists are the result of queries,
* such as doing $vcalendar->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 {
+class ElementList implements \Iterator, \Countable, \ArrayAccess {
/**
* Inner elements
@@ -44,7 +44,7 @@ class Sabre_VObject_ElementList implements Iterator, Countable, ArrayAccess {
/**
* Returns current item in iteration
*
- * @return Sabre_VObject_Element
+ * @return Element
*/
public function current() {
@@ -149,7 +149,7 @@ class Sabre_VObject_ElementList implements Iterator, Countable, ArrayAccess {
*/
public function offsetSet($offset,$value) {
- throw new LogicException('You can not add new objects to an ElementList');
+ throw new \LogicException('You can not add new objects to an ElementList');
}
@@ -163,7 +163,7 @@ class Sabre_VObject_ElementList implements Iterator, Countable, ArrayAccess {
*/
public function offsetUnset($offset) {
- throw new LogicException('You can not remove objects from an ElementList');
+ throw new \LogicException('You can not remove objects from an ElementList');
}
diff --git a/3rdparty/Sabre/VObject/FreeBusyGenerator.php b/3rdparty/Sabre/VObject/FreeBusyGenerator.php
index 1c96a64a004..c607d119ced 100755..100644
--- a/3rdparty/Sabre/VObject/FreeBusyGenerator.php
+++ b/3rdparty/Sabre/VObject/FreeBusyGenerator.php
@@ -1,5 +1,7 @@
<?php
+namespace Sabre\VObject;
+
/**
* This class helps with generating FREEBUSY reports based on existing sets of
* objects.
@@ -10,13 +12,11 @@
* VFREEBUSY components are described in RFC5545, The rules for what should
* go in a single freebusy report is taken from RFC4791, section 7.10.
*
- * @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_FreeBusyGenerator {
+class FreeBusyGenerator {
/**
* Input objects
@@ -42,11 +42,34 @@ class Sabre_VObject_FreeBusyGenerator {
/**
* VCALENDAR object
*
- * @var Sabre_VObject_Component
+ * @var Component
*/
protected $baseObject;
/**
+ * Creates the generator.
+ *
+ * Check the setTimeRange and setObjects methods for details about the
+ * arguments.
+ *
+ * @param DateTime $start
+ * @param DateTime $end
+ * @param mixed $objects
+ * @return void
+ */
+ public function __construct(\DateTime $start = null, \DateTime $end = null, $objects = null) {
+
+ if ($start && $end) {
+ $this->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
@@ -54,10 +77,10 @@ class Sabre_VObject_FreeBusyGenerator {
*
* The VFREEBUSY object will be automatically added though.
*
- * @param Sabre_VObject_Component $vcalendar
+ * @param Component $vcalendar
* @return void
*/
- public function setBaseObject(Sabre_VObject_Component $vcalendar) {
+ public function setBaseObject(Component $vcalendar) {
$this->baseObject = $vcalendar;
@@ -66,22 +89,28 @@ class Sabre_VObject_FreeBusyGenerator {
/**
* Sets the input objects
*
- * Every object must either be a string or a Sabre_VObject_Component.
+ * 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 array $objects
+ * @param mixed $objects
* @return void
*/
- public function setObjects(array $objects) {
+ public function setObjects($objects) {
+
+ if (!is_array($objects)) {
+ $objects = 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[] = 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');
+ throw new \InvalidArgumentException('You can only pass strings or \\Sabre\\VObject\\Component arguments to setObjects');
}
}
@@ -97,7 +126,7 @@ class Sabre_VObject_FreeBusyGenerator {
* @param DateTime $end
* @return void
*/
- public function setTimeRange(DateTime $start = null, DateTime $end = null) {
+ public function setTimeRange(\DateTime $start = null, \DateTime $end = null) {
$this->start = $start;
$this->end = $end;
@@ -108,7 +137,7 @@ class Sabre_VObject_FreeBusyGenerator {
* Parses the input data and returns a correct VFREEBUSY object, wrapped in
* a VCALENDAR.
*
- * @return Sabre_VObject_Component
+ * @return Component
*/
public function getResult() {
@@ -140,7 +169,7 @@ class Sabre_VObject_FreeBusyGenerator {
if ($component->RRULE) {
- $iterator = new Sabre_VObject_RecurrenceIterator($object, (string)$component->uid);
+ $iterator = new RecurrenceIterator($object, (string)$component->uid);
if ($this->start) {
$iterator->fastForward($this->start);
}
@@ -172,10 +201,10 @@ class Sabre_VObject_FreeBusyGenerator {
if (isset($component->DTEND)) {
$endTime = $component->DTEND->getDateTime();
} elseif (isset($component->DURATION)) {
- $duration = Sabre_VObject_DateTimeParser::parseDuration((string)$component->DURATION);
+ $duration = DateTimeParser::parseDuration((string)$component->DURATION);
$endTime = clone $startTime;
$endTime->add($duration);
- } elseif ($component->DTSTART->getDateType() === Sabre_VObject_Property_DateTime::DATE) {
+ } elseif ($component->DTSTART->getDateType() === Property\DateTime::DATE) {
$endTime = clone $startTime;
$endTime->modify('+1 day');
} else {
@@ -212,14 +241,14 @@ class Sabre_VObject_FreeBusyGenerator {
$values = explode(',', $freebusy);
foreach($values as $value) {
list($startTime, $endTime) = explode('/', $value);
- $startTime = Sabre_VObject_DateTimeParser::parseDateTime($startTime);
+ $startTime = DateTimeParser::parseDateTime($startTime);
if (substr($endTime,0,1)==='P' || substr($endTime,0,2)==='-P') {
- $duration = Sabre_VObject_DateTimeParser::parseDuration($endTime);
+ $duration = DateTimeParser::parseDuration($endTime);
$endTime = clone $startTime;
$endTime->add($duration);
} else {
- $endTime = Sabre_VObject_DateTimeParser::parseDateTime($endTime);
+ $endTime = DateTimeParser::parseDateTime($endTime);
}
if($this->start && $this->start > $endTime) continue;
@@ -248,39 +277,35 @@ class Sabre_VObject_FreeBusyGenerator {
if ($this->baseObject) {
$calendar = $this->baseObject;
} else {
- $calendar = new Sabre_VObject_Component('VCALENDAR');
+ $calendar = new 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->prodid = '-//Sabre//Sabre VObject ' . Version::VERSION . '//EN';
$calendar->calscale = 'GREGORIAN';
}
- $vfreebusy = new Sabre_VObject_Component('VFREEBUSY');
+ $vfreebusy = new Component('VFREEBUSY');
$calendar->add($vfreebusy);
if ($this->start) {
- $dtstart = new Sabre_VObject_Property_DateTime('DTSTART');
- $dtstart->setDateTime($this->start,Sabre_VObject_Property_DateTime::UTC);
+ $dtstart = new Property\DateTime('DTSTART');
+ $dtstart->setDateTime($this->start,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);
+ $dtend = new Property\DateTime('DTEND');
+ $dtend->setDateTime($this->end,Property\DateTime::UTC);
$vfreebusy->add($dtend);
}
- $dtstamp = new Sabre_VObject_Property_DateTime('DTSTAMP');
- $dtstamp->setDateTime(new DateTime('now'), Sabre_VObject_Property_DateTime::UTC);
+ $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'));
+ $busyTime[0]->setTimeZone(new \DateTimeZone('UTC'));
+ $busyTime[1]->setTimeZone(new \DateTimeZone('UTC'));
- $prop = new Sabre_VObject_Property(
+ $prop = new Property(
'FREEBUSY',
$busyTime[0]->format('Ymd\\THis\\Z') . '/' . $busyTime[1]->format('Ymd\\THis\\Z')
);
diff --git a/3rdparty/Sabre/VObject/Node.php b/3rdparty/Sabre/VObject/Node.php
index d89e01b56c6..5d2e1ce300f 100755..100644
--- a/3rdparty/Sabre/VObject/Node.php
+++ b/3rdparty/Sabre/VObject/Node.php
@@ -1,15 +1,20 @@
<?php
+namespace Sabre\VObject;
+
/**
* Base class for all nodes
*
- * @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
*/
-abstract class Sabre_VObject_Node implements IteratorAggregate, ArrayAccess, Countable {
+abstract class Node implements \IteratorAggregate, \ArrayAccess, \Countable {
+
+ /**
+ * The following constants are used by the validate() method.
+ */
+ const REPAIR = 1;
/**
* Turns the object back into a serialized blob.
@@ -21,30 +26,53 @@ abstract class Sabre_VObject_Node implements IteratorAggregate, ArrayAccess, Cou
/**
* Iterator override
*
- * @var Sabre_VObject_ElementList
+ * @var ElementList
*/
protected $iterator = null;
/**
* A link to the parent node
*
- * @var Sabre_VObject_Node
+ * @var Node
*/
public $parent = null;
+ /**
+ * Validates the node for correctness.
+ *
+ * The following options are supported:
+ * - Node::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) {
+
+ return array();
+
+ }
+
/* {{{ IteratorAggregator interface */
/**
* Returns the iterator for this object
*
- * @return Sabre_VObject_ElementList
+ * @return ElementList
*/
public function getIterator() {
if (!is_null($this->iterator))
return $this->iterator;
- return new Sabre_VObject_ElementList(array($this));
+ return new ElementList(array($this));
}
@@ -53,10 +81,10 @@ abstract class Sabre_VObject_Node implements IteratorAggregate, ArrayAccess, Cou
*
* Note that this is not actually part of the iterator interface
*
- * @param Sabre_VObject_ElementList $iterator
+ * @param ElementList $iterator
* @return void
*/
- public function setIterator(Sabre_VObject_ElementList $iterator) {
+ public function setIterator(ElementList $iterator) {
$this->iterator = $iterator;
@@ -125,9 +153,14 @@ abstract class Sabre_VObject_Node implements IteratorAggregate, ArrayAccess, Cou
public function offsetSet($offset,$value) {
$iterator = $this->getIterator();
- return $iterator->offsetSet($offset,$value);
+ $iterator->offsetSet($offset,$value);
+ // @codeCoverageIgnoreStart
+ //
+ // This method always throws an exception, so we ignore the closing
+ // brace
}
+ // @codeCoverageIgnoreEnd
/**
* Sets an item through ArrayAccess.
@@ -140,9 +173,14 @@ abstract class Sabre_VObject_Node implements IteratorAggregate, ArrayAccess, Cou
public function offsetUnset($offset) {
$iterator = $this->getIterator();
- return $iterator->offsetUnset($offset);
+ $iterator->offsetUnset($offset);
+ // @codeCoverageIgnoreStart
+ //
+ // This method always throws an exception, so we ignore the closing
+ // brace
}
+ // @codeCoverageIgnoreEnd
/* }}} */
diff --git a/3rdparty/Sabre/VObject/Parameter.php b/3rdparty/Sabre/VObject/Parameter.php
index 2e39af5f78a..d6d7c54c3bd 100755..100644
--- a/3rdparty/Sabre/VObject/Parameter.php
+++ b/3rdparty/Sabre/VObject/Parameter.php
@@ -1,5 +1,7 @@
<?php
+namespace Sabre\VObject;
+
/**
* VObject Parameter
*
@@ -8,13 +10,11 @@
* DTSTART;VALUE=DATE:20101108
* VALUE=DATE would be the parameter name and value.
*
- * @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_Parameter extends Sabre_VObject_Node {
+class Parameter extends Node {
/**
* Parameter name
@@ -38,6 +38,10 @@ class Sabre_VObject_Parameter extends Sabre_VObject_Node {
*/
public function __construct($name, $value = null) {
+ if (!is_scalar($value) && !is_null($value)) {
+ throw new \InvalidArgumentException('The value argument must be a scalar value or null');
+ }
+
$this->name = strtoupper($name);
$this->value = $value;
diff --git a/3rdparty/Sabre/VObject/ParseException.php b/3rdparty/Sabre/VObject/ParseException.php
index 1b5e95bf16e..91386fec536 100755..100644
--- a/3rdparty/Sabre/VObject/ParseException.php
+++ b/3rdparty/Sabre/VObject/ParseException.php
@@ -1,12 +1,12 @@
<?php
+namespace Sabre\VObject;
+
/**
- * Exception thrown by Sabre_VObject_Reader if an invalid object was attempted to be parsed.
+ * Exception thrown by Reader if an invalid object was attempted to be parsed.
*
- * @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_ParseException extends Exception { }
+class ParseException extends \Exception { }
diff --git a/3rdparty/Sabre/VObject/Property.php b/3rdparty/Sabre/VObject/Property.php
index ce74fe3865b..6f364a73257 100755..100644
--- a/3rdparty/Sabre/VObject/Property.php
+++ b/3rdparty/Sabre/VObject/Property.php
@@ -1,5 +1,7 @@
<?php
+namespace Sabre\VObject;
+
/**
* VObject Property
*
@@ -11,13 +13,11 @@
*
* Parameters can be accessed using the ArrayAccess interface.
*
- * @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_Property extends Sabre_VObject_Element {
+class Property extends Node {
/**
* Propertyname
@@ -57,27 +57,37 @@ class Sabre_VObject_Property extends Sabre_VObject_Element {
* @var array
*/
static public $classMap = array(
- 'COMPLETED' => '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',
+ 'COMPLETED' => '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',
+ 'N' => 'Sabre\\VObject\\Property\\Compound',
+ 'ORG' => 'Sabre\\VObject\\Property\\Compound',
+ 'ADR' => 'Sabre\\VObject\\Property\\Compound',
+ 'CATEGORIES' => 'Sabre\\VObject\\Property\\Compound',
);
/**
* 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
- * @return void
+ * @param array $parameters
+ * @return Property
*/
- static public function create($name, $value = null) {
+ static public function create($name, $value = null, array $parameters = array()) {
$name = strtoupper($name);
$shortName = $name;
@@ -87,9 +97,9 @@ class Sabre_VObject_Property extends Sabre_VObject_Element {
}
if (isset(self::$classMap[$shortName])) {
- return new self::$classMap[$shortName]($name, $value);
+ return new self::$classMap[$shortName]($name, $value, $parameters);
} else {
- return new self($name, $value);
+ return new self($name, $value, $parameters);
}
}
@@ -97,14 +107,20 @@ class Sabre_VObject_Property extends Sabre_VObject_Element {
/**
* Creates a new property object
*
- * By default this object will iterate over its own children, but this can
- * be overridden with the iterator argument
+ * 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 Sabre_VObject_ElementList $iterator
+ * @param array $parameters
*/
- public function __construct($name, $value = null, $iterator = null) {
+ public function __construct($name, $value = null, array $parameters = array()) {
+
+ if (!is_scalar($value) && !is_null($value)) {
+ throw new \InvalidArgumentException('The value argument must be scalar or null');
+ }
$name = strtoupper($name);
$group = null;
@@ -113,12 +129,21 @@ class Sabre_VObject_Property extends Sabre_VObject_Element {
}
$this->name = $name;
$this->group = $group;
- if (!is_null($iterator)) $this->iterator = $iterator;
$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
@@ -142,13 +167,12 @@ class Sabre_VObject_Property extends Sabre_VObject_Element {
$str = $this->name;
if ($this->group) $str = $this->group . '.' . $this->name;
- if (count($this->parameters)) {
- foreach($this->parameters as $param) {
+ foreach($this->parameters as $param) {
- $str.=';' . $param->serialize();
+ $str.=';' . $param->serialize();
- }
}
+
$src = array(
'\\',
"\n",
@@ -180,7 +204,7 @@ class Sabre_VObject_Property extends Sabre_VObject_Element {
*
* You can call this method with the following syntaxes:
*
- * add(Sabre_VObject_Parameter $element)
+ * add(Parameter $element)
* add(string $name, $value)
*
* The first version adds an Parameter
@@ -192,24 +216,21 @@ class Sabre_VObject_Property extends Sabre_VObject_Element {
*/
public function add($item, $itemValue = null) {
- if ($item instanceof Sabre_VObject_Parameter) {
+ if ($item instanceof Parameter) {
if (!is_null($itemValue)) {
- throw new InvalidArgumentException('The second argument must not be specified, when passing a VObject');
+ 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 = new 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');
+ throw new \InvalidArgumentException('The first argument must either be a Node a string');
}
@@ -240,7 +261,7 @@ class Sabre_VObject_Property extends Sabre_VObject_Element {
* Returns a parameter, or parameter list.
*
* @param string $name
- * @return Sabre_VObject_Element
+ * @return Node
*/
public function offsetGet($name) {
@@ -258,7 +279,7 @@ class Sabre_VObject_Property extends Sabre_VObject_Element {
} elseif (count($result)===1) {
return $result[0];
} else {
- $result[0]->setIterator(new Sabre_VObject_ElementList($result));
+ $result[0]->setIterator(new ElementList($result));
return $result[0];
}
@@ -273,25 +294,25 @@ class Sabre_VObject_Property extends Sabre_VObject_Element {
*/
public function offsetSet($name, $value) {
- if (is_int($name)) return parent::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.');
+ 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 = new Parameter($name, $value);
$parameter->parent = $this;
$this->parameters[] = $parameter;
- } elseif ($value instanceof Sabre_VObject_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.');
+ 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');
+ throw new \InvalidArgumentException('You can only add parameters to the property object');
}
}
@@ -304,7 +325,7 @@ class Sabre_VObject_Property extends Sabre_VObject_Element {
*/
public function offsetUnset($name) {
- if (is_int($name)) return parent::offsetUnset($name);
+ if (is_int($name)) parent::offsetUnset($name);
$name = strtoupper($name);
foreach($this->parameters as $key=>$parameter) {
@@ -345,4 +366,65 @@ class Sabre_VObject_Property extends Sabre_VObject_Element {
}
+ /**
+ * Validates the node for correctness.
+ *
+ * The following options are supported:
+ * - Node::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) {
+
+ $warnings = array();
+
+ // Checking if our value is UTF-8
+ if (!StringUtil::isUTF8($this->value)) {
+ $warnings[] = array(
+ 'level' => 1,
+ 'message' => 'Property is not valid UTF-8!',
+ 'node' => $this,
+ );
+ if ($options & self::REPAIR) {
+ $this->value = StringUtil::convertToUTF8($this->value);
+ }
+ }
+
+ // Checking if the propertyname does not contain any invalid bytes.
+ if (!preg_match('/^([A-Z0-9-]+)$/', $this->name)) {
+ $warnings[] = array(
+ 'level' => 1,
+ 'message' => 'The propertyname: ' . $this->name . ' contains invalid characters. Only A-Z, 0-9 and - are allowed',
+ 'node' => $this,
+ );
+ if ($options & self::REPAIR) {
+ // Uppercasing and converting underscores to dashes.
+ $this->name = strtoupper(
+ str_replace('_', '-', $this->name)
+ );
+ // Removing every other invalid character
+ $this->name = preg_replace('/([^A-Z0-9-])/u', '', $this->name);
+
+ }
+
+ }
+
+ // Validating inner parameters
+ foreach($this->parameters as $param) {
+ $warnings = array_merge($warnings, $param->validate($options));
+ }
+
+ return $warnings;
+
+ }
+
}
diff --git a/3rdparty/Sabre/VObject/Property/Compound.php b/3rdparty/Sabre/VObject/Property/Compound.php
new file mode 100644
index 00000000000..e2c18e7726e
--- /dev/null
+++ b/3rdparty/Sabre/VObject/Property/Compound.php
@@ -0,0 +1,129 @@
+<?php
+
+namespace Sabre\VObject\Property;
+
+use Sabre\VObject;
+
+/**
+* Compound property.
+*
+* This class adds (de)serialization of compound properties to/from arrays.
+*
+* Currently the following properties from RFC 6350 are mapped to use this
+* class:
+*
+* N: Section 6.2.2
+* ADR: Section 6.3.1
+* ORG: Section 6.6.4
+* CATEGORIES: Section 6.7.1
+*
+* In order to use this correctly, you must call setParts and getParts to
+* retrieve and modify dates respectively.
+*
+* @author Thomas Tanghus (http://tanghus.net/)
+* @author Lars Kneschke
+* @author Evert Pot (http://www.rooftopsolutions.nl/)
+* @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
+* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
+*/
+
+/**
+* This class represents a compound property in a vCard.
+*/
+class Compound extends VObject\Property {
+
+ /**
+ * If property names are added to this map, they will be (de)serialised as arrays
+ * using the getParts() and setParts() methods.
+ * The keys are the property names, values are delimiter chars.
+ *
+ * @var array
+ */
+ static public $delimiterMap = array(
+ 'N' => ';',
+ 'ADR' => ';',
+ 'ORG' => ';',
+ 'CATEGORIES' => ',',
+ );
+
+ /**
+ * The currently used delimiter.
+ *
+ * @var string
+ */
+ protected $delimiter = null;
+
+ /**
+ * Get a compound value as an array.
+ *
+ * @param $name string
+ * @return array
+ */
+ public function getParts() {
+
+ if (is_null($this->value)) {
+ return array();
+ }
+
+ $delimiter = $this->getDelimiter();
+
+ // split by any $delimiter which is NOT prefixed by a slash.
+ // Note that this is not a a perfect solution. If a value is prefixed
+ // by two slashes, it should actually be split anyway.
+ //
+ // Hopefully we can fix this better in a future version, where we can
+ // break compatibility a bit.
+ $compoundValues = preg_split("/(?<!\\\)$delimiter/", $this->value);
+
+ // remove slashes from any semicolon and comma left escaped in the single values
+ $compoundValues = array_map(
+ function($val) {
+ return strtr($val, array('\,' => ',', '\;' => ';'));
+ }, $compoundValues);
+
+ return $compoundValues;
+
+ }
+
+ /**
+ * Returns the delimiter for this property.
+ *
+ * @return string
+ */
+ public function getDelimiter() {
+
+ if (!$this->delimiter) {
+ if (isset(self::$delimiterMap[$this->name])) {
+ $this->delimiter = self::$delimiterMap[$this->name];
+ } else {
+ // To be a bit future proof, we are going to default the
+ // delimiter to ;
+ $this->delimiter = ';';
+ }
+ }
+ return $this->delimiter;
+
+ }
+
+ /**
+ * Set a compound value as an array.
+ *
+ *
+ * @param $name string
+ * @return array
+ */
+ public function setParts(array $values) {
+
+ // add slashes to all semicolons and commas in the single values
+ $values = array_map(
+ function($val) {
+ return strtr($val, array(',' => '\,', ';' => '\;'));
+ }, $values);
+
+ $this->setValue(
+ implode($this->getDelimiter(), $values)
+ );
+
+ }
+
+}
diff --git a/3rdparty/Sabre/VObject/Property/DateTime.php b/3rdparty/Sabre/VObject/Property/DateTime.php
index fe2372caa81..556cd441d8a 100755..100644
--- a/3rdparty/Sabre/VObject/Property/DateTime.php
+++ b/3rdparty/Sabre/VObject/Property/DateTime.php
@@ -1,5 +1,9 @@
<?php
+namespace Sabre\VObject\Property;
+
+use Sabre\VObject;
+
/**
* DateTime property
*
@@ -13,13 +17,11 @@
* If you use the 'value' or properties directly, this object does not keep
* reference and results might appear incorrectly.
*
- * @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_Property_DateTime extends Sabre_VObject_Property {
+class DateTime extends VObject\Property {
/**
* Local 'floating' time
@@ -44,7 +46,7 @@ class Sabre_VObject_Property_DateTime extends Sabre_VObject_Property {
/**
* DateTime representation
*
- * @var DateTime
+ * @var \DateTime
*/
protected $dateTime;
@@ -58,11 +60,11 @@ class Sabre_VObject_Property_DateTime extends Sabre_VObject_Property {
/**
* Updates the Date and Time.
*
- * @param DateTime $dt
+ * @param \DateTime $dt
* @param int $dateType
* @return void
*/
- public function setDateTime(DateTime $dt, $dateType = self::LOCALTZ) {
+ public function setDateTime(\DateTime $dt, $dateType = self::LOCALTZ) {
switch($dateType) {
@@ -73,7 +75,7 @@ class Sabre_VObject_Property_DateTime extends Sabre_VObject_Property {
$this->offsetSet('VALUE','DATE-TIME');
break;
case self::UTC :
- $dt->setTimeZone(new DateTimeZone('UTC'));
+ $dt->setTimeZone(new \DateTimeZone('UTC'));
$this->setValue($dt->format('Ymd\\THis\\Z'));
$this->offsetUnset('VALUE');
$this->offsetUnset('TZID');
@@ -93,7 +95,7 @@ class Sabre_VObject_Property_DateTime extends Sabre_VObject_Property {
$this->offsetSet('VALUE','DATE');
break;
default :
- throw new InvalidArgumentException('You must pass a valid dateType constant');
+ throw new \InvalidArgumentException('You must pass a valid dateType constant');
}
$this->dateTime = $dt;
@@ -106,7 +108,7 @@ class Sabre_VObject_Property_DateTime extends Sabre_VObject_Property {
*
* If no value was set, this method returns null.
*
- * @return DateTime|null
+ * @return \DateTime|null
*/
public function getDateTime() {
@@ -152,11 +154,11 @@ class Sabre_VObject_Property_DateTime extends Sabre_VObject_Property {
*
* @param string|null $propertyValue The string to parse (yymmdd or
* ymmddThhmmss, etc..)
- * @param Sabre_VObject_Property|null $property The instance of the
+ * @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) {
+ static public function parseData($propertyValue, VObject\Property $property = null) {
if (is_null($propertyValue)) {
return array(null, null);
@@ -167,14 +169,14 @@ class Sabre_VObject_Property_DateTime extends Sabre_VObject_Property {
$regex = "/^$date(T$time(?P<isutc>Z)?)?$/";
if (!preg_match($regex, $propertyValue, $matches)) {
- throw new InvalidArgumentException($propertyValue . ' is not a valid DateTime or Date string');
+ 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 \DateTime($matches['year'] . '-' . $matches['month'] . '-' . $matches['date'] . ' 00:00:00', new \DateTimeZone('UTC')),
);
}
@@ -187,8 +189,8 @@ class Sabre_VObject_Property_DateTime extends Sabre_VObject_Property {
$matches['second'];
if (isset($matches['isutc'])) {
- $dt = new DateTime($dateStr,new DateTimeZone('UTC'));
- $dt->setTimeZone(new DateTimeZone('UTC'));
+ $dt = new \DateTime($dateStr,new \DateTimeZone('UTC'));
+ $dt->setTimeZone(new \DateTimeZone('UTC'));
return array(
self::UTC,
$dt
@@ -198,56 +200,27 @@ class Sabre_VObject_Property_DateTime extends Sabre_VObject_Property {
// 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)
+ new \DateTime($dateStr)
);
}
- try {
- // tzid an Olson identifier?
- $tz = new DateTimeZone($tzid->value);
- } catch (Exception $e) {
-
- // Not an Olson id, we're going to try to find the information
- // through the time zone name map.
- $newtzid = Sabre_VObject_WindowsTimezoneMap::lookup($tzid->value);
- if (is_null($newtzid)) {
-
- // Not a well known time zone name either, we're going to try
- // to find the information through the VTIMEZONE object.
-
- // First we find the root object
- $root = $property;
- while($root->parent) {
- $root = $root->parent;
- }
-
- if (isset($root->VTIMEZONE)) {
- foreach($root->VTIMEZONE as $vtimezone) {
- if (((string)$vtimezone->TZID) == $tzid) {
- if (isset($vtimezone->{'X-LIC-LOCATION'})) {
- $newtzid = (string)$vtimezone->{'X-LIC-LOCATION'};
- } else {
- // No libical location specified. As a last resort we could
- // try matching $vtimezone's DST rules against all known
- // time zones returned by DateTimeZone::list*
-
- // TODO
- }
- }
- }
- }
- }
-
- try {
- $tz = new DateTimeZone($newtzid);
- } catch (Exception $e) {
- // If all else fails, we use the default PHP timezone
- $tz = new DateTimeZone(date_default_timezone_get());
- }
+ // To look up the timezone, we must first find the VCALENDAR component.
+ $root = $property;
+ while($root->parent) {
+ $root = $root->parent;
}
- $dt = new DateTime($dateStr, $tz);
+ 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(
diff --git a/3rdparty/Sabre/VObject/Property/MultiDateTime.php b/3rdparty/Sabre/VObject/Property/MultiDateTime.php
index ae53ab6a617..629ef4a1340 100755..100644
--- a/3rdparty/Sabre/VObject/Property/MultiDateTime.php
+++ b/3rdparty/Sabre/VObject/Property/MultiDateTime.php
@@ -1,5 +1,9 @@
<?php
+namespace Sabre\VObject\Property;
+
+use Sabre\VObject;
+
/**
* Multi-DateTime property
*
@@ -13,13 +17,11 @@
* If you use the 'value' or properties directly, this object does not keep
* reference and results might appear incorrectly.
*
- * @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_Property_MultiDateTime extends Sabre_VObject_Property {
+class MultiDateTime extends VObject\Property {
/**
* DateTime representation
@@ -31,7 +33,7 @@ class Sabre_VObject_Property_MultiDateTime extends Sabre_VObject_Property {
/**
* dateType
*
- * This is one of the Sabre_VObject_Property_DateTime constants.
+ * This is one of the Sabre\VObject\Property\DateTime constants.
*
* @var int
*/
@@ -44,17 +46,17 @@ class Sabre_VObject_Property_MultiDateTime extends Sabre_VObject_Property {
* @param int $dateType
* @return void
*/
- public function setDateTimes(array $dt, $dateType = Sabre_VObject_Property_DateTime::LOCALTZ) {
+ public function setDateTimes(array $dt, $dateType = VObject\Property\DateTime::LOCALTZ) {
foreach($dt as $i)
- if (!$i instanceof DateTime)
- throw new InvalidArgumentException('You must pass an array of DateTime objects');
+ if (!$i instanceof \DateTime)
+ throw new \InvalidArgumentException('You must pass an array of DateTime objects');
$this->offsetUnset('VALUE');
$this->offsetUnset('TZID');
switch($dateType) {
- case Sabre_VObject_Property_DateTime::LOCAL :
+ case DateTime::LOCAL :
$val = array();
foreach($dt as $i) {
$val[] = $i->format('Ymd\\THis');
@@ -62,16 +64,16 @@ class Sabre_VObject_Property_MultiDateTime extends Sabre_VObject_Property {
$this->setValue(implode(',',$val));
$this->offsetSet('VALUE','DATE-TIME');
break;
- case Sabre_VObject_Property_DateTime::UTC :
+ case DateTime::UTC :
$val = array();
foreach($dt as $i) {
- $i->setTimeZone(new DateTimeZone('UTC'));
+ $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 :
+ case DateTime::LOCALTZ :
$val = array();
foreach($dt as $i) {
$val[] = $i->format('Ymd\\THis');
@@ -80,7 +82,7 @@ class Sabre_VObject_Property_MultiDateTime extends Sabre_VObject_Property {
$this->offsetSet('VALUE','DATE-TIME');
$this->offsetSet('TZID', $dt[0]->getTimeZone()->getName());
break;
- case Sabre_VObject_Property_DateTime::DATE :
+ case DateTime::DATE :
$val = array();
foreach($dt as $i) {
$val[] = $i->format('Ymd');
@@ -89,7 +91,7 @@ class Sabre_VObject_Property_MultiDateTime extends Sabre_VObject_Property {
$this->offsetSet('VALUE','DATE');
break;
default :
- throw new InvalidArgumentException('You must pass a valid dateType constant');
+ throw new \InvalidArgumentException('You must pass a valid dateType constant');
}
$this->dateTimes = $dt;
@@ -121,7 +123,7 @@ class Sabre_VObject_Property_MultiDateTime extends Sabre_VObject_Property {
list(
$type,
$dt
- ) = Sabre_VObject_Property_DateTime::parseData($val, $this);
+ ) = DateTime::parseData($val, $this);
$dts[] = $dt;
$this->dateType = $type;
}
@@ -154,7 +156,7 @@ class Sabre_VObject_Property_MultiDateTime extends Sabre_VObject_Property {
list(
$type,
$dt
- ) = Sabre_VObject_Property_DateTime::parseData($val, $this);
+ ) = DateTime::parseData($val, $this);
$dts[] = $dt;
$this->dateType = $type;
}
diff --git a/3rdparty/Sabre/VObject/Reader.php b/3rdparty/Sabre/VObject/Reader.php
index eea73fa3dce..a24590cb388 100755..100644
--- a/3rdparty/Sabre/VObject/Reader.php
+++ b/3rdparty/Sabre/VObject/Reader.php
@@ -1,5 +1,7 @@
<?php
+namespace Sabre\VObject;
+
/**
* VCALENDAR/VCARD reader
*
@@ -8,21 +10,38 @@
* TODO: this class currently completely works 'statically'. This is pointless,
* and defeats OOP principals. Needs refactoring in a future version.
*
- * @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_Reader {
+class Reader {
+
+ /**
+ * If this option is passed to the reader, it will be less strict about the
+ * validity of the lines.
+ *
+ * Currently using this option just means, that it will accept underscores
+ * in property names.
+ */
+ const OPTION_FORGIVING = 1;
+
+ /**
+ * If this option is turned on, any lines we cannot parse will be ignored
+ * by the reader.
+ */
+ const OPTION_IGNORE_INVALID_LINES = 2;
/**
* Parses the file and returns the top component
*
+ * The options argument is a bitfield. Pass any of the OPTIONS constant to
+ * alter the parsers' behaviour.
+ *
* @param string $data
- * @return Sabre_VObject_Element
+ * @param int $options
+ * @return Node
*/
- static function read($data) {
+ static function read($data, $options = 0) {
// Normalizing newlines
$data = str_replace(array("\r","\n\n"), array("\n","\n"), $data);
@@ -48,7 +67,7 @@ class Sabre_VObject_Reader {
reset($lines2);
- return self::readLine($lines2);
+ return self::readLine($lines2, $options);
}
@@ -58,37 +77,45 @@ class Sabre_VObject_Reader {
* This method receives the full array of lines. The array pointer is used
* to traverse.
*
+ * This method returns null if an invalid line was encountered, and the
+ * IGNORE_INVALID_LINES option was turned on.
+ *
* @param array $lines
- * @return Sabre_VObject_Element
+ * @param int $options See the OPTIONS constants.
+ * @return Node
*/
- static private function readLine(&$lines) {
+ static private function readLine(&$lines, $options = 0) {
$line = current($lines);
$lineNr = key($lines);
next($lines);
// Components
- if (stripos($line,"BEGIN:")===0) {
+ if (strtoupper(substr($line,0,6)) === "BEGIN:") {
$componentName = strtoupper(substr($line,6));
- $obj = Sabre_VObject_Component::create($componentName);
+ $obj = Component::create($componentName);
$nextLine = current($lines);
- while(stripos($nextLine,"END:")!==0) {
-
- $obj->add(self::readLine($lines));
+ while(strtoupper(substr($nextLine,0,4))!=="END:") {
+ $parsedLine = self::readLine($lines, $options);
$nextLine = current($lines);
+ if (is_null($parsedLine)) {
+ continue;
+ }
+ $obj->add($parsedLine);
+
if ($nextLine===false)
- throw new Sabre_VObject_ParseException('Invalid VObject. Document ended prematurely.');
+ throw new 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 . '"');
+ throw new ParseException('Invalid VObject, expected: "END:' . $obj->name . '" got: "' . $nextLine . '"');
}
next($lines);
@@ -99,19 +126,26 @@ class Sabre_VObject_Reader {
// Properties
//$result = preg_match('/(?P<name>[A-Z0-9-]+)(?:;(?P<parameters>^(?<!:):))(.*)$/',$line,$matches);
-
- $token = '[A-Z0-9-\.]+';
+ if ($options & self::OPTION_FORGIVING) {
+ $token = '[A-Z0-9-\._]+';
+ } else {
+ $token = '[A-Z0-9-\.]+';
+ }
$parameters = "(?:;(?P<parameters>([^:^\"]|\"([^\"]*)\")*))?";
$regex = "/^(?P<name>$token)$parameters:(?P<value>.*)$/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');
+ if ($options & self::OPTION_IGNORE_INVALID_LINES) {
+ return null;
+ } else {
+ 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) {
+ $propertyValue = preg_replace_callback('#(\\\\(\\\\|N|n))#',function($matches) {
if ($matches[2]==='n' || $matches[2]==='N') {
return "\n";
} else {
@@ -119,7 +153,7 @@ class Sabre_VObject_Reader {
}
}, $matches['value']);
- $obj = Sabre_VObject_Property::create($propertyName, $propertyValue);
+ $obj = Property::create($propertyName, $propertyValue);
if ($matches['parameters']) {
@@ -137,7 +171,7 @@ class Sabre_VObject_Reader {
/**
* Reads a parameter list from a property
*
- * This method returns an array of Sabre_VObject_Parameter
+ * This method returns an array of Parameter
*
* @param string $parameters
* @return array
@@ -171,7 +205,7 @@ class Sabre_VObject_Reader {
}
}, $value);
- $params[] = new Sabre_VObject_Parameter($match['paramName'], $value);
+ $params[] = new Parameter($match['paramName'], $value);
}
diff --git a/3rdparty/Sabre/VObject/RecurrenceIterator.php b/3rdparty/Sabre/VObject/RecurrenceIterator.php
index 740270dd8f0..46c7f447806 100755..100644
--- a/3rdparty/Sabre/VObject/RecurrenceIterator.php
+++ b/3rdparty/Sabre/VObject/RecurrenceIterator.php
@@ -1,5 +1,7 @@
<?php
+namespace Sabre\VObject;
+
/**
* This class is used to determine new for a recurring event, when the next
* events occur.
@@ -37,13 +39,11 @@
* you may get unexpected results. The effect is that in some applications the
* specified recurrence may look incorrect, or is missing.
*
- * @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_RecurrenceIterator implements Iterator {
+class RecurrenceIterator implements \Iterator {
/**
* The initial event date
@@ -82,7 +82,7 @@ class Sabre_VObject_RecurrenceIterator implements Iterator {
/**
* Base event
*
- * @var Sabre_VObject_Component_VEvent
+ * @var Component\VEvent
*/
public $baseEvent;
@@ -97,7 +97,7 @@ class Sabre_VObject_RecurrenceIterator implements Iterator {
/**
* list of events that are 'overridden'.
*
- * This is an array of Sabre_VObject_Component_VEvent objects.
+ * This is an array of Component\VEvent objects.
*
* @var array
*/
@@ -281,7 +281,7 @@ class Sabre_VObject_RecurrenceIterator implements Iterator {
* If the current iteration of the event is an overriden event, this
* property will hold the VObject
*
- * @var Sabre_Component_VObject
+ * @var Component
*/
private $currentOverriddenEvent;
@@ -300,14 +300,14 @@ class Sabre_VObject_RecurrenceIterator implements 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 Component $vcal
* @param string|null $uid
*/
- public function __construct(Sabre_VObject_Component $vcal, $uid=null) {
+ 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');
+ throw new \InvalidArgumentException('If you pass a VCALENDAR object, you must pass a uid argument as well');
}
$components = array($vcal);
$uid = (string)$vcal->uid;
@@ -325,7 +325,7 @@ class Sabre_VObject_RecurrenceIterator implements Iterator {
}
}
if (!$this->baseEvent) {
- throw new InvalidArgumentException('Could not find a base event with uid: ' . $uid);
+ throw new \InvalidArgumentException('Could not find a base event with uid: ' . $uid);
}
$this->startDate = clone $this->baseEvent->DTSTART->getDateTime();
@@ -336,8 +336,8 @@ class Sabre_VObject_RecurrenceIterator implements Iterator {
} 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->add(DateTimeParser::parse($this->baseEvent->DURATION->value));
+ } elseif ($this->baseEvent->DTSTART->getDateType()===Property\DateTime::DATE) {
$this->endDate->modify('+1 day');
}
}
@@ -347,7 +347,11 @@ class Sabre_VObject_RecurrenceIterator implements Iterator {
$parts = explode(';', $rrule);
- foreach($parts as $part) {
+ // 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);
@@ -358,14 +362,14 @@ class Sabre_VObject_RecurrenceIterator implements Iterator {
strtolower($value),
array('secondly','minutely','hourly','daily','weekly','monthly','yearly')
)) {
- throw new InvalidArgumentException('Unknown value for FREQ=' . strtoupper($value));
+ throw new \InvalidArgumentException('Unknown value for FREQ=' . strtoupper($value));
}
$this->frequency = strtolower($value);
break;
case 'UNTIL' :
- $this->until = Sabre_VObject_DateTimeParser::parse($value);
+ $this->until = DateTimeParser::parse($value);
break;
case 'COUNT' :
@@ -374,6 +378,9 @@ class Sabre_VObject_RecurrenceIterator implements Iterator {
case 'INTERVAL' :
$this->interval = (int)$value;
+ if ($this->interval < 1) {
+ throw new \InvalidArgumentException('INTERVAL in RRULE must be a positive integer!');
+ }
break;
case 'BYSECOND' :
@@ -427,7 +434,7 @@ class Sabre_VObject_RecurrenceIterator implements Iterator {
foreach(explode(',', (string)$exDate) as $exceptionDate) {
$this->exceptionDates[] =
- Sabre_VObject_DateTimeParser::parse($exceptionDate, $this->startDate->getTimeZone());
+ DateTimeParser::parse($exceptionDate, $this->startDate->getTimeZone());
}
@@ -485,7 +492,7 @@ class Sabre_VObject_RecurrenceIterator implements Iterator {
*
* This method always returns a cloned instance.
*
- * @return void
+ * @return Component\VEvent
*/
public function getEventObject() {
@@ -561,7 +568,7 @@ class Sabre_VObject_RecurrenceIterator implements Iterator {
* @param DateTime $dt
* @return void
*/
- public function fastForward(DateTime $dt) {
+ public function fastForward(\DateTime $dt) {
while($this->valid() && $this->getDTEnd() <= $dt) {
$this->next();
@@ -570,6 +577,17 @@ class Sabre_VObject_RecurrenceIterator implements Iterator {
}
/**
+ * 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
@@ -632,7 +650,7 @@ class Sabre_VObject_RecurrenceIterator implements Iterator {
}
- // Checking overriden events
+ // Checking overridden events
foreach($this->overriddenEvents as $index=>$event) {
if ($index > $previousStamp && $index <= $currentStamp) {
@@ -880,7 +898,7 @@ class Sabre_VObject_RecurrenceIterator implements Iterator {
// 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
- // occurence is always correct.
+ // occurrence is always correct.
if ($occurrence > $currentDayOfMonth || $advancedToNewMonth) {
break 2;
}
diff --git a/3rdparty/Sabre/VObject/Splitter/ICalendar.php b/3rdparty/Sabre/VObject/Splitter/ICalendar.php
new file mode 100644
index 00000000000..7a9a63e1b21
--- /dev/null
+++ b/3rdparty/Sabre/VObject/Splitter/ICalendar.php
@@ -0,0 +1,111 @@
+<?php
+
+namespace Sabre\VObject\Splitter;
+
+use Sabre\VObject;
+
+/**
+ * Splitter
+ *
+ * This class is responsible for splitting up iCalendar objects.
+ *
+ * This class expects a single VCALENDAR object with one or more
+ * calendar-objects inside. Objects with identical UID's will be combined into
+ * a single object.
+ *
+ * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
+ * @author Dominik Tobschall
+ * @author Armin Hackmann
+ * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
+ */
+class ICalendar implements SplitterInterface {
+
+ /**
+ * Timezones
+ *
+ * @var array
+ */
+ protected $vtimezones = array();
+
+ /**
+ * iCalendar objects
+ *
+ * @var array
+ */
+ protected $objects = array();
+
+ /**
+ * Constructor
+ *
+ * The splitter should receive an readable file stream as it's input.
+ *
+ * @param resource $input
+ */
+ public function __construct($input) {
+
+ $data = VObject\Reader::read(stream_get_contents($input));
+ $vtimezones = array();
+ $components = array();
+
+ foreach($data->children as $component) {
+ if (!$component instanceof VObject\Component) {
+ continue;
+ }
+
+ // Get all timezones
+ if ($component->name === 'VTIMEZONE') {
+ $this->vtimezones[(string)$component->TZID] = $component;
+ continue;
+ }
+
+ // Get component UID for recurring Events search
+ if($component->UID) {
+ $uid = (string)$component->UID;
+ } else {
+ // Generating a random UID
+ $uid = sha1(microtime()) . '-vobjectimport';
+ }
+
+ // Take care of recurring events
+ if (!array_key_exists($uid, $this->objects)) {
+ $this->objects[$uid] = VObject\Component::create('VCALENDAR');
+ }
+
+ $this->objects[$uid]->add(clone $component);
+ }
+
+ }
+
+ /**
+ * Every time getNext() is called, a new object will be parsed, until we
+ * hit the end of the stream.
+ *
+ * When the end is reached, null will be returned.
+ *
+ * @return Sabre\VObject\Component|null
+ */
+ public function getNext() {
+
+ if($object=array_shift($this->objects)) {
+
+ // create our baseobject
+ $object->version = '2.0';
+ $object->prodid = '-//Sabre//Sabre VObject ' . VObject\Version::VERSION . '//EN';
+ $object->calscale = 'GREGORIAN';
+
+ // add vtimezone information to obj (if we have it)
+ foreach ($this->vtimezones as $vtimezone) {
+ $object->add($vtimezone);
+ }
+
+ return $object;
+
+ } else {
+
+ return null;
+
+ }
+
+ }
+
+}
diff --git a/3rdparty/Sabre/VObject/Splitter/SplitterInterface.php b/3rdparty/Sabre/VObject/Splitter/SplitterInterface.php
new file mode 100644
index 00000000000..9f7a82450e3
--- /dev/null
+++ b/3rdparty/Sabre/VObject/Splitter/SplitterInterface.php
@@ -0,0 +1,39 @@
+<?php
+
+namespace Sabre\VObject\Splitter;
+
+/**
+ * VObject splitter
+ *
+ * The splitter is responsible for reading a large vCard or iCalendar object,
+ * and splitting it into multiple objects.
+ *
+ * This is for example for Card and CalDAV, which require every event and vcard
+ * to exist in their own objects, instead of one large one.
+ *
+ * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
+ * @author Dominik Tobschall
+ * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
+ */
+interface SplitterInterface {
+
+ /**
+ * Constructor
+ *
+ * The splitter should receive an readable file stream as it's input.
+ *
+ * @param resource $input
+ */
+ function __construct($input);
+
+ /**
+ * Every time getNext() is called, a new object will be parsed, until we
+ * hit the end of the stream.
+ *
+ * When the end is reached, null will be returned.
+ *
+ * @return Sabre\VObject\Component|null
+ */
+ function getNext();
+
+}
diff --git a/3rdparty/Sabre/VObject/Splitter/VCard.php b/3rdparty/Sabre/VObject/Splitter/VCard.php
new file mode 100644
index 00000000000..829491ed07a
--- /dev/null
+++ b/3rdparty/Sabre/VObject/Splitter/VCard.php
@@ -0,0 +1,76 @@
+<?php
+
+namespace Sabre\VObject\Splitter;
+
+use Sabre\VObject;
+
+/**
+ * Splitter
+ *
+ * This class is responsible for splitting up VCard objects.
+ *
+ * It is assumed that the input stream contains 1 or more VCARD objects. This
+ * class checks for BEGIN:VCARD and END:VCARD and parses each encountered
+ * component individually.
+ *
+ * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
+ * @author Dominik Tobschall
+ * @author Armin Hackmann
+ * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
+ */
+class VCard implements SplitterInterface {
+
+ /**
+ * File handle
+ *
+ * @var resource
+ */
+ protected $input;
+
+ /**
+ * Constructor
+ *
+ * The splitter should receive an readable file stream as it's input.
+ *
+ * @param resource $input
+ */
+ public function __construct($input) {
+
+ $this->input = $input;
+
+ }
+
+ /**
+ * Every time getNext() is called, a new object will be parsed, until we
+ * hit the end of the stream.
+ *
+ * When the end is reached, null will be returned.
+ *
+ * @return Sabre\VObject\Component|null
+ */
+ public function getNext() {
+
+ $vcard = '';
+
+ do {
+
+ if (feof($this->input)) {
+ return false;
+ }
+
+ $line = fgets($this->input);
+ $vcard .= $line;
+
+ } while(strtoupper(substr($line,0,4))!=="END:");
+
+ $object = VObject\Reader::read($vcard);
+
+ if($object->name !== 'VCARD') {
+ throw new \InvalidArgumentException("Thats no vCard!", 1);
+ }
+
+ return $object;
+
+ }
+
+}
diff --git a/3rdparty/Sabre/VObject/StringUtil.php b/3rdparty/Sabre/VObject/StringUtil.php
new file mode 100644
index 00000000000..886a7135d67
--- /dev/null
+++ b/3rdparty/Sabre/VObject/StringUtil.php
@@ -0,0 +1,61 @@
+<?php
+
+namespace Sabre\VObject;
+
+/**
+ * Useful utilities for working with various strings.
+ *
+ * @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 StringUtil {
+
+ /**
+ * Returns true or false depending on if a string is valid UTF-8
+ *
+ * @param string $str
+ * @return bool
+ */
+ static function isUTF8($str) {
+
+ // First check.. mb_check_encoding
+ if (!mb_check_encoding($str, 'UTF-8')) {
+ return false;
+ }
+
+ // Control characters
+ if (preg_match('%(?:[\x00-\x08\x0B-\x0C\x0E\x0F])%', $str)) {
+ return false;
+ }
+
+ return true;
+
+ }
+
+ /**
+ * This method tries its best to convert the input string to UTF-8.
+ *
+ * Currently only ISO-5991-1 input and UTF-8 input is supported, but this
+ * may be expanded upon if we receive other examples.
+ *
+ * @param string $str
+ * @return string
+ */
+ static function convertToUTF8($str) {
+
+ $encoding = mb_detect_encoding($str , array('UTF-8','ISO-8859-1'), true);
+
+ if ($encoding === 'ISO-8859-1') {
+ $newStr = utf8_encode($str);
+ } else {
+ $newStr = $str;
+ }
+
+ // Removing any control characters
+ return (preg_replace('%(?:[\x00-\x08\x0B-\x0C\x0E\x0F])%', '', $newStr));
+
+ }
+
+}
+
diff --git a/3rdparty/Sabre/VObject/TimeZoneUtil.php b/3rdparty/Sabre/VObject/TimeZoneUtil.php
new file mode 100644
index 00000000000..ba73cf34a79
--- /dev/null
+++ b/3rdparty/Sabre/VObject/TimeZoneUtil.php
@@ -0,0 +1,351 @@
+<?php
+
+namespace Sabre\VObject;
+
+/**
+ * Time zone name translation
+ *
+ * This file translates well-known time zone names into "Olson database" time zone names.
+ *
+ * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
+ * @author Frank Edelhaeuser (fedel@users.sourceforge.net)
+ * @author Evert Pot (http://www.rooftopsolutions.nl/)
+ * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
+ */
+class TimeZoneUtil {
+
+ public static $map = array(
+
+ // from http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/zone_tzid.html
+ // snapshot taken on 2012/01/16
+
+ // windows
+ 'AUS Central Standard Time'=>'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',
+ 60 => '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/3rdparty/Sabre/VObject/Version.php b/3rdparty/Sabre/VObject/Version.php
index 9ee03d87118..0065b7abc95 100755..100644
--- a/3rdparty/Sabre/VObject/Version.php
+++ b/3rdparty/Sabre/VObject/Version.php
@@ -1,20 +1,20 @@
<?php
+namespace Sabre\VObject;
+
/**
* This class contains the version number for the VObject package
*
- * @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_Version {
+class Version {
/**
* Full version number
*/
- const VERSION = '1.3.4';
+ const VERSION = '2.0.2';
/**
* Stability : alpha, beta, stable
diff --git a/3rdparty/Sabre/VObject/WindowsTimezoneMap.php b/3rdparty/Sabre/VObject/WindowsTimezoneMap.php
deleted file mode 100755
index 5e1cc5d479b..00000000000
--- a/3rdparty/Sabre/VObject/WindowsTimezoneMap.php
+++ /dev/null
@@ -1,128 +0,0 @@
-<?php
-
-/**
- * Time zone name translation
- *
- * This file translates well-known time zone names into "Olson database" time zone names.
- *
- * @package Sabre
- * @subpackage VObject
- * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
- * @author Frank Edelhaeuser (fedel@users.sourceforge.net)
- * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
- */
-class Sabre_VObject_WindowsTimezoneMap {
-
- protected static $map = array(
-
- // from http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/zone_tzid.html
- // snapshot taken on 2012/01/16
-
- // windows
- 'AUS Central Standard Time'=>'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',
- );
-
- static public function lookup($tzid) {
- return isset(self::$map[$tzid]) ? self::$map[$tzid] : null;
- }
-}
diff --git a/3rdparty/Sabre/VObject/includes.php b/3rdparty/Sabre/VObject/includes.php
index 0177a8f1ba6..b74bd3b6cbf 100755..100644
--- a/3rdparty/Sabre/VObject/includes.php
+++ b/3rdparty/Sabre/VObject/includes.php
@@ -1,15 +1,11 @@
<?php
/**
- * Sabre_VObject includes file
+ * Includes file
*
- * Including this file will automatically include all files from the VObject
- * package.
+ * This file includes the entire VObject library in one go.
+ * The benefit is that an autoloader is not needed, which is often faster.
*
- * This often allows faster loadtimes, as autoload-speed is often quite slow.
- *
- * @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
@@ -22,20 +18,23 @@ include __DIR__ . '/FreeBusyGenerator.php';
include __DIR__ . '/Node.php';
include __DIR__ . '/Parameter.php';
include __DIR__ . '/ParseException.php';
+include __DIR__ . '/Property.php';
include __DIR__ . '/Reader.php';
include __DIR__ . '/RecurrenceIterator.php';
+include __DIR__ . '/Splitter/SplitterInterface.php';
+include __DIR__ . '/StringUtil.php';
+include __DIR__ . '/TimeZoneUtil.php';
include __DIR__ . '/Version.php';
-include __DIR__ . '/WindowsTimezoneMap.php';
-include __DIR__ . '/Element.php';
-include __DIR__ . '/Property.php';
+include __DIR__ . '/Splitter/VCard.php';
include __DIR__ . '/Component.php';
+include __DIR__ . '/Property/Compound.php';
include __DIR__ . '/Property/DateTime.php';
include __DIR__ . '/Property/MultiDateTime.php';
+include __DIR__ . '/Splitter/ICalendar.php';
include __DIR__ . '/Component/VAlarm.php';
include __DIR__ . '/Component/VCalendar.php';
include __DIR__ . '/Component/VEvent.php';
+include __DIR__ . '/Component/VFreeBusy.php';
include __DIR__ . '/Component/VJournal.php';
include __DIR__ . '/Component/VTodo.php';
-include __DIR__ . '/Element/DateTime.php';
-include __DIR__ . '/Element/MultiDateTime.php';
// End includes