@@ -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 | } |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | if (isset($info['transferid'])) { |
91 | 91 | // getNodePath is called for multiple nodes within a chunk |
92 | 92 | // upload call |
93 | - $path = $dir . '/' . $info['name']; |
|
93 | + $path = $dir.'/'.$info['name']; |
|
94 | 94 | $path = ltrim($path, '/'); |
95 | 95 | } |
96 | 96 | } |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | } catch (StorageNotAvailableException $e) { |
162 | 162 | throw new \Sabre\DAV\Exception\ServiceUnavailable('Storage is temporarily not available'); |
163 | 163 | } catch (StorageInvalidException $e) { |
164 | - throw new \Sabre\DAV\Exception\NotFound('Storage ' . $path . ' is invalid'); |
|
164 | + throw new \Sabre\DAV\Exception\NotFound('Storage '.$path.' is invalid'); |
|
165 | 165 | } catch (LockedException $e) { |
166 | 166 | throw new \Sabre\DAV\Exception\Locked(); |
167 | 167 | } catch (ForbiddenException $e) { |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | } |
171 | 171 | |
172 | 172 | if (!$info) { |
173 | - throw new \Sabre\DAV\Exception\NotFound('File with name ' . $path . ' could not be located'); |
|
173 | + throw new \Sabre\DAV\Exception\NotFound('File with name '.$path.' could not be located'); |
|
174 | 174 | } |
175 | 175 | |
176 | 176 | if ($info->getType() === 'dir') { |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | } else { |
215 | 215 | $destinationPermission = $infoDestination && $infoDestination->isCreatable(); |
216 | 216 | } |
217 | - $sourcePermission = $infoSource && $infoSource->isDeletable(); |
|
217 | + $sourcePermission = $infoSource && $infoSource->isDeletable(); |
|
218 | 218 | } |
219 | 219 | |
220 | 220 | if (!$destinationPermission || !$sourcePermission) { |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | $targetNodeExists = $this->nodeExists($destinationPath); |
225 | 225 | $sourceNode = $this->getNodeForPath($sourcePath); |
226 | 226 | if ($sourceNode instanceof \Sabre\DAV\ICollection && $targetNodeExists) { |
227 | - throw new \Sabre\DAV\Exception\Forbidden('Could not copy directory ' . $sourceNode->getName() . ', target exists'); |
|
227 | + throw new \Sabre\DAV\Exception\Forbidden('Could not copy directory '.$sourceNode->getName().', target exists'); |
|
228 | 228 | } |
229 | 229 | list($sourceDir,) = \Sabre\HTTP\URLUtil::splitPath($sourcePath); |
230 | 230 | list($destinationDir,) = \Sabre\HTTP\URLUtil::splitPath($destinationPath); |
@@ -220,9 +220,9 @@ discard block |
||
220 | 220 | )) { |
221 | 221 | // note: pre-fetching only supported for depth <= 1 |
222 | 222 | $folderContent = $node->getChildren(); |
223 | - $fileIds[] = (int)$node->getId(); |
|
223 | + $fileIds[] = (int) $node->getId(); |
|
224 | 224 | foreach ($folderContent as $info) { |
225 | - $fileIds[] = (int)$info->getId(); |
|
225 | + $fileIds[] = (int) $info->getId(); |
|
226 | 226 | } |
227 | 227 | $tags = $this->getTagger()->getTagsForObjects($fileIds); |
228 | 228 | if ($tags === false) { |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | if (is_null($node)) { |
282 | 282 | return 404; |
283 | 283 | } |
284 | - if ((int)$favState === 1 || $favState === 'true') { |
|
284 | + if ((int) $favState === 1 || $favState === 'true') { |
|
285 | 285 | $this->getTagger()->tagAs($node->getId(), self::TAG_FAVORITE); |
286 | 286 | } else { |
287 | 287 | $this->getTagger()->unTag($node->getId(), self::TAG_FAVORITE); |
@@ -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 | } |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | // exit if we can't create a new file and we don't updatable existing file |
116 | 116 | $info = \OC_FileChunking::decodeName($name); |
117 | 117 | if (!$this->fileView->isCreatable($this->path) && |
118 | - !$this->fileView->isUpdatable($this->path . '/' . $info['name']) |
|
118 | + !$this->fileView->isUpdatable($this->path.'/'.$info['name']) |
|
119 | 119 | ) { |
120 | 120 | throw new \Sabre\DAV\Exception\Forbidden(); |
121 | 121 | } |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | |
130 | 130 | $this->fileView->verifyPath($this->path, $name); |
131 | 131 | |
132 | - $path = $this->fileView->getAbsolutePath($this->path) . '/' . $name; |
|
132 | + $path = $this->fileView->getAbsolutePath($this->path).'/'.$name; |
|
133 | 133 | // using a dummy FileInfo is acceptable here since it will be refreshed after the put is complete |
134 | 134 | $info = new \OC\Files\FileInfo($path, null, null, array(), null); |
135 | 135 | $node = new \OCA\DAV\Connector\Sabre\File($this->fileView, $info); |
@@ -162,9 +162,9 @@ discard block |
||
162 | 162 | } |
163 | 163 | |
164 | 164 | $this->fileView->verifyPath($this->path, $name); |
165 | - $newPath = $this->path . '/' . $name; |
|
165 | + $newPath = $this->path.'/'.$name; |
|
166 | 166 | if (!$this->fileView->mkdir($newPath)) { |
167 | - throw new \Sabre\DAV\Exception\Forbidden('Could not create directory ' . $newPath); |
|
167 | + throw new \Sabre\DAV\Exception\Forbidden('Could not create directory '.$newPath); |
|
168 | 168 | } |
169 | 169 | } catch (\OCP\Files\StorageNotAvailableException $e) { |
170 | 170 | throw new \Sabre\DAV\Exception\ServiceUnavailable($e->getMessage()); |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | * @throws \Sabre\DAV\Exception\ServiceUnavailable |
189 | 189 | */ |
190 | 190 | public function getChild($name, $info = null) { |
191 | - $path = $this->path . '/' . $name; |
|
191 | + $path = $this->path.'/'.$name; |
|
192 | 192 | if (is_null($info)) { |
193 | 193 | try { |
194 | 194 | $this->fileView->verifyPath($this->path, $name); |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | } |
204 | 204 | |
205 | 205 | if (!$info) { |
206 | - throw new \Sabre\DAV\Exception\NotFound('File with name ' . $path . ' could not be located'); |
|
206 | + throw new \Sabre\DAV\Exception\NotFound('File with name '.$path.' could not be located'); |
|
207 | 207 | } |
208 | 208 | |
209 | 209 | if ($info['mimetype'] == 'httpd/unix-directory') { |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | // (required old code) instead of "updateFile". |
256 | 256 | // |
257 | 257 | // TODO: resolve chunk file name here and implement "updateFile" |
258 | - $path = $this->path . '/' . $name; |
|
258 | + $path = $this->path.'/'.$name; |
|
259 | 259 | return $this->fileView->file_exists($path); |
260 | 260 | |
261 | 261 | } |
@@ -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 | } |