@@ -102,11 +102,11 @@ |
||
102 | 102 | * @param array $conditions |
103 | 103 | */ |
104 | 104 | public function validateTokens(RequestInterface $request, &$conditions) { |
105 | - foreach($conditions as &$fileCondition) { |
|
106 | - if(isset($fileCondition['tokens'])) { |
|
107 | - foreach($fileCondition['tokens'] as &$token) { |
|
108 | - if(isset($token['token'])) { |
|
109 | - if(substr($token['token'], 0, 16) === 'opaquelocktoken:') { |
|
105 | + foreach ($conditions as &$fileCondition) { |
|
106 | + if (isset($fileCondition['tokens'])) { |
|
107 | + foreach ($fileCondition['tokens'] as &$token) { |
|
108 | + if (isset($token['token'])) { |
|
109 | + if (substr($token['token'], 0, 16) === 'opaquelocktoken:') { |
|
110 | 110 | $token['validToken'] = true; |
111 | 111 | } |
112 | 112 | } |
@@ -172,14 +172,14 @@ discard block |
||
172 | 172 | return; |
173 | 173 | } |
174 | 174 | |
175 | - $ns = '{' . $this::NS_OWNCLOUD . '}'; |
|
175 | + $ns = '{'.$this::NS_OWNCLOUD.'}'; |
|
176 | 176 | $requestedProps = []; |
177 | 177 | $filterRules = []; |
178 | 178 | |
179 | 179 | // parse report properties and gather filter info |
180 | 180 | foreach ($report as $reportProps) { |
181 | 181 | $name = $reportProps['name']; |
182 | - if ($name === $ns . 'filter-rules') { |
|
182 | + if ($name === $ns.'filter-rules') { |
|
183 | 183 | $filterRules = $reportProps['value']; |
184 | 184 | } else if ($name === '{DAV:}prop') { |
185 | 185 | // propfind properties |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | if (empty($filesUri)) { |
241 | 241 | return ''; |
242 | 242 | } |
243 | - return '/' . $filesUri; |
|
243 | + return '/'.$filesUri; |
|
244 | 244 | } |
245 | 245 | |
246 | 246 | /** |
@@ -252,15 +252,15 @@ discard block |
||
252 | 252 | * @throws TagNotFoundException whenever a tag was not found |
253 | 253 | */ |
254 | 254 | protected function processFilterRules($filterRules) { |
255 | - $ns = '{' . $this::NS_OWNCLOUD . '}'; |
|
255 | + $ns = '{'.$this::NS_OWNCLOUD.'}'; |
|
256 | 256 | $resultFileIds = null; |
257 | 257 | $systemTagIds = []; |
258 | 258 | $favoriteFilter = null; |
259 | 259 | foreach ($filterRules as $filterRule) { |
260 | - if ($filterRule['name'] === $ns . 'systemtag') { |
|
260 | + if ($filterRule['name'] === $ns.'systemtag') { |
|
261 | 261 | $systemTagIds[] = $filterRule['value']; |
262 | 262 | } |
263 | - if ($filterRule['name'] === $ns . 'favorite') { |
|
263 | + if ($filterRule['name'] === $ns.'favorite') { |
|
264 | 264 | $favoriteFilter = true; |
265 | 265 | } |
266 | 266 | } |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | } |
300 | 300 | |
301 | 301 | if (!empty($unknownTagIds)) { |
302 | - throw new TagNotFoundException('Tag with ids ' . implode(', ', $unknownTagIds) . ' not found'); |
|
302 | + throw new TagNotFoundException('Tag with ids '.implode(', ', $unknownTagIds).' not found'); |
|
303 | 303 | } |
304 | 304 | } |
305 | 305 | |
@@ -339,7 +339,7 @@ discard block |
||
339 | 339 | public function prepareResponses($filesUri, $requestedProps, $nodes) { |
340 | 340 | $responses = []; |
341 | 341 | foreach ($nodes as $node) { |
342 | - $propFind = new PropFind($filesUri . $node->getPath(), $requestedProps); |
|
342 | + $propFind = new PropFind($filesUri.$node->getPath(), $requestedProps); |
|
343 | 343 | |
344 | 344 | $this->server->getPropertiesByNode($propFind, $node); |
345 | 345 | // copied from Sabre Server's getPropertiesForPath |
@@ -352,7 +352,7 @@ discard block |
||
352 | 352 | } |
353 | 353 | |
354 | 354 | $responses[] = new Response( |
355 | - rtrim($this->server->getBaseUri(), '/') . $filesUri . $node->getPath(), |
|
355 | + rtrim($this->server->getBaseUri(), '/').$filesUri.$node->getPath(), |
|
356 | 356 | $result, |
357 | 357 | 200 |
358 | 358 | ); |
@@ -66,7 +66,7 @@ |
||
66 | 66 | function xmlSerialize(Writer $writer) { |
67 | 67 | |
68 | 68 | foreach ($this->checksums as $checksum) { |
69 | - $writer->writeElement('{' . self::NS_OWNCLOUD . '}checksum', $checksum); |
|
69 | + $writer->writeElement('{'.self::NS_OWNCLOUD.'}checksum', $checksum); |
|
70 | 70 | } |
71 | 71 | } |
72 | 72 | } |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | */ |
65 | 65 | public function beforeHandler(RequestInterface $request) { |
66 | 66 | $userAgent = $request->getHeader('User-Agent'); |
67 | - if($userAgent === null) { |
|
67 | + if ($userAgent === null) { |
|
68 | 68 | return; |
69 | 69 | } |
70 | 70 | |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | // Match on the mirall version which is in scheme "Mozilla/5.0 (%1) mirall/%2" or |
74 | 74 | // "mirall/%1" for older releases |
75 | 75 | preg_match("/(?:mirall\\/)([\d.]+)/i", $userAgent, $versionMatches); |
76 | - if(isset($versionMatches[1]) && |
|
76 | + if (isset($versionMatches[1]) && |
|
77 | 77 | version_compare($versionMatches[1], $minimumSupportedDesktopVersion) === -1) { |
78 | 78 | throw new \Sabre\DAV\Exception\Forbidden('Unsupported client version.'); |
79 | 79 | } |
@@ -99,13 +99,13 @@ discard block |
||
99 | 99 | * @return mixed|string |
100 | 100 | */ |
101 | 101 | public function getCommentsLink(Node $node) { |
102 | - $href = $this->server->getBaseUri(); |
|
102 | + $href = $this->server->getBaseUri(); |
|
103 | 103 | $entryPoint = strpos($href, '/remote.php/'); |
104 | - if($entryPoint === false) { |
|
104 | + if ($entryPoint === false) { |
|
105 | 105 | // in case we end up somewhere else, unexpectedly. |
106 | 106 | return null; |
107 | 107 | } |
108 | - $commentsPart = 'dav/comments/files/' . rawurldecode($node->getId()); |
|
108 | + $commentsPart = 'dav/comments/files/'.rawurldecode($node->getId()); |
|
109 | 109 | $href = substr_replace($href, $commentsPart, $entryPoint + strlen('/remote.php/')); |
110 | 110 | return $href; |
111 | 111 | } |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | */ |
120 | 120 | public function getUnreadCount(Node $node) { |
121 | 121 | $user = $this->userSession->getUser(); |
122 | - if(is_null($user)) { |
|
122 | + if (is_null($user)) { |
|
123 | 123 | return null; |
124 | 124 | } |
125 | 125 |
@@ -71,8 +71,8 @@ discard block |
||
71 | 71 | return null; |
72 | 72 | } |
73 | 73 | foreach ($tree as $elem) { |
74 | - if ($elem['name'] === '{' . self::NS_OWNCLOUD . '}share-type') { |
|
75 | - $shareTypes[] = (int)$elem['value']; |
|
74 | + if ($elem['name'] === '{'.self::NS_OWNCLOUD.'}share-type') { |
|
75 | + $shareTypes[] = (int) $elem['value']; |
|
76 | 76 | } |
77 | 77 | } |
78 | 78 | return new self($shareTypes); |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | */ |
87 | 87 | function xmlSerialize(Writer $writer) { |
88 | 88 | foreach ($this->shareTypes as $shareType) { |
89 | - $writer->writeElement('{' . self::NS_OWNCLOUD . '}share-type', $shareType); |
|
89 | + $writer->writeElement('{'.self::NS_OWNCLOUD.'}share-type', $shareType); |
|
90 | 90 | } |
91 | 91 | } |
92 | 92 | } |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | throw new Forbidden(); |
93 | 93 | } |
94 | 94 | } catch (StorageNotAvailableException $e) { |
95 | - throw new ServiceUnavailable("File is not updatable: " . $e->getMessage()); |
|
95 | + throw new ServiceUnavailable("File is not updatable: ".$e->getMessage()); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | // verify path of the target |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | |
113 | 113 | if ($needsPartFile) { |
114 | 114 | // mark file as partial while uploading (ignored by the scanner) |
115 | - $partFilePath = $this->getPartFileBasePath($this->path) . '.ocTransferId' . rand() . '.part'; |
|
115 | + $partFilePath = $this->getPartFileBasePath($this->path).'.ocTransferId'.rand().'.part'; |
|
116 | 116 | } else { |
117 | 117 | // upload file directly as the final path |
118 | 118 | $partFilePath = $this->path; |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | if (isset($_SERVER['CONTENT_LENGTH'])) { |
139 | 139 | $expected = $_SERVER['CONTENT_LENGTH']; |
140 | 140 | } |
141 | - throw new Exception('Error while copying file to target location (copied bytes: ' . $count . ', expected filesize: ' . $expected . ' )'); |
|
141 | + throw new Exception('Error while copying file to target location (copied bytes: '.$count.', expected filesize: '.$expected.' )'); |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | // if content length is sent by client: |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | if (isset($_SERVER['CONTENT_LENGTH']) && $_SERVER['REQUEST_METHOD'] === 'PUT') { |
148 | 148 | $expected = $_SERVER['CONTENT_LENGTH']; |
149 | 149 | if ($count != $expected) { |
150 | - throw new BadRequest('expected filesize ' . $expected . ' got ' . $count); |
|
150 | + throw new BadRequest('expected filesize '.$expected.' got '.$count); |
|
151 | 151 | } |
152 | 152 | } |
153 | 153 | |
@@ -227,10 +227,10 @@ discard block |
||
227 | 227 | } |
228 | 228 | |
229 | 229 | } catch (StorageNotAvailableException $e) { |
230 | - throw new ServiceUnavailable("Failed to check file size: " . $e->getMessage()); |
|
230 | + throw new ServiceUnavailable("Failed to check file size: ".$e->getMessage()); |
|
231 | 231 | } |
232 | 232 | |
233 | - return '"' . $this->info->getEtag() . '"'; |
|
233 | + return '"'.$this->info->getEtag().'"'; |
|
234 | 234 | } |
235 | 235 | |
236 | 236 | private function getPartFileBasePath($path) { |
@@ -309,9 +309,9 @@ discard block |
||
309 | 309 | return $res; |
310 | 310 | } catch (GenericEncryptionException $e) { |
311 | 311 | // returning 503 will allow retry of the operation at a later point in time |
312 | - throw new ServiceUnavailable("Encryption not ready: " . $e->getMessage()); |
|
312 | + throw new ServiceUnavailable("Encryption not ready: ".$e->getMessage()); |
|
313 | 313 | } catch (StorageNotAvailableException $e) { |
314 | - throw new ServiceUnavailable("Failed to open file: " . $e->getMessage()); |
|
314 | + throw new ServiceUnavailable("Failed to open file: ".$e->getMessage()); |
|
315 | 315 | } catch (ForbiddenException $ex) { |
316 | 316 | throw new DAVForbiddenException($ex->getMessage(), $ex->getRetry()); |
317 | 317 | } catch (LockedException $e) { |
@@ -336,7 +336,7 @@ discard block |
||
336 | 336 | throw new Forbidden(); |
337 | 337 | } |
338 | 338 | } catch (StorageNotAvailableException $e) { |
339 | - throw new ServiceUnavailable("Failed to unlink: " . $e->getMessage()); |
|
339 | + throw new ServiceUnavailable("Failed to unlink: ".$e->getMessage()); |
|
340 | 340 | } catch (ForbiddenException $ex) { |
341 | 341 | throw new DAVForbiddenException($ex->getMessage(), $ex->getRetry()); |
342 | 342 | } catch (LockedException $e) { |
@@ -403,7 +403,7 @@ discard block |
||
403 | 403 | if ($bytesWritten != $expected) { |
404 | 404 | $chunk_handler->remove($info['index']); |
405 | 405 | throw new BadRequest( |
406 | - 'expected filesize ' . $expected . ' got ' . $bytesWritten); |
|
406 | + 'expected filesize '.$expected.' got '.$bytesWritten); |
|
407 | 407 | } |
408 | 408 | } |
409 | 409 | } |
@@ -413,7 +413,7 @@ discard block |
||
413 | 413 | $needsPartFile = $this->needsPartFile($storage); |
414 | 414 | $partFile = null; |
415 | 415 | |
416 | - $targetPath = $path . '/' . $info['name']; |
|
416 | + $targetPath = $path.'/'.$info['name']; |
|
417 | 417 | /** @var \OC\Files\Storage\Storage $targetStorage */ |
418 | 418 | list($targetStorage, $targetInternalPath) = $this->fileView->resolvePath($targetPath); |
419 | 419 | |
@@ -429,7 +429,7 @@ discard block |
||
429 | 429 | |
430 | 430 | if ($needsPartFile) { |
431 | 431 | // we first assembly the target file as a part file |
432 | - $partFile = $this->getPartFileBasePath($path . '/' . $info['name']) . '.ocTransferId' . $info['transferid'] . '.part'; |
|
432 | + $partFile = $this->getPartFileBasePath($path.'/'.$info['name']).'.ocTransferId'.$info['transferid'].'.part'; |
|
433 | 433 | /** @var \OC\Files\Storage\Storage $targetStorage */ |
434 | 434 | list($partStorage, $partInternalPath) = $this->fileView->resolvePath($partFile); |
435 | 435 | |
@@ -548,10 +548,10 @@ discard block |
||
548 | 548 | } |
549 | 549 | if ($e instanceof GenericEncryptionException) { |
550 | 550 | // returning 503 will allow retry of the operation at a later point in time |
551 | - throw new ServiceUnavailable('Encryption not ready: ' . $e->getMessage(), 0, $e); |
|
551 | + throw new ServiceUnavailable('Encryption not ready: '.$e->getMessage(), 0, $e); |
|
552 | 552 | } |
553 | 553 | if ($e instanceof StorageNotAvailableException) { |
554 | - throw new ServiceUnavailable('Failed to write file contents: ' . $e->getMessage(), 0, $e); |
|
554 | + throw new ServiceUnavailable('Failed to write file contents: '.$e->getMessage(), 0, $e); |
|
555 | 555 | } |
556 | 556 | |
557 | 557 | throw new \Sabre\DAV\Exception($e->getMessage(), 0, $e); |
@@ -49,17 +49,17 @@ |
||
49 | 49 | * @param \DOMElement $errorNode |
50 | 50 | * @return void |
51 | 51 | */ |
52 | - public function serialize(\Sabre\DAV\Server $server,\DOMElement $errorNode) { |
|
52 | + public function serialize(\Sabre\DAV\Server $server, \DOMElement $errorNode) { |
|
53 | 53 | |
54 | 54 | // set ownCloud namespace |
55 | 55 | $errorNode->setAttribute('xmlns:o', self::NS_OWNCLOUD); |
56 | 56 | |
57 | 57 | // adding the retry node |
58 | - $error = $errorNode->ownerDocument->createElementNS('o:','o:retry', var_export($this->retry, true)); |
|
58 | + $error = $errorNode->ownerDocument->createElementNS('o:', 'o:retry', var_export($this->retry, true)); |
|
59 | 59 | $errorNode->appendChild($error); |
60 | 60 | |
61 | 61 | // adding the message node |
62 | - $error = $errorNode->ownerDocument->createElementNS('o:','o:reason', $this->getMessage()); |
|
62 | + $error = $errorNode->ownerDocument->createElementNS('o:', 'o:reason', $this->getMessage()); |
|
63 | 63 | $errorNode->appendChild($error); |
64 | 64 | } |
65 | 65 | } |
@@ -61,17 +61,17 @@ |
||
61 | 61 | * @param \DOMElement $errorNode |
62 | 62 | * @return void |
63 | 63 | */ |
64 | - public function serialize(\Sabre\DAV\Server $server,\DOMElement $errorNode) { |
|
64 | + public function serialize(\Sabre\DAV\Server $server, \DOMElement $errorNode) { |
|
65 | 65 | |
66 | 66 | // set ownCloud namespace |
67 | 67 | $errorNode->setAttribute('xmlns:o', self::NS_OWNCLOUD); |
68 | 68 | |
69 | 69 | // adding the retry node |
70 | - $error = $errorNode->ownerDocument->createElementNS('o:','o:retry', var_export($this->retry, true)); |
|
70 | + $error = $errorNode->ownerDocument->createElementNS('o:', 'o:retry', var_export($this->retry, true)); |
|
71 | 71 | $errorNode->appendChild($error); |
72 | 72 | |
73 | 73 | // adding the message node |
74 | - $error = $errorNode->ownerDocument->createElementNS('o:','o:reason', $this->getMessage()); |
|
74 | + $error = $errorNode->ownerDocument->createElementNS('o:', 'o:reason', $this->getMessage()); |
|
75 | 75 | $errorNode->appendChild($error); |
76 | 76 | } |
77 | 77 |