@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | * |
31 | 31 | */ |
32 | 32 | |
33 | -require_once __DIR__ . '/lib/versioncheck.php'; |
|
33 | +require_once __DIR__.'/lib/versioncheck.php'; |
|
34 | 34 | |
35 | 35 | use OCA\DAV\Connector\Sabre\ExceptionLoggerPlugin; |
36 | 36 | use Sabre\DAV\Exception\ServiceUnavailable; |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | // we shall not log on RemoteException |
59 | 59 | $server->addPlugin(new ExceptionLoggerPlugin('webdav', \OC::$server->getLogger())); |
60 | 60 | } |
61 | - $server->on('beforeMethod:*', function () use ($e) { |
|
61 | + $server->on('beforeMethod:*', function() use ($e) { |
|
62 | 62 | if ($e instanceof RemoteException) { |
63 | 63 | switch ($e->getCode()) { |
64 | 64 | case 503: |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | $server->exec(); |
75 | 75 | } else { |
76 | 76 | $statusCode = 500; |
77 | - if ($e instanceof \OC\ServiceUnavailableException ) { |
|
77 | + if ($e instanceof \OC\ServiceUnavailableException) { |
|
78 | 78 | $statusCode = 503; |
79 | 79 | } |
80 | 80 | if ($e instanceof RemoteException) { |
@@ -106,11 +106,11 @@ discard block |
||
106 | 106 | return $services[$service]; |
107 | 107 | } |
108 | 108 | |
109 | - return \OC::$server->getConfig()->getAppValue('core', 'remote_' . $service); |
|
109 | + return \OC::$server->getConfig()->getAppValue('core', 'remote_'.$service); |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | try { |
113 | - require_once __DIR__ . '/lib/base.php'; |
|
113 | + require_once __DIR__.'/lib/base.php'; |
|
114 | 114 | |
115 | 115 | // All resources served via the DAV endpoint should have the strictest possible |
116 | 116 | // policy. Exempted from this is the SabreDAV browser plugin which overwrites |
@@ -131,18 +131,18 @@ discard block |
||
131 | 131 | if (!$pos = strpos($pathInfo, '/', 1)) { |
132 | 132 | $pos = strlen($pathInfo); |
133 | 133 | } |
134 | - $service=substr($pathInfo, 1, $pos-1); |
|
134 | + $service = substr($pathInfo, 1, $pos - 1); |
|
135 | 135 | |
136 | 136 | $file = resolveService($service); |
137 | 137 | |
138 | - if(is_null($file)) { |
|
138 | + if (is_null($file)) { |
|
139 | 139 | throw new RemoteException('Path not found', 404); |
140 | 140 | } |
141 | 141 | |
142 | - $file=ltrim($file, '/'); |
|
142 | + $file = ltrim($file, '/'); |
|
143 | 143 | |
144 | - $parts=explode('/', $file, 2); |
|
145 | - $app=$parts[0]; |
|
144 | + $parts = explode('/', $file, 2); |
|
145 | + $app = $parts[0]; |
|
146 | 146 | |
147 | 147 | // Load all required applications |
148 | 148 | \OC::$REQUESTEDAPP = $app; |
@@ -151,17 +151,17 @@ discard block |
||
151 | 151 | |
152 | 152 | switch ($app) { |
153 | 153 | case 'core': |
154 | - $file = OC::$SERVERROOT .'/'. $file; |
|
154 | + $file = OC::$SERVERROOT.'/'.$file; |
|
155 | 155 | break; |
156 | 156 | default: |
157 | 157 | if (!\OC::$server->getAppManager()->isInstalled($app)) { |
158 | - throw new RemoteException('App not installed: ' . $app); |
|
158 | + throw new RemoteException('App not installed: '.$app); |
|
159 | 159 | } |
160 | 160 | OC_App::loadApp($app); |
161 | - $file = OC_App::getAppPath($app) .'/'. $parts[1]; |
|
161 | + $file = OC_App::getAppPath($app).'/'.$parts[1]; |
|
162 | 162 | break; |
163 | 163 | } |
164 | - $baseuri = OC::$WEBROOT . '/remote.php/'.$service.'/'; |
|
164 | + $baseuri = OC::$WEBROOT.'/remote.php/'.$service.'/'; |
|
165 | 165 | require_once $file; |
166 | 166 | |
167 | 167 | } catch (Exception $ex) { |
@@ -55,7 +55,7 @@ |
||
55 | 55 | $server->on('beforeMethod:*', [$this, 'beforeMethod']); |
56 | 56 | } |
57 | 57 | |
58 | - public function beforeMethod(RequestInterface $request, ResponseInterface $response){ |
|
58 | + public function beforeMethod(RequestInterface $request, ResponseInterface $response) { |
|
59 | 59 | // verify that the owner didn't have his share permissions revoked |
60 | 60 | if ($this->fileInfo && !$this->fileInfo->isShareable()) { |
61 | 61 | throw new NotFound(); |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | * InvitationResponseServer constructor. |
44 | 44 | */ |
45 | 45 | public function __construct() { |
46 | - $baseUri = \OC::$WEBROOT . '/remote.php/dav/'; |
|
46 | + $baseUri = \OC::$WEBROOT.'/remote.php/dav/'; |
|
47 | 47 | $logger = \OC::$server->getLogger(); |
48 | 48 | $dispatcher = \OC::$server->getEventDispatcher(); |
49 | 49 | |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | )); |
95 | 95 | |
96 | 96 | // wait with registering these until auth is handled and the filesystem is setup |
97 | - $this->server->on('beforeMethod:*', function () use ($root) { |
|
97 | + $this->server->on('beforeMethod:*', function() use ($root) { |
|
98 | 98 | // register plugins from apps |
99 | 99 | $pluginManager = new PluginManager( |
100 | 100 | \OC::$server, |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | |
148 | 148 | $calendar = $this->ensureCalendarExists($principalUri); |
149 | 149 | foreach (['', '-death', '-anniversary'] as $tag) { |
150 | - $objectUri = $book['uri'] . '-' . $cardUri . $tag .'.ics'; |
|
150 | + $objectUri = $book['uri'].'-'.$cardUri.$tag.'.ics'; |
|
151 | 151 | $this->calDavBackEnd->deleteCalendarObject($calendar['id'], $objectUri); |
152 | 152 | } |
153 | 153 | } |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | * @return array|null |
159 | 159 | * @throws \Sabre\DAV\Exception\BadRequest |
160 | 160 | */ |
161 | - public function ensureCalendarExists(string $principal):?array { |
|
161 | + public function ensureCalendarExists(string $principal): ?array { |
|
162 | 162 | $calendar = $this->calDavBackEnd->getCalendarByUri($principal, self::BIRTHDAY_CALENDAR_URI); |
163 | 163 | if (!is_null($calendar)) { |
164 | 164 | return $calendar; |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | */ |
182 | 182 | public function buildDateFromContact(string $cardData, |
183 | 183 | string $dateField, |
184 | - string $postfix):?VCalendar { |
|
184 | + string $postfix): ?VCalendar { |
|
185 | 185 | if (empty($cardData)) { |
186 | 186 | return null; |
187 | 187 | } |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | return null; |
205 | 205 | } |
206 | 206 | $birthday = $doc->{$dateField}; |
207 | - if (!(string)$birthday) { |
|
207 | + if (!(string) $birthday) { |
|
208 | 208 | return null; |
209 | 209 | } |
210 | 210 | // Skip if the BDAY property is not of the right type. |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | $unknownYear = false; |
223 | 223 | $originalYear = null; |
224 | 224 | if (!$dateParts['year']) { |
225 | - $birthday = '1970-' . $dateParts['month'] . '-' . $dateParts['date']; |
|
225 | + $birthday = '1970-'.$dateParts['month'].'-'.$dateParts['date']; |
|
226 | 226 | |
227 | 227 | $unknownYear = true; |
228 | 228 | } else { |
@@ -230,14 +230,14 @@ discard block |
||
230 | 230 | if (isset($parameters['X-APPLE-OMIT-YEAR'])) { |
231 | 231 | $omitYear = $parameters['X-APPLE-OMIT-YEAR']; |
232 | 232 | if ($dateParts['year'] === $omitYear) { |
233 | - $birthday = '1970-' . $dateParts['month'] . '-' . $dateParts['date']; |
|
233 | + $birthday = '1970-'.$dateParts['month'].'-'.$dateParts['date']; |
|
234 | 234 | $unknownYear = true; |
235 | 235 | } |
236 | 236 | } else { |
237 | - $originalYear = (int)$dateParts['year']; |
|
237 | + $originalYear = (int) $dateParts['year']; |
|
238 | 238 | |
239 | 239 | if ($originalYear < 1970) { |
240 | - $birthday = '1970-' . $dateParts['month'] . '-' . $dateParts['date']; |
|
240 | + $birthday = '1970-'.$dateParts['month'].'-'.$dateParts['date']; |
|
241 | 241 | } |
242 | 242 | } |
243 | 243 | } |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | ); |
273 | 273 | |
274 | 274 | $vEvent->DTEND['VALUE'] = 'DATE'; |
275 | - $vEvent->{'UID'} = $doc->UID . $postfix; |
|
275 | + $vEvent->{'UID'} = $doc->UID.$postfix; |
|
276 | 276 | $vEvent->{'RRULE'} = 'FREQ=YEARLY'; |
277 | 277 | $vEvent->{'SUMMARY'} = $summary; |
278 | 278 | $vEvent->{'TRANSP'} = 'TRANSPARENT'; |
@@ -298,7 +298,7 @@ discard block |
||
298 | 298 | $calendar = $this->calDavBackEnd->getCalendarByUri($principal, self::BIRTHDAY_CALENDAR_URI); |
299 | 299 | $calendarObjects = $this->calDavBackEnd->getCalendarObjects($calendar['id'], CalDavBackend::CALENDAR_TYPE_CALENDAR); |
300 | 300 | |
301 | - foreach($calendarObjects as $calendarObject) { |
|
301 | + foreach ($calendarObjects as $calendarObject) { |
|
302 | 302 | $this->calDavBackEnd->deleteCalendarObject($calendar['id'], $calendarObject['uri'], CalDavBackend::CALENDAR_TYPE_CALENDAR); |
303 | 303 | } |
304 | 304 | } |
@@ -311,9 +311,9 @@ discard block |
||
311 | 311 | $principal = 'principals/users/'.$user; |
312 | 312 | $this->ensureCalendarExists($principal); |
313 | 313 | $books = $this->cardDavBackEnd->getAddressBooksForUser($principal); |
314 | - foreach($books as $book) { |
|
314 | + foreach ($books as $book) { |
|
315 | 315 | $cards = $this->cardDavBackEnd->getCards($book['id']); |
316 | - foreach($cards as $card) { |
|
316 | + foreach ($cards as $card) { |
|
317 | 317 | $this->onCardChanged((int) $book['id'], $card['uri'], $card['carddata']); |
318 | 318 | } |
319 | 319 | } |
@@ -372,7 +372,7 @@ discard block |
||
372 | 372 | array $book, |
373 | 373 | int $calendarId, |
374 | 374 | array $type):void { |
375 | - $objectUri = $book['uri'] . '-' . $cardUri . $type['postfix'] . '.ics'; |
|
375 | + $objectUri = $book['uri'].'-'.$cardUri.$type['postfix'].'.ics'; |
|
376 | 376 | $calendarData = $this->buildDateFromContact($cardData, $type['field'], $type['postfix']); |
377 | 377 | $existing = $this->calDavBackEnd->getCalendarObject($calendarId, $objectUri); |
378 | 378 | if (is_null($calendarData)) { |
@@ -427,53 +427,53 @@ discard block |
||
427 | 427 | */ |
428 | 428 | private function formatTitle(string $field, |
429 | 429 | string $name, |
430 | - int $year=null, |
|
431 | - bool $supports4Byte=true):string { |
|
430 | + int $year = null, |
|
431 | + bool $supports4Byte = true):string { |
|
432 | 432 | if ($supports4Byte) { |
433 | 433 | switch ($field) { |
434 | 434 | case 'BDAY': |
435 | 435 | return implode('', [ |
436 | 436 | ' |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | $server->addPlugin(new \OCA\DAV\Connector\Sabre\LockPlugin()); |
128 | 128 | // Some WebDAV clients do require Class 2 WebDAV support (locking), since |
129 | 129 | // we do not provide locking we emulate it using a fake locking plugin. |
130 | - if($this->request->isUserAgent([ |
|
130 | + if ($this->request->isUserAgent([ |
|
131 | 131 | '/WebDAVFS/', |
132 | 132 | '/OneNote/', |
133 | 133 | '/Microsoft-WebDAV-MiniRedir/', |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | } |
141 | 141 | |
142 | 142 | // wait with registering these until auth is handled and the filesystem is setup |
143 | - $server->on('beforeMethod:*', function () use ($server, $objectTree, $viewCallBack) { |
|
143 | + $server->on('beforeMethod:*', function() use ($server, $objectTree, $viewCallBack) { |
|
144 | 144 | // ensure the skeleton is copied |
145 | 145 | $userFolder = \OC::$server->getUserFolder(); |
146 | 146 | |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | ); |
173 | 173 | $server->addPlugin(new \OCA\DAV\Connector\Sabre\QuotaPlugin($view, true)); |
174 | 174 | |
175 | - if($this->userSession->isLoggedIn()) { |
|
175 | + if ($this->userSession->isLoggedIn()) { |
|
176 | 176 | $server->addPlugin(new \OCA\DAV\Connector\Sabre\TagsPlugin($objectTree, $this->tagManager)); |
177 | 177 | $server->addPlugin(new \OCA\DAV\Connector\Sabre\SharesPlugin( |
178 | 178 | $objectTree, |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | $authPlugin->addBackend($authBackend); |
127 | 127 | |
128 | 128 | // debugging |
129 | - if(\OC::$server->getConfig()->getSystemValue('debug', false)) { |
|
129 | + if (\OC::$server->getConfig()->getSystemValue('debug', false)) { |
|
130 | 130 | $this->server->addPlugin(new \Sabre\DAV\Browser\Plugin()); |
131 | 131 | } else { |
132 | 132 | $this->server->addPlugin(new DummyGetResponsePlugin()); |
@@ -201,10 +201,10 @@ discard block |
||
201 | 201 | |
202 | 202 | // Some WebDAV clients do require Class 2 WebDAV support (locking), since |
203 | 203 | // we do not provide locking we emulate it using a fake locking plugin. |
204 | - if($request->isUserAgent([ |
|
204 | + if ($request->isUserAgent([ |
|
205 | 205 | '/WebDAVFS/', |
206 | 206 | '/OneNote/', |
207 | - '/^Microsoft-WebDAV/',// Microsoft-WebDAV-MiniRedir/6.1.7601 |
|
207 | + '/^Microsoft-WebDAV/', // Microsoft-WebDAV-MiniRedir/6.1.7601 |
|
208 | 208 | ])) { |
209 | 209 | $this->server->addPlugin(new FakeLockerPlugin()); |
210 | 210 | } |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | $this->server->addPlugin(new SearchPlugin($lazySearchBackend)); |
218 | 218 | |
219 | 219 | // wait with registering these until auth is handled and the filesystem is setup |
220 | - $this->server->on('beforeMethod:*', function () use ($root, $lazySearchBackend) { |
|
220 | + $this->server->on('beforeMethod:*', function() use ($root, $lazySearchBackend) { |
|
221 | 221 | // custom properties plugin must be the last one |
222 | 222 | $userSession = \OC::$server->getUserSession(); |
223 | 223 | $user = $userSession->getUser(); |