@@ -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'); |
@@ -533,7 +533,7 @@ discard block |
||
533 | 533 | |
534 | 534 | $this->identity = $user; |
535 | 535 | $user->updateIdentity($identity) |
536 | - ->updateShares(); |
|
536 | + ->updateShares(); |
|
537 | 537 | $this->hook->run('postServerIdentity', [$user]); |
538 | 538 | |
539 | 539 | return true; |
@@ -642,7 +642,7 @@ discard block |
||
642 | 642 | public function getGroupByName(string $name): Group |
643 | 643 | { |
644 | 644 | $group = $this->db->group->findOne([ |
645 | - 'name' => $name, |
|
645 | + 'name' => $name, |
|
646 | 646 | ]); |
647 | 647 | |
648 | 648 | if (null === $group) { |
@@ -664,7 +664,7 @@ discard block |
||
664 | 664 | } |
665 | 665 | |
666 | 666 | $group = $this->db->group->findOne([ |
667 | - '_id' => $id, |
|
667 | + '_id' => $id, |
|
668 | 668 | ]); |
669 | 669 | |
670 | 670 | if (null === $group) { |
@@ -127,20 +127,20 @@ discard block |
||
127 | 127 | 'mime' => (string) $attributes['mime'], |
128 | 128 | 'readonly' => (bool) $attributes['readonly'], |
129 | 129 | 'directory' => $node instanceof Collection, |
130 | - 'meta' => function ($node) { |
|
130 | + 'meta' => function($node) { |
|
131 | 131 | return (object) $node->getMetaAttributes(); |
132 | 132 | }, |
133 | - 'size' => function ($node) { |
|
133 | + 'size' => function($node) { |
|
134 | 134 | return $node->getSize(); |
135 | 135 | }, |
136 | - 'path' => function ($node) { |
|
136 | + 'path' => function($node) { |
|
137 | 137 | try { |
138 | 138 | return $node->getPath(); |
139 | 139 | } catch (\Exception $e) { |
140 | 140 | return null; |
141 | 141 | } |
142 | 142 | }, |
143 | - 'parent' => function ($node) { |
|
143 | + 'parent' => function($node) { |
|
144 | 144 | $parent = $node->getParent(); |
145 | 145 | |
146 | 146 | if (null === $parent || $parent->isRoot()) { |
@@ -149,10 +149,10 @@ discard block |
||
149 | 149 | |
150 | 150 | return (string) $parent->getId(); |
151 | 151 | }, |
152 | - 'access' => function ($node) use ($acl) { |
|
152 | + 'access' => function($node) use ($acl) { |
|
153 | 153 | return $acl->getAclPrivilege($node); |
154 | 154 | }, |
155 | - 'share' => function ($node) { |
|
155 | + 'share' => function($node) { |
|
156 | 156 | if (!$node->isShared() && !$node->isSpecial()) { |
157 | 157 | return false; |
158 | 158 | } |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | return false; |
164 | 164 | } |
165 | 165 | }, |
166 | - 'shareowner' => function ($node) use ($server, $fs) { |
|
166 | + 'shareowner' => function($node) use ($server, $fs) { |
|
167 | 167 | if (!$node->isSpecial()) { |
168 | 168 | return null; |
169 | 169 | } |
@@ -206,20 +206,20 @@ discard block |
||
206 | 206 | protected function getTimeAttributes(NodeInterface $node, array $attributes): array |
207 | 207 | { |
208 | 208 | return [ |
209 | - 'created' => function ($node) use ($attributes) { |
|
209 | + 'created' => function($node) use ($attributes) { |
|
210 | 210 | return $this->dateTimeToUnix($attributes['created']); |
211 | 211 | }, |
212 | - 'changed' => function ($node) use ($attributes) { |
|
212 | + 'changed' => function($node) use ($attributes) { |
|
213 | 213 | return $this->dateTimeToUnix($attributes['changed']); |
214 | 214 | }, |
215 | - 'deleted' => function ($node) use ($attributes) { |
|
215 | + 'deleted' => function($node) use ($attributes) { |
|
216 | 216 | if (false === $attributes['deleted']) { |
217 | 217 | return false; |
218 | 218 | } |
219 | 219 | |
220 | 220 | return $this->dateTimeToUnix($attributes['deleted']); |
221 | 221 | }, |
222 | - 'destroy' => function ($node) use ($attributes) { |
|
222 | + 'destroy' => function($node) use ($attributes) { |
|
223 | 223 | if (null === $attributes['destroy']) { |
224 | 224 | return null; |
225 | 225 | } |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | 'message' => (string) $message['body'], |
99 | 99 | 'subject' => (string) $message['subject'], |
100 | 100 | 'locale' => (string) $message['locale'], |
101 | - 'sender' => function ($message) use ($server, $role_decorator) { |
|
101 | + 'sender' => function($message) use ($server, $role_decorator) { |
|
102 | 102 | if (!isset($message['sender'])) { |
103 | 103 | return null; |
104 | 104 | } |
@@ -109,10 +109,10 @@ discard block |
||
109 | 109 | return null; |
110 | 110 | } |
111 | 111 | }, |
112 | - 'created' => function ($message) { |
|
112 | + 'created' => function($message) { |
|
113 | 113 | return (new DateTime())->setTimestamp($message['_id']->getTimestamp())->format('c'); |
114 | 114 | }, |
115 | - 'node' => function ($message) use ($node_decorator, $fs) { |
|
115 | + 'node' => function($message) use ($node_decorator, $fs) { |
|
116 | 116 | if (isset($message['node'])) { |
117 | 117 | try { |
118 | 118 | return $node_decorator->decorate($fs->findNodeById($message['node']), ['id', 'name', '_links']); |
@@ -54,7 +54,7 @@ |
||
54 | 54 | */ |
55 | 55 | protected function setErrorHandler(LoggerInterface $logger): self |
56 | 56 | { |
57 | - set_error_handler(function ($severity, $message, $file, $line) use ($logger) { |
|
57 | + set_error_handler(function($severity, $message, $file, $line) use ($logger) { |
|
58 | 58 | $log = $message.' in '.$file.':'.$line; |
59 | 59 | |
60 | 60 | switch ($severity) { |
@@ -246,7 +246,7 @@ |
||
246 | 246 | $delta[$share_member->getPath()] = $share_member; |
247 | 247 | } |
248 | 248 | } elseif ('undeleteCollection' === $log['operation'] || 'undeleteCollectionShare' === $log['operation']) { |
249 | - $log_node->doRecursiveAction(function ($sub_node) use (&$delta) { |
|
249 | + $log_node->doRecursiveAction(function($sub_node) use (&$delta) { |
|
250 | 250 | $delta[$sub_node->getPath()] = $sub_node; |
251 | 251 | }); |
252 | 252 | } |
@@ -958,9 +958,9 @@ |
||
958 | 958 | $node->zip($archive); |
959 | 959 | } catch (\Exception $e) { |
960 | 960 | $this->logger->debug('failed zip node in multi node request ['.$node->getId().']', [ |
961 | - 'category' => get_class($this), |
|
962 | - 'exception' => $e, |
|
963 | - ]); |
|
961 | + 'category' => get_class($this), |
|
962 | + 'exception' => $e, |
|
963 | + ]); |
|
964 | 964 | } |
965 | 965 | } |
966 | 966 |
@@ -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 { |
@@ -35,7 +35,7 @@ |
||
35 | 35 | |
36 | 36 | return $response |
37 | 37 | ->setOutputFormat(null) |
38 | - ->setBody(function () use ($file) { |
|
38 | + ->setBody(function() use ($file) { |
|
39 | 39 | $stream = $file->get(); |
40 | 40 | $name = $file->getName(); |
41 | 41 |
@@ -40,69 +40,69 @@ |
||
40 | 40 | } |
41 | 41 | |
42 | 42 | return $response |
43 | - ->setOutputFormat(null) |
|
44 | - ->setBody(function () use ($file) { |
|
45 | - $stream = $file->get(); |
|
46 | - $name = $file->getName(); |
|
47 | - |
|
48 | - if (null === $stream) { |
|
49 | - return; |
|
50 | - } |
|
51 | - |
|
52 | - $size = $file->getSize(); |
|
53 | - $length = $size; |
|
54 | - $start = 0; |
|
55 | - $end = $size - 1; |
|
56 | - |
|
57 | - set_time_limit(0); |
|
58 | - if (isset($_SERVER['HTTP_RANGE']) && strpos($_SERVER['HTTP_RANGE'], '=') !== false) { |
|
59 | - header('Accept-Ranges: bytes'); |
|
60 | - $c_start = $start; |
|
61 | - $c_end = $end; |
|
62 | - list(, $range) = explode('=', $_SERVER['HTTP_RANGE'], 2); |
|
63 | - |
|
64 | - if (strpos($range, ',') !== false) { |
|
65 | - header("Content-Range: bytes $start-$end/$size"); |
|
66 | - |
|
67 | - throw new Exception\InvalidRange('invalid offset/limit requested'); |
|
68 | - } |
|
69 | - |
|
70 | - if ($range == '-') { |
|
71 | - $c_start = $size - substr($range, 1); |
|
72 | - } else { |
|
73 | - $range = explode('-', $range); |
|
74 | - $c_start = $range[0]; |
|
75 | - $c_end = (isset($range[1]) && is_numeric($range[1])) ? $range[1] : $size; |
|
76 | - } |
|
77 | - |
|
78 | - $c_end = ($c_end > $end) ? $end : $c_end; |
|
79 | - if ($c_start > $c_end || $c_start > $size - 1 || $c_end >= $size) { |
|
80 | - header("Content-Range: bytes $start-$end/$size"); |
|
81 | - |
|
82 | - throw new Exception\InvalidRange('invalid offset/limit requested'); |
|
83 | - } |
|
84 | - |
|
85 | - $start = (int) $c_start; |
|
86 | - $end = (int) $c_end; |
|
87 | - $length = (int) $end - $start + 1; |
|
88 | - fseek($stream, $start); |
|
89 | - header('HTTP/1.1 206 Partial Content'); |
|
90 | - header("Content-Range: bytes $start-$end/$size"); |
|
91 | - } |
|
92 | - |
|
93 | - header('Content-Length: '.$length); |
|
94 | - $buffer = 1024 * 8; |
|
95 | - |
|
96 | - while (!feof($stream) && ($p = ftell($stream)) <= $end) { |
|
97 | - if ($p + $buffer > $end) { |
|
98 | - $buffer = $end - $p + 1; |
|
99 | - } |
|
100 | - |
|
101 | - echo fread($stream, $buffer); |
|
102 | - flush(); |
|
103 | - } |
|
104 | - |
|
105 | - fclose($stream); |
|
106 | - }); |
|
43 | + ->setOutputFormat(null) |
|
44 | + ->setBody(function () use ($file) { |
|
45 | + $stream = $file->get(); |
|
46 | + $name = $file->getName(); |
|
47 | + |
|
48 | + if (null === $stream) { |
|
49 | + return; |
|
50 | + } |
|
51 | + |
|
52 | + $size = $file->getSize(); |
|
53 | + $length = $size; |
|
54 | + $start = 0; |
|
55 | + $end = $size - 1; |
|
56 | + |
|
57 | + set_time_limit(0); |
|
58 | + if (isset($_SERVER['HTTP_RANGE']) && strpos($_SERVER['HTTP_RANGE'], '=') !== false) { |
|
59 | + header('Accept-Ranges: bytes'); |
|
60 | + $c_start = $start; |
|
61 | + $c_end = $end; |
|
62 | + list(, $range) = explode('=', $_SERVER['HTTP_RANGE'], 2); |
|
63 | + |
|
64 | + if (strpos($range, ',') !== false) { |
|
65 | + header("Content-Range: bytes $start-$end/$size"); |
|
66 | + |
|
67 | + throw new Exception\InvalidRange('invalid offset/limit requested'); |
|
68 | + } |
|
69 | + |
|
70 | + if ($range == '-') { |
|
71 | + $c_start = $size - substr($range, 1); |
|
72 | + } else { |
|
73 | + $range = explode('-', $range); |
|
74 | + $c_start = $range[0]; |
|
75 | + $c_end = (isset($range[1]) && is_numeric($range[1])) ? $range[1] : $size; |
|
76 | + } |
|
77 | + |
|
78 | + $c_end = ($c_end > $end) ? $end : $c_end; |
|
79 | + if ($c_start > $c_end || $c_start > $size - 1 || $c_end >= $size) { |
|
80 | + header("Content-Range: bytes $start-$end/$size"); |
|
81 | + |
|
82 | + throw new Exception\InvalidRange('invalid offset/limit requested'); |
|
83 | + } |
|
84 | + |
|
85 | + $start = (int) $c_start; |
|
86 | + $end = (int) $c_end; |
|
87 | + $length = (int) $end - $start + 1; |
|
88 | + fseek($stream, $start); |
|
89 | + header('HTTP/1.1 206 Partial Content'); |
|
90 | + header("Content-Range: bytes $start-$end/$size"); |
|
91 | + } |
|
92 | + |
|
93 | + header('Content-Length: '.$length); |
|
94 | + $buffer = 1024 * 8; |
|
95 | + |
|
96 | + while (!feof($stream) && ($p = ftell($stream)) <= $end) { |
|
97 | + if ($p + $buffer > $end) { |
|
98 | + $buffer = $end - $p + 1; |
|
99 | + } |
|
100 | + |
|
101 | + echo fread($stream, $buffer); |
|
102 | + flush(); |
|
103 | + } |
|
104 | + |
|
105 | + fclose($stream); |
|
106 | + }); |
|
107 | 107 | } |
108 | 108 | } |
@@ -49,7 +49,7 @@ |
||
49 | 49 | $this->db->storage->updateOne( |
50 | 50 | ['_id' => $object['_id']], |
51 | 51 | [ |
52 | - '$set' => ['pointer' => $pointer], |
|
52 | + '$set' => ['pointer' => $pointer], |
|
53 | 53 | ] |
54 | 54 | ); |
55 | 55 | } |