@@ -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; |
@@ -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 { |
@@ -293,46 +293,46 @@ discard block |
||
293 | 293 | } |
294 | 294 | |
295 | 295 | return $response->setOutputFormat(null) |
296 | - ->setBody(function () use ($node, $encode, $offset, $length) { |
|
297 | - $mime = $node->getContentType(); |
|
298 | - $stream = $node->get(); |
|
299 | - $name = $node->getName(); |
|
300 | - |
|
301 | - if (null === $stream) { |
|
302 | - return; |
|
303 | - } |
|
304 | - |
|
305 | - if (0 !== $offset) { |
|
306 | - if (fseek($stream, $offset) === -1) { |
|
307 | - throw new Exception\Conflict('invalid offset requested', Exception\Conflict::INVALID_OFFSET); |
|
308 | - } |
|
309 | - } |
|
310 | - |
|
311 | - $read = 0; |
|
312 | - header('Content-Type: '.$mime.''); |
|
313 | - if ('base64' === $encode) { |
|
314 | - header('Content-Encoding: base64'); |
|
315 | - while (!feof($stream)) { |
|
316 | - if (0 !== $length && $read + 8192 > $length) { |
|
317 | - echo base64_encode(fread($stream, $length - $read)); |
|
318 | - exit(); |
|
319 | - } |
|
320 | - |
|
321 | - echo base64_encode(fread($stream, 8192)); |
|
322 | - $read += 8192; |
|
323 | - } |
|
324 | - } else { |
|
325 | - while (!feof($stream)) { |
|
326 | - if (0 !== $length && $read + 8192 > $length) { |
|
327 | - echo fread($stream, $length - $read); |
|
328 | - exit(); |
|
329 | - } |
|
330 | - |
|
331 | - echo fread($stream, 8192); |
|
332 | - $read += 8192; |
|
333 | - } |
|
334 | - } |
|
335 | - }); |
|
296 | + ->setBody(function () use ($node, $encode, $offset, $length) { |
|
297 | + $mime = $node->getContentType(); |
|
298 | + $stream = $node->get(); |
|
299 | + $name = $node->getName(); |
|
300 | + |
|
301 | + if (null === $stream) { |
|
302 | + return; |
|
303 | + } |
|
304 | + |
|
305 | + if (0 !== $offset) { |
|
306 | + if (fseek($stream, $offset) === -1) { |
|
307 | + throw new Exception\Conflict('invalid offset requested', Exception\Conflict::INVALID_OFFSET); |
|
308 | + } |
|
309 | + } |
|
310 | + |
|
311 | + $read = 0; |
|
312 | + header('Content-Type: '.$mime.''); |
|
313 | + if ('base64' === $encode) { |
|
314 | + header('Content-Encoding: base64'); |
|
315 | + while (!feof($stream)) { |
|
316 | + if (0 !== $length && $read + 8192 > $length) { |
|
317 | + echo base64_encode(fread($stream, $length - $read)); |
|
318 | + exit(); |
|
319 | + } |
|
320 | + |
|
321 | + echo base64_encode(fread($stream, 8192)); |
|
322 | + $read += 8192; |
|
323 | + } |
|
324 | + } else { |
|
325 | + while (!feof($stream)) { |
|
326 | + if (0 !== $length && $read + 8192 > $length) { |
|
327 | + echo fread($stream, $length - $read); |
|
328 | + exit(); |
|
329 | + } |
|
330 | + |
|
331 | + echo fread($stream, 8192); |
|
332 | + $read += 8192; |
|
333 | + } |
|
334 | + } |
|
335 | + }); |
|
336 | 336 | } |
337 | 337 | |
338 | 338 | /** |
@@ -1327,9 +1327,9 @@ discard block |
||
1327 | 1327 | $node->zip($archive); |
1328 | 1328 | } catch (\Exception $e) { |
1329 | 1329 | $this->logger->debug('failed zip node in multi node request ['.$node->getId().']', [ |
1330 | - 'category' => static::class, |
|
1331 | - 'exception' => $e, |
|
1332 | - ]); |
|
1330 | + 'category' => static::class, |
|
1331 | + 'exception' => $e, |
|
1332 | + ]); |
|
1333 | 1333 | } |
1334 | 1334 | } |
1335 | 1335 |
@@ -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); |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | } |
109 | 109 | } |
110 | 110 | |
111 | - return $this->bulk($id, function ($node) use ($parent, $conflict, $move) { |
|
111 | + return $this->bulk($id, function($node) use ($parent, $conflict, $move) { |
|
112 | 112 | if (true === $move) { |
113 | 113 | $node = $node->setParent($parent, $conflict); |
114 | 114 | } |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | return (new Response())->setCode(200)->setBody($result); |
176 | 176 | } |
177 | 177 | |
178 | - return $this->bulk($id, function ($node) use ($attributes) { |
|
178 | + return $this->bulk($id, function($node) use ($attributes) { |
|
179 | 179 | return [ |
180 | 180 | 'code' => 200, |
181 | 181 | 'data' => $this->node_decorator->decorate($node, $attributes), |
@@ -211,11 +211,11 @@ discard block |
||
211 | 211 | public function patch(string $id, ?string $name = null, ?array $meta = null, ?bool $readonly = null, ?array $filter = null, $lock = null): Response |
212 | 212 | { |
213 | 213 | $attributes = compact('name', 'meta', 'readonly', 'filter', 'lock'); |
214 | - $attributes = array_filter($attributes, function ($attribute) {return !is_null($attribute); }); |
|
214 | + $attributes = array_filter($attributes, function($attribute) {return !is_null($attribute); }); |
|
215 | 215 | |
216 | 216 | $lock = $_SERVER['HTTP_LOCK_TOKEN'] ?? null; |
217 | 217 | |
218 | - return $this->bulk($id, function ($node) use ($attributes, $lock) { |
|
218 | + return $this->bulk($id, function($node) use ($attributes, $lock) { |
|
219 | 219 | foreach ($attributes as $attribute => $value) { |
220 | 220 | switch ($attribute) { |
221 | 221 | case 'name': |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | throw new Exception\NotFound('destination collection was not found or is not a collection', Exception\NotFound::DESTINATION_NOT_FOUND); |
269 | 269 | } |
270 | 270 | |
271 | - return $this->bulk($id, function ($node) use ($parent, $conflict) { |
|
271 | + return $this->bulk($id, function($node) use ($parent, $conflict) { |
|
272 | 272 | $result = $node->copyTo($parent, $conflict); |
273 | 273 | |
274 | 274 | return [ |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | throw new Exception\NotFound('destination collection was not found or is not a collection', Exception\NotFound::DESTINATION_NOT_FOUND); |
293 | 293 | } |
294 | 294 | |
295 | - return $this->bulk($id, function ($node) use ($parent, $conflict) { |
|
295 | + return $this->bulk($id, function($node) use ($parent, $conflict) { |
|
296 | 296 | $result = $node->setParent($parent, $conflict); |
297 | 297 | |
298 | 298 | return [ |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | $at = $this->_verifyAttributes(['destroy' => $at])['destroy']; |
318 | 318 | } |
319 | 319 | |
320 | - return $this->bulk($id, function ($node) use ($force, $ignore_flag, $at) { |
|
320 | + return $this->bulk($id, function($node) use ($force, $ignore_flag, $at) { |
|
321 | 321 | if (null === $at) { |
322 | 322 | $node->delete($force && $node->isDeleted() || $force && $ignore_flag); |
323 | 323 | } else { |
@@ -457,9 +457,9 @@ |
||
457 | 457 | $node->zip($archive); |
458 | 458 | } catch (\Exception $e) { |
459 | 459 | $this->logger->debug('failed zip node in multi node request ['.$node->getId().']', [ |
460 | - 'category' => static::class, |
|
461 | - 'exception' => $e, |
|
462 | - ]); |
|
460 | + 'category' => static::class, |
|
461 | + 'exception' => $e, |
|
462 | + ]); |
|
463 | 463 | } |
464 | 464 | } |
465 | 465 |
@@ -69,7 +69,7 @@ |
||
69 | 69 | $tpl = new Template($type); |
70 | 70 | |
71 | 71 | $attributes = compact('readonly', 'meta'); |
72 | - $attributes = array_filter($attributes, function ($attribute) {return !is_null($attribute); }); |
|
72 | + $attributes = array_filter($attributes, function($attribute) {return !is_null($attribute); }); |
|
73 | 73 | |
74 | 74 | $stream = $tpl->get(); |
75 | 75 | $session = $this->session_factory->add($this->server->getIdentity(), $parent, $stream); |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | |
35 | 35 | $subscription = null; |
36 | 36 | |
37 | - $decorator->addDecorator('subscription', function ($node) use ($notifier, $server, &$subscription) { |
|
37 | + $decorator->addDecorator('subscription', function($node) use ($notifier, $server, &$subscription) { |
|
38 | 38 | $subscription = $notifier->getSubscription($node, $server->getIdentity()); |
39 | 39 | if ($subscription === null) { |
40 | 40 | return false; |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | return true; |
44 | 44 | }); |
45 | 45 | |
46 | - $decorator->addDecorator('subscription_exclude_me', function ($node) use (&$subscription) { |
|
46 | + $decorator->addDecorator('subscription_exclude_me', function($node) use (&$subscription) { |
|
47 | 47 | if ($subscription === null) { |
48 | 48 | return false; |
49 | 49 | } |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | return $subscription['exclude_me']; |
52 | 52 | }); |
53 | 53 | |
54 | - $decorator->addDecorator('subscription_recursive', function ($node) use (&$subscription) { |
|
54 | + $decorator->addDecorator('subscription_recursive', function($node) use (&$subscription) { |
|
55 | 55 | if (!($node instanceof Collection)) { |
56 | 56 | return null; |
57 | 57 | } |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | return $subscription['recursive']; |
64 | 64 | }); |
65 | 65 | |
66 | - $decorator->addDecorator('subscription_throttle', function ($node) use ($notifier, &$subscription) { |
|
66 | + $decorator->addDecorator('subscription_throttle', function($node) use ($notifier, &$subscription) { |
|
67 | 67 | if ($subscription === null) { |
68 | 68 | return $notifier->getThrottleTime(); |
69 | 69 | } |
@@ -420,7 +420,7 @@ |
||
420 | 420 | |
421 | 421 | if ($node instanceof Collection && $recursive === true) { |
422 | 422 | $db = $this->db; |
423 | - $node->doRecursiveAction(function ($child) use ($db, $node_id, $user_id) { |
|
423 | + $node->doRecursiveAction(function($child) use ($db, $node_id, $user_id) { |
|
424 | 424 | $db->subscription->deleteOne([ |
425 | 425 | 'user' => $user_id, |
426 | 426 | 'node' => $node_id, |