@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | 'uri' => $row['uri'], |
| 180 | 180 | 'principaluri' => $this->convertPrincipal($row['principaluri'], false), |
| 181 | 181 | '{DAV:}displayname' => $row['displayname'], |
| 182 | - '{' . Plugin::NS_CARDDAV . '}addressbook-description' => $row['description'], |
|
| 182 | + '{'.Plugin::NS_CARDDAV.'}addressbook-description' => $row['description'], |
|
| 183 | 183 | '{http://calendarserver.org/ns/}getctag' => $row['synctoken'], |
| 184 | 184 | '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ?: '0', |
| 185 | 185 | ]; |
@@ -204,13 +204,13 @@ discard block |
||
| 204 | 204 | ->setParameter('principaluri', $principals, IQueryBuilder::PARAM_STR_ARRAY) |
| 205 | 205 | ->execute(); |
| 206 | 206 | |
| 207 | - $readOnlyPropertyName = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only'; |
|
| 207 | + $readOnlyPropertyName = '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}read-only'; |
|
| 208 | 208 | while ($row = $result->fetch()) { |
| 209 | 209 | if ($row['principaluri'] === $principalUri) { |
| 210 | 210 | continue; |
| 211 | 211 | } |
| 212 | 212 | |
| 213 | - $readOnly = (int)$row['access'] === Backend::ACCESS_READ; |
|
| 213 | + $readOnly = (int) $row['access'] === Backend::ACCESS_READ; |
|
| 214 | 214 | if (isset($addressBooks[$row['id']])) { |
| 215 | 215 | if ($readOnly) { |
| 216 | 216 | // New share can not have more permissions then the old one. |
@@ -224,18 +224,18 @@ discard block |
||
| 224 | 224 | } |
| 225 | 225 | |
| 226 | 226 | [, $name] = \Sabre\Uri\split($row['principaluri']); |
| 227 | - $uri = $row['uri'] . '_shared_by_' . $name; |
|
| 228 | - $displayName = $row['displayname'] . ' (' . $this->getUserDisplayName($name) . ')'; |
|
| 227 | + $uri = $row['uri'].'_shared_by_'.$name; |
|
| 228 | + $displayName = $row['displayname'].' ('.$this->getUserDisplayName($name).')'; |
|
| 229 | 229 | |
| 230 | 230 | $addressBooks[$row['id']] = [ |
| 231 | 231 | 'id' => $row['id'], |
| 232 | 232 | 'uri' => $uri, |
| 233 | 233 | 'principaluri' => $principalUriOriginal, |
| 234 | 234 | '{DAV:}displayname' => $displayName, |
| 235 | - '{' . Plugin::NS_CARDDAV . '}addressbook-description' => $row['description'], |
|
| 235 | + '{'.Plugin::NS_CARDDAV.'}addressbook-description' => $row['description'], |
|
| 236 | 236 | '{http://calendarserver.org/ns/}getctag' => $row['synctoken'], |
| 237 | 237 | '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ?: '0', |
| 238 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $row['principaluri'], |
|
| 238 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal' => $row['principaluri'], |
|
| 239 | 239 | $readOnlyPropertyName => $readOnly, |
| 240 | 240 | ]; |
| 241 | 241 | |
@@ -262,7 +262,7 @@ discard block |
||
| 262 | 262 | 'uri' => $row['uri'], |
| 263 | 263 | 'principaluri' => $this->convertPrincipal($row['principaluri'], false), |
| 264 | 264 | '{DAV:}displayname' => $row['displayname'], |
| 265 | - '{' . Plugin::NS_CARDDAV . '}addressbook-description' => $row['description'], |
|
| 265 | + '{'.Plugin::NS_CARDDAV.'}addressbook-description' => $row['description'], |
|
| 266 | 266 | '{http://calendarserver.org/ns/}getctag' => $row['synctoken'], |
| 267 | 267 | '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ?: '0', |
| 268 | 268 | ]; |
@@ -309,7 +309,7 @@ discard block |
||
| 309 | 309 | 'uri' => $row['uri'], |
| 310 | 310 | 'principaluri' => $row['principaluri'], |
| 311 | 311 | '{DAV:}displayname' => $row['displayname'], |
| 312 | - '{' . Plugin::NS_CARDDAV . '}addressbook-description' => $row['description'], |
|
| 312 | + '{'.Plugin::NS_CARDDAV.'}addressbook-description' => $row['description'], |
|
| 313 | 313 | '{http://calendarserver.org/ns/}getctag' => $row['synctoken'], |
| 314 | 314 | '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ?: '0', |
| 315 | 315 | ]; |
@@ -343,7 +343,7 @@ discard block |
||
| 343 | 343 | 'uri' => $row['uri'], |
| 344 | 344 | 'principaluri' => $row['principaluri'], |
| 345 | 345 | '{DAV:}displayname' => $row['displayname'], |
| 346 | - '{' . Plugin::NS_CARDDAV . '}addressbook-description' => $row['description'], |
|
| 346 | + '{'.Plugin::NS_CARDDAV.'}addressbook-description' => $row['description'], |
|
| 347 | 347 | '{http://calendarserver.org/ns/}getctag' => $row['synctoken'], |
| 348 | 348 | '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ?: '0', |
| 349 | 349 | ]; |
@@ -372,17 +372,17 @@ discard block |
||
| 372 | 372 | public function updateAddressBook($addressBookId, \Sabre\DAV\PropPatch $propPatch) { |
| 373 | 373 | $supportedProperties = [ |
| 374 | 374 | '{DAV:}displayname', |
| 375 | - '{' . Plugin::NS_CARDDAV . '}addressbook-description', |
|
| 375 | + '{'.Plugin::NS_CARDDAV.'}addressbook-description', |
|
| 376 | 376 | ]; |
| 377 | 377 | |
| 378 | - $propPatch->handle($supportedProperties, function ($mutations) use ($addressBookId) { |
|
| 378 | + $propPatch->handle($supportedProperties, function($mutations) use ($addressBookId) { |
|
| 379 | 379 | $updates = []; |
| 380 | 380 | foreach ($mutations as $property => $newValue) { |
| 381 | 381 | switch ($property) { |
| 382 | 382 | case '{DAV:}displayname': |
| 383 | 383 | $updates['displayname'] = $newValue; |
| 384 | 384 | break; |
| 385 | - case '{' . Plugin::NS_CARDDAV . '}addressbook-description': |
|
| 385 | + case '{'.Plugin::NS_CARDDAV.'}addressbook-description': |
|
| 386 | 386 | $updates['description'] = $newValue; |
| 387 | 387 | break; |
| 388 | 388 | } |
@@ -398,9 +398,9 @@ discard block |
||
| 398 | 398 | |
| 399 | 399 | $this->addChange($addressBookId, "", 2); |
| 400 | 400 | |
| 401 | - $addressBookRow = $this->getAddressBookById((int)$addressBookId); |
|
| 401 | + $addressBookRow = $this->getAddressBookById((int) $addressBookId); |
|
| 402 | 402 | $shares = $this->getShares($addressBookId); |
| 403 | - $this->dispatcher->dispatchTyped(new AddressBookUpdatedEvent((int)$addressBookId, $addressBookRow, $shares, $mutations)); |
|
| 403 | + $this->dispatcher->dispatchTyped(new AddressBookUpdatedEvent((int) $addressBookId, $addressBookRow, $shares, $mutations)); |
|
| 404 | 404 | |
| 405 | 405 | return true; |
| 406 | 406 | }); |
@@ -429,11 +429,11 @@ discard block |
||
| 429 | 429 | case '{DAV:}displayname': |
| 430 | 430 | $values['displayname'] = $newValue; |
| 431 | 431 | break; |
| 432 | - case '{' . Plugin::NS_CARDDAV . '}addressbook-description': |
|
| 432 | + case '{'.Plugin::NS_CARDDAV.'}addressbook-description': |
|
| 433 | 433 | $values['description'] = $newValue; |
| 434 | 434 | break; |
| 435 | 435 | default: |
| 436 | - throw new BadRequest('Unknown property: ' . $property); |
|
| 436 | + throw new BadRequest('Unknown property: '.$property); |
|
| 437 | 437 | } |
| 438 | 438 | } |
| 439 | 439 | |
@@ -457,7 +457,7 @@ discard block |
||
| 457 | 457 | |
| 458 | 458 | $addressBookId = $query->getLastInsertId(); |
| 459 | 459 | $addressBookRow = $this->getAddressBookById($addressBookId); |
| 460 | - $this->dispatcher->dispatchTyped(new AddressBookCreatedEvent((int)$addressBookId, $addressBookRow)); |
|
| 460 | + $this->dispatcher->dispatchTyped(new AddressBookCreatedEvent((int) $addressBookId, $addressBookRow)); |
|
| 461 | 461 | |
| 462 | 462 | return $addressBookId; |
| 463 | 463 | } |
@@ -528,7 +528,7 @@ discard block |
||
| 528 | 528 | |
| 529 | 529 | $result = $query->execute(); |
| 530 | 530 | while ($row = $result->fetch()) { |
| 531 | - $row['etag'] = '"' . $row['etag'] . '"'; |
|
| 531 | + $row['etag'] = '"'.$row['etag'].'"'; |
|
| 532 | 532 | |
| 533 | 533 | $modified = false; |
| 534 | 534 | $row['carddata'] = $this->readBlob($row['carddata'], $modified); |
@@ -568,7 +568,7 @@ discard block |
||
| 568 | 568 | if (!$row) { |
| 569 | 569 | return false; |
| 570 | 570 | } |
| 571 | - $row['etag'] = '"' . $row['etag'] . '"'; |
|
| 571 | + $row['etag'] = '"'.$row['etag'].'"'; |
|
| 572 | 572 | |
| 573 | 573 | $modified = false; |
| 574 | 574 | $row['carddata'] = $this->readBlob($row['carddata'], $modified); |
@@ -610,7 +610,7 @@ discard block |
||
| 610 | 610 | $result = $query->execute(); |
| 611 | 611 | |
| 612 | 612 | while ($row = $result->fetch()) { |
| 613 | - $row['etag'] = '"' . $row['etag'] . '"'; |
|
| 613 | + $row['etag'] = '"'.$row['etag'].'"'; |
|
| 614 | 614 | |
| 615 | 615 | $modified = false; |
| 616 | 616 | $row['carddata'] = $this->readBlob($row['carddata'], $modified); |
@@ -661,7 +661,7 @@ discard block |
||
| 661 | 661 | ->andWhere($q->expr()->eq('uid', $q->createNamedParameter($uid))) |
| 662 | 662 | ->setMaxResults(1); |
| 663 | 663 | $result = $q->execute(); |
| 664 | - $count = (bool)$result->fetchOne(); |
|
| 664 | + $count = (bool) $result->fetchOne(); |
|
| 665 | 665 | $result->closeCursor(); |
| 666 | 666 | if ($count) { |
| 667 | 667 | throw new \Sabre\DAV\Exception\BadRequest('VCard object with uid already exists in this addressbook collection.'); |
@@ -689,14 +689,14 @@ discard block |
||
| 689 | 689 | $addressBookData = $this->getAddressBookById($addressBookId); |
| 690 | 690 | $shares = $this->getShares($addressBookId); |
| 691 | 691 | $objectRow = $this->getCard($addressBookId, $cardUri); |
| 692 | - $this->dispatcher->dispatchTyped(new CardCreatedEvent((int)$addressBookId, $addressBookData, $shares, $objectRow)); |
|
| 692 | + $this->dispatcher->dispatchTyped(new CardCreatedEvent((int) $addressBookId, $addressBookData, $shares, $objectRow)); |
|
| 693 | 693 | $this->legacyDispatcher->dispatch('\OCA\DAV\CardDAV\CardDavBackend::createCard', |
| 694 | 694 | new GenericEvent(null, [ |
| 695 | 695 | 'addressBookId' => $addressBookId, |
| 696 | 696 | 'cardUri' => $cardUri, |
| 697 | 697 | 'cardData' => $cardData])); |
| 698 | 698 | |
| 699 | - return '"' . $etag . '"'; |
|
| 699 | + return '"'.$etag.'"'; |
|
| 700 | 700 | } |
| 701 | 701 | |
| 702 | 702 | /** |
@@ -732,7 +732,7 @@ discard block |
||
| 732 | 732 | // check for recently stored etag and stop if it is the same |
| 733 | 733 | $etagCacheKey = "$addressBookId#$cardUri"; |
| 734 | 734 | if (isset($this->etagCache[$etagCacheKey]) && $this->etagCache[$etagCacheKey] === $etag) { |
| 735 | - return '"' . $etag . '"'; |
|
| 735 | + return '"'.$etag.'"'; |
|
| 736 | 736 | } |
| 737 | 737 | |
| 738 | 738 | $query->update($this->dbCardsTable) |
@@ -753,14 +753,14 @@ discard block |
||
| 753 | 753 | $addressBookData = $this->getAddressBookById($addressBookId); |
| 754 | 754 | $shares = $this->getShares($addressBookId); |
| 755 | 755 | $objectRow = $this->getCard($addressBookId, $cardUri); |
| 756 | - $this->dispatcher->dispatchTyped(new CardUpdatedEvent((int)$addressBookId, $addressBookData, $shares, $objectRow)); |
|
| 756 | + $this->dispatcher->dispatchTyped(new CardUpdatedEvent((int) $addressBookId, $addressBookData, $shares, $objectRow)); |
|
| 757 | 757 | $this->legacyDispatcher->dispatch('\OCA\DAV\CardDAV\CardDavBackend::updateCard', |
| 758 | 758 | new GenericEvent(null, [ |
| 759 | 759 | 'addressBookId' => $addressBookId, |
| 760 | 760 | 'cardUri' => $cardUri, |
| 761 | 761 | 'cardData' => $cardData])); |
| 762 | 762 | |
| 763 | - return '"' . $etag . '"'; |
|
| 763 | + return '"'.$etag.'"'; |
|
| 764 | 764 | } |
| 765 | 765 | |
| 766 | 766 | /** |
@@ -790,7 +790,7 @@ discard block |
||
| 790 | 790 | |
| 791 | 791 | if ($ret === 1) { |
| 792 | 792 | if ($cardId !== null) { |
| 793 | - $this->dispatcher->dispatchTyped(new CardDeletedEvent((int)$addressBookId, $addressBookData, $shares, $objectRow)); |
|
| 793 | + $this->dispatcher->dispatchTyped(new CardDeletedEvent((int) $addressBookId, $addressBookData, $shares, $objectRow)); |
|
| 794 | 794 | $this->legacyDispatcher->dispatch('\OCA\DAV\CardDAV\CardDavBackend::deleteCard', |
| 795 | 795 | new GenericEvent(null, [ |
| 796 | 796 | 'addressBookId' => $addressBookId, |
@@ -1045,7 +1045,7 @@ discard block |
||
| 1045 | 1045 | string $pattern, |
| 1046 | 1046 | array $searchProperties, |
| 1047 | 1047 | array $options = []): array { |
| 1048 | - $addressBookIds = array_map(static function ($row):int { |
|
| 1048 | + $addressBookIds = array_map(static function($row):int { |
|
| 1049 | 1049 | return (int) $row['id']; |
| 1050 | 1050 | }, $this->getAddressBooksForUser($principalUri)); |
| 1051 | 1051 | |
@@ -1112,7 +1112,7 @@ discard block |
||
| 1112 | 1112 | } elseif (!$escapePattern) { |
| 1113 | 1113 | $query2->andWhere($query2->expr()->ilike('cp.value', $query2->createNamedParameter($pattern))); |
| 1114 | 1114 | } else { |
| 1115 | - $query2->andWhere($query2->expr()->ilike('cp.value', $query2->createNamedParameter('%' . $this->db->escapeLikeParameter($pattern) . '%'))); |
|
| 1115 | + $query2->andWhere($query2->expr()->ilike('cp.value', $query2->createNamedParameter('%'.$this->db->escapeLikeParameter($pattern).'%'))); |
|
| 1116 | 1116 | } |
| 1117 | 1117 | } |
| 1118 | 1118 | |
@@ -1126,8 +1126,8 @@ discard block |
||
| 1126 | 1126 | $result = $query2->execute(); |
| 1127 | 1127 | $matches = $result->fetchAll(); |
| 1128 | 1128 | $result->closeCursor(); |
| 1129 | - $matches = array_map(function ($match) { |
|
| 1130 | - return (int)$match['cardid']; |
|
| 1129 | + $matches = array_map(function($match) { |
|
| 1130 | + return (int) $match['cardid']; |
|
| 1131 | 1131 | }, $matches); |
| 1132 | 1132 | |
| 1133 | 1133 | $cards = []; |
@@ -1143,7 +1143,7 @@ discard block |
||
| 1143 | 1143 | $result->closeCursor(); |
| 1144 | 1144 | } |
| 1145 | 1145 | |
| 1146 | - return array_map(function ($array) { |
|
| 1146 | + return array_map(function($array) { |
|
| 1147 | 1147 | $array['addressbookid'] = (int) $array['addressbookid']; |
| 1148 | 1148 | $modified = false; |
| 1149 | 1149 | $array['carddata'] = $this->readBlob($array['carddata'], $modified); |
@@ -1190,7 +1190,7 @@ discard block |
||
| 1190 | 1190 | $result->closeCursor(); |
| 1191 | 1191 | |
| 1192 | 1192 | if (!isset($uri['uri'])) { |
| 1193 | - throw new \InvalidArgumentException('Card does not exists: ' . $id); |
|
| 1193 | + throw new \InvalidArgumentException('Card does not exists: '.$id); |
|
| 1194 | 1194 | } |
| 1195 | 1195 | |
| 1196 | 1196 | return $uri['uri']; |
@@ -1215,7 +1215,7 @@ discard block |
||
| 1215 | 1215 | |
| 1216 | 1216 | if (is_array($contact)) { |
| 1217 | 1217 | $modified = false; |
| 1218 | - $contact['etag'] = '"' . $contact['etag'] . '"'; |
|
| 1218 | + $contact['etag'] = '"'.$contact['etag'].'"'; |
|
| 1219 | 1219 | $contact['carddata'] = $this->readBlob($contact['carddata'], $modified); |
| 1220 | 1220 | if ($modified) { |
| 1221 | 1221 | $contact['size'] = strlen($contact['carddata']); |
@@ -1328,10 +1328,10 @@ discard block |
||
| 1328 | 1328 | $result->closeCursor(); |
| 1329 | 1329 | |
| 1330 | 1330 | if (!isset($cardIds['id'])) { |
| 1331 | - throw new \InvalidArgumentException('Card does not exists: ' . $uri); |
|
| 1331 | + throw new \InvalidArgumentException('Card does not exists: '.$uri); |
|
| 1332 | 1332 | } |
| 1333 | 1333 | |
| 1334 | - return (int)$cardIds['id']; |
|
| 1334 | + return (int) $cardIds['id']; |
|
| 1335 | 1335 | } |
| 1336 | 1336 | |
| 1337 | 1337 | /** |
@@ -1357,8 +1357,8 @@ discard block |
||
| 1357 | 1357 | } |
| 1358 | 1358 | |
| 1359 | 1359 | private function addOwnerPrincipal(&$addressbookInfo) { |
| 1360 | - $ownerPrincipalKey = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal'; |
|
| 1361 | - $displaynameKey = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD . '}owner-displayname'; |
|
| 1360 | + $ownerPrincipalKey = '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal'; |
|
| 1361 | + $displaynameKey = '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD.'}owner-displayname'; |
|
| 1362 | 1362 | if (isset($addressbookInfo[$ownerPrincipalKey])) { |
| 1363 | 1363 | $uri = $addressbookInfo[$ownerPrincipalKey]; |
| 1364 | 1364 | } else { |