diff options
author | Mario Vavti <mario@mariovavti.com> | 2017-05-04 10:51:39 +0200 |
---|---|---|
committer | Mario Vavti <mario@mariovavti.com> | 2017-05-04 10:51:39 +0200 |
commit | 5c7acf4807aa427cf1391e0a5d044b453c38e619 (patch) | |
tree | 3fe49d4c3f75b0e2c9605327a3951f1da28e28b6 /vendor/sabre/dav/lib/CardDAV | |
parent | a92b9b7adb2be489106138b6269a5f7fe8eea5aa (diff) | |
download | volse-hubzilla-5c7acf4807aa427cf1391e0a5d044b453c38e619.tar.gz volse-hubzilla-5c7acf4807aa427cf1391e0a5d044b453c38e619.tar.bz2 volse-hubzilla-5c7acf4807aa427cf1391e0a5d044b453c38e619.zip |
update sabredav to version 3.2.2
Diffstat (limited to 'vendor/sabre/dav/lib/CardDAV')
15 files changed, 54 insertions, 30 deletions
diff --git a/vendor/sabre/dav/lib/CardDAV/AddressBook.php b/vendor/sabre/dav/lib/CardDAV/AddressBook.php index 6dd098618..c9d28a091 100644 --- a/vendor/sabre/dav/lib/CardDAV/AddressBook.php +++ b/vendor/sabre/dav/lib/CardDAV/AddressBook.php @@ -60,7 +60,7 @@ class AddressBook extends DAV\Collection implements IAddressBook, DAV\IPropertie * Returns a card * * @param string $name - * @return \ICard + * @return Card */ function getChild($name) { diff --git a/vendor/sabre/dav/lib/CardDAV/AddressBookHome.php b/vendor/sabre/dav/lib/CardDAV/AddressBookHome.php index 888a44a40..d770c0ffe 100644 --- a/vendor/sabre/dav/lib/CardDAV/AddressBookHome.php +++ b/vendor/sabre/dav/lib/CardDAV/AddressBookHome.php @@ -127,7 +127,7 @@ class AddressBookHome extends DAV\Collection implements DAV\IExtendedCollection, * * @param string $name * @todo needs optimizing - * @return \AddressBook + * @return AddressBook */ function getChild($name) { diff --git a/vendor/sabre/dav/lib/CardDAV/AddressBookRoot.php b/vendor/sabre/dav/lib/CardDAV/AddressBookRoot.php index 4a33df4ec..a9f1183da 100644 --- a/vendor/sabre/dav/lib/CardDAV/AddressBookRoot.php +++ b/vendor/sabre/dav/lib/CardDAV/AddressBookRoot.php @@ -18,7 +18,7 @@ class AddressBookRoot extends DAVACL\AbstractPrincipalCollection { /** * Principal Backend * - * @var Sabre\DAVACL\PrincipalBackend\BackendInteface + * @var DAVACL\PrincipalBackend\BackendInterface */ protected $principalBackend; diff --git a/vendor/sabre/dav/lib/CardDAV/Backend/BackendInterface.php b/vendor/sabre/dav/lib/CardDAV/Backend/BackendInterface.php index 54e42b899..18c0c0a99 100644 --- a/vendor/sabre/dav/lib/CardDAV/Backend/BackendInterface.php +++ b/vendor/sabre/dav/lib/CardDAV/Backend/BackendInterface.php @@ -46,7 +46,7 @@ interface BackendInterface { * Calling the handle method is like telling the PropPatch object "I * promise I can handle updating this property". * - * Read the PropPatch documenation for more info and examples. + * Read the PropPatch documentation for more info and examples. * * @param string $addressBookId * @param \Sabre\DAV\PropPatch $propPatch diff --git a/vendor/sabre/dav/lib/CardDAV/Backend/PDO.php b/vendor/sabre/dav/lib/CardDAV/Backend/PDO.php index 7c3feff93..13487e9da 100644 --- a/vendor/sabre/dav/lib/CardDAV/Backend/PDO.php +++ b/vendor/sabre/dav/lib/CardDAV/Backend/PDO.php @@ -93,7 +93,7 @@ class PDO extends AbstractBackend implements SyncSupport { * Calling the handle method is like telling the PropPatch object "I * promise I can handle updating this property". * - * Read the PropPatch documenation for more info and examples. + * Read the PropPatch documentation for more info and examples. * * @param string $addressBookId * @param \Sabre\DAV\PropPatch $propPatch @@ -240,7 +240,7 @@ class PDO extends AbstractBackend implements SyncSupport { } /** - * Returns a specfic card. + * Returns a specific card. * * The same set of properties must be returned as with getCards. The only * exception is that 'carddata' is absolutely required. @@ -466,7 +466,7 @@ class PDO extends AbstractBackend implements SyncSupport { // Current synctoken $stmt = $this->pdo->prepare('SELECT synctoken FROM ' . $this->addressBooksTableName . ' WHERE id = ?'); - $stmt->execute([ $addressBookId ]); + $stmt->execute([$addressBookId]); $currentToken = $stmt->fetchColumn(0); if (is_null($currentToken)) return null; diff --git a/vendor/sabre/dav/lib/CardDAV/Card.php b/vendor/sabre/dav/lib/CardDAV/Card.php index 0a040be6b..42a2d7b6a 100644 --- a/vendor/sabre/dav/lib/CardDAV/Card.php +++ b/vendor/sabre/dav/lib/CardDAV/Card.php @@ -2,8 +2,8 @@ namespace Sabre\CardDAV; -use Sabre\DAVACL; use Sabre\DAV; +use Sabre\DAVACL; /** * The Card object represents a single Card from an addressbook diff --git a/vendor/sabre/dav/lib/CardDAV/Plugin.php b/vendor/sabre/dav/lib/CardDAV/Plugin.php index 0507df100..272ae71fa 100644 --- a/vendor/sabre/dav/lib/CardDAV/Plugin.php +++ b/vendor/sabre/dav/lib/CardDAV/Plugin.php @@ -43,7 +43,7 @@ class Plugin extends DAV\ServerPlugin { /** * Server class * - * @var Sabre\DAV\Server + * @var DAV\Server */ protected $server; @@ -490,7 +490,8 @@ class Plugin extends DAV\ServerPlugin { $props[200]['{' . self::NS_CARDDAV . '}address-data'] = $this->convertVCard( $props[200]['{' . self::NS_CARDDAV . '}address-data'], - $vcardType + $vcardType, + $report->addressDataProperties ); } @@ -845,14 +846,26 @@ class Plugin extends DAV\ServerPlugin { * * @param string|resource $data * @param string $target + * @param array $propertiesFilter * @return string */ - protected function convertVCard($data, $target) { + protected function convertVCard($data, $target, array $propertiesFilter = null) { if (is_resource($data)) { $data = stream_get_contents($data); } $input = VObject\Reader::read($data); + if (!empty($propertiesFilter)) { + $propertiesFilter = array_merge(['UID', 'VERSION', 'FN'], $propertiesFilter); + $keys = array_unique(array_map(function($child) { + return $child->name; + }, $input->children())); + $keys = array_diff($keys, $propertiesFilter); + foreach ($keys as $key) { + unset($input->$key); + } + $data = $input->serialize(); + } $output = null; try { diff --git a/vendor/sabre/dav/lib/CardDAV/VCFExportPlugin.php b/vendor/sabre/dav/lib/CardDAV/VCFExportPlugin.php index d015589ad..2d61db6ac 100644 --- a/vendor/sabre/dav/lib/CardDAV/VCFExportPlugin.php +++ b/vendor/sabre/dav/lib/CardDAV/VCFExportPlugin.php @@ -3,9 +3,9 @@ namespace Sabre\CardDAV; use Sabre\DAV; -use Sabre\VObject; use Sabre\HTTP\RequestInterface; use Sabre\HTTP\ResponseInterface; +use Sabre\VObject; /** * VCF Exporter @@ -24,7 +24,7 @@ class VCFExportPlugin extends DAV\ServerPlugin { /** * Reference to Server class * - * @var Sabre\DAV\Server + * @var DAV\Server */ protected $server; diff --git a/vendor/sabre/dav/lib/CardDAV/Xml/Filter/AddressData.php b/vendor/sabre/dav/lib/CardDAV/Xml/Filter/AddressData.php index 34028db85..a130cd61d 100644 --- a/vendor/sabre/dav/lib/CardDAV/Xml/Filter/AddressData.php +++ b/vendor/sabre/dav/lib/CardDAV/Xml/Filter/AddressData.php @@ -26,7 +26,7 @@ class AddressData implements XmlDeserializable { /** * The deserialize method is called during xml parsing. * - * This method is called statictly, this is because in theory this method + * 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 @@ -51,7 +51,11 @@ class AddressData implements XmlDeserializable { 'version' => $reader->getAttribute('version') ?: '3.0', ]; - $reader->next(); + $elems = (array)$reader->parseInnerTree(); + $result['addressDataProperties'] = array_map(function($element) { + return $element['attributes']['name']; + }, $elems); + return $result; } diff --git a/vendor/sabre/dav/lib/CardDAV/Xml/Filter/ParamFilter.php b/vendor/sabre/dav/lib/CardDAV/Xml/Filter/ParamFilter.php index 9646ae3e6..936e26917 100644 --- a/vendor/sabre/dav/lib/CardDAV/Xml/Filter/ParamFilter.php +++ b/vendor/sabre/dav/lib/CardDAV/Xml/Filter/ParamFilter.php @@ -2,10 +2,10 @@ namespace Sabre\CardDAV\Xml\Filter; +use Sabre\CardDAV\Plugin; +use Sabre\DAV\Exception\BadRequest; use Sabre\Xml\Element; use Sabre\Xml\Reader; -use Sabre\DAV\Exception\BadRequest; -use Sabre\CardDAV\Plugin; /** * ParamFilter parser. @@ -26,7 +26,7 @@ abstract class ParamFilter implements Element { /** * The deserialize method is called during xml parsing. * - * This method is called statictly, this is because in theory this method + * 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 diff --git a/vendor/sabre/dav/lib/CardDAV/Xml/Filter/PropFilter.php b/vendor/sabre/dav/lib/CardDAV/Xml/Filter/PropFilter.php index c162da160..d7799429d 100644 --- a/vendor/sabre/dav/lib/CardDAV/Xml/Filter/PropFilter.php +++ b/vendor/sabre/dav/lib/CardDAV/Xml/Filter/PropFilter.php @@ -2,10 +2,10 @@ namespace Sabre\CardDAV\Xml\Filter; +use Sabre\CardDAV\Plugin; +use Sabre\DAV\Exception\BadRequest; use Sabre\Xml\Reader; use Sabre\Xml\XmlDeserializable; -use Sabre\DAV\Exception\BadRequest; -use Sabre\CardDAV\Plugin; /** * PropFilter parser. @@ -26,7 +26,7 @@ class PropFilter implements XmlDeserializable { /** * The deserialize method is called during xml parsing. * - * This method is called statictly, this is because in theory this method + * 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 diff --git a/vendor/sabre/dav/lib/CardDAV/Xml/Property/SupportedAddressData.php b/vendor/sabre/dav/lib/CardDAV/Xml/Property/SupportedAddressData.php index 6ff57b6e3..aecd8a09f 100644 --- a/vendor/sabre/dav/lib/CardDAV/Xml/Property/SupportedAddressData.php +++ b/vendor/sabre/dav/lib/CardDAV/Xml/Property/SupportedAddressData.php @@ -2,9 +2,9 @@ namespace Sabre\CardDAV\Xml\Property; +use Sabre\CardDAV\Plugin; use Sabre\Xml\Writer; use Sabre\Xml\XmlSerializable; -use Sabre\CardDAV\Plugin; /** * Supported-address-data property @@ -49,12 +49,12 @@ class SupportedAddressData implements XmlSerializable { } /** - * The xmlSerialize metod is called during xml writing. + * 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 XmlSerializble should only ever write what's considered + * implementing XmlSerializable should only ever write what's considered * its 'inner xml'. * * The parent of the current element is responsible for writing a diff --git a/vendor/sabre/dav/lib/CardDAV/Xml/Property/SupportedCollationSet.php b/vendor/sabre/dav/lib/CardDAV/Xml/Property/SupportedCollationSet.php index 1fc064900..778aa2b64 100644 --- a/vendor/sabre/dav/lib/CardDAV/Xml/Property/SupportedCollationSet.php +++ b/vendor/sabre/dav/lib/CardDAV/Xml/Property/SupportedCollationSet.php @@ -18,12 +18,12 @@ use Sabre\Xml\XmlSerializable; class SupportedCollationSet implements XmlSerializable { /** - * The xmlSerialize metod is called during xml writing. + * 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 XmlSerializble should only ever write what's considered + * implementing XmlSerializable should only ever write what's considered * its 'inner xml'. * * The parent of the current element is responsible for writing a diff --git a/vendor/sabre/dav/lib/CardDAV/Xml/Request/AddressBookMultiGetReport.php b/vendor/sabre/dav/lib/CardDAV/Xml/Request/AddressBookMultiGetReport.php index c97c5eb4f..0115a0107 100644 --- a/vendor/sabre/dav/lib/CardDAV/Xml/Request/AddressBookMultiGetReport.php +++ b/vendor/sabre/dav/lib/CardDAV/Xml/Request/AddressBookMultiGetReport.php @@ -54,7 +54,7 @@ class AddressBookMultiGetReport implements XmlDeserializable { /** * The deserialize method is called during xml parsing. * - * This method is called statictly, this is because in theory this method + * 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 diff --git a/vendor/sabre/dav/lib/CardDAV/Xml/Request/AddressBookQueryReport.php b/vendor/sabre/dav/lib/CardDAV/Xml/Request/AddressBookQueryReport.php index a68ac5800..09fad008a 100644 --- a/vendor/sabre/dav/lib/CardDAV/Xml/Request/AddressBookQueryReport.php +++ b/vendor/sabre/dav/lib/CardDAV/Xml/Request/AddressBookQueryReport.php @@ -2,10 +2,10 @@ namespace Sabre\CardDAV\Xml\Request; +use Sabre\CardDAV\Plugin; +use Sabre\DAV\Exception\BadRequest; use Sabre\Xml\Reader; use Sabre\Xml\XmlDeserializable; -use Sabre\DAV\Exception\BadRequest; -use Sabre\CardDAV\Plugin; /** * AddressBookQueryReport request parser. @@ -29,6 +29,13 @@ class AddressBookQueryReport implements XmlDeserializable { public $properties; /** + * An array with requested vcard properties. + * + * @var array + */ + public $addressDataProperties = []; + + /** * List of property/component filters. * * This is an array with filters. Every item is a property filter. Every @@ -92,7 +99,7 @@ class AddressBookQueryReport implements XmlDeserializable { /** * The deserialize method is called during xml parsing. * - * This method is called statictly, this is because in theory this method + * 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 |