Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 13 Apr 2017 11:39:29 +0000 (UTC)
From:      Pietro Cerutti <gahr@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r438437 - in head/www/baikal: . files
Message-ID:  <201704131139.v3DBdTo4000362@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: gahr
Date: Thu Apr 13 11:39:28 2017
New Revision: 438437
URL: https://svnweb.freebsd.org/changeset/ports/438437

Log:
  www/baikal: backport prop filtering in addressbook-query REPORTs
  
  Also, take maintainership.
  
  PR:		218628
  Submitted by:	gahr
  Approved by:	mat (maintainer)
  Obtained from:	https://github.com/fruux/sabre-dav/pull/910

Added:
  head/www/baikal/files/patch-vendor_sabre_dav_lib_CardDAV_Plugin.php   (contents, props changed)
  head/www/baikal/files/patch-vendor_sabre_dav_lib_CardDAV_Xml_Filter_AddressData.php   (contents, props changed)
  head/www/baikal/files/patch-vendor_sabre_dav_lib_CardDAV_Xml_Request_AddressBookQueryReport.php   (contents, props changed)
Modified:
  head/www/baikal/Makefile

Modified: head/www/baikal/Makefile
==============================================================================
--- head/www/baikal/Makefile	Thu Apr 13 10:17:08 2017	(r438436)
+++ head/www/baikal/Makefile	Thu Apr 13 11:39:28 2017	(r438437)
@@ -3,17 +3,17 @@
 
 PORTNAME=	baikal
 PORTVERSION=	0.4.6
-PORTREVISION=	1
+PORTREVISION=	2
 CATEGORIES=	www
 MASTER_SITES=	https://github.com/fruux/Baikal/releases/download/${PORTVERSION}/
 
-MAINTAINER=	mat@FreeBSD.org
+MAINTAINER=	gahr@FreeBSD.org
 COMMENT=	Lightweight CalDAV/CardDAV server
 
 LICENSE=	GPLv3
 LICENSE_FILE=	${WRKSRC}/LICENSE
 
-USES=	php zip
+USES=		php zip
 USE_PHP=	ctype dom filter json mbstring openssl pdo_sqlite session xml xmlreader xmlwriter
 
 WRKSRC=		${WRKDIR}/${PORTNAME}

Added: head/www/baikal/files/patch-vendor_sabre_dav_lib_CardDAV_Plugin.php
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/www/baikal/files/patch-vendor_sabre_dav_lib_CardDAV_Plugin.php	Thu Apr 13 11:39:28 2017	(r438437)
@@ -0,0 +1,38 @@
+--- vendor/sabre/dav/lib/CardDAV/Plugin.php.orig	2017-04-13 09:06:24 UTC
++++ vendor/sabre/dav/lib/CardDAV/Plugin.php
+@@ -450,7 +450,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
+                 );
+ 
+             }
+@@ -807,12 +808,24 @@ class Plugin extends DAV\ServerPlugin {
+      * @param string $target
+      * @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);
++            $str = "";
++            foreach ($keys as $key) {
++                unset($input->$key);
++            }
++            $data = $input->serialize();
++        }
+         $output = null;
+         try {
+ 

Added: head/www/baikal/files/patch-vendor_sabre_dav_lib_CardDAV_Xml_Filter_AddressData.php
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/www/baikal/files/patch-vendor_sabre_dav_lib_CardDAV_Xml_Filter_AddressData.php	Thu Apr 13 11:39:28 2017	(r438437)
@@ -0,0 +1,14 @@
+--- vendor/sabre/dav/lib/CardDAV/Xml/Filter/AddressData.php.orig	2017-04-13 09:07:03 UTC
++++ vendor/sabre/dav/lib/CardDAV/Xml/Filter/AddressData.php
+@@ -51,6 +51,11 @@ class AddressData implements XmlDeserial
+             'version'     => $reader->getAttribute('version') ?: '3.0',
+         ];
+ 
++        $elems = (array)$reader->parseInnerTree();
++        $result['addressDataProperties'] = array_map(function($element) {
++            return $element['attributes']['name'];
++        }, $elems);
++
+         $reader->next();
+         return $result;
+ 

Added: head/www/baikal/files/patch-vendor_sabre_dav_lib_CardDAV_Xml_Request_AddressBookQueryReport.php
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/www/baikal/files/patch-vendor_sabre_dav_lib_CardDAV_Xml_Request_AddressBookQueryReport.php	Thu Apr 13 11:39:28 2017	(r438437)
@@ -0,0 +1,16 @@
+--- vendor/sabre/dav/lib/CardDAV/Xml/Request/AddressBookQueryReport.php.orig	2017-04-13 09:07:30 UTC
++++ vendor/sabre/dav/lib/CardDAV/Xml/Request/AddressBookQueryReport.php
+@@ -29,6 +29,13 @@ class AddressBookQueryReport implements 
+     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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201704131139.v3DBdTo4000362>