@@ -24,7 +24,7 @@ |
||
24 | 24 | } |
25 | 25 | |
26 | 26 | public function getKey(): string { |
27 | - return (string)$this->calendarInfo['id']; |
|
27 | + return (string) $this->calendarInfo['id']; |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | public function getUri(): string { |
@@ -45,7 +45,7 @@ |
||
45 | 45 | ): IResponse { |
46 | 46 | $sharedWithEncoded = base64_encode($shareWith->getId()); |
47 | 47 | $relativeCalendarUrl = "remote-calendars/$sharedWithEncoded/{$calendarName}_shared_by_$calendarOwner"; |
48 | - $calendarUrl = $this->url->linkTo('', 'remote.php') . "/dav/$relativeCalendarUrl"; |
|
48 | + $calendarUrl = $this->url->linkTo('', 'remote.php')."/dav/$relativeCalendarUrl"; |
|
49 | 49 | $calendarUrl = $this->url->getAbsoluteURL($calendarUrl); |
50 | 50 | |
51 | 51 | $notification = $this->federationFactory->getCloudFederationNotification(); |
@@ -60,7 +60,7 @@ |
||
60 | 60 | return 0; |
61 | 61 | } |
62 | 62 | |
63 | - $newSyncToken = (int)$matches[1]; |
|
63 | + $newSyncToken = (int) $matches[1]; |
|
64 | 64 | if ($newSyncToken !== $calendar->getSyncToken()) { |
65 | 65 | $this->federatedCalendarMapper->updateSyncTokenAndTime( |
66 | 66 | $calendar->getId(), |
@@ -159,7 +159,7 @@ |
||
159 | 159 | $qb->select($qb->func()->count('*')) |
160 | 160 | ->from(self::TABLE_NAME); |
161 | 161 | $result = $qb->executeQuery(); |
162 | - $count = (int)$result->fetchOne(); |
|
162 | + $count = (int) $result->fetchOne(); |
|
163 | 163 | $result->closeCursor(); |
164 | 164 | return $count; |
165 | 165 | } |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | string $username, |
36 | 36 | string $password, |
37 | 37 | ): ?string { |
38 | - $remoteUserPrincipalUri = RemoteUserPrincipalBackend::PRINCIPAL_PREFIX . "/$username"; |
|
38 | + $remoteUserPrincipalUri = RemoteUserPrincipalBackend::PRINCIPAL_PREFIX."/$username"; |
|
39 | 39 | [, $remoteUserPrincipalId] = \Sabre\Uri\split($remoteUserPrincipalUri); |
40 | 40 | |
41 | 41 | $rows = $this->sharingMapper->getSharedCalendarsForRemoteUser( |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | foreach ($rows as $row) { |
48 | 48 | $ownerPrincipalUri = $row['principaluri']; |
49 | 49 | [, $ownerUserId] = \Sabre\Uri\split($ownerPrincipalUri); |
50 | - $shareUri = $row['uri'] . '_shared_by_' . $ownerUserId; |
|
50 | + $shareUri = $row['uri'].'_shared_by_'.$ownerUserId; |
|
51 | 51 | if (str_starts_with($requestPath, "remote-calendars/$remoteUserPrincipalId/$shareUri")) { |
52 | 52 | // Yes? -> return early |
53 | 53 | return $remoteUserPrincipalUri; |
@@ -34,11 +34,11 @@ discard block |
||
34 | 34 | $federatedCalendarInfos = $this->calDavBackend->getFederatedCalendarsForUser($principalUri); |
35 | 35 | |
36 | 36 | if (!empty($calendarUris)) { |
37 | - $calendarInfos = array_filter($calendarInfos, function ($calendar) use ($calendarUris) { |
|
37 | + $calendarInfos = array_filter($calendarInfos, function($calendar) use ($calendarUris) { |
|
38 | 38 | return in_array($calendar['uri'], $calendarUris); |
39 | 39 | }); |
40 | 40 | |
41 | - $federatedCalendarInfos = array_filter($federatedCalendarInfos, function ($federatedCalendar) use ($calendarUris) { |
|
41 | + $federatedCalendarInfos = array_filter($federatedCalendarInfos, function($federatedCalendar) use ($calendarUris) { |
|
42 | 42 | return in_array($federatedCalendar['uri'], $calendarUris); |
43 | 43 | }); |
44 | 44 | } |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | |
49 | 49 | foreach ($calendarInfos as $calendarInfo) { |
50 | 50 | $user = str_replace('principals/users/', '', $calendarInfo['principaluri']); |
51 | - $path = 'calendars/' . $user . '/' . $calendarInfo['uri']; |
|
51 | + $path = 'calendars/'.$user.'/'.$calendarInfo['uri']; |
|
52 | 52 | |
53 | 53 | $calendarInfo = array_merge($calendarInfo, $additionalProperties[$path] ?? []); |
54 | 54 | |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | ); |
66 | 66 | foreach ($federatedCalendarInfos as $calendarInfo) { |
67 | 67 | $user = str_replace('principals/users/', '', $calendarInfo['principaluri']); |
68 | - $path = 'calendars/' . $user . '/' . $calendarInfo['uri']; |
|
68 | + $path = 'calendars/'.$user.'/'.$calendarInfo['uri']; |
|
69 | 69 | if (isset($additionalFederatedProps[$path])) { |
70 | 70 | $calendarInfo = array_merge($calendarInfo, $additionalProperties[$path]); |
71 | 71 | } |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | if (!array_key_exists($user, $calendars)) { |
92 | 92 | $calendars[$user] = []; |
93 | 93 | } |
94 | - $calendars[$user][] = 'calendars/' . $user . '/' . $uri['uri']; |
|
94 | + $calendars[$user][] = 'calendars/'.$user.'/'.$uri['uri']; |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | $properties = $this->propertyMapper->findPropertiesByPathsAndUsers($calendars); |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | } |
105 | 105 | |
106 | 106 | $list[$property->getPropertypath()][$property->getPropertyname()] = match ($property->getPropertyname()) { |
107 | - '{http://owncloud.org/ns}calendar-enabled' => (bool)$property->getPropertyvalue(), |
|
107 | + '{http://owncloud.org/ns}calendar-enabled' => (bool) $property->getPropertyvalue(), |
|
108 | 108 | default => $property->getPropertyvalue() |
109 | 109 | }; |
110 | 110 | } |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | return; |
42 | 42 | } |
43 | 43 | |
44 | - $remoteUserShares = array_filter($event->getShares(), function (array $share): bool { |
|
44 | + $remoteUserShares = array_filter($event->getShares(), function(array $share): bool { |
|
45 | 45 | $sharedWithPrincipal = $share['{http://owncloud.org/ns}principal'] ?? ''; |
46 | 46 | [$prefix] = \Sabre\Uri\split($sharedWithPrincipal); |
47 | 47 | return $prefix === RemoteUserPrincipalBackend::PRINCIPAL_PREFIX; |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | ); |
59 | 59 | $remoteShares = $this->sharingMapper->getSharesByPrincipalsAndResource( |
60 | 60 | $remoteUserPrincipals, |
61 | - (int)$calendarInfo['id'], |
|
61 | + (int) $calendarInfo['id'], |
|
62 | 62 | 'calendar', |
63 | 63 | ); |
64 | 64 |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | * @return list<array{href: string, commonName: string, status: int, readOnly: bool, '{http://owncloud.org/ns}principal': string, '{http://owncloud.org/ns}group-share': bool}> |
132 | 132 | */ |
133 | 133 | public function getShares(int $resourceId): array { |
134 | - $cached = $this->shareCache->get((string)$resourceId); |
|
134 | + $cached = $this->shareCache->get((string) $resourceId); |
|
135 | 135 | if ($cached) { |
136 | 136 | return $cached; |
137 | 137 | } |
@@ -142,20 +142,20 @@ discard block |
||
142 | 142 | $p = $this->getPrincipalByPath($row['principaluri']); |
143 | 143 | $shares[] = [ |
144 | 144 | 'href' => "principal:{$row['principaluri']}", |
145 | - 'commonName' => isset($p['{DAV:}displayname']) ? (string)$p['{DAV:}displayname'] : '', |
|
145 | + 'commonName' => isset($p['{DAV:}displayname']) ? (string) $p['{DAV:}displayname'] : '', |
|
146 | 146 | 'status' => 1, |
147 | - 'readOnly' => (int)$row['access'] === Backend::ACCESS_READ, |
|
148 | - '{http://owncloud.org/ns}principal' => (string)$row['principaluri'], |
|
147 | + 'readOnly' => (int) $row['access'] === Backend::ACCESS_READ, |
|
148 | + '{http://owncloud.org/ns}principal' => (string) $row['principaluri'], |
|
149 | 149 | '{http://owncloud.org/ns}group-share' => isset($p['uri']) && (str_starts_with($p['uri'], 'principals/groups') || str_starts_with($p['uri'], 'principals/circles')), |
150 | 150 | ]; |
151 | 151 | } |
152 | - $this->shareCache->set((string)$resourceId, $shares); |
|
152 | + $this->shareCache->set((string) $resourceId, $shares); |
|
153 | 153 | return $shares; |
154 | 154 | } |
155 | 155 | |
156 | 156 | public function preloadShares(array $resourceIds): void { |
157 | - $resourceIds = array_filter($resourceIds, function (int $resourceId) { |
|
158 | - return empty($this->shareCache->get((string)$resourceId)); |
|
157 | + $resourceIds = array_filter($resourceIds, function(int $resourceId) { |
|
158 | + return empty($this->shareCache->get((string) $resourceId)); |
|
159 | 159 | }); |
160 | 160 | if (empty($resourceIds)) { |
161 | 161 | return; |
@@ -164,17 +164,17 @@ discard block |
||
164 | 164 | $rows = $this->service->getSharesForIds($resourceIds); |
165 | 165 | $sharesByResource = array_fill_keys($resourceIds, []); |
166 | 166 | foreach ($rows as $row) { |
167 | - $resourceId = (int)$row['resourceid']; |
|
167 | + $resourceId = (int) $row['resourceid']; |
|
168 | 168 | $p = $this->getPrincipalByPath($row['principaluri']); |
169 | 169 | $sharesByResource[$resourceId][] = [ |
170 | 170 | 'href' => "principal:{$row['principaluri']}", |
171 | - 'commonName' => isset($p['{DAV:}displayname']) ? (string)$p['{DAV:}displayname'] : '', |
|
171 | + 'commonName' => isset($p['{DAV:}displayname']) ? (string) $p['{DAV:}displayname'] : '', |
|
172 | 172 | 'status' => 1, |
173 | - 'readOnly' => (int)$row['access'] === self::ACCESS_READ, |
|
174 | - '{http://owncloud.org/ns}principal' => (string)$row['principaluri'], |
|
173 | + 'readOnly' => (int) $row['access'] === self::ACCESS_READ, |
|
174 | + '{http://owncloud.org/ns}principal' => (string) $row['principaluri'], |
|
175 | 175 | '{http://owncloud.org/ns}group-share' => isset($p['uri']) && str_starts_with($p['uri'], 'principals/groups') |
176 | 176 | ]; |
177 | - $this->shareCache->set((string)$resourceId, $sharesByResource[$resourceId]); |
|
177 | + $this->shareCache->set((string) $resourceId, $sharesByResource[$resourceId]); |
|
178 | 178 | } |
179 | 179 | } |
180 | 180 | |
@@ -190,21 +190,21 @@ discard block |
||
190 | 190 | foreach ($shares as $share) { |
191 | 191 | $acl[] = [ |
192 | 192 | 'privilege' => '{DAV:}read', |
193 | - 'principal' => $share['{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}principal'], |
|
193 | + 'principal' => $share['{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}principal'], |
|
194 | 194 | 'protected' => true, |
195 | 195 | ]; |
196 | 196 | if (!$share['readOnly']) { |
197 | 197 | $acl[] = [ |
198 | 198 | 'privilege' => '{DAV:}write', |
199 | - 'principal' => $share['{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}principal'], |
|
199 | + 'principal' => $share['{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}principal'], |
|
200 | 200 | 'protected' => true, |
201 | 201 | ]; |
202 | - } elseif (in_array($this->service->getResourceType(), ['calendar','addressbook'])) { |
|
202 | + } elseif (in_array($this->service->getResourceType(), ['calendar', 'addressbook'])) { |
|
203 | 203 | // Allow changing the properties of read only calendars, |
204 | 204 | // so users can change the visibility. |
205 | 205 | $acl[] = [ |
206 | 206 | 'privilege' => '{DAV:}write-properties', |
207 | - 'principal' => $share['{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}principal'], |
|
207 | + 'principal' => $share['{'.\OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD.'}principal'], |
|
208 | 208 | 'protected' => true, |
209 | 209 | ]; |
210 | 210 | } |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | if ($ex->getCode() === Http::STATUS_UNAUTHORIZED) { |
60 | 60 | // remote server revoked access to the address book, remove it |
61 | 61 | $this->backend->deleteAddressBook($addressBookId); |
62 | - $this->logger->error('Authorization failed, remove address book: ' . $url, ['app' => 'dav']); |
|
62 | + $this->logger->error('Authorization failed, remove address book: '.$url, ['app' => 'dav']); |
|
63 | 63 | throw $ex; |
64 | 64 | } |
65 | 65 | $this->logger->error('Client exception:', ['app' => 'dav', 'exception' => $ex]); |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | if (isset($status[200])) { |
74 | 74 | $absoluteUrl = $this->prepareUri($url, $resource); |
75 | 75 | $vCard = $this->download($absoluteUrl, $userName, $sharedSecret); |
76 | - $this->atomic(function () use ($addressBookId, $cardUri, $vCard): void { |
|
76 | + $this->atomic(function() use ($addressBookId, $cardUri, $vCard): void { |
|
77 | 77 | $existingCard = $this->backend->getCard($addressBookId, $cardUri); |
78 | 78 | if ($existingCard === false) { |
79 | 79 | $this->backend->createCard($addressBookId, $cardUri, $vCard); |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | */ |
98 | 98 | public function ensureSystemAddressBookExists(string $principal, string $uri, array $properties): ?array { |
99 | 99 | try { |
100 | - return $this->atomic(function () use ($principal, $uri, $properties) { |
|
100 | + return $this->atomic(function() use ($principal, $uri, $properties) { |
|
101 | 101 | $book = $this->backend->getAddressBooksByUri($principal, $uri); |
102 | 102 | if (!is_null($book)) { |
103 | 103 | return $book; |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | |
128 | 128 | public function ensureLocalSystemAddressBookExists(): ?array { |
129 | 129 | return $this->ensureSystemAddressBookExists('principals/system/system', 'system', [ |
130 | - '{' . Plugin::NS_CARDDAV . '}addressbook-description' => 'System addressbook which holds all users of this instance' |
|
130 | + '{'.Plugin::NS_CARDDAV.'}addressbook-description' => 'System addressbook which holds all users of this instance' |
|
131 | 131 | ]); |
132 | 132 | } |
133 | 133 | |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | |
141 | 141 | $cardId = self::getCardUri($user); |
142 | 142 | if ($user->isEnabled()) { |
143 | - $this->atomic(function () use ($addressBookId, $cardId, $user): void { |
|
143 | + $this->atomic(function() use ($addressBookId, $cardId, $user): void { |
|
144 | 144 | $card = $this->backend->getCard($addressBookId, $cardId); |
145 | 145 | if ($card === false) { |
146 | 146 | $vCard = $this->converter->createCardFromUser($user); |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | */ |
189 | 189 | public function syncInstance(?\Closure $progressCallback = null) { |
190 | 190 | $systemAddressBook = $this->getLocalSystemAddressBook(); |
191 | - $this->userManager->callForAllUsers(function ($user) use ($systemAddressBook, $progressCallback): void { |
|
191 | + $this->userManager->callForAllUsers(function($user) use ($systemAddressBook, $progressCallback): void { |
|
192 | 192 | $this->updateUser($user); |
193 | 193 | if (!is_null($progressCallback)) { |
194 | 194 | $progressCallback(); |
@@ -212,6 +212,6 @@ discard block |
||
212 | 212 | * @return string |
213 | 213 | */ |
214 | 214 | public static function getCardUri(IUser $user): string { |
215 | - return $user->getBackendClassName() . ':' . $user->getUID() . '.vcf'; |
|
215 | + return $user->getBackendClassName().':'.$user->getUID().'.vcf'; |
|
216 | 216 | } |
217 | 217 | } |