diff options
Diffstat (limited to 'vendor/sabre/dav/lib')
21 files changed, 218 insertions, 94 deletions
diff --git a/vendor/sabre/dav/lib/CalDAV/Backend/AbstractBackend.php b/vendor/sabre/dav/lib/CalDAV/Backend/AbstractBackend.php index c32c86489..c761bff51 100644 --- a/vendor/sabre/dav/lib/CalDAV/Backend/AbstractBackend.php +++ b/vendor/sabre/dav/lib/CalDAV/Backend/AbstractBackend.php @@ -78,7 +78,7 @@ abstract class AbstractBackend implements BackendInterface * * This default may well be good enough for personal use, and calendars * that aren't very large. But if you anticipate high usage, big calendars - * or high loads, you are strongly adviced to optimize certain paths. + * or high loads, you are strongly advised to optimize certain paths. * * The best way to do so is override this method and to optimize * specifically for 'common filters'. @@ -95,7 +95,7 @@ abstract class AbstractBackend implements BackendInterface * Note that especially time-range-filters may be difficult to parse. A * time-range filter specified on a VEVENT must for instance also handle * recurrence rules correctly. - * A good example of how to interprete all these filters can also simply + * A good example of how to interpret all these filters can also simply * be found in \Sabre\CalDAV\CalendarQueryFilter. This class is as correct * as possible, so it gives you a good idea on what type of stuff you need * to think of. diff --git a/vendor/sabre/dav/lib/CalDAV/Backend/PDO.php b/vendor/sabre/dav/lib/CalDAV/Backend/PDO.php index 2f48ab982..b9f112cf8 100644 --- a/vendor/sabre/dav/lib/CalDAV/Backend/PDO.php +++ b/vendor/sabre/dav/lib/CalDAV/Backend/PDO.php @@ -939,7 +939,7 @@ SQL; * @param int $syncLevel * @param int $limit * - * @return array + * @return array|null */ public function getChangesForCalendar($calendarId, $syncToken, $syncLevel, $limit = null) { diff --git a/vendor/sabre/dav/lib/CalDAV/Backend/SyncSupport.php b/vendor/sabre/dav/lib/CalDAV/Backend/SyncSupport.php index c7f67d176..bfc1dafc2 100644 --- a/vendor/sabre/dav/lib/CalDAV/Backend/SyncSupport.php +++ b/vendor/sabre/dav/lib/CalDAV/Backend/SyncSupport.php @@ -77,7 +77,7 @@ interface SyncSupport extends BackendInterface * @param int $syncLevel * @param int $limit * - * @return array + * @return array|null */ public function getChangesForCalendar($calendarId, $syncToken, $syncLevel, $limit = null); } diff --git a/vendor/sabre/dav/lib/CalDAV/Calendar.php b/vendor/sabre/dav/lib/CalDAV/Calendar.php index 6e989314d..6c0bf5411 100644 --- a/vendor/sabre/dav/lib/CalDAV/Calendar.php +++ b/vendor/sabre/dav/lib/CalDAV/Calendar.php @@ -186,17 +186,17 @@ class Calendar implements ICalendar, DAV\IProperties, DAV\Sync\ISyncCollection, * The contents of the new file must be a valid ICalendar string. * * @param string $name - * @param resource $calendarData + * @param resource $data * * @return string|null */ - public function createFile($name, $calendarData = null) + public function createFile($name, $data = null) { - if (is_resource($calendarData)) { - $calendarData = stream_get_contents($calendarData); + if (is_resource($data)) { + $data = stream_get_contents($data); } - return $this->caldavBackend->createCalendarObject($this->calendarInfo['id'], $name, $calendarData); + return $this->caldavBackend->createCalendarObject($this->calendarInfo['id'], $name, $data); } /** @@ -442,7 +442,7 @@ class Calendar implements ICalendar, DAV\IProperties, DAV\Sync\ISyncCollection, * @param int $syncLevel * @param int $limit * - * @return array + * @return array|null */ public function getChanges($syncToken, $syncLevel, $limit = null) { diff --git a/vendor/sabre/dav/lib/CalDAV/CalendarHome.php b/vendor/sabre/dav/lib/CalDAV/CalendarHome.php index 159ddcc67..49c54a37a 100644 --- a/vendor/sabre/dav/lib/CalDAV/CalendarHome.php +++ b/vendor/sabre/dav/lib/CalDAV/CalendarHome.php @@ -96,10 +96,10 @@ class CalendarHome implements DAV\IExtendedCollection, DAVACL\IACL * * This is currently not allowed * - * @param string $filename + * @param string $name * @param resource $data */ - public function createFile($filename, $data = null) + public function createFile($name, $data = null) { throw new DAV\Exception\MethodNotAllowed('Creating new files in this collection is not supported'); } diff --git a/vendor/sabre/dav/lib/CalDAV/Schedule/IMipPlugin.php b/vendor/sabre/dav/lib/CalDAV/Schedule/IMipPlugin.php index e050ac273..dcaf951ef 100644 --- a/vendor/sabre/dav/lib/CalDAV/Schedule/IMipPlugin.php +++ b/vendor/sabre/dav/lib/CalDAV/Schedule/IMipPlugin.php @@ -31,13 +31,6 @@ class IMipPlugin extends DAV\ServerPlugin protected $senderEmail; /** - * ITipMessage. - * - * @var ITip\Message - */ - protected $itipMessage; - - /** * Creates the email handler. * * @param string $senderEmail. The 'senderEmail' is the email that shows up diff --git a/vendor/sabre/dav/lib/CalDAV/Schedule/Plugin.php b/vendor/sabre/dav/lib/CalDAV/Schedule/Plugin.php index 3cc360f1d..5e5659610 100644 --- a/vendor/sabre/dav/lib/CalDAV/Schedule/Plugin.php +++ b/vendor/sabre/dav/lib/CalDAV/Schedule/Plugin.php @@ -605,10 +605,9 @@ class Plugin extends ServerPlugin * * This method may update $newObject to add any status changes. * - * @param VCalendar|string $oldObject - * @param array $ignore any addresses to not send messages to - * @param bool $modified a marker to indicate that the original object - * modified by this process + * @param VCalendar|string|null $oldObject + * @param array $ignore any addresses to not send messages to + * @param bool $modified a marker to indicate that the original object modified by this process */ protected function processICalendarChange($oldObject, VCalendar $newObject, array $addresses, array $ignore = [], &$modified = false) { @@ -969,7 +968,7 @@ class Plugin extends ServerPlugin * * @return bool */ - private function scheduleReply(RequestInterface $request) + protected function scheduleReply(RequestInterface $request) { $scheduleReply = $request->getHeader('Schedule-Reply'); diff --git a/vendor/sabre/dav/lib/CalDAV/Xml/Filter/PropFilter.php b/vendor/sabre/dav/lib/CalDAV/Xml/Filter/PropFilter.php index c9a3cb5ac..f1d66cc0d 100644 --- a/vendor/sabre/dav/lib/CalDAV/Xml/Filter/PropFilter.php +++ b/vendor/sabre/dav/lib/CalDAV/Xml/Filter/PropFilter.php @@ -53,7 +53,7 @@ class PropFilter implements XmlDeserializable 'is-not-defined' => false, 'param-filters' => [], 'text-match' => null, - 'time-range' => false, + 'time-range' => [], ]; $att = $reader->parseAttributes(); diff --git a/vendor/sabre/dav/lib/CardDAV/AddressBook.php b/vendor/sabre/dav/lib/CardDAV/AddressBook.php index 86994f2d5..f5744f644 100644 --- a/vendor/sabre/dav/lib/CardDAV/AddressBook.php +++ b/vendor/sabre/dav/lib/CardDAV/AddressBook.php @@ -129,19 +129,19 @@ class AddressBook extends DAV\Collection implements IAddressBook, DAV\IPropertie * This method may return an ETag. * * @param string $name - * @param resource $vcardData + * @param resource $data * * @return string|null */ - public function createFile($name, $vcardData = null) + public function createFile($name, $data = null) { - if (is_resource($vcardData)) { - $vcardData = stream_get_contents($vcardData); + if (is_resource($data)) { + $data = stream_get_contents($data); } // Converting to UTF-8, if needed - $vcardData = DAV\StringUtil::ensureUTF8($vcardData); + $data = DAV\StringUtil::ensureUTF8($data); - return $this->carddavBackend->createCard($this->addressBookInfo['id'], $name, $vcardData); + return $this->carddavBackend->createCard($this->addressBookInfo['id'], $name, $data); } /** @@ -317,7 +317,7 @@ class AddressBook extends DAV\Collection implements IAddressBook, DAV\IPropertie * @param int $syncLevel * @param int $limit * - * @return array + * @return array|null */ public function getChanges($syncToken, $syncLevel, $limit = null) { diff --git a/vendor/sabre/dav/lib/CardDAV/AddressBookHome.php b/vendor/sabre/dav/lib/CardDAV/AddressBookHome.php index 884e9b24e..d7365fbe8 100644 --- a/vendor/sabre/dav/lib/CardDAV/AddressBookHome.php +++ b/vendor/sabre/dav/lib/CardDAV/AddressBookHome.php @@ -92,10 +92,10 @@ class AddressBookHome extends DAV\Collection implements DAV\IExtendedCollection, * * This is currently not allowed * - * @param string $filename + * @param string $name * @param resource $data */ - public function createFile($filename, $data = null) + public function createFile($name, $data = null) { throw new DAV\Exception\MethodNotAllowed('Creating new files in this collection is not supported'); } diff --git a/vendor/sabre/dav/lib/CardDAV/Backend/PDO.php b/vendor/sabre/dav/lib/CardDAV/Backend/PDO.php index 966d7ba09..4ca9284a9 100644 --- a/vendor/sabre/dav/lib/CardDAV/Backend/PDO.php +++ b/vendor/sabre/dav/lib/CardDAV/Backend/PDO.php @@ -452,7 +452,7 @@ class PDO extends AbstractBackend implements SyncSupport * @param int $syncLevel * @param int $limit * - * @return array + * @return array|null */ public function getChangesForAddressBook($addressBookId, $syncToken, $syncLevel, $limit = null) { diff --git a/vendor/sabre/dav/lib/CardDAV/Backend/SyncSupport.php b/vendor/sabre/dav/lib/CardDAV/Backend/SyncSupport.php index 071361ed0..6aaad1415 100644 --- a/vendor/sabre/dav/lib/CardDAV/Backend/SyncSupport.php +++ b/vendor/sabre/dav/lib/CardDAV/Backend/SyncSupport.php @@ -77,7 +77,7 @@ interface SyncSupport extends BackendInterface * @param int $syncLevel * @param int $limit * - * @return array + * @return array|null */ public function getChangesForAddressBook($addressBookId, $syncToken, $syncLevel, $limit = null); } diff --git a/vendor/sabre/dav/lib/CardDAV/Xml/Request/AddressBookMultiGetReport.php b/vendor/sabre/dav/lib/CardDAV/Xml/Request/AddressBookMultiGetReport.php index c11d2dd73..491f96908 100644 --- a/vendor/sabre/dav/lib/CardDAV/Xml/Request/AddressBookMultiGetReport.php +++ b/vendor/sabre/dav/lib/CardDAV/Xml/Request/AddressBookMultiGetReport.php @@ -38,7 +38,7 @@ class AddressBookMultiGetReport implements XmlDeserializable public $hrefs; /** - * The mimetype of the content that should be returend. Usually + * The mimetype of the content that should be returned. Usually * text/vcard. * * @var string @@ -54,6 +54,13 @@ class AddressBookMultiGetReport implements XmlDeserializable public $version = null; /** + * An array with requested vcard properties. + * + * @var array + */ + public $addressDataProperties; + + /** * The deserialize method is called during xml parsing. * * This method is called statically, this is because in theory this method diff --git a/vendor/sabre/dav/lib/DAV/Client.php b/vendor/sabre/dav/lib/DAV/Client.php index a9de71cdb..1028a6b9d 100644 --- a/vendor/sabre/dav/lib/DAV/Client.php +++ b/vendor/sabre/dav/lib/DAV/Client.php @@ -174,27 +174,98 @@ class Client extends HTTP\Client } /** - * Does a PROPFIND request. + * Does a PROPFIND request with filtered response returning only available properties. * * The list of requested properties must be specified as an array, in clark * notation. * - * The returned array will contain a list of filenames as keys, and - * properties as values. + * Depth should be either 0 or 1. A depth of 1 will cause a request to be + * made to the server to also return all child resources. + * + * For depth 0, just the array of properties for the resource is returned. + * + * For depth 1, the returned array will contain a list of resource names as keys, + * and an array of properties as values. * - * The properties array will contain the list of properties. Only properties - * that are actually returned from the server (without error) will be + * The array of properties will contain the properties as keys with their values as the value. + * Only properties that are actually returned from the server without error will be * returned, anything else is discarded. * + * @param 1|0 $depth + */ + public function propFind($url, array $properties, $depth = 0): array + { + $result = $this->doPropFind($url, $properties, $depth); + + // If depth was 0, we only return the top item + if (0 === $depth) { + reset($result); + $result = current($result); + + return isset($result[200]) ? $result[200] : []; + } + + $newResult = []; + foreach ($result as $href => $statusList) { + $newResult[$href] = isset($statusList[200]) ? $statusList[200] : []; + } + + return $newResult; + } + + /** + * Does a PROPFIND request with unfiltered response. + * + * The list of requested properties must be specified as an array, in clark + * notation. + * * Depth should be either 0 or 1. A depth of 1 will cause a request to be * made to the server to also return all child resources. * - * @param string $url - * @param int $depth + * For depth 0, just the multi-level array of status and properties for the resource is returned. * - * @return array + * For depth 1, the returned array will contain a list of resources as keys and + * a multi-level array containing status and properties as value. + * + * The multi-level array of status and properties is formatted the same as what is + * documented for parseMultiStatus. + * + * All properties that are actually returned from the server are returned by this method. + * + * @param 1|0 $depth + */ + public function propFindUnfiltered(string $url, array $properties, int $depth = 0): array + { + $result = $this->doPropFind($url, $properties, $depth); + + // If depth was 0, we only return the top item + if (0 === $depth) { + reset($result); + + return current($result); + } else { + return $result; + } + } + + /** + * Does a PROPFIND request. + * + * The list of requested properties must be specified as an array, in clark + * notation. + * + * Depth should be either 0 or 1. A depth of 1 will cause a request to be + * made to the server to also return all child resources. + * + * The returned array will contain a list of resources as keys and + * a multi-level array containing status and properties as value. + * + * The multi-level array of status and properties is formatted the same as what is + * documented for parseMultiStatus. + * + * @param 1|0 $depth */ - public function propFind($url, array $properties, $depth = 0) + private function doPropFind($url, array $properties, $depth = 0): array { $dom = new \DOMDocument('1.0', 'UTF-8'); $dom->formatOutput = true; @@ -232,22 +303,7 @@ class Client extends HTTP\Client throw new HTTP\ClientHttpException($response); } - $result = $this->parseMultiStatus($response->getBodyAsString()); - - // If depth was 0, we only return the top item - if (0 === $depth) { - reset($result); - $result = current($result); - - return isset($result[200]) ? $result[200] : []; - } - - $newResult = []; - foreach ($result as $href => $statusList) { - $newResult[$href] = isset($statusList[200]) ? $statusList[200] : []; - } - - return $newResult; + return $this->parseMultiStatus($response->getBodyAsString()); } /** @@ -385,7 +441,7 @@ class Client extends HTTP\Client { return Uri\resolve( $this->baseUri, - $url + (string) $url ); } diff --git a/vendor/sabre/dav/lib/DAV/INodeByPath.php b/vendor/sabre/dav/lib/DAV/INodeByPath.php new file mode 100644 index 000000000..4d63a33bd --- /dev/null +++ b/vendor/sabre/dav/lib/DAV/INodeByPath.php @@ -0,0 +1,36 @@ +<?php + +declare(strict_types=1); + +namespace Sabre\DAV; + +/** + * INodeByPath. + * + * This interface adds a tiny bit of functionality to collections. + * + * Getting a node that is deep in the tree normally requires going trough each parent node + * which can cause a significant performance overhead. + * + * Implementing this interface allows solving this overhead by directly jumping to the target node. + * + * @copyright Copyright (C) Robin Appelman (https://icewind.nl/) + * @author Robin Appelman (https://icewind.nl/) + * @license http://sabre.io/license/ Modified BSD License + */ +interface INodeByPath +{ + /** + * Returns the INode object for the requested path. + * + * In case where this collection can not retrieve the requested node + * but also can not determine that the node does not exists, + * null should be returned to signal that the caller should fallback + * to walking the directory tree. + * + * @param string $path + * + * @return INode|null + */ + public function getNodeForPath($path); +} diff --git a/vendor/sabre/dav/lib/DAV/Sync/ISyncCollection.php b/vendor/sabre/dav/lib/DAV/Sync/ISyncCollection.php index 4ca69dc89..c829716b7 100644 --- a/vendor/sabre/dav/lib/DAV/Sync/ISyncCollection.php +++ b/vendor/sabre/dav/lib/DAV/Sync/ISyncCollection.php @@ -84,7 +84,7 @@ interface ISyncCollection extends DAV\ICollection * @param int $syncLevel * @param int $limit * - * @return array + * @return array|null */ public function getChanges($syncToken, $syncLevel, $limit = null); } diff --git a/vendor/sabre/dav/lib/DAV/Tree.php b/vendor/sabre/dav/lib/DAV/Tree.php index 8215e2c39..65b4583ce 100644 --- a/vendor/sabre/dav/lib/DAV/Tree.php +++ b/vendor/sabre/dav/lib/DAV/Tree.php @@ -16,7 +16,7 @@ use Sabre\Uri; * @author Evert Pot (http://evertpot.com/) * @license http://sabre.io/license/ Modified BSD License */ -class Tree +class Tree implements INodeByPath { /** * The root node. @@ -62,20 +62,26 @@ class Tree return $this->rootNode; } - // Attempting to fetch its parent - list($parentName, $baseName) = Uri\split($path); + $parts = explode('/', $path); + $node = $this->rootNode; - // If there was no parent, we must simply ask it from the root node. - if ('' === $parentName) { - $node = $this->rootNode->getChild($baseName); - } else { - // Otherwise, we recursively grab the parent and ask him/her. - $parent = $this->getNodeForPath($parentName); - - if (!($parent instanceof ICollection)) { + while (count($parts)) { + if (!($node instanceof ICollection)) { throw new Exception\NotFound('Could not find node at path: '.$path); } - $node = $parent->getChild($baseName); + + if ($node instanceof INodeByPath) { + $targetNode = $node->getNodeForPath(implode('/', $parts)); + if ($targetNode instanceof Node) { + $node = $targetNode; + break; + } + } + + $part = array_shift($parts); + if ('' !== $part) { + $node = $node->getChild($part); + } } $this->cache[$path] = $node; diff --git a/vendor/sabre/dav/lib/DAV/Version.php b/vendor/sabre/dav/lib/DAV/Version.php index c6273ef72..345c62d7e 100644 --- a/vendor/sabre/dav/lib/DAV/Version.php +++ b/vendor/sabre/dav/lib/DAV/Version.php @@ -16,5 +16,5 @@ class Version /** * Full version number. */ - public const VERSION = '4.4.0'; + public const VERSION = '4.6.0'; } diff --git a/vendor/sabre/dav/lib/DAV/Xml/Element/Response.php b/vendor/sabre/dav/lib/DAV/Xml/Element/Response.php index 79f06a09b..df9291465 100644 --- a/vendor/sabre/dav/lib/DAV/Xml/Element/Response.php +++ b/vendor/sabre/dav/lib/DAV/Xml/Element/Response.php @@ -40,7 +40,7 @@ class Response implements Element * * This is currently only used in WebDAV-Sync * - * @var string + * @var string|null */ protected $httpStatus; @@ -112,13 +112,21 @@ class Response implements Element */ public function xmlSerialize(Writer $writer) { - if ($status = $this->getHTTPStatus()) { - $writer->writeElement('{DAV:}status', 'HTTP/1.1 '.$status.' '.\Sabre\HTTP\Response::$statusCodes[$status]); - } + /* + * Accordingly to the RFC the element looks like: + * <!ELEMENT response (href, ((href*, status)|(propstat+)), error?, responsedescription? , location?) > + * + * So the response + * - MUST contain a href and + * - EITHER a status and additional href(s) + * OR one or more propstat(s) + */ $writer->writeElement('{DAV:}href', $writer->contextUri.\Sabre\HTTP\encodePath($this->getHref())); $empty = true; + $httpStatus = $this->getHTTPStatus(); + // Add propstat elements foreach ($this->getResponseProperties() as $status => $properties) { // Skipping empty lists if (!$properties || (!is_int($status) && !ctype_digit($status))) { @@ -130,19 +138,25 @@ class Response implements Element $writer->writeElement('{DAV:}status', 'HTTP/1.1 '.$status.' '.\Sabre\HTTP\Response::$statusCodes[$status]); $writer->endElement(); // {DAV:}propstat } + + // The WebDAV spec only allows the status element on responses _without_ a propstat if ($empty) { - /* - * The WebDAV spec _requires_ at least one DAV:propstat to appear for - * every DAV:response. In some circumstances however, there are no - * properties to encode. - * - * In those cases we MUST specify at least one DAV:propstat anyway, with - * no properties. - */ - $writer->writeElement('{DAV:}propstat', [ - '{DAV:}prop' => [], - '{DAV:}status' => 'HTTP/1.1 418 '.\Sabre\HTTP\Response::$statusCodes[418], - ]); + if (null !== $httpStatus) { + $writer->writeElement('{DAV:}status', 'HTTP/1.1 '.$httpStatus.' '.\Sabre\HTTP\Response::$statusCodes[$httpStatus]); + } else { + /* + * The WebDAV spec _requires_ at least one DAV:propstat to appear for + * every DAV:response if there is no status. + * In some circumstances however, there are no properties to encode. + * + * In those cases we MUST specify at least one DAV:propstat anyway, with + * no properties. + */ + $writer->writeElement('{DAV:}propstat', [ + '{DAV:}prop' => [], + '{DAV:}status' => 'HTTP/1.1 418 '.\Sabre\HTTP\Response::$statusCodes[418], + ]); + } } } diff --git a/vendor/sabre/dav/lib/DAV/Xml/Property/Href.php b/vendor/sabre/dav/lib/DAV/Xml/Property/Href.php index f88ce814a..d4e43da7c 100644 --- a/vendor/sabre/dav/lib/DAV/Xml/Property/Href.php +++ b/vendor/sabre/dav/lib/DAV/Xml/Property/Href.php @@ -35,6 +35,19 @@ class Href implements Element, HtmlOutput protected $hrefs; /** + * Automatically prefix the url with the server base directory. + * Note: use of this property in code was removed in PR: + * https://github.com/sabre-io/dav/pull/801 + * But the property is left here because old data may still exist + * that has this property saved. + * See discussion in issue: + * https://github.com/sabre-io/Baikal/issues/1154. + * + * @var bool + */ + protected $autoPrefix = true; + + /** * Constructor. * * You must either pass a string for a single href, or an array of hrefs. diff --git a/vendor/sabre/dav/lib/DAVACL/PrincipalBackend/BackendInterface.php b/vendor/sabre/dav/lib/DAVACL/PrincipalBackend/BackendInterface.php index 7140a9295..2fd31913d 100644 --- a/vendor/sabre/dav/lib/DAVACL/PrincipalBackend/BackendInterface.php +++ b/vendor/sabre/dav/lib/DAVACL/PrincipalBackend/BackendInterface.php @@ -48,7 +48,7 @@ interface BackendInterface public function getPrincipalByPath($path); /** - * Updates one ore more webdav properties on a principal. + * Updates one or more webdav properties on a principal. * * The list of mutations is stored in a Sabre\DAV\PropPatch object. * To do the actual updates, you must tell this object which properties |