aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/lib/SabreDAV/lib/OldSabre/DAV/Property
diff options
context:
space:
mode:
authorDaniel Lange <DLange@git.local>2016-03-07 15:53:16 +0100
committerDaniel Lange <DLange@git.local>2016-03-07 15:53:16 +0100
commit50569114acdc64e7c7cae1498635d3f821517c30 (patch)
tree13d6fe76af33134fbfb2286930fb6603047f9299 /calendar/lib/SabreDAV/lib/OldSabre/DAV/Property
parentc210d30de6c62e7f7867bb32651349ddf455d9e6 (diff)
downloadroundcube_calendar-50569114acdc64e7c7cae1498635d3f821517c30.tar.gz
roundcube_calendar-50569114acdc64e7c7cae1498635d3f821517c30.tar.bz2
roundcube_calendar-50569114acdc64e7c7cae1498635d3f821517c30.zip
Initial commit of the Faster IT roundcube_calendar plugin distribution
This includes: * Kolab plugins 3.2.9 (calendar and libcalendaring) * CalDAV driver 3.2.8 * .htaccess files for at least some security * SabreDAV updated to 1.8.12 (Jan 2015 release) * Support for CURLOPT_SSL_* settings to allow self-signed certificates * Small fixes & improved documentation
Diffstat (limited to 'calendar/lib/SabreDAV/lib/OldSabre/DAV/Property')
-rw-r--r--calendar/lib/SabreDAV/lib/OldSabre/DAV/Property/GetLastModified.php78
-rw-r--r--calendar/lib/SabreDAV/lib/OldSabre/DAV/Property/Href.php99
-rw-r--r--calendar/lib/SabreDAV/lib/OldSabre/DAV/Property/HrefList.php105
-rw-r--r--calendar/lib/SabreDAV/lib/OldSabre/DAV/Property/IHref.php25
-rw-r--r--calendar/lib/SabreDAV/lib/OldSabre/DAV/Property/LockDiscovery.php104
-rw-r--r--calendar/lib/SabreDAV/lib/OldSabre/DAV/Property/ResourceType.php127
-rw-r--r--calendar/lib/SabreDAV/lib/OldSabre/DAV/Property/Response.php157
-rw-r--r--calendar/lib/SabreDAV/lib/OldSabre/DAV/Property/ResponseList.php59
-rw-r--r--calendar/lib/SabreDAV/lib/OldSabre/DAV/Property/SupportedLock.php78
-rw-r--r--calendar/lib/SabreDAV/lib/OldSabre/DAV/Property/SupportedReportSet.php111
10 files changed, 943 insertions, 0 deletions
diff --git a/calendar/lib/SabreDAV/lib/OldSabre/DAV/Property/GetLastModified.php b/calendar/lib/SabreDAV/lib/OldSabre/DAV/Property/GetLastModified.php
new file mode 100644
index 0000000..33f53c2
--- /dev/null
+++ b/calendar/lib/SabreDAV/lib/OldSabre/DAV/Property/GetLastModified.php
@@ -0,0 +1,78 @@
+<?php
+
+namespace OldSabre\DAV\Property;
+
+use OldSabre\DAV;
+use OldSabre\HTTP;
+
+/**
+ * This property represents the {DAV:}getlastmodified property.
+ *
+ * Although this is normally a simple property, windows requires us to add
+ * some new attributes.
+ *
+ * This class uses unix timestamps internally, and converts them to RFC 1123 times for
+ * serialization
+ *
+ * @copyright Copyright (C) 2007-2015 fruux GmbH (https://fruux.com/).
+ * @author Evert Pot (http://evertpot.com/)
+ * @license http://sabre.io/license/ Modified BSD License
+ */
+class GetLastModified extends DAV\Property {
+
+ /**
+ * time
+ *
+ * @var int
+ */
+ public $time;
+
+ /**
+ * __construct
+ *
+ * @param int|DateTime $time
+ */
+ public function __construct($time) {
+
+ if ($time instanceof \DateTime) {
+ $this->time = $time;
+ } elseif (is_int($time) || ctype_digit($time)) {
+ $this->time = new \DateTime('@' . $time);
+ } else {
+ $this->time = new \DateTime($time);
+ }
+
+ // Setting timezone to UTC
+ $this->time->setTimezone(new \DateTimeZone('UTC'));
+
+ }
+
+ /**
+ * serialize
+ *
+ * @param DAV\Server $server
+ * @param \DOMElement $prop
+ * @return void
+ */
+ public function serialize(DAV\Server $server, \DOMElement $prop) {
+
+ $doc = $prop->ownerDocument;
+ //$prop->setAttribute('xmlns:b','urn:uuid:c2f41010-65b3-11d1-a29f-00aa00c14882/');
+ //$prop->setAttribute('b:dt','dateTime.rfc1123');
+ $prop->nodeValue = HTTP\Util::toHTTPDate($this->time);
+
+ }
+
+ /**
+ * getTime
+ *
+ * @return \DateTime
+ */
+ public function getTime() {
+
+ return $this->time;
+
+ }
+
+}
+
diff --git a/calendar/lib/SabreDAV/lib/OldSabre/DAV/Property/Href.php b/calendar/lib/SabreDAV/lib/OldSabre/DAV/Property/Href.php
new file mode 100644
index 0000000..81f9bfb
--- /dev/null
+++ b/calendar/lib/SabreDAV/lib/OldSabre/DAV/Property/Href.php
@@ -0,0 +1,99 @@
+<?php
+
+namespace OldSabre\DAV\Property;
+
+use OldSabre\DAV;
+
+/**
+ * Href property
+ *
+ * The href property represents a url within a {DAV:}href element.
+ * This is used by many WebDAV extensions, but not really within the WebDAV core spec
+ *
+ * @copyright Copyright (C) 2007-2015 fruux GmbH (https://fruux.com/).
+ * @author Evert Pot (http://evertpot.com/)
+ * @license http://sabre.io/license/ Modified BSD License
+ */
+class Href extends DAV\Property implements IHref {
+
+ /**
+ * href
+ *
+ * @var string
+ */
+ private $href;
+
+ /**
+ * Automatically prefix the url with the server base directory
+ *
+ * @var bool
+ */
+ private $autoPrefix = true;
+
+ /**
+ * __construct
+ *
+ * @param string $href
+ * @param bool $autoPrefix
+ */
+ public function __construct($href, $autoPrefix = true) {
+
+ $this->href = $href;
+ $this->autoPrefix = $autoPrefix;
+
+ }
+
+ /**
+ * Returns the uri
+ *
+ * @return string
+ */
+ public function getHref() {
+
+ return $this->href;
+
+ }
+
+ /**
+ * Serializes this property.
+ *
+ * It will additionally prepend the href property with the server's base uri.
+ *
+ * @param DAV\Server $server
+ * @param \DOMElement $dom
+ * @return void
+ */
+ public function serialize(DAV\Server $server, \DOMElement $dom) {
+
+ $prefix = $server->xmlNamespaces['DAV:'];
+ $elem = $dom->ownerDocument->createElement($prefix . ':href');
+
+ if ($this->autoPrefix) {
+ $value = $server->getBaseUri() . DAV\URLUtil::encodePath($this->href);
+ } else {
+ $value = $this->href;
+ }
+ $elem->appendChild($dom->ownerDocument->createTextNode($value));
+
+ $dom->appendChild($elem);
+
+ }
+
+ /**
+ * Unserializes this property from a DOM Element
+ *
+ * This method returns an instance of this class.
+ * It will only decode {DAV:}href values. For non-compatible elements null will be returned.
+ *
+ * @param \DOMElement $dom
+ * @return DAV\Property\Href
+ */
+ static function unserialize(\DOMElement $dom) {
+
+ if ($dom->firstChild && DAV\XMLUtil::toClarkNotation($dom->firstChild)==='{DAV:}href') {
+ return new self($dom->firstChild->textContent,false);
+ }
+
+ }
+
+}
diff --git a/calendar/lib/SabreDAV/lib/OldSabre/DAV/Property/HrefList.php b/calendar/lib/SabreDAV/lib/OldSabre/DAV/Property/HrefList.php
new file mode 100644
index 0000000..8233db1
--- /dev/null
+++ b/calendar/lib/SabreDAV/lib/OldSabre/DAV/Property/HrefList.php
@@ -0,0 +1,105 @@
+<?php
+
+namespace OldSabre\DAV\Property;
+
+use OldSabre\DAV;
+
+/**
+ * HrefList property
+ *
+ * This property contains multiple {DAV:}href elements, each containing a url.
+ *
+ * @copyright Copyright (C) 2007-2015 fruux GmbH (https://fruux.com/).
+ * @author Evert Pot (http://evertpot.com/)
+ * @license http://sabre.io/license/ Modified BSD License
+ */
+class HrefList extends DAV\Property {
+
+ /**
+ * hrefs
+ *
+ * @var array
+ */
+ private $hrefs;
+
+ /**
+ * Automatically prefix the url with the server base directory
+ *
+ * @var bool
+ */
+ private $autoPrefix = true;
+
+ /**
+ * __construct
+ *
+ * @param array $hrefs
+ * @param bool $autoPrefix
+ */
+ public function __construct(array $hrefs, $autoPrefix = true) {
+
+ $this->hrefs = $hrefs;
+ $this->autoPrefix = $autoPrefix;
+
+ }
+
+ /**
+ * Returns the uris
+ *
+ * @return array
+ */
+ public function getHrefs() {
+
+ return $this->hrefs;
+
+ }
+
+ /**
+ * Serializes this property.
+ *
+ * It will additionally prepend the href property with the server's base uri.
+ *
+ * @param DAV\Server $server
+ * @param \DOMElement $dom
+ * @return void
+ */
+ public function serialize(DAV\Server $server,\DOMElement $dom) {
+
+ $prefix = $server->xmlNamespaces['DAV:'];
+
+ foreach($this->hrefs as $href) {
+
+ $elem = $dom->ownerDocument->createElement($prefix . ':href');
+ if ($this->autoPrefix) {
+ $value = $server->getBaseUri() . DAV\URLUtil::encodePath($href);
+ } else {
+ $value = $href;
+ }
+ $elem->appendChild($dom->ownerDocument->createTextNode($value));
+
+ $dom->appendChild($elem);
+ }
+
+ }
+
+ /**
+ * Unserializes this property from a DOM Element
+ *
+ * This method returns an instance of this class.
+ * It will only decode {DAV:}href values.
+ *
+ * @param \DOMElement $dom
+ * @return DAV\Property\HrefList
+ */
+ static function unserialize(\DOMElement $dom) {
+
+ $hrefs = array();
+ foreach($dom->childNodes as $child) {
+ if (DAV\XMLUtil::toClarkNotation($child)==='{DAV:}href') {
+ $hrefs[] = $child->textContent;
+ }
+ }
+ return new self($hrefs, false);
+
+ }
+
+}
diff --git a/calendar/lib/SabreDAV/lib/OldSabre/DAV/Property/IHref.php b/calendar/lib/SabreDAV/lib/OldSabre/DAV/Property/IHref.php
new file mode 100644
index 0000000..ce24250
--- /dev/null
+++ b/calendar/lib/SabreDAV/lib/OldSabre/DAV/Property/IHref.php
@@ -0,0 +1,25 @@
+<?php
+
+namespace OldSabre\DAV\Property;
+
+/**
+ * IHref interface
+ *
+ * Any property implementing this interface can expose a related url.
+ * This is used by certain subsystems to aquire more information about for example
+ * the owner of a file
+ *
+ * @copyright Copyright (C) 2007-2015 fruux GmbH (https://fruux.com/).
+ * @author Evert Pot (http://evertpot.com/)
+ * @license http://sabre.io/license/ Modified BSD License
+ */
+interface IHref {
+
+ /**
+ * getHref
+ *
+ * @return string
+ */
+ function getHref();
+
+}
diff --git a/calendar/lib/SabreDAV/lib/OldSabre/DAV/Property/LockDiscovery.php b/calendar/lib/SabreDAV/lib/OldSabre/DAV/Property/LockDiscovery.php
new file mode 100644
index 0000000..0a055db
--- /dev/null
+++ b/calendar/lib/SabreDAV/lib/OldSabre/DAV/Property/LockDiscovery.php
@@ -0,0 +1,104 @@
+<?php
+
+namespace OldSabre\DAV\Property;
+
+use OldSabre\DAV;
+
+/**
+ * Represents {DAV:}lockdiscovery property
+ *
+ * This property contains all the open locks on a given resource
+ *
+ * @copyright Copyright (C) 2007-2015 fruux GmbH (https://fruux.com/).
+ * @author Evert Pot (http://evertpot.com/)
+ * @license http://sabre.io/license/ Modified BSD License
+ */
+class LockDiscovery extends DAV\Property {
+
+ /**
+ * locks
+ *
+ * @var array
+ */
+ public $locks;
+
+ /**
+ * Should we show the locktoken as well?
+ *
+ * @var bool
+ */
+ public $revealLockToken;
+
+ /**
+ * Hides the {DAV:}lockroot element from the response.
+ *
+ * It was reported that showing the lockroot in the response can break
+ * Office 2000 compatibility.
+ */
+ static public $hideLockRoot = false;
+
+ /**
+ * __construct
+ *
+ * @param array $locks
+ * @param bool $revealLockToken
+ */
+ public function __construct($locks, $revealLockToken = false) {
+
+ $this->locks = $locks;
+ $this->revealLockToken = $revealLockToken;
+
+ }
+
+ /**
+ * serialize
+ *
+ * @param DAV\Server $server
+ * @param \DOMElement $prop
+ * @return void
+ */
+ public function serialize(DAV\Server $server, \DOMElement $prop) {
+
+ $doc = $prop->ownerDocument;
+
+ foreach($this->locks as $lock) {
+
+ $activeLock = $doc->createElementNS('DAV:','d:activelock');
+ $prop->appendChild($activeLock);
+
+ $lockScope = $doc->createElementNS('DAV:','d:lockscope');
+ $activeLock->appendChild($lockScope);
+
+ $lockScope->appendChild($doc->createElementNS('DAV:','d:' . ($lock->scope==DAV\Locks\LockInfo::EXCLUSIVE?'exclusive':'shared')));
+
+ $lockType = $doc->createElementNS('DAV:','d:locktype');
+ $activeLock->appendChild($lockType);
+
+ $lockType->appendChild($doc->createElementNS('DAV:','d:write'));
+
+ /* {DAV:}lockroot */
+ if (!self::$hideLockRoot) {
+ $lockRoot = $doc->createElementNS('DAV:','d:lockroot');
+ $activeLock->appendChild($lockRoot);
+ $href = $doc->createElementNS('DAV:','d:href');
+ $href->appendChild($doc->createTextNode($server->getBaseUri() . $lock->uri));
+ $lockRoot->appendChild($href);
+ }
+
+ $activeLock->appendChild($doc->createElementNS('DAV:','d:depth',($lock->depth == DAV\Server::DEPTH_INFINITY?'infinity':$lock->depth)));
+ $activeLock->appendChild($doc->createElementNS('DAV:','d:timeout','Second-' . $lock->timeout));
+
+ if ($this->revealLockToken) {
+ $lockToken = $doc->createElementNS('DAV:','d:locktoken');
+ $activeLock->appendChild($lockToken);
+ $lockToken->appendChild($doc->createElementNS('DAV:','d:href','opaquelocktoken:' . $lock->token));
+ }
+
+ $activeLock->appendChild($doc->createElementNS('DAV:','d:owner',$lock->owner));
+
+ }
+
+ }
+
+}
+
diff --git a/calendar/lib/SabreDAV/lib/OldSabre/DAV/Property/ResourceType.php b/calendar/lib/SabreDAV/lib/OldSabre/DAV/Property/ResourceType.php
new file mode 100644
index 0000000..eee2825
--- /dev/null
+++ b/calendar/lib/SabreDAV/lib/OldSabre/DAV/Property/ResourceType.php
@@ -0,0 +1,127 @@
+<?php
+
+namespace OldSabre\DAV\Property;
+
+use OldSabre\DAV;
+
+/**
+ * This class represents the {DAV:}resourcetype property
+ *
+ * Normally for files this is empty, and for collection {DAV:}collection.
+ * However, other specs define different values for this.
+ *
+ * @copyright Copyright (C) 2007-2015 fruux GmbH (https://fruux.com/).
+ * @author Evert Pot (http://evertpot.com/)
+ * @license http://sabre.io/license/ Modified BSD License
+ */
+class ResourceType extends DAV\Property {
+
+ /**
+ * resourceType
+ *
+ * @var array
+ */
+ public $resourceType = array();
+
+ /**
+ * __construct
+ *
+ * @param mixed $resourceType
+ */
+ public function __construct($resourceType = array()) {
+
+ if ($resourceType === DAV\Server::NODE_FILE)
+ $this->resourceType = array();
+ elseif ($resourceType === DAV\Server::NODE_DIRECTORY)
+ $this->resourceType = array('{DAV:}collection');
+ elseif (is_array($resourceType))
+ $this->resourceType = $resourceType;
+ else
+ $this->resourceType = array($resourceType);
+
+ }
+
+ /**
+ * serialize
+ *
+ * @param DAV\Server $server
+ * @param \DOMElement $prop
+ * @return void
+ */
+ public function serialize(DAV\Server $server, \DOMElement $prop) {
+
+ $propName = null;
+ $rt = $this->resourceType;
+
+ foreach($rt as $resourceType) {
+ if (preg_match('/^{([^}]*)}(.*)$/',$resourceType,$propName)) {
+
+ if (isset($server->xmlNamespaces[$propName[1]])) {
+ $prop->appendChild($prop->ownerDocument->createElement($server->xmlNamespaces[$propName[1]] . ':' . $propName[2]));
+ } else {
+ $prop->appendChild($prop->ownerDocument->createElementNS($propName[1],'custom:' . $propName[2]));
+ }
+
+ }
+ }
+
+ }
+
+ /**
+ * Returns the values in clark-notation
+ *
+ * For example array('{DAV:}collection')
+ *
+ * @return array
+ */
+ public function getValue() {
+
+ return $this->resourceType;
+
+ }
+
+ /**
+ * Checks if the principal contains a certain value
+ *
+ * @param string $type
+ * @return bool
+ */
+ public function is($type) {
+
+ return in_array($type, $this->resourceType);
+
+ }
+
+ /**
+ * Adds a resourcetype value to this property
+ *
+ * @param string $type
+ * @return void
+ */
+ public function add($type) {
+
+ $this->resourceType[] = $type;
+ $this->resourceType = array_unique($this->resourceType);
+
+ }
+
+ /**
+ * Unserializes a DOM element into a ResourceType property.
+ *
+ * @param \DOMElement $dom
+ * @return DAV\Property\ResourceType
+ */
+ static public function unserialize(\DOMElement $dom) {
+
+ $value = array();
+ foreach($dom->childNodes as $child) {
+
+ $value[] = DAV\XMLUtil::toClarkNotation($child);
+
+ }
+
+ return new self($value);
+
+ }
+
+}
diff --git a/calendar/lib/SabreDAV/lib/OldSabre/DAV/Property/Response.php b/calendar/lib/SabreDAV/lib/OldSabre/DAV/Property/Response.php
new file mode 100644
index 0000000..0e1b836
--- /dev/null
+++ b/calendar/lib/SabreDAV/lib/OldSabre/DAV/Property/Response.php
@@ -0,0 +1,157 @@
+<?php
+
+namespace OldSabre\DAV\Property;
+
+use OldSabre\DAV;
+
+/**
+ * Response property
+ *
+ * This class represents the {DAV:}response XML element.
+ * This is used by the Server class to encode individual items within a multistatus
+ * response.
+ *
+ * @copyright Copyright (C) 2007-2015 fruux GmbH (https://fruux.com/).
+ * @author Evert Pot (http://evertpot.com/)
+ * @license http://sabre.io/license/ Modified BSD License
+ */
+class Response extends DAV\Property implements IHref {
+
+ /**
+ * Url for the response
+ *
+ * @var string
+ */
+ private $href;
+
+ /**
+ * Propertylist, ordered by HTTP status code
+ *
+ * @var array
+ */
+ private $responseProperties;
+
+ /**
+ * The responseProperties argument is a list of properties
+ * within an array with keys representing HTTP status codes
+ *
+ * @param string $href
+ * @param array $responseProperties
+ */
+ public function __construct($href, array $responseProperties) {
+
+ $this->href = $href;
+ $this->responseProperties = $responseProperties;
+
+ }
+
+ /**
+ * Returns the url
+ *
+ * @return string
+ */
+ public function getHref() {
+
+ return $this->href;
+
+ }
+
+ /**
+ * Returns the property list
+ *
+ * @return array
+ */
+ public function getResponseProperties() {
+
+ return $this->responseProperties;
+
+ }
+
+ /**
+ * serialize
+ *
+ * @param DAV\Server $server
+ * @param \DOMElement $dom
+ * @return void
+ */
+ public function serialize(DAV\Server $server, \DOMElement $dom) {
+
+ $document = $dom->ownerDocument;
+ $properties = $this->responseProperties;
+
+ $xresponse = $document->createElement('d:response');
+ $dom->appendChild($xresponse);
+
+ $uri = DAV\URLUtil::encodePath($this->href);
+
+ // Adding the baseurl to the beginning of the url
+ $uri = $server->getBaseUri() . $uri;
+
+ $xresponse->appendChild($document->createElement('d:href',$uri));
+
+ // The properties variable is an array containing properties, grouped by
+ // HTTP status
+ foreach($properties as $httpStatus=>$propertyGroup) {
+
+ // The 'href' is also in this array, and it's special cased.
+ // We will ignore it
+ if ($httpStatus=='href') continue;
+
+ // If there are no properties in this group, we can also just carry on
+ if (!count($propertyGroup)) continue;
+
+ $xpropstat = $document->createElement('d:propstat');
+ $xresponse->appendChild($xpropstat);
+
+ $xprop = $document->createElement('d:prop');
+ $xpropstat->appendChild($xprop);
+
+ $nsList = $server->xmlNamespaces;
+
+ foreach($propertyGroup as $propertyName=>$propertyValue) {
+
+ $propName = null;
+ preg_match('/^{([^}]*)}(.*)$/',$propertyName,$propName);
+
+ // special case for empty namespaces
+ if ($propName[1]=='') {
+
+ $currentProperty = $document->createElement($propName[2]);
+ $xprop->appendChild($currentProperty);
+ $currentProperty->setAttribute('xmlns','');
+
+ } else {
+
+ if (!isset($nsList[$propName[1]])) {
+ $nsList[$propName[1]] = 'x' . count($nsList);
+ }
+
+ // If the namespace was defined in the top-level xml namespaces, it means
+ // there was already a namespace declaration, and we don't have to worry about it.
+ if (isset($server->xmlNamespaces[$propName[1]])) {
+ $currentProperty = $document->createElement($nsList[$propName[1]] . ':' . $propName[2]);
+ } else {
+ $currentProperty = $document->createElementNS($propName[1],$nsList[$propName[1]].':' . $propName[2]);
+ }
+ $xprop->appendChild($currentProperty);
+
+ }
+
+ if (is_scalar($propertyValue)) {
+ $text = $document->createTextNode($propertyValue);
+ $currentProperty->appendChild($text);
+ } elseif ($propertyValue instanceof DAV\PropertyInterface) {
+ $propertyValue->serialize($server,$currentProperty);
+ } elseif (!is_null($propertyValue)) {
+ throw new DAV\Exception('Unknown property value type: ' . gettype($propertyValue) . ' for property: ' . $propertyName);
+ }
+
+ }
+
+ $xpropstat->appendChild($document->createElement('d:status',$server->httpResponse->getStatusMessage($httpStatus)));
+
+ }
+
+ }
+
+}
diff --git a/calendar/lib/SabreDAV/lib/OldSabre/DAV/Property/ResponseList.php b/calendar/lib/SabreDAV/lib/OldSabre/DAV/Property/ResponseList.php
new file mode 100644
index 0000000..ebf9296
--- /dev/null
+++ b/calendar/lib/SabreDAV/lib/OldSabre/DAV/Property/ResponseList.php
@@ -0,0 +1,59 @@
+<?php
+
+namespace OldSabre\DAV\Property;
+
+use OldSabre\DAV;
+
+/**
+ * ResponseList property
+ *
+ * This class represents multiple {DAV:}response XML elements.
+ * This is used by the Server class to encode items within a multistatus
+ * response.
+ *
+ * @copyright Copyright (C) 2007-2015 fruux GmbH (https://fruux.com/).
+ * @author Evert Pot (http://evertpot.com/)
+ * @license http://sabre.io/license/ Modified BSD License
+ */
+class ResponseList extends DAV\Property {
+
+ /**
+ * Response objects.
+ *
+ * @var array
+ */
+ private $responses;
+
+ /**
+ * The only valid argument is a list of OldSabre\DAV\Property\Response
+ * objects.
+ *
+ * @param array $responses;
+ */
+ public function __construct($responses) {
+
+ foreach($responses as $response) {
+ if (!($response instanceof Response)) {
+ throw new \InvalidArgumentException('You must pass an array of OldSabre\DAV\Property\Response objects');
+ }
+ }
+ $this->responses = $responses;
+
+ }
+
+ /**
+ * serialize
+ *
+ * @param DAV\Server $server
+ * @param \DOMElement $dom
+ * @return void
+ */
+ public function serialize(DAV\Server $server,\DOMElement $dom) {
+
+ foreach($this->responses as $response) {
+ $response->serialize($server, $dom);
+ }
+
+ }
+
+}
diff --git a/calendar/lib/SabreDAV/lib/OldSabre/DAV/Property/SupportedLock.php b/calendar/lib/SabreDAV/lib/OldSabre/DAV/Property/SupportedLock.php
new file mode 100644
index 0000000..1699826
--- /dev/null
+++ b/calendar/lib/SabreDAV/lib/OldSabre/DAV/Property/SupportedLock.php
@@ -0,0 +1,78 @@
+<?php
+
+namespace OldSabre\DAV\Property;
+
+use OldSabre\DAV;
+
+/**
+ * This class represents the {DAV:}supportedlock property
+ *
+ * This property contains information about what kind of locks
+ * this server supports.
+ *
+ * @copyright Copyright (C) 2007-2015 fruux GmbH (https://fruux.com/).
+ * @author Evert Pot (http://evertpot.com/)
+ * @license http://sabre.io/license/ Modified BSD License
+ */
+class SupportedLock extends DAV\Property {
+
+ /**
+ * supportsLocks
+ *
+ * @var mixed
+ */
+ public $supportsLocks = false;
+
+ /**
+ * __construct
+ *
+ * @param mixed $supportsLocks
+ */
+ public function __construct($supportsLocks) {
+
+ $this->supportsLocks = $supportsLocks;
+
+ }
+
+ /**
+ * serialize
+ *
+ * @param DAV\Server $server
+ * @param \DOMElement $prop
+ * @return void
+ */
+ public function serialize(DAV\Server $server,\DOMElement $prop) {
+
+ $doc = $prop->ownerDocument;
+
+ if (!$this->supportsLocks) return null;
+
+ $lockEntry1 = $doc->createElement('d:lockentry');
+ $lockEntry2 = $doc->createElement('d:lockentry');
+
+ $prop->appendChild($lockEntry1);
+ $prop->appendChild($lockEntry2);
+
+ $lockScope1 = $doc->createElement('d:lockscope');
+ $lockScope2 = $doc->createElement('d:lockscope');
+ $lockType1 = $doc->createElement('d:locktype');
+ $lockType2 = $doc->createElement('d:locktype');
+
+ $lockEntry1->appendChild($lockScope1);
+ $lockEntry1->appendChild($lockType1);
+ $lockEntry2->appendChild($lockScope2);
+ $lockEntry2->appendChild($lockType2);
+
+ $lockScope1->appendChild($doc->createElement('d:exclusive'));
+ $lockScope2->appendChild($doc->createElement('d:shared'));
+
+ $lockType1->appendChild($doc->createElement('d:write'));
+ $lockType2->appendChild($doc->createElement('d:write'));
+
+ //$frag->appendXML('<d:lockentry><d:lockscope><d:exclusive /></d:lockscope><d:locktype><d:write /></d:locktype></d:lockentry>');
+ //$frag->appendXML('<d:lockentry><d:lockscope><d:shared /></d:lockscope><d:locktype><d:write /></d:locktype></d:lockentry>');
+
+ }
+
+}
+
diff --git a/calendar/lib/SabreDAV/lib/OldSabre/DAV/Property/SupportedReportSet.php b/calendar/lib/SabreDAV/lib/OldSabre/DAV/Property/SupportedReportSet.php
new file mode 100644
index 0000000..ecbde7d
--- /dev/null
+++ b/calendar/lib/SabreDAV/lib/OldSabre/DAV/Property/SupportedReportSet.php
@@ -0,0 +1,111 @@
+<?php
+
+namespace OldSabre\DAV\Property;
+
+use OldSabre\DAV;
+
+/**
+ * supported-report-set property.
+ *
+ * This property is defined in RFC3253, but since it's
+ * so common in other webdav-related specs, it is part of the core server.
+ *
+ * @copyright Copyright (C) 2007-2015 fruux GmbH (https://fruux.com/).
+ * @author Evert Pot (http://evertpot.com/)
+ * @license http://sabre.io/license/ Modified BSD License
+ */
+class SupportedReportSet extends DAV\Property {
+
+ /**
+ * List of reports
+ *
+ * @var array
+ */
+ protected $reports = array();
+
+ /**
+ * Creates the property
+ *
+ * Any reports passed in the constructor
+ * should be valid report-types in clark-notation.
+ *
+ * Either a string or an array of strings must be passed.
+ *
+ * @param mixed $reports
+ */
+ public function __construct($reports = null) {
+
+ if (!is_null($reports))
+ $this->addReport($reports);
+
+ }
+
+ /**
+ * Adds a report to this property
+ *
+ * The report must be a string in clark-notation.
+ * Multiple reports can be specified as an array.
+ *
+ * @param mixed $report
+ * @return void
+ */
+ public function addReport($report) {
+
+ if (!is_array($report)) $report = array($report);
+
+ foreach($report as $r) {
+
+ if (!preg_match('/^{([^}]*)}(.*)$/',$r))
+ throw new DAV\Exception('Reportname must be in clark-notation');
+
+ $this->reports[] = $r;
+
+ }
+
+ }
+
+ /**
+ * Returns the list of supported reports
+ *
+ * @return array
+ */
+ public function getValue() {
+
+ return $this->reports;
+
+ }
+
+ /**
+ * Serializes the node
+ *
+ * @param DAV\Server $server
+ * @param \DOMElement $prop
+ * @return void
+ */
+ public function serialize(DAV\Server $server, \DOMElement $prop) {
+
+ foreach($this->reports as $reportName) {
+
+ $supportedReport = $prop->ownerDocument->createElement('d:supported-report');
+ $prop->appendChild($supportedReport);
+
+ $report = $prop->ownerDocument->createElement('d:report');
+ $supportedReport->appendChild($report);
+
+ preg_match('/^{([^}]*)}(.*)$/',$reportName,$matches);
+
+ list(, $namespace, $element) = $matches;
+
+ $prefix = isset($server->xmlNamespaces[$namespace])?$server->xmlNamespaces[$namespace]:null;
+
+ if ($prefix) {
+ $report->appendChild($prop->ownerDocument->createElement($prefix . ':' . $element));
+ } else {
+ $report->appendChild($prop->ownerDocument->createElementNS($namespace, 'x:' . $element));
+ }
+
+ }
+
+ }
+
+}

© 2014-2024 Faster IT GmbH | imprint | privacy policy