@@ -301,14 +301,14 @@ discard block |
||
301 | 301 | $permissions = 0; |
302 | 302 | |
303 | 303 | if (!$isFederatedShare && $share->getNode()->getOwner() && $share->getNode()->getOwner()->getUID() !== $share->getSharedBy()) { |
304 | - $userMounts = array_filter($userFolder->getById($share->getNode()->getId()), function ($mount) { |
|
304 | + $userMounts = array_filter($userFolder->getById($share->getNode()->getId()), function($mount) { |
|
305 | 305 | // We need to filter since there might be other mountpoints that contain the file |
306 | 306 | // e.g. if the user has access to the same external storage that the file is originating from |
307 | 307 | return $mount->getStorage()->instanceOfStorage(ISharedStorage::class); |
308 | 308 | }); |
309 | 309 | $userMount = array_shift($userMounts); |
310 | 310 | if ($userMount === null) { |
311 | - throw new GenericShareException('Could not get proper share mount for ' . $share->getNode()->getId() . '. Failing since else the next calls are called with null'); |
|
311 | + throw new GenericShareException('Could not get proper share mount for '.$share->getNode()->getId().'. Failing since else the next calls are called with null'); |
|
312 | 312 | } |
313 | 313 | $mount = $userMount->getMountPoint(); |
314 | 314 | // When it's a reshare use the parent share permissions as maximum |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | $userMountPoint = array_shift($userMountPoints); |
318 | 318 | |
319 | 319 | if ($userMountPoint === null) { |
320 | - throw new GenericShareException('Could not get proper user mount for ' . $userMountPointId . '. Failing since else the next calls are called with null'); |
|
320 | + throw new GenericShareException('Could not get proper user mount for '.$userMountPointId.'. Failing since else the next calls are called with null'); |
|
321 | 321 | } |
322 | 322 | |
323 | 323 | /* Check if this is an incoming share */ |
@@ -407,9 +407,9 @@ discard block |
||
407 | 407 | |
408 | 408 | if ($fullId === null && $expirationDate === null && $this->shareApiInternalDefaultExpireDate()) { |
409 | 409 | $expirationDate = new \DateTime(); |
410 | - $expirationDate->setTime(0,0,0); |
|
410 | + $expirationDate->setTime(0, 0, 0); |
|
411 | 411 | |
412 | - $days = (int)$this->config->getAppValue('core', 'internal_defaultExpDays', $this->shareApiLinkDefaultExpireDays()); |
|
412 | + $days = (int) $this->config->getAppValue('core', 'internal_defaultExpDays', $this->shareApiLinkDefaultExpireDays()); |
|
413 | 413 | if ($days > $this->shareApiLinkDefaultExpireDays()) { |
414 | 414 | $days = $this->shareApiLinkDefaultExpireDays(); |
415 | 415 | } |
@@ -424,7 +424,7 @@ discard block |
||
424 | 424 | |
425 | 425 | $date = new \DateTime(); |
426 | 426 | $date->setTime(0, 0, 0); |
427 | - $date->add(new \DateInterval('P' . $this->shareApiInternalDefaultExpireDays() . 'D')); |
|
427 | + $date->add(new \DateInterval('P'.$this->shareApiInternalDefaultExpireDays().'D')); |
|
428 | 428 | if ($date < $expirationDate) { |
429 | 429 | $message = $this->l->t('Can’t set expiration date more than %s days in the future', [$this->shareApiInternalDefaultExpireDays()]); |
430 | 430 | throw new GenericShareException($message, $message, 404); |
@@ -483,9 +483,9 @@ discard block |
||
483 | 483 | |
484 | 484 | if ($fullId === null && $expirationDate === null && $this->shareApiLinkDefaultExpireDate()) { |
485 | 485 | $expirationDate = new \DateTime(); |
486 | - $expirationDate->setTime(0,0,0); |
|
486 | + $expirationDate->setTime(0, 0, 0); |
|
487 | 487 | |
488 | - $days = (int)$this->config->getAppValue('core', 'link_defaultExpDays', $this->shareApiLinkDefaultExpireDays()); |
|
488 | + $days = (int) $this->config->getAppValue('core', 'link_defaultExpDays', $this->shareApiLinkDefaultExpireDays()); |
|
489 | 489 | if ($days > $this->shareApiLinkDefaultExpireDays()) { |
490 | 490 | $days = $this->shareApiLinkDefaultExpireDays(); |
491 | 491 | } |
@@ -500,7 +500,7 @@ discard block |
||
500 | 500 | |
501 | 501 | $date = new \DateTime(); |
502 | 502 | $date->setTime(0, 0, 0); |
503 | - $date->add(new \DateInterval('P' . $this->shareApiLinkDefaultExpireDays() . 'D')); |
|
503 | + $date->add(new \DateInterval('P'.$this->shareApiLinkDefaultExpireDays().'D')); |
|
504 | 504 | if ($date < $expirationDate) { |
505 | 505 | $message = $this->l->t('Can’t set expiration date more than %s days in the future', [$this->shareApiLinkDefaultExpireDays()]); |
506 | 506 | throw new GenericShareException($message, $message, 404); |
@@ -785,7 +785,7 @@ discard block |
||
785 | 785 | } |
786 | 786 | |
787 | 787 | // Generate the target |
788 | - $target = $this->config->getSystemValue('share_folder', '/') .'/'. $share->getNode()->getName(); |
|
788 | + $target = $this->config->getSystemValue('share_folder', '/').'/'.$share->getNode()->getName(); |
|
789 | 789 | $target = \OC\Files\Filesystem::normalizePath($target); |
790 | 790 | $share->setTarget($target); |
791 | 791 | |
@@ -831,12 +831,12 @@ discard block |
||
831 | 831 | $emailAddress, |
832 | 832 | $share->getExpirationDate() |
833 | 833 | ); |
834 | - $this->logger->debug('Sent share notification to ' . $emailAddress . ' for share with ID ' . $share->getId(), ['app' => 'share']); |
|
834 | + $this->logger->debug('Sent share notification to '.$emailAddress.' for share with ID '.$share->getId(), ['app' => 'share']); |
|
835 | 835 | } else { |
836 | - $this->logger->debug('Share notification not sent to ' . $share->getSharedWith() . ' because email address is not set.', ['app' => 'share']); |
|
836 | + $this->logger->debug('Share notification not sent to '.$share->getSharedWith().' because email address is not set.', ['app' => 'share']); |
|
837 | 837 | } |
838 | 838 | } else { |
839 | - $this->logger->debug('Share notification not sent to ' . $share->getSharedWith() . ' because user could not be found.', ['app' => 'share']); |
|
839 | + $this->logger->debug('Share notification not sent to '.$share->getSharedWith().' because user could not be found.', ['app' => 'share']); |
|
840 | 840 | } |
841 | 841 | } else { |
842 | 842 | $this->logger->debug('Share notification not sent because mailsend is false.', ['app' => 'share']); |
@@ -883,7 +883,7 @@ discard block |
||
883 | 883 | $text = $l->t('%1$s shared »%2$s« with you.', [$initiatorDisplayName, $filename]); |
884 | 884 | |
885 | 885 | $emailTemplate->addBodyText( |
886 | - htmlspecialchars($text . ' ' . $l->t('Click the button below to open it.')), |
|
886 | + htmlspecialchars($text.' '.$l->t('Click the button below to open it.')), |
|
887 | 887 | $text |
888 | 888 | ); |
889 | 889 | $emailTemplate->addBodyButton( |
@@ -909,7 +909,7 @@ discard block |
||
909 | 909 | $initiatorEmail = $initiatorUser->getEMailAddress(); |
910 | 910 | if ($initiatorEmail !== null) { |
911 | 911 | $message->setReplyTo([$initiatorEmail => $initiatorDisplayName]); |
912 | - $emailTemplate->addFooter($instanceName . ($this->defaults->getSlogan($l->getLanguageCode()) !== '' ? ' - ' . $this->defaults->getSlogan($l->getLanguageCode()) : '')); |
|
912 | + $emailTemplate->addFooter($instanceName.($this->defaults->getSlogan($l->getLanguageCode()) !== '' ? ' - '.$this->defaults->getSlogan($l->getLanguageCode()) : '')); |
|
913 | 913 | } else { |
914 | 914 | $emailTemplate->addFooter('', $l->getLanguageCode()); |
915 | 915 | } |
@@ -918,7 +918,7 @@ discard block |
||
918 | 918 | try { |
919 | 919 | $failedRecipients = $this->mailer->send($message); |
920 | 920 | if (!empty($failedRecipients)) { |
921 | - $this->logger->error('Share notification mail could not be sent to: ' . implode(', ', $failedRecipients)); |
|
921 | + $this->logger->error('Share notification mail could not be sent to: '.implode(', ', $failedRecipients)); |
|
922 | 922 | return; |
923 | 923 | } |
924 | 924 | } catch (\Exception $e) { |
@@ -1187,7 +1187,7 @@ discard block |
||
1187 | 1187 | * @param string $recipientId |
1188 | 1188 | */ |
1189 | 1189 | public function deleteFromSelf(IShare $share, $recipientId) { |
1190 | - list($providerId, ) = $this->splitFullId($share->getFullId()); |
|
1190 | + list($providerId,) = $this->splitFullId($share->getFullId()); |
|
1191 | 1191 | $provider = $this->factory->getProvider($providerId); |
1192 | 1192 | |
1193 | 1193 | $provider->deleteFromSelf($share, $recipientId); |
@@ -1196,7 +1196,7 @@ discard block |
||
1196 | 1196 | } |
1197 | 1197 | |
1198 | 1198 | public function restoreShare(IShare $share, string $recipientId): IShare { |
1199 | - list($providerId, ) = $this->splitFullId($share->getFullId()); |
|
1199 | + list($providerId,) = $this->splitFullId($share->getFullId()); |
|
1200 | 1200 | $provider = $this->factory->getProvider($providerId); |
1201 | 1201 | |
1202 | 1202 | return $provider->restore($share, $recipientId); |
@@ -1217,7 +1217,7 @@ discard block |
||
1217 | 1217 | if ($share->getShareType() === IShare::TYPE_GROUP) { |
1218 | 1218 | $sharedWith = $this->groupManager->get($share->getSharedWith()); |
1219 | 1219 | if (is_null($sharedWith)) { |
1220 | - throw new \InvalidArgumentException('Group "' . $share->getSharedWith() . '" does not exist'); |
|
1220 | + throw new \InvalidArgumentException('Group "'.$share->getSharedWith().'" does not exist'); |
|
1221 | 1221 | } |
1222 | 1222 | $recipient = $this->userManager->get($recipientId); |
1223 | 1223 | if (!$sharedWith->inGroup($recipient)) { |
@@ -1225,7 +1225,7 @@ discard block |
||
1225 | 1225 | } |
1226 | 1226 | } |
1227 | 1227 | |
1228 | - list($providerId, ) = $this->splitFullId($share->getFullId()); |
|
1228 | + list($providerId,) = $this->splitFullId($share->getFullId()); |
|
1229 | 1229 | $provider = $this->factory->getProvider($providerId); |
1230 | 1230 | |
1231 | 1231 | return $provider->move($share, $recipientId); |
@@ -1234,7 +1234,7 @@ discard block |
||
1234 | 1234 | public function getSharesInFolder($userId, Folder $node, $reshares = false) { |
1235 | 1235 | $providers = $this->factory->getAllProviders(); |
1236 | 1236 | |
1237 | - return array_reduce($providers, function ($shares, IShareProvider $provider) use ($userId, $node, $reshares) { |
|
1237 | + return array_reduce($providers, function($shares, IShareProvider $provider) use ($userId, $node, $reshares) { |
|
1238 | 1238 | $newShares = $provider->getSharesInFolder($userId, $node, $reshares); |
1239 | 1239 | foreach ($newShares as $fid => $data) { |
1240 | 1240 | if (!isset($shares[$fid])) { |
@@ -1351,12 +1351,12 @@ discard block |
||
1351 | 1351 | $shares = $this->getSharedWith($userId, $shareType, $node, $limit, $offset); |
1352 | 1352 | |
1353 | 1353 | // Only get deleted shares |
1354 | - $shares = array_filter($shares, function (IShare $share) { |
|
1354 | + $shares = array_filter($shares, function(IShare $share) { |
|
1355 | 1355 | return $share->getPermissions() === 0; |
1356 | 1356 | }); |
1357 | 1357 | |
1358 | 1358 | // Only get shares where the owner still exists |
1359 | - $shares = array_filter($shares, function (IShare $share) { |
|
1359 | + $shares = array_filter($shares, function(IShare $share) { |
|
1360 | 1360 | return $this->userManager->userExists($share->getShareOwner()); |
1361 | 1361 | }); |
1362 | 1362 | |
@@ -1395,7 +1395,7 @@ discard block |
||
1395 | 1395 | * |
1396 | 1396 | * @return Share[] |
1397 | 1397 | */ |
1398 | - public function getSharesByPath(\OCP\Files\Node $path, $page=0, $perPage=50) { |
|
1398 | + public function getSharesByPath(\OCP\Files\Node $path, $page = 0, $perPage = 50) { |
|
1399 | 1399 | return []; |
1400 | 1400 | } |
1401 | 1401 | |
@@ -1653,7 +1653,7 @@ discard block |
||
1653 | 1653 | } |
1654 | 1654 | $al['users'][$owner] = [ |
1655 | 1655 | 'node_id' => $path->getId(), |
1656 | - 'node_path' => '/' . $ownerPath, |
|
1656 | + 'node_path' => '/'.$ownerPath, |
|
1657 | 1657 | ]; |
1658 | 1658 | } else { |
1659 | 1659 | $al['users'][] = $owner; |
@@ -1754,7 +1754,7 @@ discard block |
||
1754 | 1754 | * @return int |
1755 | 1755 | */ |
1756 | 1756 | public function shareApiLinkDefaultExpireDays() { |
1757 | - return (int)$this->config->getAppValue('core', 'shareapi_expire_after_n_days', '7'); |
|
1757 | + return (int) $this->config->getAppValue('core', 'shareapi_expire_after_n_days', '7'); |
|
1758 | 1758 | } |
1759 | 1759 | |
1760 | 1760 | /** |
@@ -1782,7 +1782,7 @@ discard block |
||
1782 | 1782 | * @return int |
1783 | 1783 | */ |
1784 | 1784 | public function shareApiInternalDefaultExpireDays(): int { |
1785 | - return (int)$this->config->getAppValue('core', 'shareapi_internal_expire_after_n_days', '7'); |
|
1785 | + return (int) $this->config->getAppValue('core', 'shareapi_internal_expire_after_n_days', '7'); |
|
1786 | 1786 | } |
1787 | 1787 | |
1788 | 1788 | /** |