|
@@ -302,14 +302,14 @@ discard block |
|
|
block discarded – undo |
|
302
|
302
|
$permissions = 0; |
|
303
|
303
|
|
|
304
|
304
|
if (!$isFederatedShare && $share->getNode()->getOwner() && $share->getNode()->getOwner()->getUID() !== $share->getSharedBy()) { |
|
305
|
|
- $userMounts = array_filter($userFolder->getById($share->getNode()->getId()), function ($mount) { |
|
|
305
|
+ $userMounts = array_filter($userFolder->getById($share->getNode()->getId()), function($mount) { |
|
306
|
306
|
// We need to filter since there might be other mountpoints that contain the file |
|
307
|
307
|
// e.g. if the user has access to the same external storage that the file is originating from |
|
308
|
308
|
return $mount->getStorage()->instanceOfStorage(ISharedStorage::class); |
|
309
|
309
|
}); |
|
310
|
310
|
$userMount = array_shift($userMounts); |
|
311
|
311
|
if ($userMount === null) { |
|
312
|
|
- throw new GenericShareException('Could not get proper share mount for ' . $share->getNode()->getId() . '. Failing since else the next calls are called with null'); |
|
|
312
|
+ throw new GenericShareException('Could not get proper share mount for '.$share->getNode()->getId().'. Failing since else the next calls are called with null'); |
|
313
|
313
|
} |
|
314
|
314
|
$mount = $userMount->getMountPoint(); |
|
315
|
315
|
// When it's a reshare use the parent share permissions as maximum |
|
@@ -318,7 +318,7 @@ discard block |
|
|
block discarded – undo |
|
318
|
318
|
$userMountPoint = array_shift($userMountPoints); |
|
319
|
319
|
|
|
320
|
320
|
if ($userMountPoint === null) { |
|
321
|
|
- throw new GenericShareException('Could not get proper user mount for ' . $userMountPointId . '. Failing since else the next calls are called with null'); |
|
|
321
|
+ throw new GenericShareException('Could not get proper user mount for '.$userMountPointId.'. Failing since else the next calls are called with null'); |
|
322
|
322
|
} |
|
323
|
323
|
|
|
324
|
324
|
/* Check if this is an incoming share */ |
|
@@ -408,9 +408,9 @@ discard block |
|
|
block discarded – undo |
|
408
|
408
|
|
|
409
|
409
|
if ($fullId === null && $expirationDate === null && $this->shareApiInternalDefaultExpireDate()) { |
|
410
|
410
|
$expirationDate = new \DateTime(); |
|
411
|
|
- $expirationDate->setTime(0,0,0); |
|
|
411
|
+ $expirationDate->setTime(0, 0, 0); |
|
412
|
412
|
|
|
413
|
|
- $days = (int)$this->config->getAppValue('core', 'internal_defaultExpDays', (string)$this->shareApiInternalDefaultExpireDays()); |
|
|
413
|
+ $days = (int) $this->config->getAppValue('core', 'internal_defaultExpDays', (string) $this->shareApiInternalDefaultExpireDays()); |
|
414
|
414
|
if ($days > $this->shareApiInternalDefaultExpireDays()) { |
|
415
|
415
|
$days = $this->shareApiInternalDefaultExpireDays(); |
|
416
|
416
|
} |
|
@@ -425,7 +425,7 @@ discard block |
|
|
block discarded – undo |
|
425
|
425
|
|
|
426
|
426
|
$date = new \DateTime(); |
|
427
|
427
|
$date->setTime(0, 0, 0); |
|
428
|
|
- $date->add(new \DateInterval('P' . $this->shareApiInternalDefaultExpireDays() . 'D')); |
|
|
428
|
+ $date->add(new \DateInterval('P'.$this->shareApiInternalDefaultExpireDays().'D')); |
|
429
|
429
|
if ($date < $expirationDate) { |
|
430
|
430
|
$message = $this->l->t('Can’t set expiration date more than %s days in the future', [$this->shareApiInternalDefaultExpireDays()]); |
|
431
|
431
|
throw new GenericShareException($message, $message, 404); |
|
@@ -484,9 +484,9 @@ discard block |
|
|
block discarded – undo |
|
484
|
484
|
|
|
485
|
485
|
if ($fullId === null && $expirationDate === null && $this->shareApiLinkDefaultExpireDate()) { |
|
486
|
486
|
$expirationDate = new \DateTime(); |
|
487
|
|
- $expirationDate->setTime(0,0,0); |
|
|
487
|
+ $expirationDate->setTime(0, 0, 0); |
|
488
|
488
|
|
|
489
|
|
- $days = (int)$this->config->getAppValue('core', 'link_defaultExpDays', $this->shareApiLinkDefaultExpireDays()); |
|
|
489
|
+ $days = (int) $this->config->getAppValue('core', 'link_defaultExpDays', $this->shareApiLinkDefaultExpireDays()); |
|
490
|
490
|
if ($days > $this->shareApiLinkDefaultExpireDays()) { |
|
491
|
491
|
$days = $this->shareApiLinkDefaultExpireDays(); |
|
492
|
492
|
} |
|
@@ -501,7 +501,7 @@ discard block |
|
|
block discarded – undo |
|
501
|
501
|
|
|
502
|
502
|
$date = new \DateTime(); |
|
503
|
503
|
$date->setTime(0, 0, 0); |
|
504
|
|
- $date->add(new \DateInterval('P' . $this->shareApiLinkDefaultExpireDays() . 'D')); |
|
|
504
|
+ $date->add(new \DateInterval('P'.$this->shareApiLinkDefaultExpireDays().'D')); |
|
505
|
505
|
if ($date < $expirationDate) { |
|
506
|
506
|
$message = $this->l->t('Can’t set expiration date more than %s days in the future', [$this->shareApiLinkDefaultExpireDays()]); |
|
507
|
507
|
throw new GenericShareException($message, $message, 404); |
|
@@ -788,7 +788,7 @@ discard block |
|
|
block discarded – undo |
|
788
|
788
|
} |
|
789
|
789
|
|
|
790
|
790
|
// Generate the target |
|
791
|
|
- $target = $this->config->getSystemValue('share_folder', '/') . '/' . $share->getNode()->getName(); |
|
|
791
|
+ $target = $this->config->getSystemValue('share_folder', '/').'/'.$share->getNode()->getName(); |
|
792
|
792
|
$target = \OC\Files\Filesystem::normalizePath($target); |
|
793
|
793
|
$share->setTarget($target); |
|
794
|
794
|
|
|
@@ -838,12 +838,12 @@ discard block |
|
|
block discarded – undo |
|
838
|
838
|
$emailAddress, |
|
839
|
839
|
$share->getExpirationDate() |
|
840
|
840
|
); |
|
841
|
|
- $this->logger->debug('Sent share notification to ' . $emailAddress . ' for share with ID ' . $share->getId(), ['app' => 'share']); |
|
|
841
|
+ $this->logger->debug('Sent share notification to '.$emailAddress.' for share with ID '.$share->getId(), ['app' => 'share']); |
|
842
|
842
|
} else { |
|
843
|
|
- $this->logger->debug('Share notification not sent to ' . $share->getSharedWith() . ' because email address is not set.', ['app' => 'share']); |
|
|
843
|
+ $this->logger->debug('Share notification not sent to '.$share->getSharedWith().' because email address is not set.', ['app' => 'share']); |
|
844
|
844
|
} |
|
845
|
845
|
} else { |
|
846
|
|
- $this->logger->debug('Share notification not sent to ' . $share->getSharedWith() . ' because user could not be found.', ['app' => 'share']); |
|
|
846
|
+ $this->logger->debug('Share notification not sent to '.$share->getSharedWith().' because user could not be found.', ['app' => 'share']); |
|
847
|
847
|
} |
|
848
|
848
|
} else { |
|
849
|
849
|
$this->logger->debug('Share notification not sent because mailsend is false.', ['app' => 'share']); |
|
@@ -890,7 +890,7 @@ discard block |
|
|
block discarded – undo |
|
890
|
890
|
$text = $l->t('%1$s shared »%2$s« with you.', [$initiatorDisplayName, $filename]); |
|
891
|
891
|
|
|
892
|
892
|
$emailTemplate->addBodyText( |
|
893
|
|
- htmlspecialchars($text . ' ' . $l->t('Click the button below to open it.')), |
|
|
893
|
+ htmlspecialchars($text.' '.$l->t('Click the button below to open it.')), |
|
894
|
894
|
$text |
|
895
|
895
|
); |
|
896
|
896
|
$emailTemplate->addBodyButton( |
|
@@ -916,7 +916,7 @@ discard block |
|
|
block discarded – undo |
|
916
|
916
|
$initiatorEmail = $initiatorUser->getEMailAddress(); |
|
917
|
917
|
if ($initiatorEmail !== null) { |
|
918
|
918
|
$message->setReplyTo([$initiatorEmail => $initiatorDisplayName]); |
|
919
|
|
- $emailTemplate->addFooter($instanceName . ($this->defaults->getSlogan($l->getLanguageCode()) !== '' ? ' - ' . $this->defaults->getSlogan($l->getLanguageCode()) : '')); |
|
|
919
|
+ $emailTemplate->addFooter($instanceName.($this->defaults->getSlogan($l->getLanguageCode()) !== '' ? ' - '.$this->defaults->getSlogan($l->getLanguageCode()) : '')); |
|
920
|
920
|
} else { |
|
921
|
921
|
$emailTemplate->addFooter('', $l->getLanguageCode()); |
|
922
|
922
|
} |
|
@@ -925,7 +925,7 @@ discard block |
|
|
block discarded – undo |
|
925
|
925
|
try { |
|
926
|
926
|
$failedRecipients = $this->mailer->send($message); |
|
927
|
927
|
if (!empty($failedRecipients)) { |
|
928
|
|
- $this->logger->error('Share notification mail could not be sent to: ' . implode(', ', $failedRecipients)); |
|
|
928
|
+ $this->logger->error('Share notification mail could not be sent to: '.implode(', ', $failedRecipients)); |
|
929
|
929
|
return; |
|
930
|
930
|
} |
|
931
|
931
|
} catch (\Exception $e) { |
|
@@ -1227,7 +1227,7 @@ discard block |
|
|
block discarded – undo |
|
1227
|
1227
|
if ($share->getShareType() === IShare::TYPE_GROUP) { |
|
1228
|
1228
|
$sharedWith = $this->groupManager->get($share->getSharedWith()); |
|
1229
|
1229
|
if (is_null($sharedWith)) { |
|
1230
|
|
- throw new \InvalidArgumentException('Group "' . $share->getSharedWith() . '" does not exist'); |
|
|
1230
|
+ throw new \InvalidArgumentException('Group "'.$share->getSharedWith().'" does not exist'); |
|
1231
|
1231
|
} |
|
1232
|
1232
|
$recipient = $this->userManager->get($recipientId); |
|
1233
|
1233
|
if (!$sharedWith->inGroup($recipient)) { |
|
@@ -1244,7 +1244,7 @@ discard block |
|
|
block discarded – undo |
|
1244
|
1244
|
public function getSharesInFolder($userId, Folder $node, $reshares = false) { |
|
1245
|
1245
|
$providers = $this->factory->getAllProviders(); |
|
1246
|
1246
|
|
|
1247
|
|
- return array_reduce($providers, function ($shares, IShareProvider $provider) use ($userId, $node, $reshares) { |
|
|
1247
|
+ return array_reduce($providers, function($shares, IShareProvider $provider) use ($userId, $node, $reshares) { |
|
1248
|
1248
|
$newShares = $provider->getSharesInFolder($userId, $node, $reshares); |
|
1249
|
1249
|
foreach ($newShares as $fid => $data) { |
|
1250
|
1250
|
if (!isset($shares[$fid])) { |
|
@@ -1361,12 +1361,12 @@ discard block |
|
|
block discarded – undo |
|
1361
|
1361
|
$shares = $this->getSharedWith($userId, $shareType, $node, $limit, $offset); |
|
1362
|
1362
|
|
|
1363
|
1363
|
// Only get deleted shares |
|
1364
|
|
- $shares = array_filter($shares, function (IShare $share) { |
|
|
1364
|
+ $shares = array_filter($shares, function(IShare $share) { |
|
1365
|
1365
|
return $share->getPermissions() === 0; |
|
1366
|
1366
|
}); |
|
1367
|
1367
|
|
|
1368
|
1368
|
// Only get shares where the owner still exists |
|
1369
|
|
- $shares = array_filter($shares, function (IShare $share) { |
|
|
1369
|
+ $shares = array_filter($shares, function(IShare $share) { |
|
1370
|
1370
|
return $this->userManager->userExists($share->getShareOwner()); |
|
1371
|
1371
|
}); |
|
1372
|
1372
|
|
|
@@ -1663,7 +1663,7 @@ discard block |
|
|
block discarded – undo |
|
1663
|
1663
|
} |
|
1664
|
1664
|
$al['users'][$owner] = [ |
|
1665
|
1665
|
'node_id' => $path->getId(), |
|
1666
|
|
- 'node_path' => '/' . $ownerPath, |
|
|
1666
|
+ 'node_path' => '/'.$ownerPath, |
|
1667
|
1667
|
]; |
|
1668
|
1668
|
} else { |
|
1669
|
1669
|
$al['users'][] = $owner; |
|
@@ -1764,7 +1764,7 @@ discard block |
|
|
block discarded – undo |
|
1764
|
1764
|
* @return int |
|
1765
|
1765
|
*/ |
|
1766
|
1766
|
public function shareApiLinkDefaultExpireDays() { |
|
1767
|
|
- return (int)$this->config->getAppValue('core', 'shareapi_expire_after_n_days', '7'); |
|
|
1767
|
+ return (int) $this->config->getAppValue('core', 'shareapi_expire_after_n_days', '7'); |
|
1768
|
1768
|
} |
|
1769
|
1769
|
|
|
1770
|
1770
|
/** |
|
@@ -1792,7 +1792,7 @@ discard block |
|
|
block discarded – undo |
|
1792
|
1792
|
* @return int |
|
1793
|
1793
|
*/ |
|
1794
|
1794
|
public function shareApiInternalDefaultExpireDays(): int { |
|
1795
|
|
- return (int)$this->config->getAppValue('core', 'shareapi_internal_expire_after_n_days', '7'); |
|
|
1795
|
+ return (int) $this->config->getAppValue('core', 'shareapi_internal_expire_after_n_days', '7'); |
|
1796
|
1796
|
} |
|
1797
|
1797
|
|
|
1798
|
1798
|
/** |