|
Line 0
Link Here
|
|
|
1 |
--- vendor/sabre/dav/lib/CardDAV/Plugin.php.orig 2017-04-13 09:06:24 UTC |
| 2 |
+++ vendor/sabre/dav/lib/CardDAV/Plugin.php |
| 3 |
@@ -450,7 +450,8 @@ class Plugin extends DAV\ServerPlugin { |
| 4 |
|
| 5 |
$props[200]['{' . self::NS_CARDDAV . '}address-data'] = $this->convertVCard( |
| 6 |
$props[200]['{' . self::NS_CARDDAV . '}address-data'], |
| 7 |
- $vcardType |
| 8 |
+ $vcardType, |
| 9 |
+ $report->addressDataProperties |
| 10 |
); |
| 11 |
|
| 12 |
} |
| 13 |
@@ -807,12 +808,24 @@ class Plugin extends DAV\ServerPlugin { |
| 14 |
* @param string $target |
| 15 |
* @return string |
| 16 |
*/ |
| 17 |
- protected function convertVCard($data, $target) { |
| 18 |
+ protected function convertVCard($data, $target, array $propertiesFilter = null) { |
| 19 |
|
| 20 |
if (is_resource($data)) { |
| 21 |
$data = stream_get_contents($data); |
| 22 |
} |
| 23 |
$input = VObject\Reader::read($data); |
| 24 |
+ if (!empty($propertiesFilter)) { |
| 25 |
+ $propertiesFilter = array_merge(['UID', 'VERSION', 'FN'], $propertiesFilter); |
| 26 |
+ $keys = array_unique(array_map(function($child) { |
| 27 |
+ return $child->name; |
| 28 |
+ }, $input->children())); |
| 29 |
+ $keys = array_diff($keys, $propertiesFilter); |
| 30 |
+ $str = ""; |
| 31 |
+ foreach ($keys as $key) { |
| 32 |
+ unset($input->$key); |
| 33 |
+ } |
| 34 |
+ $data = $input->serialize(); |
| 35 |
+ } |
| 36 |
$output = null; |
| 37 |
try { |
| 38 |
|