@@ -130,17 +130,17 @@ discard block |
||
130 | 130 | * @return Mount|null |
131 | 131 | * @throws \Doctrine\DBAL\DBALException |
132 | 132 | */ |
133 | - public function addShare($remote, $token, $password, $name, $owner, $shareType, $accepted=false, $user = null, $remoteId = -1, $parent = -1) { |
|
133 | + public function addShare($remote, $token, $password, $name, $owner, $shareType, $accepted = false, $user = null, $remoteId = -1, $parent = -1) { |
|
134 | 134 | $user = $user ? $user : $this->uid; |
135 | 135 | $accepted = $accepted ? IShare::STATUS_ACCEPTED : IShare::STATUS_PENDING; |
136 | - $name = Filesystem::normalizePath('/' . $name); |
|
136 | + $name = Filesystem::normalizePath('/'.$name); |
|
137 | 137 | |
138 | 138 | if ($accepted !== IShare::STATUS_ACCEPTED) { |
139 | 139 | // To avoid conflicts with the mount point generation later, |
140 | 140 | // we only use a temporary mount point name here. The real |
141 | 141 | // mount point name will be generated when accepting the share, |
142 | 142 | // using the original share item name. |
143 | - $tmpMountPointName = '{{TemporaryMountPointName#' . $name . '}}'; |
|
143 | + $tmpMountPointName = '{{TemporaryMountPointName#'.$name.'}}'; |
|
144 | 144 | $mountPoint = $tmpMountPointName; |
145 | 145 | $hash = md5($tmpMountPointName); |
146 | 146 | $data = [ |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | $i = 1; |
161 | 161 | while (!$this->connection->insertIfNotExist('*PREFIX*share_external', $data, ['user', 'mountpoint_hash'])) { |
162 | 162 | // The external share already exists for the user |
163 | - $data['mountpoint'] = $tmpMountPointName . '-' . $i; |
|
163 | + $data['mountpoint'] = $tmpMountPointName.'-'.$i; |
|
164 | 164 | $data['mountpoint_hash'] = md5($data['mountpoint']); |
165 | 165 | $i++; |
166 | 166 | } |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | } |
169 | 169 | |
170 | 170 | $mountPoint = Files::buildNotExistingFileName('/', $name); |
171 | - $mountPoint = Filesystem::normalizePath('/' . $mountPoint); |
|
171 | + $mountPoint = Filesystem::normalizePath('/'.$mountPoint); |
|
172 | 172 | $hash = md5($mountPoint); |
173 | 173 | |
174 | 174 | $this->writeShareToDb($remote, $token, $password, $name, $owner, $user, $mountPoint, $hash, $accepted, $remoteId, $parent, $shareType); |
@@ -227,9 +227,9 @@ discard block |
||
227 | 227 | $validShare = is_array($share) && isset($share['share_type']) && isset($share['user']); |
228 | 228 | |
229 | 229 | // check if the user is allowed to access it |
230 | - if ($validShare && (int)$share['share_type'] === IShare::TYPE_USER && $share['user'] === $this->uid) { |
|
230 | + if ($validShare && (int) $share['share_type'] === IShare::TYPE_USER && $share['user'] === $this->uid) { |
|
231 | 231 | return $share; |
232 | - } elseif ($validShare && (int)$share['share_type'] === IShare::TYPE_GROUP) { |
|
232 | + } elseif ($validShare && (int) $share['share_type'] === IShare::TYPE_GROUP) { |
|
233 | 233 | $user = $this->userManager->get($this->uid); |
234 | 234 | if ($this->groupManager->get($share['user'])->inGroup($user)) { |
235 | 235 | return $share; |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | $hash = md5($mountPoint); |
258 | 258 | $userShareAccepted = false; |
259 | 259 | |
260 | - if ((int)$share['share_type'] === IShare::TYPE_USER) { |
|
260 | + if ((int) $share['share_type'] === IShare::TYPE_USER) { |
|
261 | 261 | $acceptShare = $this->connection->prepare(' |
262 | 262 | UPDATE `*PREFIX*share_external` |
263 | 263 | SET `accepted` = ?, |
@@ -302,7 +302,7 @@ discard block |
||
302 | 302 | $share = $this->getShare($id); |
303 | 303 | $result = false; |
304 | 304 | |
305 | - if ($share && (int)$share['share_type'] === IShare::TYPE_USER) { |
|
305 | + if ($share && (int) $share['share_type'] === IShare::TYPE_USER) { |
|
306 | 306 | $removeShare = $this->connection->prepare(' |
307 | 307 | DELETE FROM `*PREFIX*share_external` WHERE `id` = ? AND `user` = ?'); |
308 | 308 | $removeShare->execute([$id, $this->uid]); |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | |
311 | 311 | $this->processNotification($id); |
312 | 312 | $result = true; |
313 | - } elseif ($share && (int)$share['share_type'] === IShare::TYPE_GROUP) { |
|
313 | + } elseif ($share && (int) $share['share_type'] === IShare::TYPE_GROUP) { |
|
314 | 314 | $result = $this->writeShareToDb( |
315 | 315 | $share['remote'], |
316 | 316 | $share['share_token'], |
@@ -360,7 +360,7 @@ discard block |
||
360 | 360 | $federationEndpoints = $this->discoveryService->discover($remote, 'FEDERATED_SHARING'); |
361 | 361 | $endpoint = isset($federationEndpoints['share']) ? $federationEndpoints['share'] : '/ocs/v2.php/cloud/shares'; |
362 | 362 | |
363 | - $url = rtrim($remote, '/') . $endpoint . '/' . $remoteId . '/' . $feedback . '?format=' . Share::RESPONSE_FORMAT; |
|
363 | + $url = rtrim($remote, '/').$endpoint.'/'.$remoteId.'/'.$feedback.'?format='.Share::RESPONSE_FORMAT; |
|
364 | 364 | $fields = ['token' => $token]; |
365 | 365 | |
366 | 366 | $client = $this->clientService->newClient(); |
@@ -432,13 +432,13 @@ discard block |
||
432 | 432 | * @return string |
433 | 433 | */ |
434 | 434 | protected function stripPath($path) { |
435 | - $prefix = '/' . $this->uid . '/files'; |
|
435 | + $prefix = '/'.$this->uid.'/files'; |
|
436 | 436 | return rtrim(substr($path, strlen($prefix)), '/'); |
437 | 437 | } |
438 | 438 | |
439 | 439 | public function getMount($data) { |
440 | 440 | $data['manager'] = $this; |
441 | - $mountPoint = '/' . $this->uid . '/files' . $data['mountpoint']; |
|
441 | + $mountPoint = '/'.$this->uid.'/files'.$data['mountpoint']; |
|
442 | 442 | $data['mountpoint'] = $mountPoint; |
443 | 443 | $data['certificateManager'] = \OC::$server->getCertificateManager($this->uid); |
444 | 444 | return new Mount(self::STORAGE, $mountPoint, $data, $this, $this->storageLoader); |
@@ -478,7 +478,7 @@ discard block |
||
478 | 478 | WHERE `mountpoint_hash` = ? |
479 | 479 | AND `user` = ? |
480 | 480 | '); |
481 | - $result = (bool)$query->execute([$target, $targetHash, $sourceHash, $this->uid]); |
|
481 | + $result = (bool) $query->execute([$target, $targetHash, $sourceHash, $this->uid]); |
|
482 | 482 | |
483 | 483 | return $result; |
484 | 484 | } |
@@ -498,7 +498,7 @@ discard block |
||
498 | 498 | |
499 | 499 | $share = $getShare->fetch(); |
500 | 500 | $getShare->closeCursor(); |
501 | - if ($result && $share !== false && (int)$share['share_type'] === IShare::TYPE_USER) { |
|
501 | + if ($result && $share !== false && (int) $share['share_type'] === IShare::TYPE_USER) { |
|
502 | 502 | try { |
503 | 503 | $this->sendFeedbackToRemote($share['remote'], $share['share_token'], $share['remote_id'], 'decline'); |
504 | 504 | } catch (\Throwable $e) { |
@@ -510,13 +510,13 @@ discard block |
||
510 | 510 | DELETE FROM `*PREFIX*share_external` |
511 | 511 | WHERE `id` = ? |
512 | 512 | '); |
513 | - $result = (bool)$query->execute([(int)$share['id']]); |
|
514 | - } elseif ($result && $share !== false && (int)$share['share_type'] === IShare::TYPE_GROUP) { |
|
513 | + $result = (bool) $query->execute([(int) $share['id']]); |
|
514 | + } elseif ($result && $share !== false && (int) $share['share_type'] === IShare::TYPE_GROUP) { |
|
515 | 515 | $query = $this->connection->prepare(' |
516 | 516 | UPDATE `*PREFIX*share_external` |
517 | 517 | SET `accepted` = ? |
518 | 518 | WHERE `id` = ?'); |
519 | - $result = (bool)$query->execute([0, (int)$share['id']]); |
|
519 | + $result = (bool) $query->execute([0, (int) $share['id']]); |
|
520 | 520 | } |
521 | 521 | |
522 | 522 | if ($result) { |
@@ -540,7 +540,7 @@ discard block |
||
540 | 540 | |
541 | 541 | |
542 | 542 | $query->delete('federated_reshares') |
543 | - ->where($query->expr()->in('share_id', $query->createFunction('(' . $select . ')'))); |
|
543 | + ->where($query->expr()->in('share_id', $query->createFunction('('.$select.')'))); |
|
544 | 544 | $query->execute(); |
545 | 545 | |
546 | 546 | $deleteReShares = $this->connection->getQueryBuilder(); |
@@ -573,7 +573,7 @@ discard block |
||
573 | 573 | DELETE FROM `*PREFIX*share_external` |
574 | 574 | WHERE `user` = ? |
575 | 575 | '); |
576 | - return (bool)$query->execute([$uid]); |
|
576 | + return (bool) $query->execute([$uid]); |
|
577 | 577 | } |
578 | 578 | |
579 | 579 | /** |
@@ -613,7 +613,7 @@ discard block |
||
613 | 613 | $query = 'SELECT `id`, `remote`, `remote_id`, `share_token`, `name`, `owner`, `user`, `mountpoint`, `accepted` |
614 | 614 | FROM `*PREFIX*share_external` |
615 | 615 | WHERE (`user` = ? OR `user` IN (?))'; |
616 | - $parameters = [$this->uid, implode(',',$userGroups)]; |
|
616 | + $parameters = [$this->uid, implode(',', $userGroups)]; |
|
617 | 617 | if (!is_null($accepted)) { |
618 | 618 | $query .= ' AND `accepted` = ?'; |
619 | 619 | $parameters[] = (int) $accepted; |