commit vendor
This commit is contained in:
84
vendor/sabre/dav/lib/DAV/Xml/Request/Lock.php
vendored
Normal file
84
vendor/sabre/dav/lib/DAV/Xml/Request/Lock.php
vendored
Normal file
@ -0,0 +1,84 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Sabre\DAV\Xml\Request;
|
||||
|
||||
use Sabre\DAV\Locks\LockInfo;
|
||||
use Sabre\Xml\Element\KeyValue;
|
||||
use Sabre\Xml\Reader;
|
||||
use Sabre\Xml\XmlDeserializable;
|
||||
|
||||
/**
|
||||
* WebDAV LOCK request parser.
|
||||
*
|
||||
* This class parses the {DAV:}lockinfo request, as defined in:
|
||||
*
|
||||
* http://tools.ietf.org/html/rfc4918#section-9.10
|
||||
*
|
||||
* @copyright Copyright (C) fruux GmbH (https://fruux.com/)
|
||||
* @author Evert Pot (http://evertpot.com/)
|
||||
* @license http://sabre.io/license/ Modified BSD License
|
||||
*/
|
||||
class Lock implements XmlDeserializable
|
||||
{
|
||||
/**
|
||||
* Owner of the lock.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $owner;
|
||||
|
||||
/**
|
||||
* Scope of the lock.
|
||||
*
|
||||
* Either LockInfo::SHARED or LockInfo::EXCLUSIVE
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $scope;
|
||||
|
||||
/**
|
||||
* The deserialize method is called during xml parsing.
|
||||
*
|
||||
* This method is called statically, this is because in theory this method
|
||||
* may be used as a type of constructor, or factory method.
|
||||
*
|
||||
* Often you want to return an instance of the current class, but you are
|
||||
* free to return other data as well.
|
||||
*
|
||||
* You are responsible for advancing the reader to the next element. Not
|
||||
* doing anything will result in a never-ending loop.
|
||||
*
|
||||
* If you just want to skip parsing for this element altogether, you can
|
||||
* just call $reader->next();
|
||||
*
|
||||
* $reader->parseInnerTree() will parse the entire sub-tree, and advance to
|
||||
* the next element.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public static function xmlDeserialize(Reader $reader)
|
||||
{
|
||||
$reader->pushContext();
|
||||
$reader->elementMap['{DAV:}owner'] = 'Sabre\\Xml\\Element\\XmlFragment';
|
||||
|
||||
$values = KeyValue::xmlDeserialize($reader);
|
||||
|
||||
$reader->popContext();
|
||||
|
||||
$new = new self();
|
||||
$new->owner = !empty($values['{DAV:}owner']) ? $values['{DAV:}owner']->getXml() : null;
|
||||
$new->scope = LockInfo::SHARED;
|
||||
|
||||
if (isset($values['{DAV:}lockscope'])) {
|
||||
foreach ($values['{DAV:}lockscope'] as $elem) {
|
||||
if ('{DAV:}exclusive' === $elem['name']) {
|
||||
$new->scope = LockInfo::EXCLUSIVE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $new;
|
||||
}
|
||||
}
|
||||
80
vendor/sabre/dav/lib/DAV/Xml/Request/MkCol.php
vendored
Normal file
80
vendor/sabre/dav/lib/DAV/Xml/Request/MkCol.php
vendored
Normal file
@ -0,0 +1,80 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Sabre\DAV\Xml\Request;
|
||||
|
||||
use Sabre\Xml\Reader;
|
||||
use Sabre\Xml\XmlDeserializable;
|
||||
|
||||
/**
|
||||
* WebDAV Extended MKCOL request parser.
|
||||
*
|
||||
* This class parses the {DAV:}mkol request, as defined in:
|
||||
*
|
||||
* https://tools.ietf.org/html/rfc5689#section-5.1
|
||||
*
|
||||
* @copyright Copyright (C) fruux GmbH (https://fruux.com/)
|
||||
* @author Evert Pot (http://evertpot.com/)
|
||||
* @license http://sabre.io/license/ Modified BSD License
|
||||
*/
|
||||
class MkCol implements XmlDeserializable
|
||||
{
|
||||
/**
|
||||
* The list of properties that will be set.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $properties = [];
|
||||
|
||||
/**
|
||||
* Returns a key=>value array with properties that are supposed to get set
|
||||
* during creation of the new collection.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getProperties()
|
||||
{
|
||||
return $this->properties;
|
||||
}
|
||||
|
||||
/**
|
||||
* The deserialize method is called during xml parsing.
|
||||
*
|
||||
* This method is called statically, this is because in theory this method
|
||||
* may be used as a type of constructor, or factory method.
|
||||
*
|
||||
* Often you want to return an instance of the current class, but you are
|
||||
* free to return other data as well.
|
||||
*
|
||||
* You are responsible for advancing the reader to the next element. Not
|
||||
* doing anything will result in a never-ending loop.
|
||||
*
|
||||
* If you just want to skip parsing for this element altogether, you can
|
||||
* just call $reader->next();
|
||||
*
|
||||
* $reader->parseInnerTree() will parse the entire sub-tree, and advance to
|
||||
* the next element.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public static function xmlDeserialize(Reader $reader)
|
||||
{
|
||||
$self = new self();
|
||||
|
||||
$elementMap = $reader->elementMap;
|
||||
$elementMap['{DAV:}prop'] = 'Sabre\DAV\Xml\Element\Prop';
|
||||
$elementMap['{DAV:}set'] = 'Sabre\Xml\Element\KeyValue';
|
||||
$elementMap['{DAV:}remove'] = 'Sabre\Xml\Element\KeyValue';
|
||||
|
||||
$elems = $reader->parseInnerTree($elementMap);
|
||||
|
||||
foreach ($elems as $elem) {
|
||||
if ('{DAV:}set' === $elem['name']) {
|
||||
$self->properties = array_merge($self->properties, $elem['value']['{DAV:}prop']);
|
||||
}
|
||||
}
|
||||
|
||||
return $self;
|
||||
}
|
||||
}
|
||||
79
vendor/sabre/dav/lib/DAV/Xml/Request/PropFind.php
vendored
Normal file
79
vendor/sabre/dav/lib/DAV/Xml/Request/PropFind.php
vendored
Normal file
@ -0,0 +1,79 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Sabre\DAV\Xml\Request;
|
||||
|
||||
use Sabre\Xml\Element\KeyValue;
|
||||
use Sabre\Xml\Reader;
|
||||
use Sabre\Xml\XmlDeserializable;
|
||||
|
||||
/**
|
||||
* WebDAV PROPFIND request parser.
|
||||
*
|
||||
* This class parses the {DAV:}propfind request, as defined in:
|
||||
*
|
||||
* https://tools.ietf.org/html/rfc4918#section-14.20
|
||||
*
|
||||
* @copyright Copyright (C) fruux GmbH (https://fruux.com/)
|
||||
* @author Evert Pot (http://www.rooftopsolutions.nl/)
|
||||
* @license http://sabre.io/license/ Modified BSD License
|
||||
*/
|
||||
class PropFind implements XmlDeserializable
|
||||
{
|
||||
/**
|
||||
* If this is set to true, this was an 'allprop' request.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
public $allProp = false;
|
||||
|
||||
/**
|
||||
* The property list.
|
||||
*
|
||||
* @var array|null
|
||||
*/
|
||||
public $properties;
|
||||
|
||||
/**
|
||||
* The deserialize method is called during xml parsing.
|
||||
*
|
||||
* This method is called statically, this is because in theory this method
|
||||
* may be used as a type of constructor, or factory method.
|
||||
*
|
||||
* Often you want to return an instance of the current class, but you are
|
||||
* free to return other data as well.
|
||||
*
|
||||
* You are responsible for advancing the reader to the next element. Not
|
||||
* doing anything will result in a never-ending loop.
|
||||
*
|
||||
* If you just want to skip parsing for this element altogether, you can
|
||||
* just call $reader->next();
|
||||
*
|
||||
* $reader->parseInnerTree() will parse the entire sub-tree, and advance to
|
||||
* the next element.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public static function xmlDeserialize(Reader $reader)
|
||||
{
|
||||
$self = new self();
|
||||
|
||||
$reader->pushContext();
|
||||
$reader->elementMap['{DAV:}prop'] = 'Sabre\Xml\Element\Elements';
|
||||
|
||||
foreach (KeyValue::xmlDeserialize($reader) as $k => $v) {
|
||||
switch ($k) {
|
||||
case '{DAV:}prop':
|
||||
$self->properties = $v;
|
||||
break;
|
||||
case '{DAV:}allprop':
|
||||
$self->allProp = true;
|
||||
}
|
||||
}
|
||||
|
||||
$reader->popContext();
|
||||
|
||||
return $self;
|
||||
}
|
||||
}
|
||||
109
vendor/sabre/dav/lib/DAV/Xml/Request/PropPatch.php
vendored
Normal file
109
vendor/sabre/dav/lib/DAV/Xml/Request/PropPatch.php
vendored
Normal file
@ -0,0 +1,109 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Sabre\DAV\Xml\Request;
|
||||
|
||||
use Sabre\Xml\Element;
|
||||
use Sabre\Xml\Reader;
|
||||
use Sabre\Xml\Writer;
|
||||
|
||||
/**
|
||||
* WebDAV PROPPATCH request parser.
|
||||
*
|
||||
* This class parses the {DAV:}propertyupdate request, as defined in:
|
||||
*
|
||||
* https://tools.ietf.org/html/rfc4918#section-14.20
|
||||
*
|
||||
* @copyright Copyright (C) fruux GmbH (https://fruux.com/)
|
||||
* @author Evert Pot (http://www.rooftopsolutions.nl/)
|
||||
* @license http://sabre.io/license/ Modified BSD License
|
||||
*/
|
||||
class PropPatch implements Element
|
||||
{
|
||||
/**
|
||||
* The list of properties that will be updated and removed.
|
||||
*
|
||||
* If a property will be removed, it's value will be set to null.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $properties = [];
|
||||
|
||||
/**
|
||||
* The xmlSerialize method is called during xml writing.
|
||||
*
|
||||
* Use the $writer argument to write its own xml serialization.
|
||||
*
|
||||
* An important note: do _not_ create a parent element. Any element
|
||||
* implementing XmlSerializable should only ever write what's considered
|
||||
* its 'inner xml'.
|
||||
*
|
||||
* The parent of the current element is responsible for writing a
|
||||
* containing element.
|
||||
*
|
||||
* This allows serializers to be re-used for different element names.
|
||||
*
|
||||
* If you are opening new elements, you must also close them again.
|
||||
*/
|
||||
public function xmlSerialize(Writer $writer)
|
||||
{
|
||||
foreach ($this->properties as $propertyName => $propertyValue) {
|
||||
if (is_null($propertyValue)) {
|
||||
$writer->startElement('{DAV:}remove');
|
||||
$writer->write(['{DAV:}prop' => [$propertyName => $propertyValue]]);
|
||||
$writer->endElement();
|
||||
} else {
|
||||
$writer->startElement('{DAV:}set');
|
||||
$writer->write(['{DAV:}prop' => [$propertyName => $propertyValue]]);
|
||||
$writer->endElement();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The deserialize method is called during xml parsing.
|
||||
*
|
||||
* This method is called statically, this is because in theory this method
|
||||
* may be used as a type of constructor, or factory method.
|
||||
*
|
||||
* Often you want to return an instance of the current class, but you are
|
||||
* free to return other data as well.
|
||||
*
|
||||
* You are responsible for advancing the reader to the next element. Not
|
||||
* doing anything will result in a never-ending loop.
|
||||
*
|
||||
* If you just want to skip parsing for this element altogether, you can
|
||||
* just call $reader->next();
|
||||
*
|
||||
* $reader->parseInnerTree() will parse the entire sub-tree, and advance to
|
||||
* the next element.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public static function xmlDeserialize(Reader $reader)
|
||||
{
|
||||
$self = new self();
|
||||
|
||||
$elementMap = $reader->elementMap;
|
||||
$elementMap['{DAV:}prop'] = 'Sabre\DAV\Xml\Element\Prop';
|
||||
$elementMap['{DAV:}set'] = 'Sabre\Xml\Element\KeyValue';
|
||||
$elementMap['{DAV:}remove'] = 'Sabre\Xml\Element\KeyValue';
|
||||
|
||||
$elems = $reader->parseInnerTree($elementMap);
|
||||
|
||||
foreach ($elems as $elem) {
|
||||
if ('{DAV:}set' === $elem['name']) {
|
||||
$self->properties = array_merge($self->properties, $elem['value']['{DAV:}prop']);
|
||||
}
|
||||
if ('{DAV:}remove' === $elem['name']) {
|
||||
// Ensuring there are no values.
|
||||
foreach ($elem['value']['{DAV:}prop'] as $remove => $value) {
|
||||
$self->properties[$remove] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $self;
|
||||
}
|
||||
}
|
||||
80
vendor/sabre/dav/lib/DAV/Xml/Request/ShareResource.php
vendored
Normal file
80
vendor/sabre/dav/lib/DAV/Xml/Request/ShareResource.php
vendored
Normal file
@ -0,0 +1,80 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Sabre\DAV\Xml\Request;
|
||||
|
||||
use Sabre\DAV\Xml\Element\Sharee;
|
||||
use Sabre\Xml\Reader;
|
||||
use Sabre\Xml\XmlDeserializable;
|
||||
|
||||
/**
|
||||
* ShareResource request parser.
|
||||
*
|
||||
* This class parses the {DAV:}share-resource POST request as defined in:
|
||||
*
|
||||
* https://tools.ietf.org/html/draft-pot-webdav-resource-sharing-01#section-5.3.2.1
|
||||
*
|
||||
* @copyright Copyright (C) 2007-2015 fruux GmbH (https://fruux.com/).
|
||||
* @author Evert Pot (http://www.rooftopsolutions.nl/)
|
||||
* @license http://sabre.io/license/ Modified BSD License
|
||||
*/
|
||||
class ShareResource implements XmlDeserializable
|
||||
{
|
||||
/**
|
||||
* The list of new people added or updated or removed from the share.
|
||||
*
|
||||
* @var Sharee[]
|
||||
*/
|
||||
public $sharees = [];
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param Sharee[] $sharees
|
||||
*/
|
||||
public function __construct(array $sharees)
|
||||
{
|
||||
$this->sharees = $sharees;
|
||||
}
|
||||
|
||||
/**
|
||||
* The deserialize method is called during xml parsing.
|
||||
*
|
||||
* This method is called statically, this is because in theory this method
|
||||
* may be used as a type of constructor, or factory method.
|
||||
*
|
||||
* Often you want to return an instance of the current class, but you are
|
||||
* free to return other data as well.
|
||||
*
|
||||
* You are responsible for advancing the reader to the next element. Not
|
||||
* doing anything will result in a never-ending loop.
|
||||
*
|
||||
* If you just want to skip parsing for this element altogether, you can
|
||||
* just call $reader->next();
|
||||
*
|
||||
* $reader->parseInnerTree() will parse the entire sub-tree, and advance to
|
||||
* the next element.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public static function xmlDeserialize(Reader $reader)
|
||||
{
|
||||
$elems = $reader->parseInnerTree([
|
||||
'{DAV:}sharee' => 'Sabre\DAV\Xml\Element\Sharee',
|
||||
'{DAV:}share-access' => 'Sabre\DAV\Xml\Property\ShareAccess',
|
||||
'{DAV:}prop' => 'Sabre\Xml\Deserializer\keyValue',
|
||||
]);
|
||||
|
||||
$sharees = [];
|
||||
|
||||
foreach ($elems as $elem) {
|
||||
if ('{DAV:}sharee' !== $elem['name']) {
|
||||
continue;
|
||||
}
|
||||
$sharees[] = $elem['value'];
|
||||
}
|
||||
|
||||
return new self($sharees);
|
||||
}
|
||||
}
|
||||
118
vendor/sabre/dav/lib/DAV/Xml/Request/SyncCollectionReport.php
vendored
Normal file
118
vendor/sabre/dav/lib/DAV/Xml/Request/SyncCollectionReport.php
vendored
Normal file
@ -0,0 +1,118 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Sabre\DAV\Xml\Request;
|
||||
|
||||
use Sabre\DAV\Exception\BadRequest;
|
||||
use Sabre\Xml\Element\KeyValue;
|
||||
use Sabre\Xml\Reader;
|
||||
use Sabre\Xml\XmlDeserializable;
|
||||
|
||||
/**
|
||||
* SyncCollection request parser.
|
||||
*
|
||||
* This class parses the {DAV:}sync-collection reprot, as defined in:
|
||||
*
|
||||
* http://tools.ietf.org/html/rfc6578#section-3.2
|
||||
*
|
||||
* @copyright Copyright (C) fruux GmbH (https://fruux.com/)
|
||||
* @author Evert Pot (http://www.rooftopsolutions.nl/)
|
||||
* @license http://sabre.io/license/ Modified BSD License
|
||||
*/
|
||||
class SyncCollectionReport implements XmlDeserializable
|
||||
{
|
||||
/**
|
||||
* The sync-token the client supplied for the report.
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
public $syncToken;
|
||||
|
||||
/**
|
||||
* The 'depth' of the sync the client is interested in.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $syncLevel;
|
||||
|
||||
/**
|
||||
* Maximum amount of items returned.
|
||||
*
|
||||
* @var int|null
|
||||
*/
|
||||
public $limit;
|
||||
|
||||
/**
|
||||
* The list of properties that are being requested for every change.
|
||||
*
|
||||
* @var array|null
|
||||
*/
|
||||
public $properties;
|
||||
|
||||
/**
|
||||
* The deserialize method is called during xml parsing.
|
||||
*
|
||||
* This method is called statically, this is because in theory this method
|
||||
* may be used as a type of constructor, or factory method.
|
||||
*
|
||||
* Often you want to return an instance of the current class, but you are
|
||||
* free to return other data as well.
|
||||
*
|
||||
* You are responsible for advancing the reader to the next element. Not
|
||||
* doing anything will result in a never-ending loop.
|
||||
*
|
||||
* If you just want to skip parsing for this element altogether, you can
|
||||
* just call $reader->next();
|
||||
*
|
||||
* $reader->parseInnerTree() will parse the entire sub-tree, and advance to
|
||||
* the next element.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public static function xmlDeserialize(Reader $reader)
|
||||
{
|
||||
$self = new self();
|
||||
|
||||
$reader->pushContext();
|
||||
|
||||
$reader->elementMap['{DAV:}prop'] = 'Sabre\Xml\Element\Elements';
|
||||
$elems = KeyValue::xmlDeserialize($reader);
|
||||
|
||||
$reader->popContext();
|
||||
|
||||
$required = [
|
||||
'{DAV:}sync-token',
|
||||
'{DAV:}prop',
|
||||
];
|
||||
|
||||
foreach ($required as $elem) {
|
||||
if (!array_key_exists($elem, $elems)) {
|
||||
throw new BadRequest('The '.$elem.' element in the {DAV:}sync-collection report is required');
|
||||
}
|
||||
}
|
||||
|
||||
$self->properties = $elems['{DAV:}prop'];
|
||||
$self->syncToken = $elems['{DAV:}sync-token'];
|
||||
|
||||
if (isset($elems['{DAV:}limit'])) {
|
||||
$nresults = null;
|
||||
foreach ($elems['{DAV:}limit'] as $child) {
|
||||
if ('{DAV:}nresults' === $child['name']) {
|
||||
$nresults = (int) $child['value'];
|
||||
}
|
||||
}
|
||||
$self->limit = $nresults;
|
||||
}
|
||||
|
||||
if (isset($elems['{DAV:}sync-level'])) {
|
||||
$value = $elems['{DAV:}sync-level'];
|
||||
if ('infinity' === $value) {
|
||||
$value = \Sabre\DAV\Server::DEPTH_INFINITY;
|
||||
}
|
||||
$self->syncLevel = $value;
|
||||
}
|
||||
|
||||
return $self;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user