@@ -4,13 +4,13 @@ discard block |
||
4 | 4 | script('federatedfilesharing', 'settings-admin'); |
5 | 5 | ?> |
6 | 6 | |
7 | -<?php if($_['internalOnly'] === false): ?> |
|
7 | +<?php if ($_['internalOnly'] === false): ?> |
|
8 | 8 | |
9 | 9 | <div id="fileSharingSettings" class="section"> |
10 | 10 | <h2> |
11 | - <?php p($l->t('Federated Cloud Sharing'));?> |
|
11 | + <?php p($l->t('Federated Cloud Sharing')); ?> |
|
12 | 12 | <a target="_blank" rel="noreferrer noopener" class="icon-info svg" |
13 | - title="<?php p($l->t('Open documentation'));?>" |
|
13 | + title="<?php p($l->t('Open documentation')); ?>" |
|
14 | 14 | href="<?php p(link_to_docs('admin-sharing-federated')); ?>"></a> |
15 | 15 | </h2> |
16 | 16 | |
@@ -20,29 +20,29 @@ discard block |
||
20 | 20 | <input type="checkbox" name="outgoing_server2server_share_enabled" id="outgoingServer2serverShareEnabled" class="checkbox" |
21 | 21 | value="1" <?php if ($_['outgoingServer2serverShareEnabled']) print_unescaped('checked="checked"'); ?> /> |
22 | 22 | <label for="outgoingServer2serverShareEnabled"> |
23 | - <?php p($l->t('Allow users on this server to send shares to other servers'));?> |
|
23 | + <?php p($l->t('Allow users on this server to send shares to other servers')); ?> |
|
24 | 24 | </label> |
25 | 25 | </p> |
26 | 26 | <p> |
27 | 27 | <input type="checkbox" name="incoming_server2server_share_enabled" id="incomingServer2serverShareEnabled" class="checkbox" |
28 | 28 | value="1" <?php if ($_['incomingServer2serverShareEnabled']) print_unescaped('checked="checked"'); ?> /> |
29 | 29 | <label for="incomingServer2serverShareEnabled"> |
30 | - <?php p($l->t('Allow users on this server to receive shares from other servers'));?> |
|
30 | + <?php p($l->t('Allow users on this server to receive shares from other servers')); ?> |
|
31 | 31 | </label><br/> |
32 | 32 | </p> |
33 | - <?php if($_['federatedGroupSharingSupported']): ?> |
|
33 | + <?php if ($_['federatedGroupSharingSupported']): ?> |
|
34 | 34 | <p> |
35 | 35 | <input type="checkbox" name="outgoing_server2server_group_share_enabled" id="outgoingServer2serverGroupShareEnabled" class="checkbox" |
36 | 36 | value="1" <?php if ($_['outgoingServer2serverGroupShareEnabled']) print_unescaped('checked="checked"'); ?> /> |
37 | 37 | <label for="outgoingServer2serverGroupShareEnabled"> |
38 | - <?php p($l->t('Allow users on this server to send shares to groups on other servers'));?> |
|
38 | + <?php p($l->t('Allow users on this server to send shares to groups on other servers')); ?> |
|
39 | 39 | </label> |
40 | 40 | </p> |
41 | 41 | <p> |
42 | 42 | <input type="checkbox" name="incoming_server2server_group_share_enabled" id="incomingServer2serverGroupShareEnabled" class="checkbox" |
43 | 43 | value="1" <?php if ($_['incomingServer2serverGroupShareEnabled']) print_unescaped('checked="checked"'); ?> /> |
44 | 44 | <label for="incomingServer2serverGroupShareEnabled"> |
45 | - <?php p($l->t('Allow users on this server to receive group shares from other servers'));?> |
|
45 | + <?php p($l->t('Allow users on this server to receive group shares from other servers')); ?> |
|
46 | 46 | </label><br/> |
47 | 47 | </p> |
48 | 48 | <?php endif; ?> |
@@ -50,14 +50,14 @@ discard block |
||
50 | 50 | <input type="checkbox" name="lookupServerEnabled" id="lookupServerEnabled" class="checkbox" |
51 | 51 | value="1" <?php if ($_['lookupServerEnabled']) print_unescaped('checked="checked"'); ?> /> |
52 | 52 | <label for="lookupServerEnabled"> |
53 | - <?php p($l->t('Search global and public address book for users'));?> |
|
53 | + <?php p($l->t('Search global and public address book for users')); ?> |
|
54 | 54 | </label><br/> |
55 | 55 | </p> |
56 | 56 | <p> |
57 | 57 | <input type="checkbox" name="lookupServerUploadEnabled" id="lookupServerUploadEnabled" class="checkbox" |
58 | 58 | value="1" <?php if ($_['lookupServerUploadEnabled']) print_unescaped('checked="checked"'); ?> /> |
59 | 59 | <label for="lookupServerUploadEnabled"> |
60 | - <?php p($l->t('Allow users to publish their data to a global and public address book'));?> |
|
60 | + <?php p($l->t('Allow users to publish their data to a global and public address book')); ?> |
|
61 | 61 | </label><br/> |
62 | 62 | </p> |
63 | 63 |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | $supportedShareTypes = $this->config->getSupportedShareTypes($resourceType); |
146 | 146 | if (!in_array($shareType, $supportedShareTypes)) { |
147 | 147 | return new JSONResponse( |
148 | - ['message' => 'Share type "' . $shareType . '" not implemented'], |
|
148 | + ['message' => 'Share type "'.$shareType.'" not implemented'], |
|
149 | 149 | Http::STATUS_NOT_IMPLEMENTED |
150 | 150 | ); |
151 | 151 | } |
@@ -158,16 +158,16 @@ discard block |
||
158 | 158 | |
159 | 159 | if (!$this->userManager->userExists($shareWith)) { |
160 | 160 | return new JSONResponse( |
161 | - ['message' => 'User "' . $shareWith . '" does not exists at ' . $this->urlGenerator->getBaseUrl()], |
|
161 | + ['message' => 'User "'.$shareWith.'" does not exists at '.$this->urlGenerator->getBaseUrl()], |
|
162 | 162 | Http::STATUS_BAD_REQUEST |
163 | 163 | ); |
164 | 164 | } |
165 | 165 | } |
166 | 166 | |
167 | 167 | if ($shareType === 'group') { |
168 | - if(!$this->groupManager->groupExists($shareWith)) { |
|
168 | + if (!$this->groupManager->groupExists($shareWith)) { |
|
169 | 169 | return new JSONResponse( |
170 | - ['message' => 'Group "' . $shareWith . '" does not exists at ' . $this->urlGenerator->getBaseUrl()], |
|
170 | + ['message' => 'Group "'.$shareWith.'" does not exists at '.$this->urlGenerator->getBaseUrl()], |
|
171 | 171 | Http::STATUS_BAD_REQUEST |
172 | 172 | ); |
173 | 173 | } |
@@ -200,14 +200,14 @@ discard block |
||
200 | 200 | ); |
201 | 201 | } catch (\Exception $e) { |
202 | 202 | return new JSONResponse( |
203 | - ['message' => 'Internal error at ' . $this->urlGenerator->getBaseUrl()], |
|
203 | + ['message' => 'Internal error at '.$this->urlGenerator->getBaseUrl()], |
|
204 | 204 | Http::STATUS_BAD_REQUEST |
205 | 205 | ); |
206 | 206 | } |
207 | 207 | |
208 | 208 | $user = $this->userManager->get($shareWith); |
209 | 209 | $recipientDisplayName = ''; |
210 | - if($user) { |
|
210 | + if ($user) { |
|
211 | 211 | $recipientDisplayName = $user->getDisplayName(); |
212 | 212 | } |
213 | 213 | |
@@ -269,12 +269,12 @@ discard block |
||
269 | 269 | } |
270 | 270 | catch (\Exception $e) { |
271 | 271 | return new JSONResponse( |
272 | - ['message' => 'Internal error at ' . $this->urlGenerator->getBaseUrl()], |
|
272 | + ['message' => 'Internal error at '.$this->urlGenerator->getBaseUrl()], |
|
273 | 273 | Http::STATUS_BAD_REQUEST |
274 | 274 | ); |
275 | 275 | } |
276 | 276 | |
277 | - return new JSONResponse($result,Http::STATUS_CREATED); |
|
277 | + return new JSONResponse($result, Http::STATUS_CREATED); |
|
278 | 278 | |
279 | 279 | } |
280 | 280 | |
@@ -286,13 +286,13 @@ discard block |
||
286 | 286 | */ |
287 | 287 | private function mapUid($uid) { |
288 | 288 | // FIXME this should be a method in the user management instead |
289 | - $this->logger->debug('shareWith before, ' . $uid, ['app' => $this->appName]); |
|
289 | + $this->logger->debug('shareWith before, '.$uid, ['app' => $this->appName]); |
|
290 | 290 | \OCP\Util::emitHook( |
291 | 291 | '\OCA\Files_Sharing\API\Server2Server', |
292 | 292 | 'preLoginNameUsedAsUserName', |
293 | 293 | array('uid' => &$uid) |
294 | 294 | ); |
295 | - $this->logger->debug('shareWith after, ' . $uid, ['app' => $this->appName]); |
|
295 | + $this->logger->debug('shareWith after, '.$uid, ['app' => $this->appName]); |
|
296 | 296 | |
297 | 297 | return $uid; |
298 | 298 | } |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | if ($share->getSharedWith() === null) { |
227 | 227 | throw new \InvalidArgumentException('SharedWith should not be empty'); |
228 | 228 | } |
229 | - } else if ($share->getShareType() === \OCP\Share::SHARE_TYPE_REMOTE_GROUP) { |
|
229 | + } else if ($share->getShareType() === \OCP\Share::SHARE_TYPE_REMOTE_GROUP) { |
|
230 | 230 | if ($share->getSharedWith() === null) { |
231 | 231 | throw new \InvalidArgumentException('SharedWith should not be empty'); |
232 | 232 | } |
@@ -361,7 +361,7 @@ discard block |
||
361 | 361 | |
362 | 362 | if ($fullId === null && $expirationDate === null && $this->shareApiLinkDefaultExpireDate()) { |
363 | 363 | $expirationDate = new \DateTime(); |
364 | - $expirationDate->setTime(0,0,0); |
|
364 | + $expirationDate->setTime(0, 0, 0); |
|
365 | 365 | $expirationDate->add(new \DateInterval('P'.$this->shareApiLinkDefaultExpireDays().'D')); |
366 | 366 | } |
367 | 367 | |
@@ -373,7 +373,7 @@ discard block |
||
373 | 373 | |
374 | 374 | $date = new \DateTime(); |
375 | 375 | $date->setTime(0, 0, 0); |
376 | - $date->add(new \DateInterval('P' . $this->shareApiLinkDefaultExpireDays() . 'D')); |
|
376 | + $date->add(new \DateInterval('P'.$this->shareApiLinkDefaultExpireDays().'D')); |
|
377 | 377 | if ($date < $expirationDate) { |
378 | 378 | $message = $this->l->t('Can’t set expiration date more than %s days in the future', [$this->shareApiLinkDefaultExpireDays()]); |
379 | 379 | throw new GenericShareException($message, $message, 404); |
@@ -426,7 +426,7 @@ discard block |
||
426 | 426 | */ |
427 | 427 | $provider = $this->factory->getProviderForType(\OCP\Share::SHARE_TYPE_USER); |
428 | 428 | $existingShares = $provider->getSharesByPath($share->getNode()); |
429 | - foreach($existingShares as $existingShare) { |
|
429 | + foreach ($existingShares as $existingShare) { |
|
430 | 430 | // Ignore if it is the same share |
431 | 431 | try { |
432 | 432 | if ($existingShare->getFullId() === $share->getFullId()) { |
@@ -483,7 +483,7 @@ discard block |
||
483 | 483 | */ |
484 | 484 | $provider = $this->factory->getProviderForType(\OCP\Share::SHARE_TYPE_GROUP); |
485 | 485 | $existingShares = $provider->getSharesByPath($share->getNode()); |
486 | - foreach($existingShares as $existingShare) { |
|
486 | + foreach ($existingShares as $existingShare) { |
|
487 | 487 | try { |
488 | 488 | if ($existingShare->getFullId() === $share->getFullId()) { |
489 | 489 | continue; |
@@ -552,7 +552,7 @@ discard block |
||
552 | 552 | // Make sure that we do not share a path that contains a shared mountpoint |
553 | 553 | if ($path instanceof \OCP\Files\Folder) { |
554 | 554 | $mounts = $this->mountManager->findIn($path->getPath()); |
555 | - foreach($mounts as $mount) { |
|
555 | + foreach ($mounts as $mount) { |
|
556 | 556 | if ($mount->getStorage()->instanceOfStorage('\OCA\Files_Sharing\ISharedStorage')) { |
557 | 557 | throw new \InvalidArgumentException('Path contains files shared with you'); |
558 | 558 | } |
@@ -600,7 +600,7 @@ discard block |
||
600 | 600 | $storage = $share->getNode()->getStorage(); |
601 | 601 | if ($storage->instanceOfStorage('OCA\Files_Sharing\External\Storage')) { |
602 | 602 | $parent = $share->getNode()->getParent(); |
603 | - while($parent->getStorage()->instanceOfStorage('OCA\Files_Sharing\External\Storage')) { |
|
603 | + while ($parent->getStorage()->instanceOfStorage('OCA\Files_Sharing\External\Storage')) { |
|
604 | 604 | $parent = $parent->getParent(); |
605 | 605 | } |
606 | 606 | $share->setShareOwner($parent->getOwner()->getUID()); |
@@ -653,7 +653,7 @@ discard block |
||
653 | 653 | } |
654 | 654 | |
655 | 655 | // Generate the target |
656 | - $target = $this->config->getSystemValue('share_folder', '/') .'/'. $share->getNode()->getName(); |
|
656 | + $target = $this->config->getSystemValue('share_folder', '/').'/'.$share->getNode()->getName(); |
|
657 | 657 | $target = \OC\Files\Filesystem::normalizePath($target); |
658 | 658 | $share->setTarget($target); |
659 | 659 | |
@@ -676,7 +676,7 @@ discard block |
||
676 | 676 | |
677 | 677 | if ($share->getShareType() === \OCP\Share::SHARE_TYPE_USER) { |
678 | 678 | $mailSend = $share->getMailSend(); |
679 | - if($mailSend === true) { |
|
679 | + if ($mailSend === true) { |
|
680 | 680 | $user = $this->userManager->get($share->getSharedWith()); |
681 | 681 | if ($user !== null) { |
682 | 682 | $emailAddress = $user->getEMailAddress(); |
@@ -691,12 +691,12 @@ discard block |
||
691 | 691 | $emailAddress, |
692 | 692 | $share->getExpirationDate() |
693 | 693 | ); |
694 | - $this->logger->debug('Send share notification to ' . $emailAddress . ' for share with ID ' . $share->getId(), ['app' => 'share']); |
|
694 | + $this->logger->debug('Send share notification to '.$emailAddress.' for share with ID '.$share->getId(), ['app' => 'share']); |
|
695 | 695 | } else { |
696 | - $this->logger->debug('Share notification not send to ' . $share->getSharedWith() . ' because email address is not set.', ['app' => 'share']); |
|
696 | + $this->logger->debug('Share notification not send to '.$share->getSharedWith().' because email address is not set.', ['app' => 'share']); |
|
697 | 697 | } |
698 | 698 | } else { |
699 | - $this->logger->debug('Share notification not send to ' . $share->getSharedWith() . ' because user could not be found.', ['app' => 'share']); |
|
699 | + $this->logger->debug('Share notification not send to '.$share->getSharedWith().' because user could not be found.', ['app' => 'share']); |
|
700 | 700 | } |
701 | 701 | } else { |
702 | 702 | $this->logger->debug('Share notification not send because mailsend is false.', ['app' => 'share']); |
@@ -740,7 +740,7 @@ discard block |
||
740 | 740 | $text = $l->t('%s shared »%s« with you.', [$initiatorDisplayName, $filename]); |
741 | 741 | |
742 | 742 | $emailTemplate->addBodyText( |
743 | - htmlspecialchars($text . ' ' . $l->t('Click the button below to open it.')), |
|
743 | + htmlspecialchars($text.' '.$l->t('Click the button below to open it.')), |
|
744 | 744 | $text |
745 | 745 | ); |
746 | 746 | $emailTemplate->addBodyButton( |
@@ -764,9 +764,9 @@ discard block |
||
764 | 764 | // The "Reply-To" is set to the sharer if an mail address is configured |
765 | 765 | // also the default footer contains a "Do not reply" which needs to be adjusted. |
766 | 766 | $initiatorEmail = $initiatorUser->getEMailAddress(); |
767 | - if($initiatorEmail !== null) { |
|
767 | + if ($initiatorEmail !== null) { |
|
768 | 768 | $message->setReplyTo([$initiatorEmail => $initiatorDisplayName]); |
769 | - $emailTemplate->addFooter($instanceName . ($this->defaults->getSlogan() !== '' ? ' - ' . $this->defaults->getSlogan() : '')); |
|
769 | + $emailTemplate->addFooter($instanceName.($this->defaults->getSlogan() !== '' ? ' - '.$this->defaults->getSlogan() : '')); |
|
770 | 770 | } else { |
771 | 771 | $emailTemplate->addFooter(); |
772 | 772 | } |
@@ -975,7 +975,7 @@ discard block |
||
975 | 975 | * @param string $recipientId |
976 | 976 | */ |
977 | 977 | public function deleteFromSelf(\OCP\Share\IShare $share, $recipientId) { |
978 | - list($providerId, ) = $this->splitFullId($share->getFullId()); |
|
978 | + list($providerId,) = $this->splitFullId($share->getFullId()); |
|
979 | 979 | $provider = $this->factory->getProvider($providerId); |
980 | 980 | |
981 | 981 | $provider->deleteFromSelf($share, $recipientId); |
@@ -984,7 +984,7 @@ discard block |
||
984 | 984 | } |
985 | 985 | |
986 | 986 | public function restoreShare(IShare $share, string $recipientId): IShare { |
987 | - list($providerId, ) = $this->splitFullId($share->getFullId()); |
|
987 | + list($providerId,) = $this->splitFullId($share->getFullId()); |
|
988 | 988 | $provider = $this->factory->getProvider($providerId); |
989 | 989 | |
990 | 990 | return $provider->restore($share, $recipientId); |
@@ -1005,7 +1005,7 @@ discard block |
||
1005 | 1005 | if ($share->getShareType() === \OCP\Share::SHARE_TYPE_GROUP) { |
1006 | 1006 | $sharedWith = $this->groupManager->get($share->getSharedWith()); |
1007 | 1007 | if (is_null($sharedWith)) { |
1008 | - throw new \InvalidArgumentException('Group "' . $share->getSharedWith() . '" does not exist'); |
|
1008 | + throw new \InvalidArgumentException('Group "'.$share->getSharedWith().'" does not exist'); |
|
1009 | 1009 | } |
1010 | 1010 | $recipient = $this->userManager->get($recipientId); |
1011 | 1011 | if (!$sharedWith->inGroup($recipient)) { |
@@ -1013,7 +1013,7 @@ discard block |
||
1013 | 1013 | } |
1014 | 1014 | } |
1015 | 1015 | |
1016 | - list($providerId, ) = $this->splitFullId($share->getFullId()); |
|
1016 | + list($providerId,) = $this->splitFullId($share->getFullId()); |
|
1017 | 1017 | $provider = $this->factory->getProvider($providerId); |
1018 | 1018 | |
1019 | 1019 | $provider->move($share, $recipientId); |
@@ -1060,7 +1060,7 @@ discard block |
||
1060 | 1060 | |
1061 | 1061 | $shares2 = []; |
1062 | 1062 | |
1063 | - while(true) { |
|
1063 | + while (true) { |
|
1064 | 1064 | $added = 0; |
1065 | 1065 | foreach ($shares as $share) { |
1066 | 1066 | |
@@ -1145,7 +1145,7 @@ discard block |
||
1145 | 1145 | }); |
1146 | 1146 | |
1147 | 1147 | // Only get shares where the owner still exists |
1148 | - $shares = array_filter($shares, function (IShare $share) { |
|
1148 | + $shares = array_filter($shares, function(IShare $share) { |
|
1149 | 1149 | return $this->userManager->userExists($share->getShareOwner()); |
1150 | 1150 | }); |
1151 | 1151 | |
@@ -1184,7 +1184,7 @@ discard block |
||
1184 | 1184 | * |
1185 | 1185 | * @return Share[] |
1186 | 1186 | */ |
1187 | - public function getSharesByPath(\OCP\Files\Node $path, $page=0, $perPage=50) { |
|
1187 | + public function getSharesByPath(\OCP\Files\Node $path, $page = 0, $perPage = 50) { |
|
1188 | 1188 | return []; |
1189 | 1189 | } |
1190 | 1190 | |
@@ -1199,7 +1199,7 @@ discard block |
||
1199 | 1199 | public function getShareByToken($token) { |
1200 | 1200 | $share = null; |
1201 | 1201 | try { |
1202 | - if($this->shareApiAllowLinks()) { |
|
1202 | + if ($this->shareApiAllowLinks()) { |
|
1203 | 1203 | $provider = $this->factory->getProviderForType(\OCP\Share::SHARE_TYPE_LINK); |
1204 | 1204 | $share = $provider->getShareByToken($token); |
1205 | 1205 | } |
@@ -1406,7 +1406,7 @@ discard block |
||
1406 | 1406 | } |
1407 | 1407 | $al['users'][$owner] = [ |
1408 | 1408 | 'node_id' => $path->getId(), |
1409 | - 'node_path' => '/' . $ownerPath, |
|
1409 | + 'node_path' => '/'.$ownerPath, |
|
1410 | 1410 | ]; |
1411 | 1411 | } else { |
1412 | 1412 | $al['users'][] = $owner; |
@@ -1506,7 +1506,7 @@ discard block |
||
1506 | 1506 | * @return int |
1507 | 1507 | */ |
1508 | 1508 | public function shareApiLinkDefaultExpireDays() { |
1509 | - return (int)$this->config->getAppValue('core', 'shareapi_expire_after_n_days', '7'); |
|
1509 | + return (int) $this->config->getAppValue('core', 'shareapi_expire_after_n_days', '7'); |
|
1510 | 1510 | } |
1511 | 1511 | |
1512 | 1512 | /** |
@@ -148,18 +148,18 @@ discard block |
||
148 | 148 | * @return Mount|null |
149 | 149 | * @throws \Doctrine\DBAL\DBALException |
150 | 150 | */ |
151 | - public function addShare($remote, $token, $password, $name, $owner, $shareType, $accepted=false, $user = null, $remoteId = -1, $parent = -1) { |
|
151 | + public function addShare($remote, $token, $password, $name, $owner, $shareType, $accepted = false, $user = null, $remoteId = -1, $parent = -1) { |
|
152 | 152 | |
153 | 153 | $user = $user ? $user : $this->uid; |
154 | 154 | $accepted = $accepted ? 1 : 0; |
155 | - $name = Filesystem::normalizePath('/' . $name); |
|
155 | + $name = Filesystem::normalizePath('/'.$name); |
|
156 | 156 | |
157 | 157 | if (!$accepted) { |
158 | 158 | // To avoid conflicts with the mount point generation later, |
159 | 159 | // we only use a temporary mount point name here. The real |
160 | 160 | // mount point name will be generated when accepting the share, |
161 | 161 | // using the original share item name. |
162 | - $tmpMountPointName = '{{TemporaryMountPointName#' . $name . '}}'; |
|
162 | + $tmpMountPointName = '{{TemporaryMountPointName#'.$name.'}}'; |
|
163 | 163 | $mountPoint = $tmpMountPointName; |
164 | 164 | $hash = md5($tmpMountPointName); |
165 | 165 | $data = [ |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | $i = 1; |
180 | 180 | while (!$this->connection->insertIfNotExist('*PREFIX*share_external', $data, ['user', 'mountpoint_hash'])) { |
181 | 181 | // The external share already exists for the user |
182 | - $data['mountpoint'] = $tmpMountPointName . '-' . $i; |
|
182 | + $data['mountpoint'] = $tmpMountPointName.'-'.$i; |
|
183 | 183 | $data['mountpoint_hash'] = md5($data['mountpoint']); |
184 | 184 | $i++; |
185 | 185 | } |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | } |
188 | 188 | |
189 | 189 | $mountPoint = Files::buildNotExistingFileName('/', $name); |
190 | - $mountPoint = Filesystem::normalizePath('/' . $mountPoint); |
|
190 | + $mountPoint = Filesystem::normalizePath('/'.$mountPoint); |
|
191 | 191 | $hash = md5($mountPoint); |
192 | 192 | |
193 | 193 | $this->writeShareToDb($remote, $token, $password, $name, $owner, $user, $mountPoint, $hash, $accepted, $remoteId, $parent, $shareType); |
@@ -246,9 +246,9 @@ discard block |
||
246 | 246 | $validShare = is_array($share) && isset($share['share_type']) && isset($share['user']); |
247 | 247 | |
248 | 248 | // check if the user is allowed to access it |
249 | - if ($validShare && (int)$share['share_type'] === Share::SHARE_TYPE_USER && $share['user'] === $this->uid) { |
|
249 | + if ($validShare && (int) $share['share_type'] === Share::SHARE_TYPE_USER && $share['user'] === $this->uid) { |
|
250 | 250 | return $share; |
251 | - } else if ($validShare && (int)$share['share_type'] === Share::SHARE_TYPE_GROUP) { |
|
251 | + } else if ($validShare && (int) $share['share_type'] === Share::SHARE_TYPE_GROUP) { |
|
252 | 252 | $user = $this->userManager->get($this->uid); |
253 | 253 | if ($this->groupManager->get($share['user'])->inGroup($user)) { |
254 | 254 | return $share; |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | $hash = md5($mountPoint); |
279 | 279 | $userShareAccepted = false; |
280 | 280 | |
281 | - if((int)$share['share_type'] === Share::SHARE_TYPE_USER) { |
|
281 | + if ((int) $share['share_type'] === Share::SHARE_TYPE_USER) { |
|
282 | 282 | $acceptShare = $this->connection->prepare(' |
283 | 283 | UPDATE `*PREFIX*share_external` |
284 | 284 | SET `accepted` = ?, |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | $share = $this->getShare($id); |
324 | 324 | $result = false; |
325 | 325 | |
326 | - if ($share && (int)$share['share_type'] === Share::SHARE_TYPE_USER) { |
|
326 | + if ($share && (int) $share['share_type'] === Share::SHARE_TYPE_USER) { |
|
327 | 327 | $removeShare = $this->connection->prepare(' |
328 | 328 | DELETE FROM `*PREFIX*share_external` WHERE `id` = ? AND `user` = ?'); |
329 | 329 | $removeShare->execute(array($id, $this->uid)); |
@@ -331,7 +331,7 @@ discard block |
||
331 | 331 | |
332 | 332 | $this->processNotification($id); |
333 | 333 | $result = true; |
334 | - } else if ($share && (int)$share['share_type'] === Share::SHARE_TYPE_GROUP) { |
|
334 | + } else if ($share && (int) $share['share_type'] === Share::SHARE_TYPE_GROUP) { |
|
335 | 335 | $result = $this->writeShareToDb( |
336 | 336 | $share['remote'], |
337 | 337 | $share['share_token'], |
@@ -375,14 +375,14 @@ discard block |
||
375 | 375 | |
376 | 376 | $result = $this->tryOCMEndPoint($remote, $token, $remoteId, $feedback); |
377 | 377 | |
378 | - if($result === true) { |
|
378 | + if ($result === true) { |
|
379 | 379 | return true; |
380 | 380 | } |
381 | 381 | |
382 | 382 | $federationEndpoints = $this->discoveryService->discover($remote, 'FEDERATED_SHARING'); |
383 | 383 | $endpoint = isset($federationEndpoints['share']) ? $federationEndpoints['share'] : '/ocs/v2.php/cloud/shares'; |
384 | 384 | |
385 | - $url = rtrim($remote, '/') . $endpoint . '/' . $remoteId . '/' . $feedback . '?format=' . Share::RESPONSE_FORMAT; |
|
385 | + $url = rtrim($remote, '/').$endpoint.'/'.$remoteId.'/'.$feedback.'?format='.Share::RESPONSE_FORMAT; |
|
386 | 386 | $fields = array('token' => $token); |
387 | 387 | |
388 | 388 | $client = $this->clientService->newClient(); |
@@ -455,13 +455,13 @@ discard block |
||
455 | 455 | * @return string |
456 | 456 | */ |
457 | 457 | protected function stripPath($path) { |
458 | - $prefix = '/' . $this->uid . '/files'; |
|
458 | + $prefix = '/'.$this->uid.'/files'; |
|
459 | 459 | return rtrim(substr($path, strlen($prefix)), '/'); |
460 | 460 | } |
461 | 461 | |
462 | 462 | public function getMount($data) { |
463 | 463 | $data['manager'] = $this; |
464 | - $mountPoint = '/' . $this->uid . '/files' . $data['mountpoint']; |
|
464 | + $mountPoint = '/'.$this->uid.'/files'.$data['mountpoint']; |
|
465 | 465 | $data['mountpoint'] = $mountPoint; |
466 | 466 | $data['certificateManager'] = \OC::$server->getCertificateManager($this->uid); |
467 | 467 | return new Mount(self::STORAGE, $mountPoint, $data, $this, $this->storageLoader); |
@@ -501,7 +501,7 @@ discard block |
||
501 | 501 | WHERE `mountpoint_hash` = ? |
502 | 502 | AND `user` = ? |
503 | 503 | '); |
504 | - $result = (bool)$query->execute(array($target, $targetHash, $sourceHash, $this->uid)); |
|
504 | + $result = (bool) $query->execute(array($target, $targetHash, $sourceHash, $this->uid)); |
|
505 | 505 | |
506 | 506 | return $result; |
507 | 507 | } |
@@ -522,7 +522,7 @@ discard block |
||
522 | 522 | |
523 | 523 | $share = $getShare->fetch(); |
524 | 524 | $getShare->closeCursor(); |
525 | - if ($result && (int)$share['share_type'] === Share::SHARE_TYPE_USER) { |
|
525 | + if ($result && (int) $share['share_type'] === Share::SHARE_TYPE_USER) { |
|
526 | 526 | try { |
527 | 527 | $this->sendFeedbackToRemote($share['remote'], $share['share_token'], $share['remote_id'], 'decline'); |
528 | 528 | } catch (\Exception $e) { |
@@ -534,16 +534,16 @@ discard block |
||
534 | 534 | DELETE FROM `*PREFIX*share_external` |
535 | 535 | WHERE `id` = ? |
536 | 536 | '); |
537 | - $result = (bool)$query->execute(array((int)$share['id'])); |
|
538 | - } else if ($result && (int)$share['share_type'] === Share::SHARE_TYPE_GROUP) { |
|
537 | + $result = (bool) $query->execute(array((int) $share['id'])); |
|
538 | + } else if ($result && (int) $share['share_type'] === Share::SHARE_TYPE_GROUP) { |
|
539 | 539 | $query = $this->connection->prepare(' |
540 | 540 | UPDATE `*PREFIX*share_external` |
541 | 541 | SET `accepted` = ? |
542 | 542 | WHERE `id` = ?'); |
543 | - $result = (bool)$query->execute(array(0, (int)$share['id'])); |
|
543 | + $result = (bool) $query->execute(array(0, (int) $share['id'])); |
|
544 | 544 | } |
545 | 545 | |
546 | - if($result) { |
|
546 | + if ($result) { |
|
547 | 547 | $this->removeReShares($id); |
548 | 548 | } |
549 | 549 | |
@@ -564,7 +564,7 @@ discard block |
||
564 | 564 | |
565 | 565 | |
566 | 566 | $query->delete('federated_reshares') |
567 | - ->where($query->expr()->in('share_id', $query->createFunction('(' . $select . ')'))); |
|
567 | + ->where($query->expr()->in('share_id', $query->createFunction('('.$select.')'))); |
|
568 | 568 | $query->execute(); |
569 | 569 | |
570 | 570 | $deleteReShares = $this->connection->getQueryBuilder(); |
@@ -588,7 +588,7 @@ discard block |
||
588 | 588 | |
589 | 589 | if ($result) { |
590 | 590 | $shares = $getShare->fetchAll(); |
591 | - foreach($shares as $share) { |
|
591 | + foreach ($shares as $share) { |
|
592 | 592 | $this->sendFeedbackToRemote($share['remote'], $share['share_token'], $share['remote_id'], 'decline'); |
593 | 593 | } |
594 | 594 | } |
@@ -597,7 +597,7 @@ discard block |
||
597 | 597 | DELETE FROM `*PREFIX*share_external` |
598 | 598 | WHERE `user` = ? |
599 | 599 | '); |
600 | - return (bool)$query->execute(array($uid)); |
|
600 | + return (bool) $query->execute(array($uid)); |
|
601 | 601 | } |
602 | 602 | |
603 | 603 | /** |
@@ -637,7 +637,7 @@ discard block |
||
637 | 637 | $query = 'SELECT `id`, `remote`, `remote_id`, `share_token`, `name`, `owner`, `user`, `mountpoint`, `accepted` |
638 | 638 | FROM `*PREFIX*share_external` |
639 | 639 | WHERE (`user` = ? OR `user` IN (?))'; |
640 | - $parameters = [$this->uid, implode(',',$userGroups)]; |
|
640 | + $parameters = [$this->uid, implode(',', $userGroups)]; |
|
641 | 641 | if (!is_null($accepted)) { |
642 | 642 | $query .= ' AND `accepted` = ?'; |
643 | 643 | $parameters[] = (int) $accepted; |
@@ -212,11 +212,11 @@ discard block |
||
212 | 212 | // "name (type, owner) [id]", depending on the Circles app version. |
213 | 213 | $hasCircleId = (substr($share->getSharedWith(), -1) === ']'); |
214 | 214 | |
215 | - $displayNameLength = ($hasCircleId? strrpos($share->getSharedWith(), ' '): strlen($share->getSharedWith())); |
|
215 | + $displayNameLength = ($hasCircleId ? strrpos($share->getSharedWith(), ' ') : strlen($share->getSharedWith())); |
|
216 | 216 | $result['share_with_displayname'] = substr($share->getSharedWith(), 0, $displayNameLength); |
217 | 217 | |
218 | - $shareWithStart = ($hasCircleId? strrpos($share->getSharedWith(), '[') + 1: 0); |
|
219 | - $shareWithLength = ($hasCircleId? -1: strpos($share->getSharedWith(), ' ')); |
|
218 | + $shareWithStart = ($hasCircleId ? strrpos($share->getSharedWith(), '[') + 1 : 0); |
|
219 | + $shareWithLength = ($hasCircleId ? -1 : strpos($share->getSharedWith(), ' ')); |
|
220 | 220 | $result['share_with'] = substr($share->getSharedWith(), $shareWithStart, $shareWithLength); |
221 | 221 | } |
222 | 222 | |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | // FIXME: If we inject the contacts manager it gets initialized bofore any address books are registered |
239 | 239 | $result = \OC::$server->getContactsManager()->search($query, [$property]); |
240 | 240 | foreach ($result as $r) { |
241 | - foreach($r[$property] as $value) { |
|
241 | + foreach ($r[$property] as $value) { |
|
242 | 242 | if ($value === $query) { |
243 | 243 | return $r['FN']; |
244 | 244 | } |
@@ -465,7 +465,7 @@ discard block |
||
465 | 465 | |
466 | 466 | $share->setSharedWith($shareWith); |
467 | 467 | $share->setPermissions($permissions); |
468 | - } else if ($shareType === Share::SHARE_TYPE_REMOTE_GROUP) { |
|
468 | + } else if ($shareType === Share::SHARE_TYPE_REMOTE_GROUP) { |
|
469 | 469 | if (!$this->shareManager->outgoingServer2ServerGroupSharesAllowed()) { |
470 | 470 | throw new OCSForbiddenException($this->l->t('Sharing %s failed because the back end does not allow shares from type %s', [$path->getPath(), $shareType])); |
471 | 471 | } |
@@ -526,7 +526,7 @@ discard block |
||
526 | 526 | |
527 | 527 | $shares = array_merge($userShares, $groupShares, $circleShares); |
528 | 528 | |
529 | - $shares = array_filter($shares, function (IShare $share) { |
|
529 | + $shares = array_filter($shares, function(IShare $share) { |
|
530 | 530 | return $share->getShareOwner() !== $this->currentUser; |
531 | 531 | }); |
532 | 532 | |
@@ -565,7 +565,7 @@ discard block |
||
565 | 565 | $shares = array_merge($shares, $this->shareManager->getSharesBy($this->currentUser, Share::SHARE_TYPE_USER, $node, false, -1, 0)); |
566 | 566 | $shares = array_merge($shares, $this->shareManager->getSharesBy($this->currentUser, Share::SHARE_TYPE_GROUP, $node, false, -1, 0)); |
567 | 567 | $shares = array_merge($shares, $this->shareManager->getSharesBy($this->currentUser, Share::SHARE_TYPE_LINK, $node, false, -1, 0)); |
568 | - if($this->shareManager->shareProviderExists(Share::SHARE_TYPE_EMAIL)) { |
|
568 | + if ($this->shareManager->shareProviderExists(Share::SHARE_TYPE_EMAIL)) { |
|
569 | 569 | $shares = array_merge($shares, $this->shareManager->getSharesBy($this->currentUser, Share::SHARE_TYPE_EMAIL, $node, false, -1, 0)); |
570 | 570 | } |
571 | 571 | if ($this->shareManager->outgoingServer2ServerSharesAllowed()) { |
@@ -734,7 +734,7 @@ discard block |
||
734 | 734 | } |
735 | 735 | |
736 | 736 | if ($permissions !== null) { |
737 | - $newPermissions = (int)$permissions; |
|
737 | + $newPermissions = (int) $permissions; |
|
738 | 738 | $newPermissions = $newPermissions & ~Constants::PERMISSION_SHARE; |
739 | 739 | } |
740 | 740 | |
@@ -792,7 +792,7 @@ discard block |
||
792 | 792 | |
793 | 793 | } else { |
794 | 794 | if ($permissions !== null) { |
795 | - $permissions = (int)$permissions; |
|
795 | + $permissions = (int) $permissions; |
|
796 | 796 | $share->setPermissions($permissions); |
797 | 797 | } |
798 | 798 | |
@@ -920,7 +920,7 @@ discard block |
||
920 | 920 | |
921 | 921 | // First check if it is an internal share. |
922 | 922 | try { |
923 | - $share = $this->shareManager->getShareById('ocinternal:' . $id, $this->currentUser); |
|
923 | + $share = $this->shareManager->getShareById('ocinternal:'.$id, $this->currentUser); |
|
924 | 924 | return $share; |
925 | 925 | } catch (ShareNotFound $e) { |
926 | 926 | // Do nothing, just try the other share type |
@@ -929,7 +929,7 @@ discard block |
||
929 | 929 | |
930 | 930 | try { |
931 | 931 | if ($this->shareManager->shareProviderExists(Share::SHARE_TYPE_CIRCLE)) { |
932 | - $share = $this->shareManager->getShareById('ocCircleShare:' . $id, $this->currentUser); |
|
932 | + $share = $this->shareManager->getShareById('ocCircleShare:'.$id, $this->currentUser); |
|
933 | 933 | return $share; |
934 | 934 | } |
935 | 935 | } catch (ShareNotFound $e) { |
@@ -938,7 +938,7 @@ discard block |
||
938 | 938 | |
939 | 939 | try { |
940 | 940 | if ($this->shareManager->shareProviderExists(Share::SHARE_TYPE_EMAIL)) { |
941 | - $share = $this->shareManager->getShareById('ocMailShare:' . $id, $this->currentUser); |
|
941 | + $share = $this->shareManager->getShareById('ocMailShare:'.$id, $this->currentUser); |
|
942 | 942 | return $share; |
943 | 943 | } |
944 | 944 | } catch (ShareNotFound $e) { |
@@ -948,7 +948,7 @@ discard block |
||
948 | 948 | if (!$this->shareManager->outgoingServer2ServerSharesAllowed()) { |
949 | 949 | throw new ShareNotFound(); |
950 | 950 | } |
951 | - $share = $this->shareManager->getShareById('ocFederatedSharing:' . $id, $this->currentUser); |
|
951 | + $share = $this->shareManager->getShareById('ocFederatedSharing:'.$id, $this->currentUser); |
|
952 | 952 | |
953 | 953 | return $share; |
954 | 954 | } |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | if ($remoteShare) { |
215 | 215 | try { |
216 | 216 | $ownerCloudId = $this->cloudIdManager->getCloudId($remoteShare['owner'], $remoteShare['remote']); |
217 | - $shareId = $this->addShareToDB($itemSource, $itemType, $shareWith, $sharedBy, $ownerCloudId->getId(), $permissions, 'tmp_token_' . time(), $shareType); |
|
217 | + $shareId = $this->addShareToDB($itemSource, $itemType, $shareWith, $sharedBy, $ownerCloudId->getId(), $permissions, 'tmp_token_'.time(), $shareType); |
|
218 | 218 | $share->setId($shareId); |
219 | 219 | list($token, $remoteId) = $this->askOwnerToReShare($shareWith, $share, $shareId); |
220 | 220 | // remote share was create successfully if we get a valid token as return |
@@ -296,7 +296,7 @@ discard block |
||
296 | 296 | $failure = true; |
297 | 297 | } |
298 | 298 | |
299 | - if($failure) { |
|
299 | + if ($failure) { |
|
300 | 300 | $this->removeShareFromTableById($shareId); |
301 | 301 | $message_t = $this->l->t('Sharing %s failed, could not find %s, maybe the server is currently unreachable or uses a self-signed certificate.', |
302 | 302 | [$share->getNode()->getName(), $share->getSharedWith()]); |
@@ -348,7 +348,7 @@ discard block |
||
348 | 348 | ->andWhere($query->expr()->eq('mountpoint', $query->createNamedParameter($share->getTarget()))); |
349 | 349 | $result = $query->execute()->fetchAll(); |
350 | 350 | |
351 | - if (isset($result[0]) && (int)$result[0]['remote_id'] > 0) { |
|
351 | + if (isset($result[0]) && (int) $result[0]['remote_id'] > 0) { |
|
352 | 352 | return $result[0]; |
353 | 353 | } |
354 | 354 | |
@@ -391,7 +391,7 @@ discard block |
||
391 | 391 | $qb->execute(); |
392 | 392 | $id = $qb->getLastInsertId(); |
393 | 393 | |
394 | - return (int)$id; |
|
394 | + return (int) $id; |
|
395 | 395 | } |
396 | 396 | |
397 | 397 | /** |
@@ -481,14 +481,14 @@ discard block |
||
481 | 481 | public function getRemoteId(IShare $share) { |
482 | 482 | $query = $this->dbConnection->getQueryBuilder(); |
483 | 483 | $query->select('remote_id')->from('federated_reshares') |
484 | - ->where($query->expr()->eq('share_id', $query->createNamedParameter((int)$share->getId()))); |
|
484 | + ->where($query->expr()->eq('share_id', $query->createNamedParameter((int) $share->getId()))); |
|
485 | 485 | $data = $query->execute()->fetch(); |
486 | 486 | |
487 | 487 | if (!is_array($data) || !isset($data['remote_id'])) { |
488 | 488 | throw new ShareNotFound(); |
489 | 489 | } |
490 | 490 | |
491 | - return (int)$data['remote_id']; |
|
491 | + return (int) $data['remote_id']; |
|
492 | 492 | } |
493 | 493 | |
494 | 494 | /** |
@@ -519,7 +519,7 @@ discard block |
||
519 | 519 | ->orderBy('id'); |
520 | 520 | |
521 | 521 | $cursor = $qb->execute(); |
522 | - while($data = $cursor->fetch()) { |
|
522 | + while ($data = $cursor->fetch()) { |
|
523 | 523 | $children[] = $this->createShareObject($data); |
524 | 524 | } |
525 | 525 | $cursor->closeCursor(); |
@@ -641,7 +641,7 @@ discard block |
||
641 | 641 | ); |
642 | 642 | } |
643 | 643 | |
644 | - $qb->innerJoin('s', 'filecache' ,'f', $qb->expr()->eq('s.file_source', 'f.fileid')); |
|
644 | + $qb->innerJoin('s', 'filecache', 'f', $qb->expr()->eq('s.file_source', 'f.fileid')); |
|
645 | 645 | $qb->andWhere($qb->expr()->eq('f.parent', $qb->createNamedParameter($node->getId()))); |
646 | 646 | |
647 | 647 | $qb->orderBy('id'); |
@@ -704,7 +704,7 @@ discard block |
||
704 | 704 | |
705 | 705 | $cursor = $qb->execute(); |
706 | 706 | $shares = []; |
707 | - while($data = $cursor->fetch()) { |
|
707 | + while ($data = $cursor->fetch()) { |
|
708 | 708 | $shares[] = $this->createShareObject($data); |
709 | 709 | } |
710 | 710 | $cursor->closeCursor(); |
@@ -728,7 +728,7 @@ discard block |
||
728 | 728 | $cursor->closeCursor(); |
729 | 729 | |
730 | 730 | if ($data === false) { |
731 | - throw new ShareNotFound('Can not find share with ID: ' . $id); |
|
731 | + throw new ShareNotFound('Can not find share with ID: '.$id); |
|
732 | 732 | } |
733 | 733 | |
734 | 734 | try { |
@@ -757,7 +757,7 @@ discard block |
||
757 | 757 | ->execute(); |
758 | 758 | |
759 | 759 | $shares = []; |
760 | - while($data = $cursor->fetch()) { |
|
760 | + while ($data = $cursor->fetch()) { |
|
761 | 761 | $shares[] = $this->createShareObject($data); |
762 | 762 | } |
763 | 763 | $cursor->closeCursor(); |
@@ -796,7 +796,7 @@ discard block |
||
796 | 796 | |
797 | 797 | $cursor = $qb->execute(); |
798 | 798 | |
799 | - while($data = $cursor->fetch()) { |
|
799 | + while ($data = $cursor->fetch()) { |
|
800 | 800 | $shares[] = $this->createShareObject($data); |
801 | 801 | } |
802 | 802 | $cursor->closeCursor(); |
@@ -873,15 +873,15 @@ discard block |
||
873 | 873 | private function createShareObject($data) { |
874 | 874 | |
875 | 875 | $share = new Share($this->rootFolder, $this->userManager); |
876 | - $share->setId((int)$data['id']) |
|
877 | - ->setShareType((int)$data['share_type']) |
|
878 | - ->setPermissions((int)$data['permissions']) |
|
876 | + $share->setId((int) $data['id']) |
|
877 | + ->setShareType((int) $data['share_type']) |
|
878 | + ->setPermissions((int) $data['permissions']) |
|
879 | 879 | ->setTarget($data['file_target']) |
880 | - ->setMailSend((bool)$data['mail_send']) |
|
880 | + ->setMailSend((bool) $data['mail_send']) |
|
881 | 881 | ->setToken($data['token']); |
882 | 882 | |
883 | 883 | $shareTime = new \DateTime(); |
884 | - $shareTime->setTimestamp((int)$data['stime']); |
|
884 | + $shareTime->setTimestamp((int) $data['stime']); |
|
885 | 885 | $share->setShareTime($shareTime); |
886 | 886 | $share->setSharedWith($data['share_with']); |
887 | 887 | |
@@ -891,13 +891,13 @@ discard block |
||
891 | 891 | } else { |
892 | 892 | //OLD SHARE |
893 | 893 | $share->setSharedBy($data['uid_owner']); |
894 | - $path = $this->getNode($share->getSharedBy(), (int)$data['file_source']); |
|
894 | + $path = $this->getNode($share->getSharedBy(), (int) $data['file_source']); |
|
895 | 895 | |
896 | 896 | $owner = $path->getOwner(); |
897 | 897 | $share->setShareOwner($owner->getUID()); |
898 | 898 | } |
899 | 899 | |
900 | - $share->setNodeId((int)$data['file_source']); |
|
900 | + $share->setNodeId((int) $data['file_source']); |
|
901 | 901 | $share->setNodeType($data['item_type']); |
902 | 902 | |
903 | 903 | $share->setProviderId($this->identifier()); |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | // for backward compatibility make sure that the remote url stored in the |
173 | 173 | // database ends with a trailing slash |
174 | 174 | if (substr($remote, -1) !== '/') { |
175 | - $remote = $remote . '/'; |
|
175 | + $remote = $remote.'/'; |
|
176 | 176 | } |
177 | 177 | |
178 | 178 | $token = $share->getShareSecret(); |
@@ -200,23 +200,23 @@ discard block |
||
200 | 200 | |
201 | 201 | // FIXME this should be a method in the user management instead |
202 | 202 | if ($shareType === Share::SHARE_TYPE_USER) { |
203 | - $this->logger->debug('shareWith before, ' . $shareWith, ['app' => 'files_sharing']); |
|
203 | + $this->logger->debug('shareWith before, '.$shareWith, ['app' => 'files_sharing']); |
|
204 | 204 | Util::emitHook( |
205 | 205 | '\OCA\Files_Sharing\API\Server2Server', |
206 | 206 | 'preLoginNameUsedAsUserName', |
207 | 207 | array('uid' => &$shareWith) |
208 | 208 | ); |
209 | - $this->logger->debug('shareWith after, ' . $shareWith, ['app' => 'files_sharing']); |
|
209 | + $this->logger->debug('shareWith after, '.$shareWith, ['app' => 'files_sharing']); |
|
210 | 210 | |
211 | 211 | if (!$this->userManager->userExists($shareWith)) { |
212 | - throw new ProviderCouldNotAddShareException('User does not exists', '',Http::STATUS_BAD_REQUEST); |
|
212 | + throw new ProviderCouldNotAddShareException('User does not exists', '', Http::STATUS_BAD_REQUEST); |
|
213 | 213 | } |
214 | 214 | |
215 | 215 | \OC_Util::setupFS($shareWith); |
216 | 216 | } |
217 | 217 | |
218 | 218 | if ($shareType === Share::SHARE_TYPE_GROUP && !$this->groupManager->groupExists($shareWith)) { |
219 | - throw new ProviderCouldNotAddShareException('Group does not exists', '',Http::STATUS_BAD_REQUEST); |
|
219 | + throw new ProviderCouldNotAddShareException('Group does not exists', '', Http::STATUS_BAD_REQUEST); |
|
220 | 220 | } |
221 | 221 | |
222 | 222 | $externalManager = new \OCA\Files_Sharing\External\Manager( |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | ); |
235 | 235 | |
236 | 236 | try { |
237 | - $externalManager->addShare($remote, $token, '', $name, $owner, $shareType,false, $shareWith, $remoteId); |
|
237 | + $externalManager->addShare($remote, $token, '', $name, $owner, $shareType, false, $shareWith, $remoteId); |
|
238 | 238 | $shareId = \OC::$server->getDatabaseConnection()->lastInsertId('*PREFIX*share_external'); |
239 | 239 | |
240 | 240 | if ($shareType === Share::SHARE_TYPE_USER) { |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | ->setType('remote_share') |
244 | 244 | ->setSubject(RemoteShares::SUBJECT_REMOTE_SHARE_RECEIVED, [$ownerFederatedId, trim($name, '/')]) |
245 | 245 | ->setAffectedUser($shareWith) |
246 | - ->setObject('remote_share', (int)$shareId, $name); |
|
246 | + ->setObject('remote_share', (int) $shareId, $name); |
|
247 | 247 | \OC::$server->getActivityManager()->publish($event); |
248 | 248 | $this->notifyAboutNewShare($shareWith, $shareId, $ownerFederatedId, $sharedByFederatedId, $name); |
249 | 249 | } else { |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | ->setType('remote_share') |
255 | 255 | ->setSubject(RemoteShares::SUBJECT_REMOTE_SHARE_RECEIVED, [$ownerFederatedId, trim($name, '/')]) |
256 | 256 | ->setAffectedUser($user->getUID()) |
257 | - ->setObject('remote_share', (int)$shareId, $name); |
|
257 | + ->setObject('remote_share', (int) $shareId, $name); |
|
258 | 258 | \OC::$server->getActivityManager()->publish($event); |
259 | 259 | $this->notifyAboutNewShare($user->getUID(), $shareId, $ownerFederatedId, $sharedByFederatedId, $name); |
260 | 260 | } |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | 'level' => ILogger::ERROR, |
267 | 267 | 'app' => 'files_sharing' |
268 | 268 | ]); |
269 | - throw new ProviderCouldNotAddShareException('internal server error, was not able to add share from ' . $remote, '', HTTP::STATUS_INTERNAL_SERVER_ERROR); |
|
269 | + throw new ProviderCouldNotAddShareException('internal server error, was not able to add share from '.$remote, '', HTTP::STATUS_INTERNAL_SERVER_ERROR); |
|
270 | 270 | } |
271 | 271 | } |
272 | 272 | |
@@ -343,12 +343,12 @@ discard block |
||
343 | 343 | |
344 | 344 | $declineAction = $notification->createAction(); |
345 | 345 | $declineAction->setLabel('decline') |
346 | - ->setLink($this->urlGenerator->getAbsoluteURL($this->urlGenerator->linkTo('', 'ocs/v2.php/apps/files_sharing/api/v1/remote_shares/pending/' . $shareId)), 'DELETE'); |
|
346 | + ->setLink($this->urlGenerator->getAbsoluteURL($this->urlGenerator->linkTo('', 'ocs/v2.php/apps/files_sharing/api/v1/remote_shares/pending/'.$shareId)), 'DELETE'); |
|
347 | 347 | $notification->addAction($declineAction); |
348 | 348 | |
349 | 349 | $acceptAction = $notification->createAction(); |
350 | 350 | $acceptAction->setLabel('accept') |
351 | - ->setLink($this->urlGenerator->getAbsoluteURL($this->urlGenerator->linkTo('', 'ocs/v2.php/apps/files_sharing/api/v1/remote_shares/pending/' . $shareId)), 'POST'); |
|
351 | + ->setLink($this->urlGenerator->getAbsoluteURL($this->urlGenerator->linkTo('', 'ocs/v2.php/apps/files_sharing/api/v1/remote_shares/pending/'.$shareId)), 'POST'); |
|
352 | 352 | $notification->addAction($acceptAction); |
353 | 353 | |
354 | 354 | $this->notificationManager->notify($notification); |
@@ -408,7 +408,7 @@ discard block |
||
408 | 408 | */ |
409 | 409 | protected function executeAcceptShare(IShare $share) { |
410 | 410 | try { |
411 | - $fileId = (int)$share->getNode()->getId(); |
|
411 | + $fileId = (int) $share->getNode()->getId(); |
|
412 | 412 | list($file, $link) = $this->getFile($this->getCorrectUid($share), $fileId); |
413 | 413 | } catch (\Exception $e) { |
414 | 414 | throw new ShareNotFound(); |
@@ -486,7 +486,7 @@ discard block |
||
486 | 486 | $this->federatedShareProvider->removeShareFromTable($share); |
487 | 487 | |
488 | 488 | try { |
489 | - $fileId = (int)$share->getNode()->getId(); |
|
489 | + $fileId = (int) $share->getNode()->getId(); |
|
490 | 490 | list($file, $link) = $this->getFile($this->getCorrectUid($share), $fileId); |
491 | 491 | } catch (\Exception $e) { |
492 | 492 | throw new ShareNotFound(); |
@@ -581,10 +581,10 @@ discard block |
||
581 | 581 | // delete all child in case of a group share |
582 | 582 | $qb = $this->connection->getQueryBuilder(); |
583 | 583 | $qb->delete('share_external') |
584 | - ->where($qb->expr()->eq('parent', $qb->createNamedParameter((int)$share['id']))); |
|
584 | + ->where($qb->expr()->eq('parent', $qb->createNamedParameter((int) $share['id']))); |
|
585 | 585 | $qb->execute(); |
586 | 586 | |
587 | - if ((int)$share['share_type'] === Share::SHARE_TYPE_USER) { |
|
587 | + if ((int) $share['share_type'] === Share::SHARE_TYPE_USER) { |
|
588 | 588 | if ($share['accepted']) { |
589 | 589 | $path = trim($mountpoint, '/'); |
590 | 590 | } else { |
@@ -593,7 +593,7 @@ discard block |
||
593 | 593 | $notification = $this->notificationManager->createNotification(); |
594 | 594 | $notification->setApp('files_sharing') |
595 | 595 | ->setUser($share['user']) |
596 | - ->setObject('remote_share', (int)$share['id']); |
|
596 | + ->setObject('remote_share', (int) $share['id']); |
|
597 | 597 | $this->notificationManager->markProcessed($notification); |
598 | 598 | |
599 | 599 | $event = $this->activityManager->generateEvent(); |
@@ -601,7 +601,7 @@ discard block |
||
601 | 601 | ->setType('remote_share') |
602 | 602 | ->setSubject(RemoteShares::SUBJECT_REMOTE_SHARE_UNSHARED, [$owner->getId(), $path]) |
603 | 603 | ->setAffectedUser($user) |
604 | - ->setObject('remote_share', (int)$share['id'], $path); |
|
604 | + ->setObject('remote_share', (int) $share['id'], $path); |
|
605 | 605 | \OC::$server->getActivityManager()->publish($event); |
606 | 606 | } |
607 | 607 | } |
@@ -650,7 +650,7 @@ discard block |
||
650 | 650 | $owner = $share->getShareOwner(); |
651 | 651 | $currentServer = $this->addressHandler->generateRemoteURL(); |
652 | 652 | if ($this->addressHandler->compareAddresses($user, $remote, $owner, $currentServer)) { |
653 | - throw new ProviderCouldNotAddShareException('Resharing back to the owner is not allowed: ' . $id); |
|
653 | + throw new ProviderCouldNotAddShareException('Resharing back to the owner is not allowed: '.$id); |
|
654 | 654 | } |
655 | 655 | } catch (\Exception $e) { |
656 | 656 | throw new ProviderCouldNotAddShareException($e->getMessage()); |
@@ -664,10 +664,10 @@ discard block |
||
664 | 664 | $share->setSharedBy($share->getSharedWith()); |
665 | 665 | $share->setSharedWith($shareWith); |
666 | 666 | $result = $this->federatedShareProvider->create($share); |
667 | - $this->federatedShareProvider->storeRemoteId((int)$result->getId(), $senderId); |
|
667 | + $this->federatedShareProvider->storeRemoteId((int) $result->getId(), $senderId); |
|
668 | 668 | return ['token' => $result->getToken(), 'providerId' => $result->getId()]; |
669 | 669 | } else { |
670 | - throw new ProviderCouldNotAddShareException('resharing not allowed for share: ' . $id); |
|
670 | + throw new ProviderCouldNotAddShareException('resharing not allowed for share: '.$id); |
|
671 | 671 | } |
672 | 672 | |
673 | 673 | } |
@@ -713,7 +713,7 @@ discard block |
||
713 | 713 | */ |
714 | 714 | protected function ocmPermissions2ncPermissions(array $ocmPermissions) { |
715 | 715 | $ncPermissions = 0; |
716 | - foreach($ocmPermissions as $permission) { |
|
716 | + foreach ($ocmPermissions as $permission) { |
|
717 | 717 | switch (strtolower($permission)) { |
718 | 718 | case 'read': |
719 | 719 | $ncPermissions += Constants::PERMISSION_READ; |