@@ -283,7 +283,7 @@ discard block |
||
| 283 | 283 | } |
| 284 | 284 | |
| 285 | 285 | protected function getTables(Connection $db) { |
| 286 | - $filterExpression = '/^' . preg_quote($this->config->getSystemValue('dbtableprefix', 'oc_')) . '/'; |
|
| 286 | + $filterExpression = '/^'.preg_quote($this->config->getSystemValue('dbtableprefix', 'oc_')).'/'; |
|
| 287 | 287 | $db->getConfiguration()-> |
| 288 | 288 | setFilterSchemaAssetsExpression($filterExpression); |
| 289 | 289 | return $db->getSchemaManager()->listTableNames(); |
@@ -297,7 +297,7 @@ discard block |
||
| 297 | 297 | * @param OutputInterface $output |
| 298 | 298 | */ |
| 299 | 299 | protected function copyTable(Connection $fromDB, Connection $toDB, Table $table, InputInterface $input, OutputInterface $output) { |
| 300 | - if ($table->getName() === $toDB->getPrefix() . 'migrations') { |
|
| 300 | + if ($table->getName() === $toDB->getPrefix().'migrations') { |
|
| 301 | 301 | $output->writeln('<comment>Skipping migrations table because it was already filled by running the migrations</comment>'); |
| 302 | 302 | return; |
| 303 | 303 | } |
@@ -312,9 +312,9 @@ discard block |
||
| 312 | 312 | $count = $result->fetchColumn(); |
| 313 | 313 | $result->closeCursor(); |
| 314 | 314 | |
| 315 | - $numChunks = ceil($count/$chunkSize); |
|
| 315 | + $numChunks = ceil($count / $chunkSize); |
|
| 316 | 316 | if ($numChunks > 1) { |
| 317 | - $output->writeln('chunked query, ' . $numChunks . ' chunks'); |
|
| 317 | + $output->writeln('chunked query, '.$numChunks.' chunks'); |
|
| 318 | 318 | } |
| 319 | 319 | |
| 320 | 320 | $progress = new ProgressBar($output, $count); |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | ->from('addressbooks') |
| 139 | 139 | ->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri))); |
| 140 | 140 | |
| 141 | - return (int)$query->execute()->fetchColumn(); |
|
| 141 | + return (int) $query->execute()->fetchColumn(); |
|
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | /** |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | 'uri' => $row['uri'], |
| 176 | 176 | 'principaluri' => $this->convertPrincipal($row['principaluri'], false), |
| 177 | 177 | '{DAV:}displayname' => $row['displayname'], |
| 178 | - '{' . Plugin::NS_CARDDAV . '}addressbook-description' => $row['description'], |
|
| 178 | + '{'.Plugin::NS_CARDDAV.'}addressbook-description' => $row['description'], |
|
| 179 | 179 | '{http://calendarserver.org/ns/}getctag' => $row['synctoken'], |
| 180 | 180 | '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ?: '0', |
| 181 | 181 | ]; |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | $principals = $this->principalBackend->getGroupMembership($principalUriOriginal, true); |
| 189 | 189 | $principals = array_merge($principals, $this->principalBackend->getCircleMembership($principalUriOriginal)); |
| 190 | 190 | |
| 191 | - $principals = array_map(function ($principal) { |
|
| 191 | + $principals = array_map(function($principal) { |
|
| 192 | 192 | return urldecode($principal); |
| 193 | 193 | }, $principals); |
| 194 | 194 | $principals[] = $principalUri; |
@@ -203,13 +203,13 @@ discard block |
||
| 203 | 203 | ->setParameter('principaluri', $principals, IQueryBuilder::PARAM_STR_ARRAY) |
| 204 | 204 | ->execute(); |
| 205 | 205 | |
| 206 | - $readOnlyPropertyName = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only'; |
|
| 206 | + $readOnlyPropertyName = '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}read-only'; |
|
| 207 | 207 | while ($row = $result->fetch()) { |
| 208 | 208 | if ($row['principaluri'] === $principalUri) { |
| 209 | 209 | continue; |
| 210 | 210 | } |
| 211 | 211 | |
| 212 | - $readOnly = (int)$row['access'] === Backend::ACCESS_READ; |
|
| 212 | + $readOnly = (int) $row['access'] === Backend::ACCESS_READ; |
|
| 213 | 213 | if (isset($addressBooks[$row['id']])) { |
| 214 | 214 | if ($readOnly) { |
| 215 | 215 | // New share can not have more permissions then the old one. |
@@ -223,18 +223,18 @@ discard block |
||
| 223 | 223 | } |
| 224 | 224 | |
| 225 | 225 | list(, $name) = \Sabre\Uri\split($row['principaluri']); |
| 226 | - $uri = $row['uri'] . '_shared_by_' . $name; |
|
| 227 | - $displayName = $row['displayname'] . ' (' . $this->getUserDisplayName($name) . ')'; |
|
| 226 | + $uri = $row['uri'].'_shared_by_'.$name; |
|
| 227 | + $displayName = $row['displayname'].' ('.$this->getUserDisplayName($name).')'; |
|
| 228 | 228 | |
| 229 | 229 | $addressBooks[$row['id']] = [ |
| 230 | 230 | 'id' => $row['id'], |
| 231 | 231 | 'uri' => $uri, |
| 232 | 232 | 'principaluri' => $principalUriOriginal, |
| 233 | 233 | '{DAV:}displayname' => $displayName, |
| 234 | - '{' . Plugin::NS_CARDDAV . '}addressbook-description' => $row['description'], |
|
| 234 | + '{'.Plugin::NS_CARDDAV.'}addressbook-description' => $row['description'], |
|
| 235 | 235 | '{http://calendarserver.org/ns/}getctag' => $row['synctoken'], |
| 236 | 236 | '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ?: '0', |
| 237 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $row['principaluri'], |
|
| 237 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal' => $row['principaluri'], |
|
| 238 | 238 | $readOnlyPropertyName => $readOnly, |
| 239 | 239 | ]; |
| 240 | 240 | |
@@ -261,7 +261,7 @@ discard block |
||
| 261 | 261 | 'uri' => $row['uri'], |
| 262 | 262 | 'principaluri' => $this->convertPrincipal($row['principaluri'], false), |
| 263 | 263 | '{DAV:}displayname' => $row['displayname'], |
| 264 | - '{' . Plugin::NS_CARDDAV . '}addressbook-description' => $row['description'], |
|
| 264 | + '{'.Plugin::NS_CARDDAV.'}addressbook-description' => $row['description'], |
|
| 265 | 265 | '{http://calendarserver.org/ns/}getctag' => $row['synctoken'], |
| 266 | 266 | '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ?: '0', |
| 267 | 267 | ]; |
@@ -308,7 +308,7 @@ discard block |
||
| 308 | 308 | 'uri' => $row['uri'], |
| 309 | 309 | 'principaluri' => $row['principaluri'], |
| 310 | 310 | '{DAV:}displayname' => $row['displayname'], |
| 311 | - '{' . Plugin::NS_CARDDAV . '}addressbook-description' => $row['description'], |
|
| 311 | + '{'.Plugin::NS_CARDDAV.'}addressbook-description' => $row['description'], |
|
| 312 | 312 | '{http://calendarserver.org/ns/}getctag' => $row['synctoken'], |
| 313 | 313 | '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ?: '0', |
| 314 | 314 | ]; |
@@ -342,7 +342,7 @@ discard block |
||
| 342 | 342 | 'uri' => $row['uri'], |
| 343 | 343 | 'principaluri' => $row['principaluri'], |
| 344 | 344 | '{DAV:}displayname' => $row['displayname'], |
| 345 | - '{' . Plugin::NS_CARDDAV . '}addressbook-description' => $row['description'], |
|
| 345 | + '{'.Plugin::NS_CARDDAV.'}addressbook-description' => $row['description'], |
|
| 346 | 346 | '{http://calendarserver.org/ns/}getctag' => $row['synctoken'], |
| 347 | 347 | '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ?: '0', |
| 348 | 348 | ]; |
@@ -371,17 +371,17 @@ discard block |
||
| 371 | 371 | public function updateAddressBook($addressBookId, \Sabre\DAV\PropPatch $propPatch) { |
| 372 | 372 | $supportedProperties = [ |
| 373 | 373 | '{DAV:}displayname', |
| 374 | - '{' . Plugin::NS_CARDDAV . '}addressbook-description', |
|
| 374 | + '{'.Plugin::NS_CARDDAV.'}addressbook-description', |
|
| 375 | 375 | ]; |
| 376 | 376 | |
| 377 | - $propPatch->handle($supportedProperties, function ($mutations) use ($addressBookId) { |
|
| 377 | + $propPatch->handle($supportedProperties, function($mutations) use ($addressBookId) { |
|
| 378 | 378 | $updates = []; |
| 379 | 379 | foreach ($mutations as $property => $newValue) { |
| 380 | 380 | switch ($property) { |
| 381 | 381 | case '{DAV:}displayname': |
| 382 | 382 | $updates['displayname'] = $newValue; |
| 383 | 383 | break; |
| 384 | - case '{' . Plugin::NS_CARDDAV . '}addressbook-description': |
|
| 384 | + case '{'.Plugin::NS_CARDDAV.'}addressbook-description': |
|
| 385 | 385 | $updates['description'] = $newValue; |
| 386 | 386 | break; |
| 387 | 387 | } |
@@ -397,9 +397,9 @@ discard block |
||
| 397 | 397 | |
| 398 | 398 | $this->addChange($addressBookId, "", 2); |
| 399 | 399 | |
| 400 | - $addressBookRow = $this->getAddressBookById((int)$addressBookId); |
|
| 400 | + $addressBookRow = $this->getAddressBookById((int) $addressBookId); |
|
| 401 | 401 | $shares = $this->getShares($addressBookId); |
| 402 | - $this->dispatcher->dispatchTyped(new AddressBookUpdatedEvent((int)$addressBookId, $addressBookRow, $shares, $mutations)); |
|
| 402 | + $this->dispatcher->dispatchTyped(new AddressBookUpdatedEvent((int) $addressBookId, $addressBookRow, $shares, $mutations)); |
|
| 403 | 403 | |
| 404 | 404 | return true; |
| 405 | 405 | }); |
@@ -428,11 +428,11 @@ discard block |
||
| 428 | 428 | case '{DAV:}displayname': |
| 429 | 429 | $values['displayname'] = $newValue; |
| 430 | 430 | break; |
| 431 | - case '{' . Plugin::NS_CARDDAV . '}addressbook-description': |
|
| 431 | + case '{'.Plugin::NS_CARDDAV.'}addressbook-description': |
|
| 432 | 432 | $values['description'] = $newValue; |
| 433 | 433 | break; |
| 434 | 434 | default: |
| 435 | - throw new BadRequest('Unknown property: ' . $property); |
|
| 435 | + throw new BadRequest('Unknown property: '.$property); |
|
| 436 | 436 | } |
| 437 | 437 | } |
| 438 | 438 | |
@@ -456,7 +456,7 @@ discard block |
||
| 456 | 456 | |
| 457 | 457 | $addressBookId = $query->getLastInsertId(); |
| 458 | 458 | $addressBookRow = $this->getAddressBookById($addressBookId); |
| 459 | - $this->dispatcher->dispatchTyped(new AddressBookCreatedEvent((int)$addressBookId, $addressBookRow)); |
|
| 459 | + $this->dispatcher->dispatchTyped(new AddressBookCreatedEvent((int) $addressBookId, $addressBookRow)); |
|
| 460 | 460 | |
| 461 | 461 | return $addressBookId; |
| 462 | 462 | } |
@@ -527,7 +527,7 @@ discard block |
||
| 527 | 527 | |
| 528 | 528 | $result = $query->execute(); |
| 529 | 529 | while ($row = $result->fetch()) { |
| 530 | - $row['etag'] = '"' . $row['etag'] . '"'; |
|
| 530 | + $row['etag'] = '"'.$row['etag'].'"'; |
|
| 531 | 531 | |
| 532 | 532 | $modified = false; |
| 533 | 533 | $row['carddata'] = $this->readBlob($row['carddata'], $modified); |
@@ -567,7 +567,7 @@ discard block |
||
| 567 | 567 | if (!$row) { |
| 568 | 568 | return false; |
| 569 | 569 | } |
| 570 | - $row['etag'] = '"' . $row['etag'] . '"'; |
|
| 570 | + $row['etag'] = '"'.$row['etag'].'"'; |
|
| 571 | 571 | |
| 572 | 572 | $modified = false; |
| 573 | 573 | $row['carddata'] = $this->readBlob($row['carddata'], $modified); |
@@ -609,7 +609,7 @@ discard block |
||
| 609 | 609 | $result = $query->execute(); |
| 610 | 610 | |
| 611 | 611 | while ($row = $result->fetch()) { |
| 612 | - $row['etag'] = '"' . $row['etag'] . '"'; |
|
| 612 | + $row['etag'] = '"'.$row['etag'].'"'; |
|
| 613 | 613 | |
| 614 | 614 | $modified = false; |
| 615 | 615 | $row['carddata'] = $this->readBlob($row['carddata'], $modified); |
@@ -660,7 +660,7 @@ discard block |
||
| 660 | 660 | ->andWhere($q->expr()->eq('uid', $q->createNamedParameter($uid))) |
| 661 | 661 | ->setMaxResults(1); |
| 662 | 662 | $result = $q->execute(); |
| 663 | - $count = (bool)$result->fetchColumn(); |
|
| 663 | + $count = (bool) $result->fetchColumn(); |
|
| 664 | 664 | $result->closeCursor(); |
| 665 | 665 | if ($count) { |
| 666 | 666 | throw new \Sabre\DAV\Exception\BadRequest('VCard object with uid already exists in this addressbook collection.'); |
@@ -688,14 +688,14 @@ discard block |
||
| 688 | 688 | $addressBookData = $this->getAddressBookById($addressBookId); |
| 689 | 689 | $shares = $this->getShares($addressBookId); |
| 690 | 690 | $objectRow = $this->getCard($addressBookId, $cardUri); |
| 691 | - $this->dispatcher->dispatchTyped(new CardCreatedEvent((int)$addressBookId, $addressBookData, $shares, $objectRow)); |
|
| 691 | + $this->dispatcher->dispatchTyped(new CardCreatedEvent((int) $addressBookId, $addressBookData, $shares, $objectRow)); |
|
| 692 | 692 | $this->legacyDispatcher->dispatch('\OCA\DAV\CardDAV\CardDavBackend::createCard', |
| 693 | 693 | new GenericEvent(null, [ |
| 694 | 694 | 'addressBookId' => $addressBookId, |
| 695 | 695 | 'cardUri' => $cardUri, |
| 696 | 696 | 'cardData' => $cardData])); |
| 697 | 697 | |
| 698 | - return '"' . $etag . '"'; |
|
| 698 | + return '"'.$etag.'"'; |
|
| 699 | 699 | } |
| 700 | 700 | |
| 701 | 701 | /** |
@@ -731,7 +731,7 @@ discard block |
||
| 731 | 731 | // check for recently stored etag and stop if it is the same |
| 732 | 732 | $etagCacheKey = "$addressBookId#$cardUri"; |
| 733 | 733 | if (isset($this->etagCache[$etagCacheKey]) && $this->etagCache[$etagCacheKey] === $etag) { |
| 734 | - return '"' . $etag . '"'; |
|
| 734 | + return '"'.$etag.'"'; |
|
| 735 | 735 | } |
| 736 | 736 | |
| 737 | 737 | $query->update($this->dbCardsTable) |
@@ -752,14 +752,14 @@ discard block |
||
| 752 | 752 | $addressBookData = $this->getAddressBookById($addressBookId); |
| 753 | 753 | $shares = $this->getShares($addressBookId); |
| 754 | 754 | $objectRow = $this->getCard($addressBookId, $cardUri); |
| 755 | - $this->dispatcher->dispatchTyped(new CardUpdatedEvent((int)$addressBookId, $addressBookData, $shares, $objectRow)); |
|
| 755 | + $this->dispatcher->dispatchTyped(new CardUpdatedEvent((int) $addressBookId, $addressBookData, $shares, $objectRow)); |
|
| 756 | 756 | $this->legacyDispatcher->dispatch('\OCA\DAV\CardDAV\CardDavBackend::updateCard', |
| 757 | 757 | new GenericEvent(null, [ |
| 758 | 758 | 'addressBookId' => $addressBookId, |
| 759 | 759 | 'cardUri' => $cardUri, |
| 760 | 760 | 'cardData' => $cardData])); |
| 761 | 761 | |
| 762 | - return '"' . $etag . '"'; |
|
| 762 | + return '"'.$etag.'"'; |
|
| 763 | 763 | } |
| 764 | 764 | |
| 765 | 765 | /** |
@@ -789,7 +789,7 @@ discard block |
||
| 789 | 789 | |
| 790 | 790 | if ($ret === 1) { |
| 791 | 791 | if ($cardId !== null) { |
| 792 | - $this->dispatcher->dispatchTyped(new CardDeletedEvent((int)$addressBookId, $addressBookData, $shares, $objectRow)); |
|
| 792 | + $this->dispatcher->dispatchTyped(new CardDeletedEvent((int) $addressBookId, $addressBookData, $shares, $objectRow)); |
|
| 793 | 793 | $this->legacyDispatcher->dispatch('\OCA\DAV\CardDAV\CardDavBackend::deleteCard', |
| 794 | 794 | new GenericEvent(null, [ |
| 795 | 795 | 'addressBookId' => $addressBookId, |
@@ -879,7 +879,7 @@ discard block |
||
| 879 | 879 | if ($syncToken) { |
| 880 | 880 | $query = "SELECT `uri`, `operation` FROM `*PREFIX*addressbookchanges` WHERE `synctoken` >= ? AND `synctoken` < ? AND `addressbookid` = ? ORDER BY `synctoken`"; |
| 881 | 881 | if ($limit > 0) { |
| 882 | - $query .= " LIMIT " . (int)$limit; |
|
| 882 | + $query .= " LIMIT ".(int) $limit; |
|
| 883 | 883 | } |
| 884 | 884 | |
| 885 | 885 | // Fetching all changes |
@@ -1022,7 +1022,7 @@ discard block |
||
| 1022 | 1022 | string $pattern, |
| 1023 | 1023 | array $searchProperties, |
| 1024 | 1024 | array $options = []): array { |
| 1025 | - $addressBookIds = array_map(static function ($row):int { |
|
| 1025 | + $addressBookIds = array_map(static function($row):int { |
|
| 1026 | 1026 | return (int) $row['id']; |
| 1027 | 1027 | }, $this->getAddressBooksForUser($principalUri)); |
| 1028 | 1028 | |
@@ -1044,7 +1044,7 @@ discard block |
||
| 1044 | 1044 | |
| 1045 | 1045 | $query2 = $this->db->getQueryBuilder(); |
| 1046 | 1046 | |
| 1047 | - $addressBookOr = $query2->expr()->orX(); |
|
| 1047 | + $addressBookOr = $query2->expr()->orX(); |
|
| 1048 | 1048 | foreach ($addressBookIds as $addressBookId) { |
| 1049 | 1049 | $addressBookOr->add($query2->expr()->eq('cp.addressbookid', $query2->createNamedParameter($addressBookId))); |
| 1050 | 1050 | } |
@@ -1085,7 +1085,7 @@ discard block |
||
| 1085 | 1085 | if (!$escapePattern) { |
| 1086 | 1086 | $query2->andWhere($query2->expr()->ilike('cp.value', $query2->createNamedParameter($pattern))); |
| 1087 | 1087 | } else { |
| 1088 | - $query2->andWhere($query2->expr()->ilike('cp.value', $query2->createNamedParameter('%' . $this->db->escapeLikeParameter($pattern) . '%'))); |
|
| 1088 | + $query2->andWhere($query2->expr()->ilike('cp.value', $query2->createNamedParameter('%'.$this->db->escapeLikeParameter($pattern).'%'))); |
|
| 1089 | 1089 | } |
| 1090 | 1090 | } |
| 1091 | 1091 | |
@@ -1099,8 +1099,8 @@ discard block |
||
| 1099 | 1099 | $result = $query2->execute(); |
| 1100 | 1100 | $matches = $result->fetchAll(); |
| 1101 | 1101 | $result->closeCursor(); |
| 1102 | - $matches = array_map(function ($match) { |
|
| 1103 | - return (int)$match['cardid']; |
|
| 1102 | + $matches = array_map(function($match) { |
|
| 1103 | + return (int) $match['cardid']; |
|
| 1104 | 1104 | }, $matches); |
| 1105 | 1105 | |
| 1106 | 1106 | $query = $this->db->getQueryBuilder(); |
@@ -1113,7 +1113,7 @@ discard block |
||
| 1113 | 1113 | |
| 1114 | 1114 | $result->closeCursor(); |
| 1115 | 1115 | |
| 1116 | - return array_map(function ($array) { |
|
| 1116 | + return array_map(function($array) { |
|
| 1117 | 1117 | $array['addressbookid'] = (int) $array['addressbookid']; |
| 1118 | 1118 | $modified = false; |
| 1119 | 1119 | $array['carddata'] = $this->readBlob($array['carddata'], $modified); |
@@ -1160,7 +1160,7 @@ discard block |
||
| 1160 | 1160 | $result->closeCursor(); |
| 1161 | 1161 | |
| 1162 | 1162 | if (!isset($uri['uri'])) { |
| 1163 | - throw new \InvalidArgumentException('Card does not exists: ' . $id); |
|
| 1163 | + throw new \InvalidArgumentException('Card does not exists: '.$id); |
|
| 1164 | 1164 | } |
| 1165 | 1165 | |
| 1166 | 1166 | return $uri['uri']; |
@@ -1185,7 +1185,7 @@ discard block |
||
| 1185 | 1185 | |
| 1186 | 1186 | if (is_array($contact)) { |
| 1187 | 1187 | $modified = false; |
| 1188 | - $contact['etag'] = '"' . $contact['etag'] . '"'; |
|
| 1188 | + $contact['etag'] = '"'.$contact['etag'].'"'; |
|
| 1189 | 1189 | $contact['carddata'] = $this->readBlob($contact['carddata'], $modified); |
| 1190 | 1190 | if ($modified) { |
| 1191 | 1191 | $contact['size'] = strlen($contact['carddata']); |
@@ -1298,10 +1298,10 @@ discard block |
||
| 1298 | 1298 | $result->closeCursor(); |
| 1299 | 1299 | |
| 1300 | 1300 | if (!isset($cardIds['id'])) { |
| 1301 | - throw new \InvalidArgumentException('Card does not exists: ' . $uri); |
|
| 1301 | + throw new \InvalidArgumentException('Card does not exists: '.$uri); |
|
| 1302 | 1302 | } |
| 1303 | 1303 | |
| 1304 | - return (int)$cardIds['id']; |
|
| 1304 | + return (int) $cardIds['id']; |
|
| 1305 | 1305 | } |
| 1306 | 1306 | |
| 1307 | 1307 | /** |
@@ -1327,8 +1327,8 @@ discard block |
||
| 1327 | 1327 | } |
| 1328 | 1328 | |
| 1329 | 1329 | private function addOwnerPrincipal(&$addressbookInfo) { |
| 1330 | - $ownerPrincipalKey = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal'; |
|
| 1331 | - $displaynameKey = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD . '}owner-displayname'; |
|
| 1330 | + $ownerPrincipalKey = '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal'; |
|
| 1331 | + $displaynameKey = '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD.'}owner-displayname'; |
|
| 1332 | 1332 | if (isset($addressbookInfo[$ownerPrincipalKey])) { |
| 1333 | 1333 | $uri = $addressbookInfo[$ownerPrincipalKey]; |
| 1334 | 1334 | } else { |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | $query->andWhere($query->expr()->neq('uri', $query->createNamedParameter(BirthdayService::BIRTHDAY_CALENDAR_URI))); |
| 248 | 248 | } |
| 249 | 249 | |
| 250 | - return (int)$query->execute()->fetchColumn(); |
|
| 250 | + return (int) $query->execute()->fetchColumn(); |
|
| 251 | 251 | } |
| 252 | 252 | |
| 253 | 253 | /** |
@@ -297,18 +297,18 @@ discard block |
||
| 297 | 297 | while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
| 298 | 298 | $components = []; |
| 299 | 299 | if ($row['components']) { |
| 300 | - $components = explode(',',$row['components']); |
|
| 300 | + $components = explode(',', $row['components']); |
|
| 301 | 301 | } |
| 302 | 302 | |
| 303 | 303 | $calendar = [ |
| 304 | 304 | 'id' => $row['id'], |
| 305 | 305 | 'uri' => $row['uri'], |
| 306 | 306 | 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
| 307 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'), |
|
| 308 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
| 309 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 310 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
| 311 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($principalUri, !$this->legacyEndpoint), |
|
| 307 | + '{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'), |
|
| 308 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0', |
|
| 309 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 310 | + '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'), |
|
| 311 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal' => $this->convertPrincipal($principalUri, !$this->legacyEndpoint), |
|
| 312 | 312 | ]; |
| 313 | 313 | |
| 314 | 314 | foreach ($this->propertyMap as $xmlName=>$dbName) { |
@@ -328,10 +328,10 @@ discard block |
||
| 328 | 328 | $principals = $this->principalBackend->getGroupMembership($principalUriOriginal, true); |
| 329 | 329 | $principals = array_merge($principals, $this->principalBackend->getCircleMembership($principalUriOriginal)); |
| 330 | 330 | |
| 331 | - $principals = array_map(function ($principal) { |
|
| 331 | + $principals = array_map(function($principal) { |
|
| 332 | 332 | return urldecode($principal); |
| 333 | 333 | }, $principals); |
| 334 | - $principals[]= $principalUri; |
|
| 334 | + $principals[] = $principalUri; |
|
| 335 | 335 | |
| 336 | 336 | $fields = array_values($this->propertyMap); |
| 337 | 337 | $fields[] = 'a.id'; |
@@ -351,7 +351,7 @@ discard block |
||
| 351 | 351 | ->setParameter('principaluri', $principals, \Doctrine\DBAL\Connection::PARAM_STR_ARRAY) |
| 352 | 352 | ->execute(); |
| 353 | 353 | |
| 354 | - $readOnlyPropertyName = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only'; |
|
| 354 | + $readOnlyPropertyName = '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}read-only'; |
|
| 355 | 355 | while ($row = $result->fetch()) { |
| 356 | 356 | if ($row['principaluri'] === $principalUri) { |
| 357 | 357 | continue; |
@@ -371,21 +371,21 @@ discard block |
||
| 371 | 371 | } |
| 372 | 372 | |
| 373 | 373 | list(, $name) = Uri\split($row['principaluri']); |
| 374 | - $uri = $row['uri'] . '_shared_by_' . $name; |
|
| 375 | - $row['displayname'] = $row['displayname'] . ' (' . $this->getUserDisplayName($name) . ')'; |
|
| 374 | + $uri = $row['uri'].'_shared_by_'.$name; |
|
| 375 | + $row['displayname'] = $row['displayname'].' ('.$this->getUserDisplayName($name).')'; |
|
| 376 | 376 | $components = []; |
| 377 | 377 | if ($row['components']) { |
| 378 | - $components = explode(',',$row['components']); |
|
| 378 | + $components = explode(',', $row['components']); |
|
| 379 | 379 | } |
| 380 | 380 | $calendar = [ |
| 381 | 381 | 'id' => $row['id'], |
| 382 | 382 | 'uri' => $uri, |
| 383 | 383 | 'principaluri' => $this->convertPrincipal($principalUri, !$this->legacyEndpoint), |
| 384 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'), |
|
| 385 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
| 386 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 387 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp('transparent'), |
|
| 388 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
|
| 384 | + '{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'), |
|
| 385 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0', |
|
| 386 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 387 | + '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp('transparent'), |
|
| 388 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
|
| 389 | 389 | $readOnlyPropertyName => $readOnly, |
| 390 | 390 | ]; |
| 391 | 391 | |
@@ -425,16 +425,16 @@ discard block |
||
| 425 | 425 | while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
| 426 | 426 | $components = []; |
| 427 | 427 | if ($row['components']) { |
| 428 | - $components = explode(',',$row['components']); |
|
| 428 | + $components = explode(',', $row['components']); |
|
| 429 | 429 | } |
| 430 | 430 | $calendar = [ |
| 431 | 431 | 'id' => $row['id'], |
| 432 | 432 | 'uri' => $row['uri'], |
| 433 | 433 | 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
| 434 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'), |
|
| 435 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
| 436 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 437 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
| 434 | + '{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'), |
|
| 435 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0', |
|
| 436 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 437 | + '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'), |
|
| 438 | 438 | ]; |
| 439 | 439 | foreach ($this->propertyMap as $xmlName=>$dbName) { |
| 440 | 440 | $calendar[$xmlName] = $row[$dbName]; |
@@ -493,22 +493,22 @@ discard block |
||
| 493 | 493 | |
| 494 | 494 | while ($row = $result->fetch()) { |
| 495 | 495 | list(, $name) = Uri\split($row['principaluri']); |
| 496 | - $row['displayname'] = $row['displayname'] . "($name)"; |
|
| 496 | + $row['displayname'] = $row['displayname']."($name)"; |
|
| 497 | 497 | $components = []; |
| 498 | 498 | if ($row['components']) { |
| 499 | - $components = explode(',',$row['components']); |
|
| 499 | + $components = explode(',', $row['components']); |
|
| 500 | 500 | } |
| 501 | 501 | $calendar = [ |
| 502 | 502 | 'id' => $row['id'], |
| 503 | 503 | 'uri' => $row['publicuri'], |
| 504 | 504 | 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
| 505 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'), |
|
| 506 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
| 507 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 508 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
| 509 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($row['principaluri'], $this->legacyEndpoint), |
|
| 510 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only' => (int)$row['access'] === Backend::ACCESS_READ, |
|
| 511 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}public' => (int)$row['access'] === self::ACCESS_PUBLIC, |
|
| 505 | + '{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'), |
|
| 506 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0', |
|
| 507 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 508 | + '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'), |
|
| 509 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal' => $this->convertPrincipal($row['principaluri'], $this->legacyEndpoint), |
|
| 510 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}read-only' => (int) $row['access'] === Backend::ACCESS_READ, |
|
| 511 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}public' => (int) $row['access'] === self::ACCESS_PUBLIC, |
|
| 512 | 512 | ]; |
| 513 | 513 | |
| 514 | 514 | foreach ($this->propertyMap as $xmlName=>$dbName) { |
@@ -555,26 +555,26 @@ discard block |
||
| 555 | 555 | $result->closeCursor(); |
| 556 | 556 | |
| 557 | 557 | if ($row === false) { |
| 558 | - throw new NotFound('Node with name \'' . $uri . '\' could not be found'); |
|
| 558 | + throw new NotFound('Node with name \''.$uri.'\' could not be found'); |
|
| 559 | 559 | } |
| 560 | 560 | |
| 561 | 561 | list(, $name) = Uri\split($row['principaluri']); |
| 562 | - $row['displayname'] = $row['displayname'] . ' ' . "($name)"; |
|
| 562 | + $row['displayname'] = $row['displayname'].' '."($name)"; |
|
| 563 | 563 | $components = []; |
| 564 | 564 | if ($row['components']) { |
| 565 | - $components = explode(',',$row['components']); |
|
| 565 | + $components = explode(',', $row['components']); |
|
| 566 | 566 | } |
| 567 | 567 | $calendar = [ |
| 568 | 568 | 'id' => $row['id'], |
| 569 | 569 | 'uri' => $row['publicuri'], |
| 570 | 570 | 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
| 571 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'), |
|
| 572 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
| 573 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 574 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
| 575 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
|
| 576 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only' => (int)$row['access'] === Backend::ACCESS_READ, |
|
| 577 | - '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}public' => (int)$row['access'] === self::ACCESS_PUBLIC, |
|
| 571 | + '{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'), |
|
| 572 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0', |
|
| 573 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 574 | + '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'), |
|
| 575 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
|
| 576 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}read-only' => (int) $row['access'] === Backend::ACCESS_READ, |
|
| 577 | + '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}public' => (int) $row['access'] === self::ACCESS_PUBLIC, |
|
| 578 | 578 | ]; |
| 579 | 579 | |
| 580 | 580 | foreach ($this->propertyMap as $xmlName=>$dbName) { |
@@ -616,17 +616,17 @@ discard block |
||
| 616 | 616 | |
| 617 | 617 | $components = []; |
| 618 | 618 | if ($row['components']) { |
| 619 | - $components = explode(',',$row['components']); |
|
| 619 | + $components = explode(',', $row['components']); |
|
| 620 | 620 | } |
| 621 | 621 | |
| 622 | 622 | $calendar = [ |
| 623 | 623 | 'id' => $row['id'], |
| 624 | 624 | 'uri' => $row['uri'], |
| 625 | 625 | 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
| 626 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'), |
|
| 627 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
| 628 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 629 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
| 626 | + '{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'), |
|
| 627 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0', |
|
| 628 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 629 | + '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'), |
|
| 630 | 630 | ]; |
| 631 | 631 | |
| 632 | 632 | foreach ($this->propertyMap as $xmlName=>$dbName) { |
@@ -666,17 +666,17 @@ discard block |
||
| 666 | 666 | |
| 667 | 667 | $components = []; |
| 668 | 668 | if ($row['components']) { |
| 669 | - $components = explode(',',$row['components']); |
|
| 669 | + $components = explode(',', $row['components']); |
|
| 670 | 670 | } |
| 671 | 671 | |
| 672 | 672 | $calendar = [ |
| 673 | 673 | 'id' => $row['id'], |
| 674 | 674 | 'uri' => $row['uri'], |
| 675 | 675 | 'principaluri' => $this->convertPrincipal($row['principaluri'], !$this->legacyEndpoint), |
| 676 | - '{' . Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($row['synctoken']?$row['synctoken']:'0'), |
|
| 677 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
| 678 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 679 | - '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent']?'transparent':'opaque'), |
|
| 676 | + '{'.Plugin::NS_CALENDARSERVER.'}getctag' => 'http://sabre.io/ns/sync/'.($row['synctoken'] ? $row['synctoken'] : '0'), |
|
| 677 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0', |
|
| 678 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet($components), |
|
| 679 | + '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp' => new ScheduleCalendarTransp($row['transparent'] ? 'transparent' : 'opaque'), |
|
| 680 | 680 | ]; |
| 681 | 681 | |
| 682 | 682 | foreach ($this->propertyMap as $xmlName=>$dbName) { |
@@ -705,7 +705,7 @@ discard block |
||
| 705 | 705 | ->from('calendarsubscriptions') |
| 706 | 706 | ->where($query->expr()->eq('id', $query->createNamedParameter($subscriptionId))) |
| 707 | 707 | ->orderBy('calendarorder', 'asc'); |
| 708 | - $stmt =$query->execute(); |
|
| 708 | + $stmt = $query->execute(); |
|
| 709 | 709 | |
| 710 | 710 | $row = $stmt->fetch(\PDO::FETCH_ASSOC); |
| 711 | 711 | $stmt->closeCursor(); |
@@ -719,8 +719,8 @@ discard block |
||
| 719 | 719 | 'principaluri' => $row['principaluri'], |
| 720 | 720 | 'source' => $row['source'], |
| 721 | 721 | 'lastmodified' => $row['lastmodified'], |
| 722 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet(['VTODO', 'VEVENT']), |
|
| 723 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
| 722 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet(['VTODO', 'VEVENT']), |
|
| 723 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0', |
|
| 724 | 724 | ]; |
| 725 | 725 | |
| 726 | 726 | foreach ($this->subscriptionPropertyMap as $xmlName=>$dbName) { |
@@ -757,16 +757,16 @@ discard block |
||
| 757 | 757 | $sccs = '{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set'; |
| 758 | 758 | if (isset($properties[$sccs])) { |
| 759 | 759 | if (!($properties[$sccs] instanceof SupportedCalendarComponentSet)) { |
| 760 | - throw new DAV\Exception('The ' . $sccs . ' property must be of type: \Sabre\CalDAV\Property\SupportedCalendarComponentSet'); |
|
| 760 | + throw new DAV\Exception('The '.$sccs.' property must be of type: \Sabre\CalDAV\Property\SupportedCalendarComponentSet'); |
|
| 761 | 761 | } |
| 762 | - $values['components'] = implode(',',$properties[$sccs]->getValue()); |
|
| 762 | + $values['components'] = implode(',', $properties[$sccs]->getValue()); |
|
| 763 | 763 | } elseif (isset($properties['components'])) { |
| 764 | 764 | // Allow to provide components internally without having |
| 765 | 765 | // to create a SupportedCalendarComponentSet object |
| 766 | 766 | $values['components'] = $properties['components']; |
| 767 | 767 | } |
| 768 | 768 | |
| 769 | - $transp = '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp'; |
|
| 769 | + $transp = '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp'; |
|
| 770 | 770 | if (isset($properties[$transp])) { |
| 771 | 771 | $values['transparent'] = (int) ($properties[$transp]->getValue() === 'transparent'); |
| 772 | 772 | } |
@@ -786,7 +786,7 @@ discard block |
||
| 786 | 786 | $calendarId = $query->getLastInsertId(); |
| 787 | 787 | |
| 788 | 788 | $calendarData = $this->getCalendarById($calendarId); |
| 789 | - $this->dispatcher->dispatchTyped(new CalendarCreatedEvent((int)$calendarId, $calendarData)); |
|
| 789 | + $this->dispatcher->dispatchTyped(new CalendarCreatedEvent((int) $calendarId, $calendarData)); |
|
| 790 | 790 | $this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::createCalendar', new GenericEvent( |
| 791 | 791 | '\OCA\DAV\CalDAV\CalDavBackend::createCalendar', |
| 792 | 792 | [ |
@@ -815,13 +815,13 @@ discard block |
||
| 815 | 815 | */ |
| 816 | 816 | public function updateCalendar($calendarId, PropPatch $propPatch) { |
| 817 | 817 | $supportedProperties = array_keys($this->propertyMap); |
| 818 | - $supportedProperties[] = '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp'; |
|
| 818 | + $supportedProperties[] = '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp'; |
|
| 819 | 819 | |
| 820 | - $propPatch->handle($supportedProperties, function ($mutations) use ($calendarId) { |
|
| 820 | + $propPatch->handle($supportedProperties, function($mutations) use ($calendarId) { |
|
| 821 | 821 | $newValues = []; |
| 822 | 822 | foreach ($mutations as $propertyName => $propertyValue) { |
| 823 | 823 | switch ($propertyName) { |
| 824 | - case '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp': |
|
| 824 | + case '{'.Plugin::NS_CALDAV.'}schedule-calendar-transp': |
|
| 825 | 825 | $fieldName = 'transparent'; |
| 826 | 826 | $newValues[$fieldName] = (int) ($propertyValue->getValue() === 'transparent'); |
| 827 | 827 | break; |
@@ -843,7 +843,7 @@ discard block |
||
| 843 | 843 | |
| 844 | 844 | $calendarData = $this->getCalendarById($calendarId); |
| 845 | 845 | $shares = $this->getShares($calendarId); |
| 846 | - $this->dispatcher->dispatchTyped(new CalendarUpdatedEvent((int)$calendarId, $calendarData, $shares, $mutations)); |
|
| 846 | + $this->dispatcher->dispatchTyped(new CalendarUpdatedEvent((int) $calendarId, $calendarData, $shares, $mutations)); |
|
| 847 | 847 | $this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::updateCalendar', new GenericEvent( |
| 848 | 848 | '\OCA\DAV\CalDAV\CalDavBackend::updateCalendar', |
| 849 | 849 | [ |
@@ -893,7 +893,7 @@ discard block |
||
| 893 | 893 | ->execute(); |
| 894 | 894 | |
| 895 | 895 | if ($calendarData) { |
| 896 | - $this->dispatcher->dispatchTyped(new CalendarDeletedEvent((int)$calendarId, $calendarData, $shares)); |
|
| 896 | + $this->dispatcher->dispatchTyped(new CalendarDeletedEvent((int) $calendarId, $calendarData, $shares)); |
|
| 897 | 897 | } |
| 898 | 898 | } |
| 899 | 899 | |
@@ -939,7 +939,7 @@ discard block |
||
| 939 | 939 | * @param int $calendarType |
| 940 | 940 | * @return array |
| 941 | 941 | */ |
| 942 | - public function getCalendarObjects($calendarId, $calendarType=self::CALENDAR_TYPE_CALENDAR):array { |
|
| 942 | + public function getCalendarObjects($calendarId, $calendarType = self::CALENDAR_TYPE_CALENDAR):array { |
|
| 943 | 943 | $query = $this->db->getQueryBuilder(); |
| 944 | 944 | $query->select(['id', 'uri', 'lastmodified', 'etag', 'calendarid', 'size', 'componenttype', 'classification']) |
| 945 | 945 | ->from('calendarobjects') |
@@ -953,11 +953,11 @@ discard block |
||
| 953 | 953 | 'id' => $row['id'], |
| 954 | 954 | 'uri' => $row['uri'], |
| 955 | 955 | 'lastmodified' => $row['lastmodified'], |
| 956 | - 'etag' => '"' . $row['etag'] . '"', |
|
| 956 | + 'etag' => '"'.$row['etag'].'"', |
|
| 957 | 957 | 'calendarid' => $row['calendarid'], |
| 958 | - 'size' => (int)$row['size'], |
|
| 958 | + 'size' => (int) $row['size'], |
|
| 959 | 959 | 'component' => strtolower($row['componenttype']), |
| 960 | - 'classification'=> (int)$row['classification'] |
|
| 960 | + 'classification'=> (int) $row['classification'] |
|
| 961 | 961 | ]; |
| 962 | 962 | } |
| 963 | 963 | |
@@ -981,7 +981,7 @@ discard block |
||
| 981 | 981 | * @param int $calendarType |
| 982 | 982 | * @return array|null |
| 983 | 983 | */ |
| 984 | - public function getCalendarObject($calendarId, $objectUri, $calendarType=self::CALENDAR_TYPE_CALENDAR) { |
|
| 984 | + public function getCalendarObject($calendarId, $objectUri, $calendarType = self::CALENDAR_TYPE_CALENDAR) { |
|
| 985 | 985 | $query = $this->db->getQueryBuilder(); |
| 986 | 986 | $query->select(['id', 'uri', 'lastmodified', 'etag', 'calendarid', 'size', 'calendardata', 'componenttype', 'classification']) |
| 987 | 987 | ->from('calendarobjects') |
@@ -999,12 +999,12 @@ discard block |
||
| 999 | 999 | 'id' => $row['id'], |
| 1000 | 1000 | 'uri' => $row['uri'], |
| 1001 | 1001 | 'lastmodified' => $row['lastmodified'], |
| 1002 | - 'etag' => '"' . $row['etag'] . '"', |
|
| 1002 | + 'etag' => '"'.$row['etag'].'"', |
|
| 1003 | 1003 | 'calendarid' => $row['calendarid'], |
| 1004 | - 'size' => (int)$row['size'], |
|
| 1004 | + 'size' => (int) $row['size'], |
|
| 1005 | 1005 | 'calendardata' => $this->readBlob($row['calendardata']), |
| 1006 | 1006 | 'component' => strtolower($row['componenttype']), |
| 1007 | - 'classification'=> (int)$row['classification'] |
|
| 1007 | + 'classification'=> (int) $row['classification'] |
|
| 1008 | 1008 | ]; |
| 1009 | 1009 | } |
| 1010 | 1010 | |
@@ -1021,7 +1021,7 @@ discard block |
||
| 1021 | 1021 | * @param int $calendarType |
| 1022 | 1022 | * @return array |
| 1023 | 1023 | */ |
| 1024 | - public function getMultipleCalendarObjects($calendarId, array $uris, $calendarType=self::CALENDAR_TYPE_CALENDAR):array { |
|
| 1024 | + public function getMultipleCalendarObjects($calendarId, array $uris, $calendarType = self::CALENDAR_TYPE_CALENDAR):array { |
|
| 1025 | 1025 | if (empty($uris)) { |
| 1026 | 1026 | return []; |
| 1027 | 1027 | } |
@@ -1045,12 +1045,12 @@ discard block |
||
| 1045 | 1045 | 'id' => $row['id'], |
| 1046 | 1046 | 'uri' => $row['uri'], |
| 1047 | 1047 | 'lastmodified' => $row['lastmodified'], |
| 1048 | - 'etag' => '"' . $row['etag'] . '"', |
|
| 1048 | + 'etag' => '"'.$row['etag'].'"', |
|
| 1049 | 1049 | 'calendarid' => $row['calendarid'], |
| 1050 | - 'size' => (int)$row['size'], |
|
| 1050 | + 'size' => (int) $row['size'], |
|
| 1051 | 1051 | 'calendardata' => $this->readBlob($row['calendardata']), |
| 1052 | 1052 | 'component' => strtolower($row['componenttype']), |
| 1053 | - 'classification' => (int)$row['classification'] |
|
| 1053 | + 'classification' => (int) $row['classification'] |
|
| 1054 | 1054 | ]; |
| 1055 | 1055 | } |
| 1056 | 1056 | $result->closeCursor(); |
@@ -1078,7 +1078,7 @@ discard block |
||
| 1078 | 1078 | * @param int $calendarType |
| 1079 | 1079 | * @return string |
| 1080 | 1080 | */ |
| 1081 | - public function createCalendarObject($calendarId, $objectUri, $calendarData, $calendarType=self::CALENDAR_TYPE_CALENDAR) { |
|
| 1081 | + public function createCalendarObject($calendarId, $objectUri, $calendarData, $calendarType = self::CALENDAR_TYPE_CALENDAR) { |
|
| 1082 | 1082 | $extraData = $this->getDenormalizedData($calendarData); |
| 1083 | 1083 | |
| 1084 | 1084 | $q = $this->db->getQueryBuilder(); |
@@ -1122,7 +1122,7 @@ discard block |
||
| 1122 | 1122 | $calendarRow = $this->getCalendarById($calendarId); |
| 1123 | 1123 | $shares = $this->getShares($calendarId); |
| 1124 | 1124 | |
| 1125 | - $this->dispatcher->dispatchTyped(new CalendarObjectCreatedEvent((int)$calendarId, $calendarRow, $shares, $objectRow)); |
|
| 1125 | + $this->dispatcher->dispatchTyped(new CalendarObjectCreatedEvent((int) $calendarId, $calendarRow, $shares, $objectRow)); |
|
| 1126 | 1126 | $this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::createCalendarObject', new GenericEvent( |
| 1127 | 1127 | '\OCA\DAV\CalDAV\CalDavBackend::createCalendarObject', |
| 1128 | 1128 | [ |
@@ -1135,7 +1135,7 @@ discard block |
||
| 1135 | 1135 | } else { |
| 1136 | 1136 | $subscriptionRow = $this->getSubscriptionById($calendarId); |
| 1137 | 1137 | |
| 1138 | - $this->dispatcher->dispatchTyped(new CachedCalendarObjectCreatedEvent((int)$calendarId, $subscriptionRow, [], $objectRow)); |
|
| 1138 | + $this->dispatcher->dispatchTyped(new CachedCalendarObjectCreatedEvent((int) $calendarId, $subscriptionRow, [], $objectRow)); |
|
| 1139 | 1139 | $this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::createCachedCalendarObject', new GenericEvent( |
| 1140 | 1140 | '\OCA\DAV\CalDAV\CalDavBackend::createCachedCalendarObject', |
| 1141 | 1141 | [ |
@@ -1147,7 +1147,7 @@ discard block |
||
| 1147 | 1147 | )); |
| 1148 | 1148 | } |
| 1149 | 1149 | |
| 1150 | - return '"' . $extraData['etag'] . '"'; |
|
| 1150 | + return '"'.$extraData['etag'].'"'; |
|
| 1151 | 1151 | } |
| 1152 | 1152 | |
| 1153 | 1153 | /** |
@@ -1169,7 +1169,7 @@ discard block |
||
| 1169 | 1169 | * @param int $calendarType |
| 1170 | 1170 | * @return string |
| 1171 | 1171 | */ |
| 1172 | - public function updateCalendarObject($calendarId, $objectUri, $calendarData, $calendarType=self::CALENDAR_TYPE_CALENDAR) { |
|
| 1172 | + public function updateCalendarObject($calendarId, $objectUri, $calendarData, $calendarType = self::CALENDAR_TYPE_CALENDAR) { |
|
| 1173 | 1173 | $extraData = $this->getDenormalizedData($calendarData); |
| 1174 | 1174 | $query = $this->db->getQueryBuilder(); |
| 1175 | 1175 | $query->update('calendarobjects') |
@@ -1196,7 +1196,7 @@ discard block |
||
| 1196 | 1196 | $calendarRow = $this->getCalendarById($calendarId); |
| 1197 | 1197 | $shares = $this->getShares($calendarId); |
| 1198 | 1198 | |
| 1199 | - $this->dispatcher->dispatchTyped(new CalendarObjectUpdatedEvent((int)$calendarId, $calendarRow, $shares, $objectRow)); |
|
| 1199 | + $this->dispatcher->dispatchTyped(new CalendarObjectUpdatedEvent((int) $calendarId, $calendarRow, $shares, $objectRow)); |
|
| 1200 | 1200 | $this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::updateCalendarObject', new GenericEvent( |
| 1201 | 1201 | '\OCA\DAV\CalDAV\CalDavBackend::updateCalendarObject', |
| 1202 | 1202 | [ |
@@ -1209,7 +1209,7 @@ discard block |
||
| 1209 | 1209 | } else { |
| 1210 | 1210 | $subscriptionRow = $this->getSubscriptionById($calendarId); |
| 1211 | 1211 | |
| 1212 | - $this->dispatcher->dispatchTyped(new CachedCalendarObjectUpdatedEvent((int)$calendarId, $subscriptionRow, [], $objectRow)); |
|
| 1212 | + $this->dispatcher->dispatchTyped(new CachedCalendarObjectUpdatedEvent((int) $calendarId, $subscriptionRow, [], $objectRow)); |
|
| 1213 | 1213 | $this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::updateCachedCalendarObject', new GenericEvent( |
| 1214 | 1214 | '\OCA\DAV\CalDAV\CalDavBackend::updateCachedCalendarObject', |
| 1215 | 1215 | [ |
@@ -1222,7 +1222,7 @@ discard block |
||
| 1222 | 1222 | } |
| 1223 | 1223 | } |
| 1224 | 1224 | |
| 1225 | - return '"' . $extraData['etag'] . '"'; |
|
| 1225 | + return '"'.$extraData['etag'].'"'; |
|
| 1226 | 1226 | } |
| 1227 | 1227 | |
| 1228 | 1228 | /** |
@@ -1252,14 +1252,14 @@ discard block |
||
| 1252 | 1252 | * @param int $calendarType |
| 1253 | 1253 | * @return void |
| 1254 | 1254 | */ |
| 1255 | - public function deleteCalendarObject($calendarId, $objectUri, $calendarType=self::CALENDAR_TYPE_CALENDAR) { |
|
| 1255 | + public function deleteCalendarObject($calendarId, $objectUri, $calendarType = self::CALENDAR_TYPE_CALENDAR) { |
|
| 1256 | 1256 | $data = $this->getCalendarObject($calendarId, $objectUri, $calendarType); |
| 1257 | 1257 | if (is_array($data)) { |
| 1258 | 1258 | if ($calendarType === self::CALENDAR_TYPE_CALENDAR) { |
| 1259 | 1259 | $calendarRow = $this->getCalendarById($calendarId); |
| 1260 | 1260 | $shares = $this->getShares($calendarId); |
| 1261 | 1261 | |
| 1262 | - $this->dispatcher->dispatchTyped(new CalendarObjectDeletedEvent((int)$calendarId, $calendarRow, $shares, $data)); |
|
| 1262 | + $this->dispatcher->dispatchTyped(new CalendarObjectDeletedEvent((int) $calendarId, $calendarRow, $shares, $data)); |
|
| 1263 | 1263 | $this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::deleteCalendarObject', new GenericEvent( |
| 1264 | 1264 | '\OCA\DAV\CalDAV\CalDavBackend::deleteCalendarObject', |
| 1265 | 1265 | [ |
@@ -1272,7 +1272,7 @@ discard block |
||
| 1272 | 1272 | } else { |
| 1273 | 1273 | $subscriptionRow = $this->getSubscriptionById($calendarId); |
| 1274 | 1274 | |
| 1275 | - $this->dispatcher->dispatchTyped(new CachedCalendarObjectDeletedEvent((int)$calendarId, $subscriptionRow, [], $data)); |
|
| 1275 | + $this->dispatcher->dispatchTyped(new CachedCalendarObjectDeletedEvent((int) $calendarId, $subscriptionRow, [], $data)); |
|
| 1276 | 1276 | $this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::deleteCachedCalendarObject', new GenericEvent( |
| 1277 | 1277 | '\OCA\DAV\CalDAV\CalDavBackend::deleteCachedCalendarObject', |
| 1278 | 1278 | [ |
@@ -1345,7 +1345,7 @@ discard block |
||
| 1345 | 1345 | * @param int $calendarType |
| 1346 | 1346 | * @return array |
| 1347 | 1347 | */ |
| 1348 | - public function calendarQuery($calendarId, array $filters, $calendarType=self::CALENDAR_TYPE_CALENDAR):array { |
|
| 1348 | + public function calendarQuery($calendarId, array $filters, $calendarType = self::CALENDAR_TYPE_CALENDAR):array { |
|
| 1349 | 1349 | $componentType = null; |
| 1350 | 1350 | $requirePostFilter = true; |
| 1351 | 1351 | $timeRange = null; |
@@ -1439,7 +1439,7 @@ discard block |
||
| 1439 | 1439 | * @param integer|null $offset |
| 1440 | 1440 | * @return array |
| 1441 | 1441 | */ |
| 1442 | - public function calendarSearch($principalUri, array $filters, $limit=null, $offset=null) { |
|
| 1442 | + public function calendarSearch($principalUri, array $filters, $limit = null, $offset = null) { |
|
| 1443 | 1443 | $calendars = $this->getCalendarsForUser($principalUri); |
| 1444 | 1444 | $ownCalendars = []; |
| 1445 | 1445 | $sharedCalendars = []; |
@@ -1544,7 +1544,7 @@ discard block |
||
| 1544 | 1544 | |
| 1545 | 1545 | $result = []; |
| 1546 | 1546 | while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
| 1547 | - $path = $uriMapper[$row['calendarid']] . '/' . $row['uri']; |
|
| 1547 | + $path = $uriMapper[$row['calendarid']].'/'.$row['uri']; |
|
| 1548 | 1548 | if (!in_array($path, $result)) { |
| 1549 | 1549 | $result[] = $path; |
| 1550 | 1550 | } |
@@ -1592,8 +1592,8 @@ discard block |
||
| 1592 | 1592 | |
| 1593 | 1593 | if ($pattern !== '') { |
| 1594 | 1594 | $innerQuery->andWhere($innerQuery->expr()->iLike('op.value', |
| 1595 | - $outerQuery->createNamedParameter('%' . |
|
| 1596 | - $this->db->escapeLikeParameter($pattern) . '%'))); |
|
| 1595 | + $outerQuery->createNamedParameter('%'. |
|
| 1596 | + $this->db->escapeLikeParameter($pattern).'%'))); |
|
| 1597 | 1597 | } |
| 1598 | 1598 | |
| 1599 | 1599 | $outerQuery->select('c.id', 'c.calendardata', 'c.componenttype', 'c.uid', 'c.uri') |
@@ -1632,7 +1632,7 @@ discard block |
||
| 1632 | 1632 | $result = $outerQuery->execute(); |
| 1633 | 1633 | $calendarObjects = $result->fetchAll(); |
| 1634 | 1634 | |
| 1635 | - return array_map(function ($o) { |
|
| 1635 | + return array_map(function($o) { |
|
| 1636 | 1636 | $calendarData = Reader::read($o['calendardata']); |
| 1637 | 1637 | $comps = $calendarData->getComponents(); |
| 1638 | 1638 | $objects = []; |
@@ -1650,10 +1650,10 @@ discard block |
||
| 1650 | 1650 | 'type' => $o['componenttype'], |
| 1651 | 1651 | 'uid' => $o['uid'], |
| 1652 | 1652 | 'uri' => $o['uri'], |
| 1653 | - 'objects' => array_map(function ($c) { |
|
| 1653 | + 'objects' => array_map(function($c) { |
|
| 1654 | 1654 | return $this->transformSearchData($c); |
| 1655 | 1655 | }, $objects), |
| 1656 | - 'timezones' => array_map(function ($c) { |
|
| 1656 | + 'timezones' => array_map(function($c) { |
|
| 1657 | 1657 | return $this->transformSearchData($c); |
| 1658 | 1658 | }, $timezones), |
| 1659 | 1659 | ]; |
@@ -1669,7 +1669,7 @@ discard block |
||
| 1669 | 1669 | /** @var Component[] $subComponents */ |
| 1670 | 1670 | $subComponents = $comp->getComponents(); |
| 1671 | 1671 | /** @var Property[] $properties */ |
| 1672 | - $properties = array_filter($comp->children(), function ($c) { |
|
| 1672 | + $properties = array_filter($comp->children(), function($c) { |
|
| 1673 | 1673 | return $c instanceof Property; |
| 1674 | 1674 | }); |
| 1675 | 1675 | $validationRules = $comp->getValidationRules(); |
@@ -1747,7 +1747,7 @@ discard block |
||
| 1747 | 1747 | $subscriptions = $this->getSubscriptionsForUser($principalUri); |
| 1748 | 1748 | foreach ($calendars as $calendar) { |
| 1749 | 1749 | $calendarAnd = $calendarObjectIdQuery->expr()->andX(); |
| 1750 | - $calendarAnd->add($calendarObjectIdQuery->expr()->eq('cob.calendarid', $calendarObjectIdQuery->createNamedParameter((int)$calendar['id']))); |
|
| 1750 | + $calendarAnd->add($calendarObjectIdQuery->expr()->eq('cob.calendarid', $calendarObjectIdQuery->createNamedParameter((int) $calendar['id']))); |
|
| 1751 | 1751 | $calendarAnd->add($calendarObjectIdQuery->expr()->eq('cob.calendartype', $calendarObjectIdQuery->createNamedParameter(self::CALENDAR_TYPE_CALENDAR))); |
| 1752 | 1752 | |
| 1753 | 1753 | // If it's shared, limit search to public events |
@@ -1759,7 +1759,7 @@ discard block |
||
| 1759 | 1759 | } |
| 1760 | 1760 | foreach ($subscriptions as $subscription) { |
| 1761 | 1761 | $subscriptionAnd = $calendarObjectIdQuery->expr()->andX(); |
| 1762 | - $subscriptionAnd->add($calendarObjectIdQuery->expr()->eq('cob.calendarid', $calendarObjectIdQuery->createNamedParameter((int)$subscription['id']))); |
|
| 1762 | + $subscriptionAnd->add($calendarObjectIdQuery->expr()->eq('cob.calendarid', $calendarObjectIdQuery->createNamedParameter((int) $subscription['id']))); |
|
| 1763 | 1763 | $subscriptionAnd->add($calendarObjectIdQuery->expr()->eq('cob.calendartype', $calendarObjectIdQuery->createNamedParameter(self::CALENDAR_TYPE_SUBSCRIPTION))); |
| 1764 | 1764 | |
| 1765 | 1765 | // If it's shared, limit search to public events |
@@ -1803,7 +1803,7 @@ discard block |
||
| 1803 | 1803 | if (!$escapePattern) { |
| 1804 | 1804 | $calendarObjectIdQuery->andWhere($calendarObjectIdQuery->expr()->ilike('cob.value', $calendarObjectIdQuery->createNamedParameter($pattern))); |
| 1805 | 1805 | } else { |
| 1806 | - $calendarObjectIdQuery->andWhere($calendarObjectIdQuery->expr()->ilike('cob.value', $calendarObjectIdQuery->createNamedParameter('%' . $this->db->escapeLikeParameter($pattern) . '%'))); |
|
| 1806 | + $calendarObjectIdQuery->andWhere($calendarObjectIdQuery->expr()->ilike('cob.value', $calendarObjectIdQuery->createNamedParameter('%'.$this->db->escapeLikeParameter($pattern).'%'))); |
|
| 1807 | 1807 | } |
| 1808 | 1808 | } |
| 1809 | 1809 | |
@@ -1817,7 +1817,7 @@ discard block |
||
| 1817 | 1817 | $result = $calendarObjectIdQuery->execute(); |
| 1818 | 1818 | $matches = $result->fetchAll(); |
| 1819 | 1819 | $result->closeCursor(); |
| 1820 | - $matches = array_map(static function (array $match):int { |
|
| 1820 | + $matches = array_map(static function(array $match):int { |
|
| 1821 | 1821 | return (int) $match['objectid']; |
| 1822 | 1822 | }, $matches); |
| 1823 | 1823 | |
@@ -1830,9 +1830,9 @@ discard block |
||
| 1830 | 1830 | $calendarObjects = $result->fetchAll(); |
| 1831 | 1831 | $result->closeCursor(); |
| 1832 | 1832 | |
| 1833 | - return array_map(function (array $array): array { |
|
| 1834 | - $array['calendarid'] = (int)$array['calendarid']; |
|
| 1835 | - $array['calendartype'] = (int)$array['calendartype']; |
|
| 1833 | + return array_map(function(array $array): array { |
|
| 1834 | + $array['calendarid'] = (int) $array['calendarid']; |
|
| 1835 | + $array['calendartype'] = (int) $array['calendartype']; |
|
| 1836 | 1836 | $array['calendardata'] = $this->readBlob($array['calendardata']); |
| 1837 | 1837 | |
| 1838 | 1838 | return $array; |
@@ -1869,7 +1869,7 @@ discard block |
||
| 1869 | 1869 | $stmt = $query->execute(); |
| 1870 | 1870 | |
| 1871 | 1871 | if ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
| 1872 | - return $row['calendaruri'] . '/' . $row['objecturi']; |
|
| 1872 | + return $row['calendaruri'].'/'.$row['objecturi']; |
|
| 1873 | 1873 | } |
| 1874 | 1874 | |
| 1875 | 1875 | return null; |
@@ -1932,10 +1932,10 @@ discard block |
||
| 1932 | 1932 | * @param int $calendarType |
| 1933 | 1933 | * @return array |
| 1934 | 1934 | */ |
| 1935 | - public function getChangesForCalendar($calendarId, $syncToken, $syncLevel, $limit = null, $calendarType=self::CALENDAR_TYPE_CALENDAR) { |
|
| 1935 | + public function getChangesForCalendar($calendarId, $syncToken, $syncLevel, $limit = null, $calendarType = self::CALENDAR_TYPE_CALENDAR) { |
|
| 1936 | 1936 | // Current synctoken |
| 1937 | 1937 | $stmt = $this->db->prepare('SELECT `synctoken` FROM `*PREFIX*calendars` WHERE `id` = ?'); |
| 1938 | - $stmt->execute([ $calendarId ]); |
|
| 1938 | + $stmt->execute([$calendarId]); |
|
| 1939 | 1939 | $currentToken = $stmt->fetchColumn(0); |
| 1940 | 1940 | |
| 1941 | 1941 | if (is_null($currentToken)) { |
@@ -1951,8 +1951,8 @@ discard block |
||
| 1951 | 1951 | |
| 1952 | 1952 | if ($syncToken) { |
| 1953 | 1953 | $query = "SELECT `uri`, `operation` FROM `*PREFIX*calendarchanges` WHERE `synctoken` >= ? AND `synctoken` < ? AND `calendarid` = ? AND `calendartype` = ? ORDER BY `synctoken`"; |
| 1954 | - if ($limit>0) { |
|
| 1955 | - $query.= " LIMIT " . (int)$limit; |
|
| 1954 | + if ($limit > 0) { |
|
| 1955 | + $query .= " LIMIT ".(int) $limit; |
|
| 1956 | 1956 | } |
| 1957 | 1957 | |
| 1958 | 1958 | // Fetching all changes |
@@ -2037,7 +2037,7 @@ discard block |
||
| 2037 | 2037 | ->from('calendarsubscriptions') |
| 2038 | 2038 | ->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri))) |
| 2039 | 2039 | ->orderBy('calendarorder', 'asc'); |
| 2040 | - $stmt =$query->execute(); |
|
| 2040 | + $stmt = $query->execute(); |
|
| 2041 | 2041 | |
| 2042 | 2042 | $subscriptions = []; |
| 2043 | 2043 | while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
@@ -2048,8 +2048,8 @@ discard block |
||
| 2048 | 2048 | 'source' => $row['source'], |
| 2049 | 2049 | 'lastmodified' => $row['lastmodified'], |
| 2050 | 2050 | |
| 2051 | - '{' . Plugin::NS_CALDAV . '}supported-calendar-component-set' => new SupportedCalendarComponentSet(['VTODO', 'VEVENT']), |
|
| 2052 | - '{http://sabredav.org/ns}sync-token' => $row['synctoken']?$row['synctoken']:'0', |
|
| 2051 | + '{'.Plugin::NS_CALDAV.'}supported-calendar-component-set' => new SupportedCalendarComponentSet(['VTODO', 'VEVENT']), |
|
| 2052 | + '{http://sabredav.org/ns}sync-token' => $row['synctoken'] ? $row['synctoken'] : '0', |
|
| 2053 | 2053 | ]; |
| 2054 | 2054 | |
| 2055 | 2055 | foreach ($this->subscriptionPropertyMap as $xmlName=>$dbName) { |
@@ -2113,7 +2113,7 @@ discard block |
||
| 2113 | 2113 | $subscriptionId = $this->db->lastInsertId('*PREFIX*calendarsubscriptions'); |
| 2114 | 2114 | |
| 2115 | 2115 | $subscriptionRow = $this->getSubscriptionById($subscriptionId); |
| 2116 | - $this->dispatcher->dispatchTyped(new SubscriptionCreatedEvent((int)$subscriptionId, $subscriptionRow)); |
|
| 2116 | + $this->dispatcher->dispatchTyped(new SubscriptionCreatedEvent((int) $subscriptionId, $subscriptionRow)); |
|
| 2117 | 2117 | $this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::createSubscription', new GenericEvent( |
| 2118 | 2118 | '\OCA\DAV\CalDAV\CalDavBackend::createSubscription', |
| 2119 | 2119 | [ |
@@ -2144,7 +2144,7 @@ discard block |
||
| 2144 | 2144 | $supportedProperties = array_keys($this->subscriptionPropertyMap); |
| 2145 | 2145 | $supportedProperties[] = '{http://calendarserver.org/ns/}source'; |
| 2146 | 2146 | |
| 2147 | - $propPatch->handle($supportedProperties, function ($mutations) use ($subscriptionId) { |
|
| 2147 | + $propPatch->handle($supportedProperties, function($mutations) use ($subscriptionId) { |
|
| 2148 | 2148 | $newValues = []; |
| 2149 | 2149 | |
| 2150 | 2150 | foreach ($mutations as $propertyName=>$propertyValue) { |
@@ -2166,7 +2166,7 @@ discard block |
||
| 2166 | 2166 | ->execute(); |
| 2167 | 2167 | |
| 2168 | 2168 | $subscriptionRow = $this->getSubscriptionById($subscriptionId); |
| 2169 | - $this->dispatcher->dispatchTyped(new SubscriptionUpdatedEvent((int)$subscriptionId, $subscriptionRow, [], $mutations)); |
|
| 2169 | + $this->dispatcher->dispatchTyped(new SubscriptionUpdatedEvent((int) $subscriptionId, $subscriptionRow, [], $mutations)); |
|
| 2170 | 2170 | $this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::updateSubscription', new GenericEvent( |
| 2171 | 2171 | '\OCA\DAV\CalDAV\CalDavBackend::updateSubscription', |
| 2172 | 2172 | [ |
@@ -2217,7 +2217,7 @@ discard block |
||
| 2217 | 2217 | ->execute(); |
| 2218 | 2218 | |
| 2219 | 2219 | if ($subscriptionRow) { |
| 2220 | - $this->dispatcher->dispatchTyped(new SubscriptionDeletedEvent((int)$subscriptionId, $subscriptionRow, [])); |
|
| 2220 | + $this->dispatcher->dispatchTyped(new SubscriptionDeletedEvent((int) $subscriptionId, $subscriptionRow, [])); |
|
| 2221 | 2221 | } |
| 2222 | 2222 | } |
| 2223 | 2223 | |
@@ -2255,8 +2255,8 @@ discard block |
||
| 2255 | 2255 | 'uri' => $row['uri'], |
| 2256 | 2256 | 'calendardata' => $row['calendardata'], |
| 2257 | 2257 | 'lastmodified' => $row['lastmodified'], |
| 2258 | - 'etag' => '"' . $row['etag'] . '"', |
|
| 2259 | - 'size' => (int)$row['size'], |
|
| 2258 | + 'etag' => '"'.$row['etag'].'"', |
|
| 2259 | + 'size' => (int) $row['size'], |
|
| 2260 | 2260 | ]; |
| 2261 | 2261 | } |
| 2262 | 2262 | |
@@ -2284,8 +2284,8 @@ discard block |
||
| 2284 | 2284 | 'calendardata' => $row['calendardata'], |
| 2285 | 2285 | 'uri' => $row['uri'], |
| 2286 | 2286 | 'lastmodified' => $row['lastmodified'], |
| 2287 | - 'etag' => '"' . $row['etag'] . '"', |
|
| 2288 | - 'size' => (int)$row['size'], |
|
| 2287 | + 'etag' => '"'.$row['etag'].'"', |
|
| 2288 | + 'size' => (int) $row['size'], |
|
| 2289 | 2289 | ]; |
| 2290 | 2290 | } |
| 2291 | 2291 | |
@@ -2338,14 +2338,14 @@ discard block |
||
| 2338 | 2338 | * @param int $calendarType |
| 2339 | 2339 | * @return void |
| 2340 | 2340 | */ |
| 2341 | - protected function addChange($calendarId, $objectUri, $operation, $calendarType=self::CALENDAR_TYPE_CALENDAR) { |
|
| 2342 | - $table = $calendarType === self::CALENDAR_TYPE_CALENDAR ? 'calendars': 'calendarsubscriptions'; |
|
| 2341 | + protected function addChange($calendarId, $objectUri, $operation, $calendarType = self::CALENDAR_TYPE_CALENDAR) { |
|
| 2342 | + $table = $calendarType === self::CALENDAR_TYPE_CALENDAR ? 'calendars' : 'calendarsubscriptions'; |
|
| 2343 | 2343 | |
| 2344 | 2344 | $query = $this->db->getQueryBuilder(); |
| 2345 | 2345 | $query->select('synctoken') |
| 2346 | 2346 | ->from($table) |
| 2347 | 2347 | ->where($query->expr()->eq('id', $query->createNamedParameter($calendarId))); |
| 2348 | - $syncToken = (int)$query->execute()->fetchColumn(); |
|
| 2348 | + $syncToken = (int) $query->execute()->fetchColumn(); |
|
| 2349 | 2349 | |
| 2350 | 2350 | $query = $this->db->getQueryBuilder(); |
| 2351 | 2351 | $query->insert('calendarchanges') |
@@ -2388,9 +2388,9 @@ discard block |
||
| 2388 | 2388 | $uid = null; |
| 2389 | 2389 | $classification = self::CLASSIFICATION_PUBLIC; |
| 2390 | 2390 | foreach ($vObject->getComponents() as $component) { |
| 2391 | - if ($component->name!=='VTIMEZONE') { |
|
| 2391 | + if ($component->name !== 'VTIMEZONE') { |
|
| 2392 | 2392 | $componentType = $component->name; |
| 2393 | - $uid = (string)$component->UID; |
|
| 2393 | + $uid = (string) $component->UID; |
|
| 2394 | 2394 | break; |
| 2395 | 2395 | } |
| 2396 | 2396 | } |
@@ -2415,7 +2415,7 @@ discard block |
||
| 2415 | 2415 | $lastOccurrence = $firstOccurrence; |
| 2416 | 2416 | } |
| 2417 | 2417 | } else { |
| 2418 | - $it = new EventIterator($vObject, (string)$component->UID); |
|
| 2418 | + $it = new EventIterator($vObject, (string) $component->UID); |
|
| 2419 | 2419 | $maxDate = new DateTime(self::MAX_DATE); |
| 2420 | 2420 | if ($it->isInfinite()) { |
| 2421 | 2421 | $lastOccurrence = $maxDate->getTimestamp(); |
@@ -2485,7 +2485,7 @@ discard block |
||
| 2485 | 2485 | ])); |
| 2486 | 2486 | $this->calendarSharingBackend->updateShares($shareable, $add, $remove); |
| 2487 | 2487 | |
| 2488 | - $this->dispatcher->dispatchTyped(new CalendarShareUpdatedEvent((int)$calendarId, $calendarRow, $oldShares, $add, $remove)); |
|
| 2488 | + $this->dispatcher->dispatchTyped(new CalendarShareUpdatedEvent((int) $calendarId, $calendarRow, $oldShares, $add, $remove)); |
|
| 2489 | 2489 | } |
| 2490 | 2490 | |
| 2491 | 2491 | /** |
@@ -2493,7 +2493,7 @@ discard block |
||
| 2493 | 2493 | * @param int $calendarType |
| 2494 | 2494 | * @return array |
| 2495 | 2495 | */ |
| 2496 | - public function getShares($resourceId, $calendarType=self::CALENDAR_TYPE_CALENDAR) { |
|
| 2496 | + public function getShares($resourceId, $calendarType = self::CALENDAR_TYPE_CALENDAR) { |
|
| 2497 | 2497 | return $this->calendarSharingBackend->getShares($resourceId); |
| 2498 | 2498 | } |
| 2499 | 2499 | |
@@ -2526,7 +2526,7 @@ discard block |
||
| 2526 | 2526 | ]); |
| 2527 | 2527 | $query->execute(); |
| 2528 | 2528 | |
| 2529 | - $this->dispatcher->dispatchTyped(new CalendarPublishedEvent((int)$calendarId, $calendarData, $publicUri)); |
|
| 2529 | + $this->dispatcher->dispatchTyped(new CalendarPublishedEvent((int) $calendarId, $calendarData, $publicUri)); |
|
| 2530 | 2530 | return $publicUri; |
| 2531 | 2531 | } |
| 2532 | 2532 | $query->delete('dav_shares') |
@@ -2534,7 +2534,7 @@ discard block |
||
| 2534 | 2534 | ->andWhere($query->expr()->eq('access', $query->createNamedParameter(self::ACCESS_PUBLIC))); |
| 2535 | 2535 | $query->execute(); |
| 2536 | 2536 | |
| 2537 | - $this->dispatcher->dispatchTyped(new CalendarUnpublishedEvent((int)$calendarId, $calendarData)); |
|
| 2537 | + $this->dispatcher->dispatchTyped(new CalendarUnpublishedEvent((int) $calendarId, $calendarData)); |
|
| 2538 | 2538 | return null; |
| 2539 | 2539 | } |
| 2540 | 2540 | |
@@ -2574,7 +2574,7 @@ discard block |
||
| 2574 | 2574 | * @param string $calendarData |
| 2575 | 2575 | * @param int $calendarType |
| 2576 | 2576 | */ |
| 2577 | - public function updateProperties($calendarId, $objectUri, $calendarData, $calendarType=self::CALENDAR_TYPE_CALENDAR) { |
|
| 2577 | + public function updateProperties($calendarId, $objectUri, $calendarData, $calendarType = self::CALENDAR_TYPE_CALENDAR) { |
|
| 2578 | 2578 | $objectId = $this->getCalendarObjectId($calendarId, $objectUri, $calendarType); |
| 2579 | 2579 | |
| 2580 | 2580 | try { |
@@ -2755,10 +2755,10 @@ discard block |
||
| 2755 | 2755 | $result->closeCursor(); |
| 2756 | 2756 | |
| 2757 | 2757 | if (!isset($objectIds['id'])) { |
| 2758 | - throw new \InvalidArgumentException('Calendarobject does not exists: ' . $uri); |
|
| 2758 | + throw new \InvalidArgumentException('Calendarobject does not exists: '.$uri); |
|
| 2759 | 2759 | } |
| 2760 | 2760 | |
| 2761 | - return (int)$objectIds['id']; |
|
| 2761 | + return (int) $objectIds['id']; |
|
| 2762 | 2762 | } |
| 2763 | 2763 | |
| 2764 | 2764 | /** |
@@ -2785,8 +2785,8 @@ discard block |
||
| 2785 | 2785 | * @param $calendarInfo |
| 2786 | 2786 | */ |
| 2787 | 2787 | private function addOwnerPrincipal(&$calendarInfo) { |
| 2788 | - $ownerPrincipalKey = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}owner-principal'; |
|
| 2789 | - $displaynameKey = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD . '}owner-displayname'; |
|
| 2788 | + $ownerPrincipalKey = '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}owner-principal'; |
|
| 2789 | + $displaynameKey = '{'.\OCA\DAV\DAV\Sharing\Plugin::NS_NEXTCLOUD.'}owner-displayname'; |
|
| 2790 | 2790 | if (isset($calendarInfo[$ownerPrincipalKey])) { |
| 2791 | 2791 | $uri = $calendarInfo[$ownerPrincipalKey]; |
| 2792 | 2792 | } else { |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | */ |
| 72 | 72 | public function lockTable($tableName) { |
| 73 | 73 | $this->conn->beginTransaction(); |
| 74 | - $this->conn->executeUpdate('LOCK TABLE `' .$tableName . '` IN EXCLUSIVE MODE'); |
|
| 74 | + $this->conn->executeUpdate('LOCK TABLE `'.$tableName.'` IN EXCLUSIVE MODE'); |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | /** |
@@ -101,14 +101,14 @@ discard block |
||
| 101 | 101 | if (empty($compare)) { |
| 102 | 102 | $compare = array_keys($input); |
| 103 | 103 | } |
| 104 | - $query = 'INSERT INTO `' .$table . '` (`' |
|
| 105 | - . implode('`,`', array_keys($input)) . '`) SELECT ' |
|
| 106 | - . str_repeat('?,', count($input)-1).'? ' // Is there a prettier alternative? |
|
| 107 | - . 'FROM `' . $table . '` WHERE '; |
|
| 104 | + $query = 'INSERT INTO `'.$table.'` (`' |
|
| 105 | + . implode('`,`', array_keys($input)).'`) SELECT ' |
|
| 106 | + . str_repeat('?,', count($input) - 1).'? ' // Is there a prettier alternative? |
|
| 107 | + . 'FROM `'.$table.'` WHERE '; |
|
| 108 | 108 | |
| 109 | 109 | $inserts = array_values($input); |
| 110 | 110 | foreach ($compare as $key) { |
| 111 | - $query .= '`' . $key . '`'; |
|
| 111 | + $query .= '`'.$key.'`'; |
|
| 112 | 112 | if (is_null($input[$key])) { |
| 113 | 113 | $query .= ' IS NULL AND '; |
| 114 | 114 | } else { |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | } |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | - public function insertIgnoreConflict(string $table,array $values) : int { |
|
| 133 | + public function insertIgnoreConflict(string $table, array $values) : int { |
|
| 134 | 134 | try { |
| 135 | 135 | $builder = $this->conn->getQueryBuilder(); |
| 136 | 136 | $builder->insert($table); |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | return $statement; |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | - public function insertIgnoreConflict(string $table,array $values) : int { |
|
| 44 | + public function insertIgnoreConflict(string $table, array $values) : int { |
|
| 45 | 45 | if ($this->isPre9_5CompatMode() === true) { |
| 46 | 46 | return parent::insertIgnoreConflict($table, $values); |
| 47 | 47 | } |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | foreach ($values as $key => $value) { |
| 54 | 54 | $builder->setValue($key, $builder->createNamedParameter($value)); |
| 55 | 55 | } |
| 56 | - $queryString = $builder->getSQL() . ' ON CONFLICT DO NOTHING'; |
|
| 56 | + $queryString = $builder->getSQL().' ON CONFLICT DO NOTHING'; |
|
| 57 | 57 | return $this->conn->executeUpdate($queryString, $builder->getParameters(), $builder->getParameterTypes()); |
| 58 | 58 | } |
| 59 | 59 | |