@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | ->from('addressbooks') |
124 | 124 | ->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri))); |
125 | 125 | |
126 | - return (int)$query->execute()->fetchColumn(); |
|
126 | + return (int) $query->execute()->fetchColumn(); |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | /** |
@@ -160,9 +160,9 @@ discard block |
||
160 | 160 | 'uri' => $row['uri'], |
161 | 161 | 'principaluri' => $this->convertPrincipal($row['principaluri'], false), |
162 | 162 | '{DAV:}displayname' => $row['displayname'], |
163 | - '{' . Plugin::NS_CARDDAV . '}addressbook-description' => $row['description'], |
|
163 | + '{'.Plugin::NS_CARDDAV.'}addressbook-description' => $row['description'], |
|
164 | 164 | '{http://calendarserver.org/ns/}getctag' => $row['synctoken'], |
165 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
165 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0', |
|
166 | 166 | ]; |
167 | 167 | |
168 | 168 | $this->addOwnerPrincipal($addressBooks[$row['id']]); |
@@ -173,10 +173,10 @@ discard block |
||
173 | 173 | $principals = $this->principalBackend->getGroupMembership($principalUriOriginal, true); |
174 | 174 | $principals = array_merge($principals, $this->principalBackend->getCircleMembership($principalUriOriginal)); |
175 | 175 | |
176 | - $principals = array_map(function ($principal) { |
|
176 | + $principals = array_map(function($principal) { |
|
177 | 177 | return urldecode($principal); |
178 | 178 | }, $principals); |
179 | - $principals[]= $principalUri; |
|
179 | + $principals[] = $principalUri; |
|
180 | 180 | |
181 | 181 | $query = $this->db->getQueryBuilder(); |
182 | 182 | $result = $query->select(['a.id', 'a.uri', 'a.displayname', 'a.principaluri', 'a.description', 'a.synctoken', 's.access']) |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | ->setParameter('principaluri', $principals, IQueryBuilder::PARAM_STR_ARRAY) |
189 | 189 | ->execute(); |
190 | 190 | |
191 | - $readOnlyPropertyName = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only'; |
|
191 | + $readOnlyPropertyName = '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}read-only'; |
|
192 | 192 | while ($row = $result->fetch()) { |
193 | 193 | if ($row['principaluri'] === $principalUri) { |
194 | 194 | continue; |
@@ -208,18 +208,18 @@ discard block |
||
208 | 208 | } |
209 | 209 | |
210 | 210 | list(, $name) = \Sabre\Uri\split($row['principaluri']); |
211 | - $uri = $row['uri'] . '_shared_by_' . $name; |
|
212 | - $displayName = $row['displayname'] . ' (' . $this->getUserDisplayName($name) . ')'; |
|
211 | + $uri = $row['uri'].'_shared_by_'.$name; |
|
212 | + $displayName = $row['displayname'].' ('.$this->getUserDisplayName($name).')'; |
|
213 | 213 | |
214 | 214 | $addressBooks[$row['id']] = [ |
215 | 215 | 'id' => $row['id'], |
216 | 216 | 'uri' => $uri, |
217 | 217 | 'principaluri' => $principalUriOriginal, |
218 | 218 | '{DAV:}displayname' => $displayName, |
219 | - '{' . Plugin::NS_CARDDAV . '}addressbook-description' => $row['description'], |
|
219 | + '{'.Plugin::NS_CARDDAV.'}addressbook-description' => $row['description'], |
|
220 | 220 | '{http://calendarserver.org/ns/}getctag' => $row['synctoken'], |
221 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
222 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $row['principaluri'], |
|
221 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0', |
|
222 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal' => $row['principaluri'], |
|
223 | 223 | $readOnlyPropertyName => $readOnly, |
224 | 224 | ]; |
225 | 225 | |
@@ -246,9 +246,9 @@ discard block |
||
246 | 246 | 'uri' => $row['uri'], |
247 | 247 | 'principaluri' => $this->convertPrincipal($row['principaluri'], false), |
248 | 248 | '{DAV:}displayname' => $row['displayname'], |
249 | - '{' . Plugin::NS_CARDDAV . '}addressbook-description' => $row['description'], |
|
249 | + '{'.Plugin::NS_CARDDAV.'}addressbook-description' => $row['description'], |
|
250 | 250 | '{http://calendarserver.org/ns/}getctag' => $row['synctoken'], |
251 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
251 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0', |
|
252 | 252 | ]; |
253 | 253 | |
254 | 254 | $this->addOwnerPrincipal($addressBooks[$row['id']]); |
@@ -293,9 +293,9 @@ discard block |
||
293 | 293 | 'uri' => $row['uri'], |
294 | 294 | 'principaluri' => $row['principaluri'], |
295 | 295 | '{DAV:}displayname' => $row['displayname'], |
296 | - '{' . Plugin::NS_CARDDAV . '}addressbook-description' => $row['description'], |
|
296 | + '{'.Plugin::NS_CARDDAV.'}addressbook-description' => $row['description'], |
|
297 | 297 | '{http://calendarserver.org/ns/}getctag' => $row['synctoken'], |
298 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
298 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0', |
|
299 | 299 | ]; |
300 | 300 | |
301 | 301 | $this->addOwnerPrincipal($addressBook); |
@@ -327,9 +327,9 @@ discard block |
||
327 | 327 | 'uri' => $row['uri'], |
328 | 328 | 'principaluri' => $row['principaluri'], |
329 | 329 | '{DAV:}displayname' => $row['displayname'], |
330 | - '{' . Plugin::NS_CARDDAV . '}addressbook-description' => $row['description'], |
|
330 | + '{'.Plugin::NS_CARDDAV.'}addressbook-description' => $row['description'], |
|
331 | 331 | '{http://calendarserver.org/ns/}getctag' => $row['synctoken'], |
332 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
332 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0', |
|
333 | 333 | ]; |
334 | 334 | |
335 | 335 | $this->addOwnerPrincipal($addressBook); |
@@ -356,20 +356,20 @@ discard block |
||
356 | 356 | public function updateAddressBook($addressBookId, \Sabre\DAV\PropPatch $propPatch) { |
357 | 357 | $supportedProperties = [ |
358 | 358 | '{DAV:}displayname', |
359 | - '{' . Plugin::NS_CARDDAV . '}addressbook-description', |
|
359 | + '{'.Plugin::NS_CARDDAV.'}addressbook-description', |
|
360 | 360 | ]; |
361 | 361 | |
362 | 362 | /** |
363 | 363 | * @suppress SqlInjectionChecker |
364 | 364 | */ |
365 | - $propPatch->handle($supportedProperties, function ($mutations) use ($addressBookId) { |
|
365 | + $propPatch->handle($supportedProperties, function($mutations) use ($addressBookId) { |
|
366 | 366 | $updates = []; |
367 | 367 | foreach ($mutations as $property=>$newValue) { |
368 | 368 | switch ($property) { |
369 | 369 | case '{DAV:}displayname': |
370 | 370 | $updates['displayname'] = $newValue; |
371 | 371 | break; |
372 | - case '{' . Plugin::NS_CARDDAV . '}addressbook-description': |
|
372 | + case '{'.Plugin::NS_CARDDAV.'}addressbook-description': |
|
373 | 373 | $updates['description'] = $newValue; |
374 | 374 | break; |
375 | 375 | } |
@@ -412,11 +412,11 @@ discard block |
||
412 | 412 | case '{DAV:}displayname': |
413 | 413 | $values['displayname'] = $newValue; |
414 | 414 | break; |
415 | - case '{' . Plugin::NS_CARDDAV . '}addressbook-description': |
|
415 | + case '{'.Plugin::NS_CARDDAV.'}addressbook-description': |
|
416 | 416 | $values['description'] = $newValue; |
417 | 417 | break; |
418 | 418 | default: |
419 | - throw new BadRequest('Unknown property: ' . $property); |
|
419 | + throw new BadRequest('Unknown property: '.$property); |
|
420 | 420 | } |
421 | 421 | } |
422 | 422 | |
@@ -500,7 +500,7 @@ discard block |
||
500 | 500 | |
501 | 501 | $result = $query->execute(); |
502 | 502 | while ($row = $result->fetch()) { |
503 | - $row['etag'] = '"' . $row['etag'] . '"'; |
|
503 | + $row['etag'] = '"'.$row['etag'].'"'; |
|
504 | 504 | |
505 | 505 | $modified = false; |
506 | 506 | $row['carddata'] = $this->readBlob($row['carddata'], $modified); |
@@ -540,7 +540,7 @@ discard block |
||
540 | 540 | if (!$row) { |
541 | 541 | return false; |
542 | 542 | } |
543 | - $row['etag'] = '"' . $row['etag'] . '"'; |
|
543 | + $row['etag'] = '"'.$row['etag'].'"'; |
|
544 | 544 | |
545 | 545 | $modified = false; |
546 | 546 | $row['carddata'] = $this->readBlob($row['carddata'], $modified); |
@@ -582,7 +582,7 @@ discard block |
||
582 | 582 | $result = $query->execute(); |
583 | 583 | |
584 | 584 | while ($row = $result->fetch()) { |
585 | - $row['etag'] = '"' . $row['etag'] . '"'; |
|
585 | + $row['etag'] = '"'.$row['etag'].'"'; |
|
586 | 586 | |
587 | 587 | $modified = false; |
588 | 588 | $row['carddata'] = $this->readBlob($row['carddata'], $modified); |
@@ -661,7 +661,7 @@ discard block |
||
661 | 661 | 'cardUri' => $cardUri, |
662 | 662 | 'cardData' => $cardData])); |
663 | 663 | |
664 | - return '"' . $etag . '"'; |
|
664 | + return '"'.$etag.'"'; |
|
665 | 665 | } |
666 | 666 | |
667 | 667 | /** |
@@ -712,7 +712,7 @@ discard block |
||
712 | 712 | 'cardUri' => $cardUri, |
713 | 713 | 'cardData' => $cardData])); |
714 | 714 | |
715 | - return '"' . $etag . '"'; |
|
715 | + return '"'.$etag.'"'; |
|
716 | 716 | } |
717 | 717 | |
718 | 718 | /** |
@@ -810,7 +810,7 @@ discard block |
||
810 | 810 | public function getChangesForAddressBook($addressBookId, $syncToken, $syncLevel, $limit = null) { |
811 | 811 | // Current synctoken |
812 | 812 | $stmt = $this->db->prepare('SELECT `synctoken` FROM `*PREFIX*addressbooks` WHERE `id` = ?'); |
813 | - $stmt->execute([ $addressBookId ]); |
|
813 | + $stmt->execute([$addressBookId]); |
|
814 | 814 | $currentToken = $stmt->fetchColumn(0); |
815 | 815 | |
816 | 816 | if (is_null($currentToken)) { |
@@ -826,8 +826,8 @@ discard block |
||
826 | 826 | |
827 | 827 | if ($syncToken) { |
828 | 828 | $query = "SELECT `uri`, `operation` FROM `*PREFIX*addressbookchanges` WHERE `synctoken` >= ? AND `synctoken` < ? AND `addressbookid` = ? ORDER BY `synctoken`"; |
829 | - if ($limit>0) { |
|
830 | - $query .= " LIMIT " . (int)$limit; |
|
829 | + if ($limit > 0) { |
|
830 | + $query .= " LIMIT ".(int) $limit; |
|
831 | 831 | } |
832 | 832 | |
833 | 833 | // Fetching all changes |
@@ -894,7 +894,7 @@ discard block |
||
894 | 894 | * @param bool $modified |
895 | 895 | * @return string |
896 | 896 | */ |
897 | - private function readBlob($cardData, &$modified=false) { |
|
897 | + private function readBlob($cardData, &$modified = false) { |
|
898 | 898 | if (is_resource($cardData)) { |
899 | 899 | $cardData = stream_get_contents($cardData); |
900 | 900 | } |
@@ -962,7 +962,7 @@ discard block |
||
962 | 962 | if (\array_key_exists('escape_like_param', $options) && $options['escape_like_param'] === false) { |
963 | 963 | $query2->andWhere($query2->expr()->ilike('cp.value', $query->createNamedParameter($pattern))); |
964 | 964 | } else { |
965 | - $query2->andWhere($query2->expr()->ilike('cp.value', $query->createNamedParameter('%' . $this->db->escapeLikeParameter($pattern) . '%'))); |
|
965 | + $query2->andWhere($query2->expr()->ilike('cp.value', $query->createNamedParameter('%'.$this->db->escapeLikeParameter($pattern).'%'))); |
|
966 | 966 | } |
967 | 967 | } |
968 | 968 | |
@@ -974,7 +974,7 @@ discard block |
||
974 | 974 | |
975 | 975 | $result->closeCursor(); |
976 | 976 | |
977 | - return array_map(function ($array) { |
|
977 | + return array_map(function($array) { |
|
978 | 978 | $modified = false; |
979 | 979 | $array['carddata'] = $this->readBlob($array['carddata'], $modified); |
980 | 980 | if ($modified) { |
@@ -1020,7 +1020,7 @@ discard block |
||
1020 | 1020 | $result->closeCursor(); |
1021 | 1021 | |
1022 | 1022 | if (!isset($uri['uri'])) { |
1023 | - throw new \InvalidArgumentException('Card does not exists: ' . $id); |
|
1023 | + throw new \InvalidArgumentException('Card does not exists: '.$id); |
|
1024 | 1024 | } |
1025 | 1025 | |
1026 | 1026 | return $uri['uri']; |
@@ -1045,7 +1045,7 @@ discard block |
||
1045 | 1045 | |
1046 | 1046 | if (is_array($contact)) { |
1047 | 1047 | $modified = false; |
1048 | - $contact['etag'] = '"' . $contact['etag'] . '"'; |
|
1048 | + $contact['etag'] = '"'.$contact['etag'].'"'; |
|
1049 | 1049 | $contact['carddata'] = $this->readBlob($contact['carddata'], $modified); |
1050 | 1050 | if ($modified) { |
1051 | 1051 | $contact['size'] = strlen($contact['carddata']); |
@@ -1158,10 +1158,10 @@ discard block |
||
1158 | 1158 | $result->closeCursor(); |
1159 | 1159 | |
1160 | 1160 | if (!isset($cardIds['id'])) { |
1161 | - throw new \InvalidArgumentException('Card does not exists: ' . $uri); |
|
1161 | + throw new \InvalidArgumentException('Card does not exists: '.$uri); |
|
1162 | 1162 | } |
1163 | 1163 | |
1164 | - return (int)$cardIds['id']; |
|
1164 | + return (int) $cardIds['id']; |
|
1165 | 1165 | } |
1166 | 1166 | |
1167 | 1167 | /** |
@@ -1186,8 +1186,8 @@ discard block |
||
1186 | 1186 | } |
1187 | 1187 | |
1188 | 1188 | private function addOwnerPrincipal(&$addressbookInfo) { |
1189 | - $ownerPrincipalKey = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal'; |
|
1190 | - $displaynameKey = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD . '}owner-displayname'; |
|
1189 | + $ownerPrincipalKey = '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal'; |
|
1190 | + $displaynameKey = '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD.'}owner-displayname'; |
|
1191 | 1191 | if (isset($addressbookInfo[$ownerPrincipalKey])) { |
1192 | 1192 | $uri = $addressbookInfo[$ownerPrincipalKey]; |
1193 | 1193 | } else { |
@@ -60,7 +60,7 @@ |
||
60 | 60 | $ns = '{http://nextcloud.com/ns}'; |
61 | 61 | |
62 | 62 | if ($node instanceof Card) { |
63 | - $propFind->handle($ns . 'has-photo', function () use ($node) { |
|
63 | + $propFind->handle($ns.'has-photo', function() use ($node) { |
|
64 | 64 | $vcard = Reader::read($node->get()); |
65 | 65 | return $vcard instanceof VCard |
66 | 66 | && $vcard->PHOTO |