@@ -65,13 +65,13 @@ discard block |
||
| 65 | 65 | } |
| 66 | 66 | }); |
| 67 | 67 | |
| 68 | - $node_decorator_v2->addDecorator('sharelink_has_password', function ($node) use ($sharelink) { |
|
| 68 | + $node_decorator_v2->addDecorator('sharelink_has_password', function($node) use ($sharelink) { |
|
| 69 | 69 | $attributes = $sharelink->getSharelink($node); |
| 70 | 70 | |
| 71 | 71 | return isset($attributes['password']); |
| 72 | 72 | }); |
| 73 | 73 | |
| 74 | - $node_decorator_v2->addDecorator('sharelink_token', function ($node) use ($sharelink) { |
|
| 74 | + $node_decorator_v2->addDecorator('sharelink_token', function($node) use ($sharelink) { |
|
| 75 | 75 | $attributes = $sharelink->getSharelink($node); |
| 76 | 76 | |
| 77 | 77 | if (isset($attributes['token'])) { |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | } |
| 80 | 80 | }); |
| 81 | 81 | |
| 82 | - $node_decorator_v2->addDecorator('sharelink_expire', function ($node) use ($sharelink) { |
|
| 82 | + $node_decorator_v2->addDecorator('sharelink_expire', function($node) use ($sharelink) { |
|
| 83 | 83 | $attributes = $sharelink->getSharelink($node); |
| 84 | 84 | |
| 85 | 85 | if (isset($attributes['expiration'])) { |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | } |
| 90 | 90 | }); |
| 91 | 91 | |
| 92 | - $node_decorator_v1->addDecorator('sharelink', function ($node) use ($sharelink) { |
|
| 92 | + $node_decorator_v1->addDecorator('sharelink', function($node) use ($sharelink) { |
|
| 93 | 93 | return isset($sharelink->getSharelink($node)['token']); |
| 94 | 94 | }); |
| 95 | 95 | |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | * @param string $class Force set node type |
| 211 | 211 | * @param bool $multiple Allow $id to be an array |
| 212 | 212 | * @param bool $allow_root Allow instance of root collection |
| 213 | - * @param bool $deleted How to handle deleted node |
|
| 213 | + * @param integer $deleted How to handle deleted node |
|
| 214 | 214 | */ |
| 215 | 215 | protected function _getNode( |
| 216 | 216 | ?string $id = null, |
@@ -242,7 +242,7 @@ discard block |
||
| 242 | 242 | * @param string $id |
| 243 | 243 | * @param string $path |
| 244 | 244 | * @param string $class Force set node type |
| 245 | - * @param bool $deleted How to handle deleted node |
|
| 245 | + * @param integer $deleted How to handle deleted node |
|
| 246 | 246 | */ |
| 247 | 247 | protected function _getNodes( |
| 248 | 248 | $id = null, |
@@ -278,49 +278,49 @@ discard block |
||
| 278 | 278 | } |
| 279 | 279 | |
| 280 | 280 | return $response->setOutputFormat(null) |
| 281 | - ->setBody(function () use ($node, $encode, $offset, $length) { |
|
| 282 | - $mime = $node->getContentType(); |
|
| 283 | - $stream = $node->get(); |
|
| 284 | - $name = $node->getName(); |
|
| 285 | - |
|
| 286 | - if (null === $stream) { |
|
| 287 | - return; |
|
| 288 | - } |
|
| 289 | - |
|
| 290 | - if (0 !== $offset) { |
|
| 291 | - if (fseek($stream, $offset) === -1) { |
|
| 292 | - throw new Exception\Conflict( |
|
| 281 | + ->setBody(function () use ($node, $encode, $offset, $length) { |
|
| 282 | + $mime = $node->getContentType(); |
|
| 283 | + $stream = $node->get(); |
|
| 284 | + $name = $node->getName(); |
|
| 285 | + |
|
| 286 | + if (null === $stream) { |
|
| 287 | + return; |
|
| 288 | + } |
|
| 289 | + |
|
| 290 | + if (0 !== $offset) { |
|
| 291 | + if (fseek($stream, $offset) === -1) { |
|
| 292 | + throw new Exception\Conflict( |
|
| 293 | 293 | 'invalid offset requested', |
| 294 | 294 | Exception\Conflict::INVALID_OFFSET |
| 295 | 295 | ); |
| 296 | - } |
|
| 297 | - } |
|
| 298 | - |
|
| 299 | - $read = 0; |
|
| 300 | - header('Content-Type: '.$mime.''); |
|
| 301 | - if ('base64' === $encode) { |
|
| 302 | - header('Content-Encoding: base64'); |
|
| 303 | - while (!feof($stream)) { |
|
| 304 | - if (0 !== $length && $read + 8192 > $length) { |
|
| 305 | - echo base64_encode(fread($stream, $length - $read)); |
|
| 306 | - exit(); |
|
| 307 | - } |
|
| 308 | - |
|
| 309 | - echo base64_encode(fread($stream, 8192)); |
|
| 310 | - $read += 8192; |
|
| 311 | - } |
|
| 312 | - } else { |
|
| 313 | - while (!feof($stream)) { |
|
| 314 | - if (0 !== $length && $read + 8192 > $length) { |
|
| 315 | - echo fread($stream, $length - $read); |
|
| 316 | - exit(); |
|
| 317 | - } |
|
| 318 | - |
|
| 319 | - echo fread($stream, 8192); |
|
| 320 | - $read += 8192; |
|
| 321 | - } |
|
| 322 | - } |
|
| 323 | - }); |
|
| 296 | + } |
|
| 297 | + } |
|
| 298 | + |
|
| 299 | + $read = 0; |
|
| 300 | + header('Content-Type: '.$mime.''); |
|
| 301 | + if ('base64' === $encode) { |
|
| 302 | + header('Content-Encoding: base64'); |
|
| 303 | + while (!feof($stream)) { |
|
| 304 | + if (0 !== $length && $read + 8192 > $length) { |
|
| 305 | + echo base64_encode(fread($stream, $length - $read)); |
|
| 306 | + exit(); |
|
| 307 | + } |
|
| 308 | + |
|
| 309 | + echo base64_encode(fread($stream, 8192)); |
|
| 310 | + $read += 8192; |
|
| 311 | + } |
|
| 312 | + } else { |
|
| 313 | + while (!feof($stream)) { |
|
| 314 | + if (0 !== $length && $read + 8192 > $length) { |
|
| 315 | + echo fread($stream, $length - $read); |
|
| 316 | + exit(); |
|
| 317 | + } |
|
| 318 | + |
|
| 319 | + echo fread($stream, 8192); |
|
| 320 | + $read += 8192; |
|
| 321 | + } |
|
| 322 | + } |
|
| 323 | + }); |
|
| 324 | 324 | } |
| 325 | 325 | |
| 326 | 326 | /** |
@@ -1321,9 +1321,9 @@ discard block |
||
| 1321 | 1321 | $node->zip($archive); |
| 1322 | 1322 | } catch (\Exception $e) { |
| 1323 | 1323 | $this->logger->debug('failed zip node in multi node request ['.$node->getId().']', [ |
| 1324 | - 'category' => get_class($this), |
|
| 1325 | - 'exception' => $e, |
|
| 1326 | - ]); |
|
| 1324 | + 'category' => get_class($this), |
|
| 1325 | + 'exception' => $e, |
|
| 1326 | + ]); |
|
| 1327 | 1327 | } |
| 1328 | 1328 | } |
| 1329 | 1329 | |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | } |
| 184 | 184 | } |
| 185 | 185 | |
| 186 | - return $this->bulk($id, $p, function ($node) use ($parent, $conflict, $move) { |
|
| 186 | + return $this->bulk($id, $p, function($node) use ($parent, $conflict, $move) { |
|
| 187 | 187 | if (true === $move) { |
| 188 | 188 | $node = $node->setParent($parent, $conflict); |
| 189 | 189 | } |
@@ -260,7 +260,7 @@ discard block |
||
| 260 | 260 | |
| 261 | 261 | $node = $this->_getNode($id, $p); |
| 262 | 262 | if ($node instanceof Collection) { |
| 263 | - return (new Response())->setBody(function () use ($node) { |
|
| 263 | + return (new Response())->setBody(function() use ($node) { |
|
| 264 | 264 | $node->getZip(); |
| 265 | 265 | }); |
| 266 | 266 | } |
@@ -278,7 +278,7 @@ discard block |
||
| 278 | 278 | } |
| 279 | 279 | |
| 280 | 280 | return $response->setOutputFormat(null) |
| 281 | - ->setBody(function () use ($node, $encode, $offset, $length) { |
|
| 281 | + ->setBody(function() use ($node, $encode, $offset, $length) { |
|
| 282 | 282 | $mime = $node->getContentType(); |
| 283 | 283 | $stream = $node->get(); |
| 284 | 284 | $name = $node->getName(); |
@@ -349,7 +349,7 @@ discard block |
||
| 349 | 349 | */ |
| 350 | 350 | public function postReadonly($id = null, $p = null, bool $readonly = true): Response |
| 351 | 351 | { |
| 352 | - return $this->bulk($id, $p, function ($node) use ($readonly) { |
|
| 352 | + return $this->bulk($id, $p, function($node) use ($readonly) { |
|
| 353 | 353 | $node->setReadonly($readonly); |
| 354 | 354 | |
| 355 | 355 | return ['status' => 204]; |
@@ -594,7 +594,7 @@ discard block |
||
| 594 | 594 | */ |
| 595 | 595 | public function postMetaAttributes(?string $id = null, ?string $p = null): Response |
| 596 | 596 | { |
| 597 | - return $this->bulk($id, $p, function ($node) { |
|
| 597 | + return $this->bulk($id, $p, function($node) { |
|
| 598 | 598 | $node->setMetaAttributes($_POST); |
| 599 | 599 | |
| 600 | 600 | return ['status' => 204]; |
@@ -676,7 +676,7 @@ discard block |
||
| 676 | 676 | ); |
| 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 [ |
@@ -737,7 +737,7 @@ discard block |
||
| 737 | 737 | ); |
| 738 | 738 | } |
| 739 | 739 | |
| 740 | - return $this->bulk($id, $p, function ($node) use ($parent, $conflict) { |
|
| 740 | + return $this->bulk($id, $p, function($node) use ($parent, $conflict) { |
|
| 741 | 741 | $result = $node->setParent($parent, $conflict); |
| 742 | 742 | if (NodeInterface::CONFLICT_RENAME === $conflict) { |
| 743 | 743 | return [ |
@@ -792,7 +792,7 @@ discard block |
||
| 792 | 792 | $at = $this->_verifyAttributes(['destroy' => $at])['destroy']; |
| 793 | 793 | } |
| 794 | 794 | |
| 795 | - return $this->bulk($id, $p, function ($node) use ($force, $ignore_flag, $at) { |
|
| 795 | + return $this->bulk($id, $p, function($node) use ($force, $ignore_flag, $at) { |
|
| 796 | 796 | if (null === $at) { |
| 797 | 797 | $node->delete($force && $node->isDeleted() || $force && $ignore_flag); |
| 798 | 798 | } else { |
@@ -115,7 +115,7 @@ |
||
| 115 | 115 | * |
| 116 | 116 | * @param string $id |
| 117 | 117 | * @param string $p |
| 118 | - * @param string $version |
|
| 118 | + * @param integer $version |
|
| 119 | 119 | */ |
| 120 | 120 | public function postRestore(int $version, ?string $id = null, ?string $p = null): Response |
| 121 | 121 | { |
@@ -281,7 +281,7 @@ discard block |
||
| 281 | 281 | |
| 282 | 282 | if ($index === $chunks) { |
| 283 | 283 | $attributes = compact('changed', 'created', 'readonly', 'meta', 'acl'); |
| 284 | - $attributes = array_filter($attributes, function ($attribute) {return !is_null($attribute); }); |
|
| 284 | + $attributes = array_filter($attributes, function($attribute) {return !is_null($attribute); }); |
|
| 285 | 285 | $attributes = $this->_verifyAttributes($attributes); |
| 286 | 286 | |
| 287 | 287 | return $this->_put($session, $id, $p, $collection, $name, $attributes, $conflict); |
@@ -395,7 +395,7 @@ discard block |
||
| 395 | 395 | $session = $this->storage->storeTemporaryFile($input, $this->server->getIdentity()); |
| 396 | 396 | |
| 397 | 397 | $attributes = compact('changed', 'created', 'readonly', 'meta', 'acl'); |
| 398 | - $attributes = array_filter($attributes, function ($attribute) {return !is_null($attribute); }); |
|
| 398 | + $attributes = array_filter($attributes, function($attribute) {return !is_null($attribute); }); |
|
| 399 | 399 | $attributes = $this->_verifyAttributes($attributes); |
| 400 | 400 | |
| 401 | 401 | return $this->_put($session, $id, $p, $collection, $name, $attributes, $conflict); |
@@ -256,9 +256,9 @@ |
||
| 256 | 256 | $body->setParts([$html, $plain]); |
| 257 | 257 | |
| 258 | 258 | $mail = (new Message()) |
| 259 | - ->setSubject($message->getSubject()) |
|
| 260 | - ->setBody($body) |
|
| 261 | - ->setEncoding('UTF-8'); |
|
| 259 | + ->setSubject($message->getSubject()) |
|
| 260 | + ->setBody($body) |
|
| 261 | + ->setEncoding('UTF-8'); |
|
| 262 | 262 | |
| 263 | 263 | $type = $mail->getHeaders()->get('Content-Type'); |
| 264 | 264 | $type->setType('multipart/alternative'); |
@@ -370,7 +370,7 @@ discard block |
||
| 370 | 370 | } |
| 371 | 371 | |
| 372 | 372 | $attributes = compact('password', 'soft_quota', 'hard_quota', 'avatar', 'mail', 'admin', 'namespace', 'locale', 'optional'); |
| 373 | - $attributes = array_filter($attributes, function ($attribute) {return !is_null($attribute); }); |
|
| 373 | + $attributes = array_filter($attributes, function($attribute) {return !is_null($attribute); }); |
|
| 374 | 374 | |
| 375 | 375 | if (isset($attributes['avatar'])) { |
| 376 | 376 | $attributes['avatar'] = new Binary(base64_decode($attributes['avatar']), Binary::TYPE_GENERIC); |
@@ -415,7 +415,7 @@ discard block |
||
| 415 | 415 | public function patch(?string $id = null, ?string $uname = null, ?string $username = null, ?string $password = null, ?int $soft_quota = null, ?int $hard_quota = null, ?string $avatar = null, ?string $mail = null, ?bool $admin = null, ?string $namespace = null, ?string $locale = null, ?array $optional = null): Response |
| 416 | 416 | { |
| 417 | 417 | $attributes = compact('username', 'password', 'soft_quota', 'hard_quota', 'avatar', 'mail', 'admin', 'namespace', 'locale', 'optional'); |
| 418 | - $attributes = array_filter($attributes, function ($attribute) {return !is_null($attribute); }); |
|
| 418 | + $attributes = array_filter($attributes, function($attribute) {return !is_null($attribute); }); |
|
| 419 | 419 | |
| 420 | 420 | if (isset($attributes['avatar'])) { |
| 421 | 421 | $attributes['avatar'] = new Binary(base64_decode($attributes['avatar']), Binary::TYPE_GENERIC); |
@@ -147,6 +147,7 @@ |
||
| 147 | 147 | |
| 148 | 148 | /** |
| 149 | 149 | * Store file. |
| 150 | + * @param string $adapter |
|
| 150 | 151 | */ |
| 151 | 152 | public function storeFile(File $file, ObjectId $session, ?string &$adapter = null) |
| 152 | 153 | { |
@@ -367,7 +367,7 @@ |
||
| 367 | 367 | |
| 368 | 368 | throw new Exception\InsufficientStorage( |
| 369 | 369 | 'user quota is full', |
| 370 | - Exception\InsufficientStorage::USER_QUOTA_FULL |
|
| 370 | + Exception\InsufficientStorage::USER_QUOTA_FULL |
|
| 371 | 371 | ); |
| 372 | 372 | } |
| 373 | 373 | |
@@ -161,7 +161,7 @@ |
||
| 161 | 161 | $tpl = new Template($type); |
| 162 | 162 | |
| 163 | 163 | $attributes = compact('readonly', 'meta'); |
| 164 | - $attributes = array_filter($attributes, function ($attribute) {return !is_null($attribute); }); |
|
| 164 | + $attributes = array_filter($attributes, function($attribute) {return !is_null($attribute); }); |
|
| 165 | 165 | |
| 166 | 166 | $session = $parent->temporarySession($tpl->get()); |
| 167 | 167 | $result = $parent->addFile($name, $session, $attributes); |
@@ -287,7 +287,7 @@ |
||
| 287 | 287 | * Load nodes by id. |
| 288 | 288 | * |
| 289 | 289 | * @param string $class Force check node type |
| 290 | - * @param bool $deleted |
|
| 290 | + * @param integer $deleted |
|
| 291 | 291 | */ |
| 292 | 292 | public function findNodesById(array $id = [], ?string $class = null, int $deleted = NodeInterface::DELETED_INCLUDE): Generator |
| 293 | 293 | { |