@@ -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 | } |
@@ -362,7 +362,7 @@ discard block |
||
| 362 | 362 | |
| 363 | 363 | if ($fullId === null && $expirationDate === null && $this->shareApiLinkDefaultExpireDate()) { |
| 364 | 364 | $expirationDate = new \DateTime(); |
| 365 | - $expirationDate->setTime(0,0,0); |
|
| 365 | + $expirationDate->setTime(0, 0, 0); |
|
| 366 | 366 | $expirationDate->add(new \DateInterval('P'.$this->shareApiLinkDefaultExpireDays().'D')); |
| 367 | 367 | } |
| 368 | 368 | |
@@ -374,7 +374,7 @@ discard block |
||
| 374 | 374 | |
| 375 | 375 | $date = new \DateTime(); |
| 376 | 376 | $date->setTime(0, 0, 0); |
| 377 | - $date->add(new \DateInterval('P' . $this->shareApiLinkDefaultExpireDays() . 'D')); |
|
| 377 | + $date->add(new \DateInterval('P'.$this->shareApiLinkDefaultExpireDays().'D')); |
|
| 378 | 378 | if ($date < $expirationDate) { |
| 379 | 379 | $message = $this->l->t('Can’t set expiration date more than %s days in the future', [$this->shareApiLinkDefaultExpireDays()]); |
| 380 | 380 | throw new GenericShareException($message, $message, 404); |
@@ -427,7 +427,7 @@ discard block |
||
| 427 | 427 | */ |
| 428 | 428 | $provider = $this->factory->getProviderForType(\OCP\Share::SHARE_TYPE_USER); |
| 429 | 429 | $existingShares = $provider->getSharesByPath($share->getNode()); |
| 430 | - foreach($existingShares as $existingShare) { |
|
| 430 | + foreach ($existingShares as $existingShare) { |
|
| 431 | 431 | // Ignore if it is the same share |
| 432 | 432 | try { |
| 433 | 433 | if ($existingShare->getFullId() === $share->getFullId()) { |
@@ -484,7 +484,7 @@ discard block |
||
| 484 | 484 | */ |
| 485 | 485 | $provider = $this->factory->getProviderForType(\OCP\Share::SHARE_TYPE_GROUP); |
| 486 | 486 | $existingShares = $provider->getSharesByPath($share->getNode()); |
| 487 | - foreach($existingShares as $existingShare) { |
|
| 487 | + foreach ($existingShares as $existingShare) { |
|
| 488 | 488 | try { |
| 489 | 489 | if ($existingShare->getFullId() === $share->getFullId()) { |
| 490 | 490 | continue; |
@@ -553,7 +553,7 @@ discard block |
||
| 553 | 553 | // Make sure that we do not share a path that contains a shared mountpoint |
| 554 | 554 | if ($path instanceof \OCP\Files\Folder) { |
| 555 | 555 | $mounts = $this->mountManager->findIn($path->getPath()); |
| 556 | - foreach($mounts as $mount) { |
|
| 556 | + foreach ($mounts as $mount) { |
|
| 557 | 557 | if ($mount->getStorage()->instanceOfStorage('\OCA\Files_Sharing\ISharedStorage')) { |
| 558 | 558 | throw new \InvalidArgumentException('Path contains files shared with you'); |
| 559 | 559 | } |
@@ -601,7 +601,7 @@ discard block |
||
| 601 | 601 | $storage = $share->getNode()->getStorage(); |
| 602 | 602 | if ($storage->instanceOfStorage('OCA\Files_Sharing\External\Storage')) { |
| 603 | 603 | $parent = $share->getNode()->getParent(); |
| 604 | - while($parent->getStorage()->instanceOfStorage('OCA\Files_Sharing\External\Storage')) { |
|
| 604 | + while ($parent->getStorage()->instanceOfStorage('OCA\Files_Sharing\External\Storage')) { |
|
| 605 | 605 | $parent = $parent->getParent(); |
| 606 | 606 | } |
| 607 | 607 | $share->setShareOwner($parent->getOwner()->getUID()); |
@@ -654,7 +654,7 @@ discard block |
||
| 654 | 654 | } |
| 655 | 655 | |
| 656 | 656 | // Generate the target |
| 657 | - $target = $this->config->getSystemValue('share_folder', '/') .'/'. $share->getNode()->getName(); |
|
| 657 | + $target = $this->config->getSystemValue('share_folder', '/').'/'.$share->getNode()->getName(); |
|
| 658 | 658 | $target = \OC\Files\Filesystem::normalizePath($target); |
| 659 | 659 | $share->setTarget($target); |
| 660 | 660 | |
@@ -677,7 +677,7 @@ discard block |
||
| 677 | 677 | |
| 678 | 678 | if ($share->getShareType() === \OCP\Share::SHARE_TYPE_USER) { |
| 679 | 679 | $mailSend = $share->getMailSend(); |
| 680 | - if($mailSend === true) { |
|
| 680 | + if ($mailSend === true) { |
|
| 681 | 681 | $user = $this->userManager->get($share->getSharedWith()); |
| 682 | 682 | if ($user !== null) { |
| 683 | 683 | $emailAddress = $user->getEMailAddress(); |
@@ -692,12 +692,12 @@ discard block |
||
| 692 | 692 | $emailAddress, |
| 693 | 693 | $share->getExpirationDate() |
| 694 | 694 | ); |
| 695 | - $this->logger->debug('Sent share notification to ' . $emailAddress . ' for share with ID ' . $share->getId(), ['app' => 'share']); |
|
| 695 | + $this->logger->debug('Sent share notification to '.$emailAddress.' for share with ID '.$share->getId(), ['app' => 'share']); |
|
| 696 | 696 | } else { |
| 697 | - $this->logger->debug('Share notification not sent to ' . $share->getSharedWith() . ' because email address is not set.', ['app' => 'share']); |
|
| 697 | + $this->logger->debug('Share notification not sent to '.$share->getSharedWith().' because email address is not set.', ['app' => 'share']); |
|
| 698 | 698 | } |
| 699 | 699 | } else { |
| 700 | - $this->logger->debug('Share notification not sent to ' . $share->getSharedWith() . ' because user could not be found.', ['app' => 'share']); |
|
| 700 | + $this->logger->debug('Share notification not sent to '.$share->getSharedWith().' because user could not be found.', ['app' => 'share']); |
|
| 701 | 701 | } |
| 702 | 702 | } else { |
| 703 | 703 | $this->logger->debug('Share notification not sent because mailsend is false.', ['app' => 'share']); |
@@ -744,7 +744,7 @@ discard block |
||
| 744 | 744 | $text = $l->t('%1$s shared »%2$s« with you.', [$initiatorDisplayName, $filename]); |
| 745 | 745 | |
| 746 | 746 | $emailTemplate->addBodyText( |
| 747 | - htmlspecialchars($text . ' ' . $l->t('Click the button below to open it.')), |
|
| 747 | + htmlspecialchars($text.' '.$l->t('Click the button below to open it.')), |
|
| 748 | 748 | $text |
| 749 | 749 | ); |
| 750 | 750 | $emailTemplate->addBodyButton( |
@@ -768,9 +768,9 @@ discard block |
||
| 768 | 768 | // The "Reply-To" is set to the sharer if an mail address is configured |
| 769 | 769 | // also the default footer contains a "Do not reply" which needs to be adjusted. |
| 770 | 770 | $initiatorEmail = $initiatorUser->getEMailAddress(); |
| 771 | - if($initiatorEmail !== null) { |
|
| 771 | + if ($initiatorEmail !== null) { |
|
| 772 | 772 | $message->setReplyTo([$initiatorEmail => $initiatorDisplayName]); |
| 773 | - $emailTemplate->addFooter($instanceName . ($this->defaults->getSlogan() !== '' ? ' - ' . $this->defaults->getSlogan() : '')); |
|
| 773 | + $emailTemplate->addFooter($instanceName.($this->defaults->getSlogan() !== '' ? ' - '.$this->defaults->getSlogan() : '')); |
|
| 774 | 774 | } else { |
| 775 | 775 | $emailTemplate->addFooter(); |
| 776 | 776 | } |
@@ -778,8 +778,8 @@ discard block |
||
| 778 | 778 | $message->useTemplate($emailTemplate); |
| 779 | 779 | try { |
| 780 | 780 | $failedRecipients = $this->mailer->send($message); |
| 781 | - if(!empty($failedRecipients)) { |
|
| 782 | - $this->logger->error('Share notification mail could not be sent to: ' . implode(', ', $failedRecipients)); |
|
| 781 | + if (!empty($failedRecipients)) { |
|
| 782 | + $this->logger->error('Share notification mail could not be sent to: '.implode(', ', $failedRecipients)); |
|
| 783 | 783 | return; |
| 784 | 784 | } |
| 785 | 785 | } catch (\Exception $e) { |
@@ -997,7 +997,7 @@ discard block |
||
| 997 | 997 | * @param string $recipientId |
| 998 | 998 | */ |
| 999 | 999 | public function deleteFromSelf(\OCP\Share\IShare $share, $recipientId) { |
| 1000 | - list($providerId, ) = $this->splitFullId($share->getFullId()); |
|
| 1000 | + list($providerId,) = $this->splitFullId($share->getFullId()); |
|
| 1001 | 1001 | $provider = $this->factory->getProvider($providerId); |
| 1002 | 1002 | |
| 1003 | 1003 | $provider->deleteFromSelf($share, $recipientId); |
@@ -1006,7 +1006,7 @@ discard block |
||
| 1006 | 1006 | } |
| 1007 | 1007 | |
| 1008 | 1008 | public function restoreShare(IShare $share, string $recipientId): IShare { |
| 1009 | - list($providerId, ) = $this->splitFullId($share->getFullId()); |
|
| 1009 | + list($providerId,) = $this->splitFullId($share->getFullId()); |
|
| 1010 | 1010 | $provider = $this->factory->getProvider($providerId); |
| 1011 | 1011 | |
| 1012 | 1012 | return $provider->restore($share, $recipientId); |
@@ -1027,7 +1027,7 @@ discard block |
||
| 1027 | 1027 | if ($share->getShareType() === \OCP\Share::SHARE_TYPE_GROUP) { |
| 1028 | 1028 | $sharedWith = $this->groupManager->get($share->getSharedWith()); |
| 1029 | 1029 | if (is_null($sharedWith)) { |
| 1030 | - throw new \InvalidArgumentException('Group "' . $share->getSharedWith() . '" does not exist'); |
|
| 1030 | + throw new \InvalidArgumentException('Group "'.$share->getSharedWith().'" does not exist'); |
|
| 1031 | 1031 | } |
| 1032 | 1032 | $recipient = $this->userManager->get($recipientId); |
| 1033 | 1033 | if (!$sharedWith->inGroup($recipient)) { |
@@ -1035,7 +1035,7 @@ discard block |
||
| 1035 | 1035 | } |
| 1036 | 1036 | } |
| 1037 | 1037 | |
| 1038 | - list($providerId, ) = $this->splitFullId($share->getFullId()); |
|
| 1038 | + list($providerId,) = $this->splitFullId($share->getFullId()); |
|
| 1039 | 1039 | $provider = $this->factory->getProvider($providerId); |
| 1040 | 1040 | |
| 1041 | 1041 | $provider->move($share, $recipientId); |
@@ -1082,7 +1082,7 @@ discard block |
||
| 1082 | 1082 | |
| 1083 | 1083 | $shares2 = []; |
| 1084 | 1084 | |
| 1085 | - while(true) { |
|
| 1085 | + while (true) { |
|
| 1086 | 1086 | $added = 0; |
| 1087 | 1087 | foreach ($shares as $share) { |
| 1088 | 1088 | |
@@ -1167,7 +1167,7 @@ discard block |
||
| 1167 | 1167 | }); |
| 1168 | 1168 | |
| 1169 | 1169 | // Only get shares where the owner still exists |
| 1170 | - $shares = array_filter($shares, function (IShare $share) { |
|
| 1170 | + $shares = array_filter($shares, function(IShare $share) { |
|
| 1171 | 1171 | return $this->userManager->userExists($share->getShareOwner()); |
| 1172 | 1172 | }); |
| 1173 | 1173 | |
@@ -1206,7 +1206,7 @@ discard block |
||
| 1206 | 1206 | * |
| 1207 | 1207 | * @return Share[] |
| 1208 | 1208 | */ |
| 1209 | - public function getSharesByPath(\OCP\Files\Node $path, $page=0, $perPage=50) { |
|
| 1209 | + public function getSharesByPath(\OCP\Files\Node $path, $page = 0, $perPage = 50) { |
|
| 1210 | 1210 | return []; |
| 1211 | 1211 | } |
| 1212 | 1212 | |
@@ -1225,7 +1225,7 @@ discard block |
||
| 1225 | 1225 | } |
| 1226 | 1226 | $share = null; |
| 1227 | 1227 | try { |
| 1228 | - if($this->shareApiAllowLinks()) { |
|
| 1228 | + if ($this->shareApiAllowLinks()) { |
|
| 1229 | 1229 | $provider = $this->factory->getProviderForType(\OCP\Share::SHARE_TYPE_LINK); |
| 1230 | 1230 | $share = $provider->getShareByToken($token); |
| 1231 | 1231 | } |
@@ -1441,7 +1441,7 @@ discard block |
||
| 1441 | 1441 | } |
| 1442 | 1442 | $al['users'][$owner] = [ |
| 1443 | 1443 | 'node_id' => $path->getId(), |
| 1444 | - 'node_path' => '/' . $ownerPath, |
|
| 1444 | + 'node_path' => '/'.$ownerPath, |
|
| 1445 | 1445 | ]; |
| 1446 | 1446 | } else { |
| 1447 | 1447 | $al['users'][] = $owner; |
@@ -1541,7 +1541,7 @@ discard block |
||
| 1541 | 1541 | * @return int |
| 1542 | 1542 | */ |
| 1543 | 1543 | public function shareApiLinkDefaultExpireDays() { |
| 1544 | - return (int)$this->config->getAppValue('core', 'shareapi_expire_after_n_days', '7'); |
|
| 1544 | + return (int) $this->config->getAppValue('core', 'shareapi_expire_after_n_days', '7'); |
|
| 1545 | 1545 | } |
| 1546 | 1546 | |
| 1547 | 1547 | /** |