@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | } |
122 | 122 | |
123 | 123 | $attributes = compact('namespace'); |
124 | - $attributes = array_filter($attributes, function ($attribute) {return !is_null($attribute); }); |
|
124 | + $attributes = array_filter($attributes, function($attribute) {return !is_null($attribute); }); |
|
125 | 125 | |
126 | 126 | $id = $this->server->addGroup($name, $member, $attributes); |
127 | 127 | $result = $this->decorator->decorate($this->server->getGroupById($id)); |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | public function patch(string $id, ?string $name = null, ?array $member = null, ?string $namespace = null): Response |
136 | 136 | { |
137 | 137 | $attributes = compact('namespace', 'name', 'member'); |
138 | - $attributes = array_filter($attributes, function ($attribute) {return !is_null($attribute); }); |
|
138 | + $attributes = array_filter($attributes, function($attribute) {return !is_null($attribute); }); |
|
139 | 139 | |
140 | 140 | $group = $this->_getGroup($id, true); |
141 | 141 | $group->setAttributes($attributes); |
@@ -246,8 +246,8 @@ discard block |
||
246 | 246 | $share = $node->getFilesystem()->findRawNode($node->getReference()); |
247 | 247 | } catch (\Exception $e) { |
248 | 248 | $this->logger->error('could not find share node ['.$node->getReference().'] for reference ['.$node->getId().'], dead reference?', [ |
249 | - 'category' => get_class($this), |
|
250 | - 'exception' => $e, |
|
249 | + 'category' => get_class($this), |
|
250 | + 'exception' => $e, |
|
251 | 251 | ]); |
252 | 252 | |
253 | 253 | return self::PRIVILEGE_DENY; |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | |
256 | 256 | if ($share['deleted'] instanceof UTCDateTime || true !== $share['shared']) { |
257 | 257 | $this->logger->error('share node ['.$share['_id'].'] has been deleted, dead reference?', [ |
258 | - 'category' => get_class($this), |
|
258 | + 'category' => get_class($this), |
|
259 | 259 | ]); |
260 | 260 | |
261 | 261 | return self::PRIVILEGE_DENY; |
@@ -85,6 +85,6 @@ |
||
85 | 85 | protected function getTemplate(): string |
86 | 86 | { |
87 | 87 | return __DIR__.DIRECTORY_SEPARATOR.'assets' |
88 | - .DIRECTORY_SEPARATOR.'template.'.$this->type; |
|
88 | + .DIRECTORY_SEPARATOR.'template.'.$this->type; |
|
89 | 89 | } |
90 | 90 | } |
@@ -31,7 +31,7 @@ |
||
31 | 31 | ->prependRoute(new Route('/api/v2/files/preview(/|\z)', v2\Preview::class)) |
32 | 32 | ->prependRoute(new Route('/api/v2/files/{id:#([0-9a-z]{24})#}/preview(/|\z)', v2\Preview::class)); |
33 | 33 | |
34 | - $decorator->addDecorator('preview', function ($node) { |
|
34 | + $decorator->addDecorator('preview', function($node) { |
|
35 | 35 | if ($node instanceof Collection) { |
36 | 36 | return null; |
37 | 37 | } |
@@ -62,10 +62,10 @@ |
||
62 | 62 | |
63 | 63 | // Public Key Credential Request Options |
64 | 64 | $key = new PublicKeyCredentialRequestOptions( |
65 | - random_bytes(32), // Challenge |
|
66 | - 60000, // Timeout |
|
67 | - $domain, // Relying Party ID |
|
68 | - $registeredPublicKeyCredentialDescriptors, // Registered PublicKeyCredentialDescriptor classes |
|
65 | + random_bytes(32), // Challenge |
|
66 | + 60000, // Timeout |
|
67 | + $domain, // Relying Party ID |
|
68 | + $registeredPublicKeyCredentialDescriptors, // Registered PublicKeyCredentialDescriptor classes |
|
69 | 69 | PublicKeyCredentialRequestOptions::USER_VERIFICATION_REQUIREMENT_PREFERRED, // User verification requirement |
70 | 70 | $this->auth_extensions |
71 | 71 | ); |
@@ -97,13 +97,13 @@ discard block |
||
97 | 97 | } |
98 | 98 | |
99 | 99 | return [ |
100 | - 'created' => function ($role) use ($attributes) { |
|
100 | + 'created' => function($role) use ($attributes) { |
|
101 | 101 | return $attributes['created']->toDateTime()->format('c'); |
102 | 102 | }, |
103 | - 'changed' => function ($role) use ($attributes) { |
|
103 | + 'changed' => function($role) use ($attributes) { |
|
104 | 104 | return $attributes['changed']->toDateTime()->format('c'); |
105 | 105 | }, |
106 | - 'deleted' => function ($role) use ($attributes) { |
|
106 | + 'deleted' => function($role) use ($attributes) { |
|
107 | 107 | if (false === $attributes['deleted']) { |
108 | 108 | return null; |
109 | 109 | } |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | 'id' => (string) $attributes['_id'], |
127 | 127 | 'name' => $attributes['name'], |
128 | 128 | 'namespace' => isset($attributes['namespace']) ? (string) $attributes['namespace'] : null, |
129 | - 'member' => array_map(function ($member) { return (string) $member; }, $attributes['member']), |
|
129 | + 'member' => array_map(function($member) { return (string) $member; }, $attributes['member']), |
|
130 | 130 | ]; |
131 | 131 | } |
132 | 132 | |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | 'name' => (string) $attributes['username'], |
149 | 149 | 'admin' => (bool) $attributes['admin'], |
150 | 150 | 'namespace' => isset($attributes['namespace']) ? (string) $attributes['namespace'] : null, |
151 | - 'mail' => function ($role) use ($attributes, $user) { |
|
151 | + 'mail' => function($role) use ($attributes, $user) { |
|
152 | 152 | if (!isset($attributes['mail'])) { |
153 | 153 | return null; |
154 | 154 | } |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | 'locale' => isset($attributes['locale']) ? (string) $attributes['locale'] : null, |
163 | 163 | 'hard_quota' => isset($attributes['hard_quota']) ? (int) $attributes['hard_quota'] : null, |
164 | 164 | 'soft_quota' => isset($attributes['soft_quota']) ? (int) $attributes['soft_quota'] : null, |
165 | - 'available' => function ($role) use (&$quota, $attributes, $user) { |
|
165 | + 'available' => function($role) use (&$quota, $attributes, $user) { |
|
166 | 166 | $quota === null ? $quota = $role->getQuotaUsage() : null; |
167 | 167 | if ($attributes['_id'] == $user->getId() || $user->isAdmin()) { |
168 | 168 | return $quota['available']; |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | |
171 | 171 | return null; |
172 | 172 | }, |
173 | - 'used' => function ($role) use (&$quota, $attributes, $user) { |
|
173 | + 'used' => function($role) use (&$quota, $attributes, $user) { |
|
174 | 174 | $quota === null ? $quota = $role->getQuotaUsage() : null; |
175 | 175 | if ($attributes['_id'] == $user->getId() || $user->isAdmin()) { |
176 | 176 | return $quota['used']; |
@@ -178,14 +178,14 @@ discard block |
||
178 | 178 | |
179 | 179 | return null; |
180 | 180 | }, |
181 | - 'has_password' => function ($role) use ($user, $attributes) { |
|
181 | + 'has_password' => function($role) use ($user, $attributes) { |
|
182 | 182 | if ($attributes['_id'] == $user->getId() || $user->isAdmin()) { |
183 | 183 | return $role->hasPassword(); |
184 | 184 | } |
185 | 185 | |
186 | 186 | return null; |
187 | 187 | }, |
188 | - 'auth' => function () use ($user) { |
|
188 | + 'auth' => function() use ($user) { |
|
189 | 189 | $identity = $user->getIdentity(); |
190 | 190 | if ($identity === null) { |
191 | 191 | return null; |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | |
82 | 82 | if ( |
83 | 83 | !($this->auth->getIdentity()->getAdapter() instanceof AuthNone)) { |
84 | - $this->auth->getIdentity()->getAttributeMap()->addMapper('binary', function ($value) { |
|
84 | + $this->auth->getIdentity()->getAttributeMap()->addMapper('binary', function($value) { |
|
85 | 85 | return new Binary($value, Binary::TYPE_GENERIC); |
86 | 86 | }); |
87 | 87 | |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | */ |
139 | 139 | protected function setExceptionHandler(): self |
140 | 140 | { |
141 | - set_exception_handler(function ($e) { |
|
141 | + set_exception_handler(function($e) { |
|
142 | 142 | $this->logger->emergency('uncaught exception: '.$e->getMessage(), [ |
143 | 143 | 'category' => get_class($this), |
144 | 144 | 'exception' => $e, |
@@ -284,46 +284,46 @@ discard block |
||
284 | 284 | } |
285 | 285 | |
286 | 286 | return $response->setOutputFormat(null) |
287 | - ->setBody(function () use ($node, $encode, $offset, $length) { |
|
288 | - $mime = $node->getContentType(); |
|
289 | - $stream = $node->get(); |
|
290 | - $name = $node->getName(); |
|
291 | - |
|
292 | - if (null === $stream) { |
|
293 | - return; |
|
294 | - } |
|
295 | - |
|
296 | - if (0 !== $offset) { |
|
297 | - if (fseek($stream, $offset) === -1) { |
|
298 | - throw new Exception\Conflict('invalid offset requested', Exception\Conflict::INVALID_OFFSET); |
|
299 | - } |
|
300 | - } |
|
301 | - |
|
302 | - $read = 0; |
|
303 | - header('Content-Type: '.$mime.''); |
|
304 | - if ('base64' === $encode) { |
|
305 | - header('Content-Encoding: base64'); |
|
306 | - while (!feof($stream)) { |
|
307 | - if (0 !== $length && $read + 8192 > $length) { |
|
308 | - echo base64_encode(fread($stream, $length - $read)); |
|
309 | - exit(); |
|
310 | - } |
|
311 | - |
|
312 | - echo base64_encode(fread($stream, 8192)); |
|
313 | - $read += 8192; |
|
314 | - } |
|
315 | - } else { |
|
316 | - while (!feof($stream)) { |
|
317 | - if (0 !== $length && $read + 8192 > $length) { |
|
318 | - echo fread($stream, $length - $read); |
|
319 | - exit(); |
|
320 | - } |
|
321 | - |
|
322 | - echo fread($stream, 8192); |
|
323 | - $read += 8192; |
|
324 | - } |
|
325 | - } |
|
326 | - }); |
|
287 | + ->setBody(function () use ($node, $encode, $offset, $length) { |
|
288 | + $mime = $node->getContentType(); |
|
289 | + $stream = $node->get(); |
|
290 | + $name = $node->getName(); |
|
291 | + |
|
292 | + if (null === $stream) { |
|
293 | + return; |
|
294 | + } |
|
295 | + |
|
296 | + if (0 !== $offset) { |
|
297 | + if (fseek($stream, $offset) === -1) { |
|
298 | + throw new Exception\Conflict('invalid offset requested', Exception\Conflict::INVALID_OFFSET); |
|
299 | + } |
|
300 | + } |
|
301 | + |
|
302 | + $read = 0; |
|
303 | + header('Content-Type: '.$mime.''); |
|
304 | + if ('base64' === $encode) { |
|
305 | + header('Content-Encoding: base64'); |
|
306 | + while (!feof($stream)) { |
|
307 | + if (0 !== $length && $read + 8192 > $length) { |
|
308 | + echo base64_encode(fread($stream, $length - $read)); |
|
309 | + exit(); |
|
310 | + } |
|
311 | + |
|
312 | + echo base64_encode(fread($stream, 8192)); |
|
313 | + $read += 8192; |
|
314 | + } |
|
315 | + } else { |
|
316 | + while (!feof($stream)) { |
|
317 | + if (0 !== $length && $read + 8192 > $length) { |
|
318 | + echo fread($stream, $length - $read); |
|
319 | + exit(); |
|
320 | + } |
|
321 | + |
|
322 | + echo fread($stream, 8192); |
|
323 | + $read += 8192; |
|
324 | + } |
|
325 | + } |
|
326 | + }); |
|
327 | 327 | } |
328 | 328 | |
329 | 329 | /** |
@@ -1318,9 +1318,9 @@ discard block |
||
1318 | 1318 | $node->zip($archive); |
1319 | 1319 | } catch (\Exception $e) { |
1320 | 1320 | $this->logger->debug('failed zip node in multi node request ['.$node->getId().']', [ |
1321 | - 'category' => get_class($this), |
|
1322 | - 'exception' => $e, |
|
1323 | - ]); |
|
1321 | + 'category' => get_class($this), |
|
1322 | + 'exception' => $e, |
|
1323 | + ]); |
|
1324 | 1324 | } |
1325 | 1325 | } |
1326 | 1326 |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | } |
189 | 189 | } |
190 | 190 | |
191 | - return $this->bulk($id, $p, function ($node) use ($parent, $conflict, $move) { |
|
191 | + return $this->bulk($id, $p, function($node) use ($parent, $conflict, $move) { |
|
192 | 192 | if (true === $move) { |
193 | 193 | $node = $node->setParent($parent, $conflict); |
194 | 194 | } |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | |
266 | 266 | $node = $this->_getNode($id, $p); |
267 | 267 | if ($node instanceof Collection) { |
268 | - return (new Response())->setBody(function () use ($node) { |
|
268 | + return (new Response())->setBody(function() use ($node) { |
|
269 | 269 | $node->getZip(); |
270 | 270 | }); |
271 | 271 | } |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | } |
285 | 285 | |
286 | 286 | return $response->setOutputFormat(null) |
287 | - ->setBody(function () use ($node, $encode, $offset, $length) { |
|
287 | + ->setBody(function() use ($node, $encode, $offset, $length) { |
|
288 | 288 | $mime = $node->getContentType(); |
289 | 289 | $stream = $node->get(); |
290 | 290 | $name = $node->getName(); |
@@ -352,7 +352,7 @@ discard block |
||
352 | 352 | */ |
353 | 353 | public function postReadonly($id = null, $p = null, bool $readonly = true): Response |
354 | 354 | { |
355 | - return $this->bulk($id, $p, function ($node) use ($readonly) { |
|
355 | + return $this->bulk($id, $p, function($node) use ($readonly) { |
|
356 | 356 | $node->setReadonly($readonly); |
357 | 357 | |
358 | 358 | return ['status' => 204]; |
@@ -597,7 +597,7 @@ discard block |
||
597 | 597 | */ |
598 | 598 | public function postMetaAttributes(?string $id = null, ?string $p = null): Response |
599 | 599 | { |
600 | - return $this->bulk($id, $p, function ($node) { |
|
600 | + return $this->bulk($id, $p, function($node) { |
|
601 | 601 | $node->setMetaAttributes($_POST); |
602 | 602 | |
603 | 603 | return ['status' => 204]; |
@@ -676,7 +676,7 @@ discard block |
||
676 | 676 | throw new Exception\NotFound('destination collection was not found or is not a collection', Exception\NotFound::DESTINATION_NOT_FOUND); |
677 | 677 | } |
678 | 678 | |
679 | - return $this->bulk($id, $p, function ($node) use ($parent, $conflict) { |
|
679 | + return $this->bulk($id, $p, function($node) use ($parent, $conflict) { |
|
680 | 680 | $result = $node->copyTo($parent, $conflict); |
681 | 681 | |
682 | 682 | return [ |
@@ -734,7 +734,7 @@ discard block |
||
734 | 734 | throw new Exception\NotFound('destination collection was not found or is not a collection', Exception\NotFound::DESTINATION_NOT_FOUND); |
735 | 735 | } |
736 | 736 | |
737 | - return $this->bulk($id, $p, function ($node) use ($parent, $conflict) { |
|
737 | + return $this->bulk($id, $p, function($node) use ($parent, $conflict) { |
|
738 | 738 | $result = $node->setParent($parent, $conflict); |
739 | 739 | if (NodeInterface::CONFLICT_RENAME === $conflict) { |
740 | 740 | return [ |
@@ -789,7 +789,7 @@ discard block |
||
789 | 789 | $at = $this->_verifyAttributes(['destroy' => $at])['destroy']; |
790 | 790 | } |
791 | 791 | |
792 | - return $this->bulk($id, $p, function ($node) use ($force, $ignore_flag, $at) { |
|
792 | + return $this->bulk($id, $p, function($node) use ($force, $ignore_flag, $at) { |
|
793 | 793 | if (null === $at) { |
794 | 794 | $node->delete($force && $node->isDeleted() || $force && $ignore_flag); |
795 | 795 | } else { |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | |
98 | 98 | if ($index === $chunks) { |
99 | 99 | $attributes = compact('changed', 'created', 'readonly', 'meta', 'acl'); |
100 | - $attributes = array_filter($attributes, function ($attribute) {return !is_null($attribute); }); |
|
100 | + $attributes = array_filter($attributes, function($attribute) {return !is_null($attribute); }); |
|
101 | 101 | $attributes = $this->_verifyAttributes($attributes); |
102 | 102 | |
103 | 103 | return $this->_put($session, $id, $collection, $name, $attributes, $conflict); |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | $parent = $this->getParent($id, $collection); |
130 | 130 | $session = $this->session_factory->add($this->server->getIdentity(), $parent, $input); |
131 | 131 | $attributes = compact('changed', 'created', 'readonly', 'meta', 'acl'); |
132 | - $attributes = array_filter($attributes, function ($attribute) {return !is_null($attribute); }); |
|
132 | + $attributes = array_filter($attributes, function($attribute) {return !is_null($attribute); }); |
|
133 | 133 | $attributes = $this->_verifyAttributes($attributes); |
134 | 134 | |
135 | 135 | return $this->_put($session, $id, $collection, $name, $attributes, $conflict); |