@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | |
151 | 151 | $select = self::createSelectStatement(self::FORMAT_NONE, $fileDependent); |
152 | 152 | |
153 | - $where .= ' `' . $column . '` = ? AND `item_type` = ? '; |
|
153 | + $where .= ' `'.$column.'` = ? AND `item_type` = ? '; |
|
154 | 154 | $arguments = [$itemSource, $itemType]; |
155 | 155 | // for link shares $user === null |
156 | 156 | if ($user !== null) { |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | $arguments[] = $owner; |
169 | 169 | } |
170 | 170 | |
171 | - $query = \OC_DB::prepare('SELECT ' . $select . ' FROM `*PREFIX*share` '. $fileDependentWhere . $where); |
|
171 | + $query = \OC_DB::prepare('SELECT '.$select.' FROM `*PREFIX*share` '.$fileDependentWhere.$where); |
|
172 | 172 | |
173 | 173 | $result = \OC_DB::executeAudited($query, $arguments); |
174 | 174 | |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | if ($fileDependent && !self::isFileReachable($row['path'], $row['storage_id'])) { |
177 | 177 | continue; |
178 | 178 | } |
179 | - if ($fileDependent && (int)$row['file_parent'] === -1) { |
|
179 | + if ($fileDependent && (int) $row['file_parent'] === -1) { |
|
180 | 180 | // if it is a mount point we need to get the path from the mount manager |
181 | 181 | $mountManager = \OC\Files\Filesystem::getMountManager(); |
182 | 182 | $mountPoint = $mountManager->findByStorageId($row['storage_id']); |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | $row['path'] = $path; |
188 | 188 | } else { |
189 | 189 | \OC::$server->getLogger()->warning( |
190 | - 'Could not resolve mount point for ' . $row['storage_id'], |
|
190 | + 'Could not resolve mount point for '.$row['storage_id'], |
|
191 | 191 | ['app' => 'OCP\Share'] |
192 | 192 | ); |
193 | 193 | } |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | } |
205 | 205 | |
206 | 206 | if (!empty($groups)) { |
207 | - $where = $fileDependentWhere . ' WHERE `' . $column . '` = ? AND `item_type` = ? AND `share_with` in (?)'; |
|
207 | + $where = $fileDependentWhere.' WHERE `'.$column.'` = ? AND `item_type` = ? AND `share_with` in (?)'; |
|
208 | 208 | $arguments = [$itemSource, $itemType, $groups]; |
209 | 209 | $types = [null, null, IQueryBuilder::PARAM_STR_ARRAY]; |
210 | 210 | |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | // class isn't static anymore... |
219 | 219 | $conn = \OC::$server->getDatabaseConnection(); |
220 | 220 | $result = $conn->executeQuery( |
221 | - 'SELECT ' . $select . ' FROM `*PREFIX*share` ' . $where, |
|
221 | + 'SELECT '.$select.' FROM `*PREFIX*share` '.$where, |
|
222 | 222 | $arguments, |
223 | 223 | $types |
224 | 224 | ); |
@@ -351,12 +351,12 @@ discard block |
||
351 | 351 | $currentUser = $owner ? $owner : \OC_User::getUser(); |
352 | 352 | foreach ($items as $item) { |
353 | 353 | // delete the item with the expected share_type and owner |
354 | - if ((int)$item['share_type'] === (int)$shareType && $item['uid_owner'] === $currentUser) { |
|
354 | + if ((int) $item['share_type'] === (int) $shareType && $item['uid_owner'] === $currentUser) { |
|
355 | 355 | $toDelete = $item; |
356 | 356 | // if there is more then one result we don't have to delete the children |
357 | 357 | // but update their parent. For group shares the new parent should always be |
358 | 358 | // the original group share and not the db entry with the unique name |
359 | - } elseif ((int)$item['share_type'] === self::$shareTypeGroupUserUnique) { |
|
359 | + } elseif ((int) $item['share_type'] === self::$shareTypeGroupUserUnique) { |
|
360 | 360 | $newParent = $item['parent']; |
361 | 361 | } else { |
362 | 362 | $newParent = $item['id']; |
@@ -413,7 +413,7 @@ discard block |
||
413 | 413 | * @return null |
414 | 414 | */ |
415 | 415 | protected static function unshareItem(array $item, $newParent = null) { |
416 | - $shareType = (int)$item['share_type']; |
|
416 | + $shareType = (int) $item['share_type']; |
|
417 | 417 | $shareWith = null; |
418 | 418 | if ($shareType !== IShare::TYPE_LINK) { |
419 | 419 | $shareWith = $item['share_with']; |
@@ -439,7 +439,7 @@ discard block |
||
439 | 439 | $deletedShares[] = $hookParams; |
440 | 440 | $hookParams['deletedShares'] = $deletedShares; |
441 | 441 | \OC_Hook::emit(\OCP\Share::class, 'post_unshare', $hookParams); |
442 | - if ((int)$item['share_type'] === IShare::TYPE_REMOTE && \OC::$server->getUserSession()->getUser()) { |
|
442 | + if ((int) $item['share_type'] === IShare::TYPE_REMOTE && \OC::$server->getUserSession()->getUser()) { |
|
443 | 443 | list(, $remote) = Helper::splitUserRemote($item['share_with']); |
444 | 444 | self::sendRemoteUnshare($remote, $item['id'], $item['token']); |
445 | 445 | } |
@@ -748,7 +748,7 @@ discard block |
||
748 | 748 | $result = $query->execute($queryArgs); |
749 | 749 | if ($result === false) { |
750 | 750 | \OCP\Util::writeLog('OCP\Share', |
751 | - \OC_DB::getErrorMessage() . ', select=' . $select . ' where=', |
|
751 | + \OC_DB::getErrorMessage().', select='.$select.' where=', |
|
752 | 752 | ILogger::ERROR); |
753 | 753 | } |
754 | 754 | $items = []; |
@@ -790,14 +790,14 @@ discard block |
||
790 | 790 | } |
791 | 791 | // Switch ids if sharing permission is granted on only |
792 | 792 | // one share to ensure correct parent is used if resharing |
793 | - if (~(int)$items[$id]['permissions'] & \OCP\Constants::PERMISSION_SHARE |
|
794 | - && (int)$row['permissions'] & \OCP\Constants::PERMISSION_SHARE) { |
|
793 | + if (~(int) $items[$id]['permissions'] & \OCP\Constants::PERMISSION_SHARE |
|
794 | + && (int) $row['permissions'] & \OCP\Constants::PERMISSION_SHARE) { |
|
795 | 795 | $items[$row['id']] = $items[$id]; |
796 | 796 | $switchedItems[$id] = $row['id']; |
797 | 797 | unset($items[$id]); |
798 | 798 | $id = $row['id']; |
799 | 799 | } |
800 | - $items[$id]['permissions'] |= (int)$row['permissions']; |
|
800 | + $items[$id]['permissions'] |= (int) $row['permissions']; |
|
801 | 801 | } |
802 | 802 | continue; |
803 | 803 | } elseif (!empty($row['parent'])) { |
@@ -810,8 +810,8 @@ discard block |
||
810 | 810 | $query = \OC_DB::prepare('SELECT `file_target` FROM `*PREFIX*share` WHERE `id` = ?'); |
811 | 811 | $parentResult = $query->execute([$row['parent']]); |
812 | 812 | if ($result === false) { |
813 | - \OCP\Util::writeLog('OCP\Share', 'Can\'t select parent: ' . |
|
814 | - \OC_DB::getErrorMessage() . ', select=' . $select . ' where=' . $where, |
|
813 | + \OCP\Util::writeLog('OCP\Share', 'Can\'t select parent: '. |
|
814 | + \OC_DB::getErrorMessage().', select='.$select.' where='.$where, |
|
815 | 815 | ILogger::ERROR); |
816 | 816 | } else { |
817 | 817 | $parentRow = $parentResult->fetchRow(); |
@@ -821,7 +821,7 @@ discard block |
||
821 | 821 | $subPath = substr($row['path'], $pos); |
822 | 822 | $splitPath = explode('/', $subPath); |
823 | 823 | foreach (array_slice($splitPath, 2) as $pathPart) { |
824 | - $tmpPath = $tmpPath . '/' . $pathPart; |
|
824 | + $tmpPath = $tmpPath.'/'.$pathPart; |
|
825 | 825 | } |
826 | 826 | $row['path'] = $tmpPath; |
827 | 827 | } |
@@ -971,7 +971,7 @@ discard block |
||
971 | 971 | |
972 | 972 | // filter out invalid items, these can appear when subshare entries exist |
973 | 973 | // for a group in which the requested user isn't a member any more |
974 | - $items = array_filter($items, function ($item) { |
|
974 | + $items = array_filter($items, function($item) { |
|
975 | 975 | return $item['share_type'] !== self::$shareTypeGroupUserUnique; |
976 | 976 | }); |
977 | 977 | |
@@ -1211,8 +1211,8 @@ discard block |
||
1211 | 1211 | |
1212 | 1212 | if ($checkReshare && $checkReshare['uid_owner'] !== \OC_User::getUser()) { |
1213 | 1213 | // Check if share permissions is granted |
1214 | - if (self::isResharingAllowed() && (int)$checkReshare['permissions'] & \OCP\Constants::PERMISSION_SHARE) { |
|
1215 | - if (~(int)$checkReshare['permissions'] & $permissions) { |
|
1214 | + if (self::isResharingAllowed() && (int) $checkReshare['permissions'] & \OCP\Constants::PERMISSION_SHARE) { |
|
1215 | + if (~(int) $checkReshare['permissions'] & $permissions) { |
|
1216 | 1216 | $message = 'Sharing %1$s failed, because the permissions exceed permissions granted to %2$s'; |
1217 | 1217 | throw new \Exception(sprintf($message, $itemSourceName, $uidOwner)); |
1218 | 1218 | } else { |
@@ -1300,7 +1300,7 @@ discard block |
||
1300 | 1300 | |
1301 | 1301 | $id = false; |
1302 | 1302 | if ($result) { |
1303 | - $id = \OC::$server->getDatabaseConnection()->lastInsertId('*PREFIX*share'); |
|
1303 | + $id = \OC::$server->getDatabaseConnection()->lastInsertId('*PREFIX*share'); |
|
1304 | 1304 | } |
1305 | 1305 | |
1306 | 1306 | return $id; |
@@ -1401,7 +1401,7 @@ discard block |
||
1401 | 1401 | * @param array $parameters additional format parameters |
1402 | 1402 | * @return array format result |
1403 | 1403 | */ |
1404 | - private static function formatResult($items, $column, $backend, $format = self::FORMAT_NONE , $parameters = null) { |
|
1404 | + private static function formatResult($items, $column, $backend, $format = self::FORMAT_NONE, $parameters = null) { |
|
1405 | 1405 | if ($format === self::FORMAT_NONE) { |
1406 | 1406 | return $items; |
1407 | 1407 | } elseif ($format === self::FORMAT_STATUSES) { |
@@ -1458,13 +1458,13 @@ discard block |
||
1458 | 1458 | $try = 0; |
1459 | 1459 | $discoveryService = \OC::$server->query(\OCP\OCS\IDiscoveryService::class); |
1460 | 1460 | while ($result['success'] === false && $try < 2) { |
1461 | - $federationEndpoints = $discoveryService->discover($protocol . $remoteDomain, 'FEDERATED_SHARING'); |
|
1461 | + $federationEndpoints = $discoveryService->discover($protocol.$remoteDomain, 'FEDERATED_SHARING'); |
|
1462 | 1462 | $endpoint = isset($federationEndpoints['share']) ? $federationEndpoints['share'] : '/ocs/v2.php/cloud/shares'; |
1463 | 1463 | $client = \OC::$server->getHTTPClientService()->newClient(); |
1464 | 1464 | |
1465 | 1465 | try { |
1466 | 1466 | $response = $client->post( |
1467 | - $protocol . $remoteDomain . $endpoint . $urlSuffix . '?format=' . self::RESPONSE_FORMAT, |
|
1467 | + $protocol.$remoteDomain.$endpoint.$urlSuffix.'?format='.self::RESPONSE_FORMAT, |
|
1468 | 1468 | [ |
1469 | 1469 | 'body' => $fields, |
1470 | 1470 | 'connect_timeout' => 10, |
@@ -1505,7 +1505,7 @@ discard block |
||
1505 | 1505 | * @return int |
1506 | 1506 | */ |
1507 | 1507 | public static function getExpireInterval() { |
1508 | - return (int)\OC::$server->getConfig()->getAppValue('core', 'shareapi_expire_after_n_days', '7'); |
|
1508 | + return (int) \OC::$server->getConfig()->getAppValue('core', 'shareapi_expire_after_n_days', '7'); |
|
1509 | 1509 | } |
1510 | 1510 | |
1511 | 1511 | /** |
@@ -392,9 +392,9 @@ discard block |
||
392 | 392 | |
393 | 393 | if ($fullId === null && $expirationDate === null && $this->shareApiInternalDefaultExpireDate()) { |
394 | 394 | $expirationDate = new \DateTime(); |
395 | - $expirationDate->setTime(0,0,0); |
|
395 | + $expirationDate->setTime(0, 0, 0); |
|
396 | 396 | |
397 | - $days = (int)$this->config->getAppValue('core', 'internal_defaultExpDays', $this->shareApiLinkDefaultExpireDays()); |
|
397 | + $days = (int) $this->config->getAppValue('core', 'internal_defaultExpDays', $this->shareApiLinkDefaultExpireDays()); |
|
398 | 398 | if ($days > $this->shareApiLinkDefaultExpireDays()) { |
399 | 399 | $days = $this->shareApiLinkDefaultExpireDays(); |
400 | 400 | } |
@@ -409,7 +409,7 @@ discard block |
||
409 | 409 | |
410 | 410 | $date = new \DateTime(); |
411 | 411 | $date->setTime(0, 0, 0); |
412 | - $date->add(new \DateInterval('P' . $this->shareApiInternalDefaultExpireDays() . 'D')); |
|
412 | + $date->add(new \DateInterval('P'.$this->shareApiInternalDefaultExpireDays().'D')); |
|
413 | 413 | if ($date < $expirationDate) { |
414 | 414 | $message = $this->l->t('Can’t set expiration date more than %s days in the future', [$this->shareApiInternalDefaultExpireDays()]); |
415 | 415 | throw new GenericShareException($message, $message, 404); |
@@ -468,9 +468,9 @@ discard block |
||
468 | 468 | |
469 | 469 | if ($fullId === null && $expirationDate === null && $this->shareApiLinkDefaultExpireDate()) { |
470 | 470 | $expirationDate = new \DateTime(); |
471 | - $expirationDate->setTime(0,0,0); |
|
471 | + $expirationDate->setTime(0, 0, 0); |
|
472 | 472 | |
473 | - $days = (int)$this->config->getAppValue('core', 'link_defaultExpDays', $this->shareApiLinkDefaultExpireDays()); |
|
473 | + $days = (int) $this->config->getAppValue('core', 'link_defaultExpDays', $this->shareApiLinkDefaultExpireDays()); |
|
474 | 474 | if ($days > $this->shareApiLinkDefaultExpireDays()) { |
475 | 475 | $days = $this->shareApiLinkDefaultExpireDays(); |
476 | 476 | } |
@@ -485,7 +485,7 @@ discard block |
||
485 | 485 | |
486 | 486 | $date = new \DateTime(); |
487 | 487 | $date->setTime(0, 0, 0); |
488 | - $date->add(new \DateInterval('P' . $this->shareApiLinkDefaultExpireDays() . 'D')); |
|
488 | + $date->add(new \DateInterval('P'.$this->shareApiLinkDefaultExpireDays().'D')); |
|
489 | 489 | if ($date < $expirationDate) { |
490 | 490 | $message = $this->l->t('Can’t set expiration date more than %s days in the future', [$this->shareApiLinkDefaultExpireDays()]); |
491 | 491 | throw new GenericShareException($message, $message, 404); |
@@ -770,7 +770,7 @@ discard block |
||
770 | 770 | } |
771 | 771 | |
772 | 772 | // Generate the target |
773 | - $target = $this->config->getSystemValue('share_folder', '/') .'/'. $share->getNode()->getName(); |
|
773 | + $target = $this->config->getSystemValue('share_folder', '/').'/'.$share->getNode()->getName(); |
|
774 | 774 | $target = \OC\Files\Filesystem::normalizePath($target); |
775 | 775 | $share->setTarget($target); |
776 | 776 | |
@@ -815,12 +815,12 @@ discard block |
||
815 | 815 | $emailAddress, |
816 | 816 | $share->getExpirationDate() |
817 | 817 | ); |
818 | - $this->logger->debug('Sent share notification to ' . $emailAddress . ' for share with ID ' . $share->getId(), ['app' => 'share']); |
|
818 | + $this->logger->debug('Sent share notification to '.$emailAddress.' for share with ID '.$share->getId(), ['app' => 'share']); |
|
819 | 819 | } else { |
820 | - $this->logger->debug('Share notification not sent to ' . $share->getSharedWith() . ' because email address is not set.', ['app' => 'share']); |
|
820 | + $this->logger->debug('Share notification not sent to '.$share->getSharedWith().' because email address is not set.', ['app' => 'share']); |
|
821 | 821 | } |
822 | 822 | } else { |
823 | - $this->logger->debug('Share notification not sent to ' . $share->getSharedWith() . ' because user could not be found.', ['app' => 'share']); |
|
823 | + $this->logger->debug('Share notification not sent to '.$share->getSharedWith().' because user could not be found.', ['app' => 'share']); |
|
824 | 824 | } |
825 | 825 | } else { |
826 | 826 | $this->logger->debug('Share notification not sent because mailsend is false.', ['app' => 'share']); |
@@ -867,7 +867,7 @@ discard block |
||
867 | 867 | $text = $l->t('%1$s shared »%2$s« with you.', [$initiatorDisplayName, $filename]); |
868 | 868 | |
869 | 869 | $emailTemplate->addBodyText( |
870 | - htmlspecialchars($text . ' ' . $l->t('Click the button below to open it.')), |
|
870 | + htmlspecialchars($text.' '.$l->t('Click the button below to open it.')), |
|
871 | 871 | $text |
872 | 872 | ); |
873 | 873 | $emailTemplate->addBodyButton( |
@@ -893,7 +893,7 @@ discard block |
||
893 | 893 | $initiatorEmail = $initiatorUser->getEMailAddress(); |
894 | 894 | if ($initiatorEmail !== null) { |
895 | 895 | $message->setReplyTo([$initiatorEmail => $initiatorDisplayName]); |
896 | - $emailTemplate->addFooter($instanceName . ($this->defaults->getSlogan($l->getLanguageCode()) !== '' ? ' - ' . $this->defaults->getSlogan($l->getLanguageCode()) : '')); |
|
896 | + $emailTemplate->addFooter($instanceName.($this->defaults->getSlogan($l->getLanguageCode()) !== '' ? ' - '.$this->defaults->getSlogan($l->getLanguageCode()) : '')); |
|
897 | 897 | } else { |
898 | 898 | $emailTemplate->addFooter('', $l->getLanguageCode()); |
899 | 899 | } |
@@ -902,7 +902,7 @@ discard block |
||
902 | 902 | try { |
903 | 903 | $failedRecipients = $this->mailer->send($message); |
904 | 904 | if (!empty($failedRecipients)) { |
905 | - $this->logger->error('Share notification mail could not be sent to: ' . implode(', ', $failedRecipients)); |
|
905 | + $this->logger->error('Share notification mail could not be sent to: '.implode(', ', $failedRecipients)); |
|
906 | 906 | return; |
907 | 907 | } |
908 | 908 | } catch (\Exception $e) { |
@@ -1171,7 +1171,7 @@ discard block |
||
1171 | 1171 | * @param string $recipientId |
1172 | 1172 | */ |
1173 | 1173 | public function deleteFromSelf(IShare $share, $recipientId) { |
1174 | - list($providerId, ) = $this->splitFullId($share->getFullId()); |
|
1174 | + list($providerId,) = $this->splitFullId($share->getFullId()); |
|
1175 | 1175 | $provider = $this->factory->getProvider($providerId); |
1176 | 1176 | |
1177 | 1177 | $provider->deleteFromSelf($share, $recipientId); |
@@ -1180,7 +1180,7 @@ discard block |
||
1180 | 1180 | } |
1181 | 1181 | |
1182 | 1182 | public function restoreShare(IShare $share, string $recipientId): IShare { |
1183 | - list($providerId, ) = $this->splitFullId($share->getFullId()); |
|
1183 | + list($providerId,) = $this->splitFullId($share->getFullId()); |
|
1184 | 1184 | $provider = $this->factory->getProvider($providerId); |
1185 | 1185 | |
1186 | 1186 | return $provider->restore($share, $recipientId); |
@@ -1201,7 +1201,7 @@ discard block |
||
1201 | 1201 | if ($share->getShareType() === IShare::TYPE_GROUP) { |
1202 | 1202 | $sharedWith = $this->groupManager->get($share->getSharedWith()); |
1203 | 1203 | if (is_null($sharedWith)) { |
1204 | - throw new \InvalidArgumentException('Group "' . $share->getSharedWith() . '" does not exist'); |
|
1204 | + throw new \InvalidArgumentException('Group "'.$share->getSharedWith().'" does not exist'); |
|
1205 | 1205 | } |
1206 | 1206 | $recipient = $this->userManager->get($recipientId); |
1207 | 1207 | if (!$sharedWith->inGroup($recipient)) { |
@@ -1209,7 +1209,7 @@ discard block |
||
1209 | 1209 | } |
1210 | 1210 | } |
1211 | 1211 | |
1212 | - list($providerId, ) = $this->splitFullId($share->getFullId()); |
|
1212 | + list($providerId,) = $this->splitFullId($share->getFullId()); |
|
1213 | 1213 | $provider = $this->factory->getProvider($providerId); |
1214 | 1214 | |
1215 | 1215 | $provider->move($share, $recipientId); |
@@ -1218,7 +1218,7 @@ discard block |
||
1218 | 1218 | public function getSharesInFolder($userId, Folder $node, $reshares = false) { |
1219 | 1219 | $providers = $this->factory->getAllProviders(); |
1220 | 1220 | |
1221 | - return array_reduce($providers, function ($shares, IShareProvider $provider) use ($userId, $node, $reshares) { |
|
1221 | + return array_reduce($providers, function($shares, IShareProvider $provider) use ($userId, $node, $reshares) { |
|
1222 | 1222 | $newShares = $provider->getSharesInFolder($userId, $node, $reshares); |
1223 | 1223 | foreach ($newShares as $fid => $data) { |
1224 | 1224 | if (!isset($shares[$fid])) { |
@@ -1335,12 +1335,12 @@ discard block |
||
1335 | 1335 | $shares = $this->getSharedWith($userId, $shareType, $node, $limit, $offset); |
1336 | 1336 | |
1337 | 1337 | // Only get deleted shares |
1338 | - $shares = array_filter($shares, function (IShare $share) { |
|
1338 | + $shares = array_filter($shares, function(IShare $share) { |
|
1339 | 1339 | return $share->getPermissions() === 0; |
1340 | 1340 | }); |
1341 | 1341 | |
1342 | 1342 | // Only get shares where the owner still exists |
1343 | - $shares = array_filter($shares, function (IShare $share) { |
|
1343 | + $shares = array_filter($shares, function(IShare $share) { |
|
1344 | 1344 | return $this->userManager->userExists($share->getShareOwner()); |
1345 | 1345 | }); |
1346 | 1346 | |
@@ -1379,7 +1379,7 @@ discard block |
||
1379 | 1379 | * |
1380 | 1380 | * @return Share[] |
1381 | 1381 | */ |
1382 | - public function getSharesByPath(\OCP\Files\Node $path, $page=0, $perPage=50) { |
|
1382 | + public function getSharesByPath(\OCP\Files\Node $path, $page = 0, $perPage = 50) { |
|
1383 | 1383 | return []; |
1384 | 1384 | } |
1385 | 1385 | |
@@ -1637,7 +1637,7 @@ discard block |
||
1637 | 1637 | } |
1638 | 1638 | $al['users'][$owner] = [ |
1639 | 1639 | 'node_id' => $path->getId(), |
1640 | - 'node_path' => '/' . $ownerPath, |
|
1640 | + 'node_path' => '/'.$ownerPath, |
|
1641 | 1641 | ]; |
1642 | 1642 | } else { |
1643 | 1643 | $al['users'][] = $owner; |
@@ -1738,7 +1738,7 @@ discard block |
||
1738 | 1738 | * @return int |
1739 | 1739 | */ |
1740 | 1740 | public function shareApiLinkDefaultExpireDays() { |
1741 | - return (int)$this->config->getAppValue('core', 'shareapi_expire_after_n_days', '7'); |
|
1741 | + return (int) $this->config->getAppValue('core', 'shareapi_expire_after_n_days', '7'); |
|
1742 | 1742 | } |
1743 | 1743 | |
1744 | 1744 | /** |
@@ -1766,7 +1766,7 @@ discard block |
||
1766 | 1766 | * @return int |
1767 | 1767 | */ |
1768 | 1768 | public function shareApiInternalDefaultExpireDays(): int { |
1769 | - return (int)$this->config->getAppValue('core', 'shareapi_internal_expire_after_n_days', '7'); |
|
1769 | + return (int) $this->config->getAppValue('core', 'shareapi_internal_expire_after_n_days', '7'); |
|
1770 | 1770 | } |
1771 | 1771 | |
1772 | 1772 | /** |
@@ -339,7 +339,7 @@ discard block |
||
339 | 339 | $user = $this->userManager->get($recipient); |
340 | 340 | |
341 | 341 | if (is_null($group)) { |
342 | - throw new ProviderException('Group "' . $share->getSharedWith() . '" does not exist'); |
|
342 | + throw new ProviderException('Group "'.$share->getSharedWith().'" does not exist'); |
|
343 | 343 | } |
344 | 344 | |
345 | 345 | if (!$group->inGroup($user)) { |
@@ -465,7 +465,7 @@ discard block |
||
465 | 465 | $user = $this->userManager->get($recipient); |
466 | 466 | |
467 | 467 | if (is_null($group)) { |
468 | - throw new ProviderException('Group "' . $share->getSharedWith() . '" does not exist'); |
|
468 | + throw new ProviderException('Group "'.$share->getSharedWith().'" does not exist'); |
|
469 | 469 | } |
470 | 470 | |
471 | 471 | if (!$group->inGroup($user)) { |
@@ -665,7 +665,7 @@ discard block |
||
665 | 665 | ); |
666 | 666 | } |
667 | 667 | |
668 | - $qb->innerJoin('s', 'filecache' ,'f', $qb->expr()->eq('s.file_source', 'f.fileid')); |
|
668 | + $qb->innerJoin('s', 'filecache', 'f', $qb->expr()->eq('s.file_source', 'f.fileid')); |
|
669 | 669 | $qb->andWhere($qb->expr()->eq('f.parent', $qb->createNamedParameter($node->getId()))); |
670 | 670 | |
671 | 671 | $qb->orderBy('id'); |
@@ -1000,17 +1000,17 @@ discard block |
||
1000 | 1000 | */ |
1001 | 1001 | private function createShare($data) { |
1002 | 1002 | $share = new Share($this->rootFolder, $this->userManager); |
1003 | - $share->setId((int)$data['id']) |
|
1004 | - ->setShareType((int)$data['share_type']) |
|
1005 | - ->setPermissions((int)$data['permissions']) |
|
1003 | + $share->setId((int) $data['id']) |
|
1004 | + ->setShareType((int) $data['share_type']) |
|
1005 | + ->setPermissions((int) $data['permissions']) |
|
1006 | 1006 | ->setTarget($data['file_target']) |
1007 | 1007 | ->setNote($data['note']) |
1008 | - ->setMailSend((bool)$data['mail_send']) |
|
1009 | - ->setStatus((int)$data['accepted']) |
|
1008 | + ->setMailSend((bool) $data['mail_send']) |
|
1009 | + ->setStatus((int) $data['accepted']) |
|
1010 | 1010 | ->setLabel($data['label']); |
1011 | 1011 | |
1012 | 1012 | $shareTime = new \DateTime(); |
1013 | - $shareTime->setTimestamp((int)$data['stime']); |
|
1013 | + $shareTime->setTimestamp((int) $data['stime']); |
|
1014 | 1014 | $share->setShareTime($shareTime); |
1015 | 1015 | |
1016 | 1016 | if ($share->getShareType() === IShare::TYPE_USER) { |
@@ -1023,14 +1023,14 @@ discard block |
||
1023 | 1023 | $share->setSharedWith($data['share_with']); |
1024 | 1024 | } elseif ($share->getShareType() === IShare::TYPE_LINK) { |
1025 | 1025 | $share->setPassword($data['password']); |
1026 | - $share->setSendPasswordByTalk((bool)$data['password_by_talk']); |
|
1026 | + $share->setSendPasswordByTalk((bool) $data['password_by_talk']); |
|
1027 | 1027 | $share->setToken($data['token']); |
1028 | 1028 | } |
1029 | 1029 | |
1030 | 1030 | $share->setSharedBy($data['uid_initiator']); |
1031 | 1031 | $share->setShareOwner($data['uid_owner']); |
1032 | 1032 | |
1033 | - $share->setNodeId((int)$data['file_source']); |
|
1033 | + $share->setNodeId((int) $data['file_source']); |
|
1034 | 1034 | $share->setNodeType($data['item_type']); |
1035 | 1035 | |
1036 | 1036 | if ($data['expiration'] !== null) { |
@@ -1047,7 +1047,7 @@ discard block |
||
1047 | 1047 | } |
1048 | 1048 | |
1049 | 1049 | $share->setProviderId($this->identifier()); |
1050 | - $share->setHideDownload((int)$data['hide_download'] === 1); |
|
1050 | + $share->setHideDownload((int) $data['hide_download'] === 1); |
|
1051 | 1051 | |
1052 | 1052 | return $share; |
1053 | 1053 | } |
@@ -1076,7 +1076,7 @@ discard block |
||
1076 | 1076 | $shareMap = []; |
1077 | 1077 | |
1078 | 1078 | foreach ($shareSlice as $share) { |
1079 | - $ids[] = (int)$share->getId(); |
|
1079 | + $ids[] = (int) $share->getId(); |
|
1080 | 1080 | $shareMap[$share->getId()] = $share; |
1081 | 1081 | } |
1082 | 1082 | |
@@ -1094,8 +1094,8 @@ discard block |
||
1094 | 1094 | $stmt = $query->execute(); |
1095 | 1095 | |
1096 | 1096 | while ($data = $stmt->fetch()) { |
1097 | - $shareMap[$data['parent']]->setPermissions((int)$data['permissions']); |
|
1098 | - $shareMap[$data['parent']]->setStatus((int)$data['accepted']); |
|
1097 | + $shareMap[$data['parent']]->setPermissions((int) $data['permissions']); |
|
1098 | + $shareMap[$data['parent']]->setStatus((int) $data['accepted']); |
|
1099 | 1099 | $shareMap[$data['parent']]->setTarget($data['file_target']); |
1100 | 1100 | $shareMap[$data['parent']]->setParent($data['parent']); |
1101 | 1101 | } |
@@ -1171,7 +1171,7 @@ discard block |
||
1171 | 1171 | ) |
1172 | 1172 | ); |
1173 | 1173 | } else { |
1174 | - \OC::$server->getLogger()->logException(new \InvalidArgumentException('Default share provider tried to delete all shares for type: ' . $shareType)); |
|
1174 | + \OC::$server->getLogger()->logException(new \InvalidArgumentException('Default share provider tried to delete all shares for type: '.$shareType)); |
|
1175 | 1175 | return; |
1176 | 1176 | } |
1177 | 1177 | |
@@ -1197,7 +1197,7 @@ discard block |
||
1197 | 1197 | $cursor = $qb->execute(); |
1198 | 1198 | $ids = []; |
1199 | 1199 | while ($row = $cursor->fetch()) { |
1200 | - $ids[] = (int)$row['id']; |
|
1200 | + $ids[] = (int) $row['id']; |
|
1201 | 1201 | } |
1202 | 1202 | $cursor->closeCursor(); |
1203 | 1203 | |
@@ -1240,7 +1240,7 @@ discard block |
||
1240 | 1240 | $cursor = $qb->execute(); |
1241 | 1241 | $ids = []; |
1242 | 1242 | while ($row = $cursor->fetch()) { |
1243 | - $ids[] = (int)$row['id']; |
|
1243 | + $ids[] = (int) $row['id']; |
|
1244 | 1244 | } |
1245 | 1245 | $cursor->closeCursor(); |
1246 | 1246 | |
@@ -1295,7 +1295,7 @@ discard block |
||
1295 | 1295 | $users = []; |
1296 | 1296 | $link = false; |
1297 | 1297 | while ($row = $cursor->fetch()) { |
1298 | - $type = (int)$row['share_type']; |
|
1298 | + $type = (int) $row['share_type']; |
|
1299 | 1299 | if ($type === IShare::TYPE_USER) { |
1300 | 1300 | $uid = $row['share_with']; |
1301 | 1301 | $users[$uid] = isset($users[$uid]) ? $users[$uid] : []; |
@@ -1456,7 +1456,7 @@ discard block |
||
1456 | 1456 | $message->setFrom([\OCP\Util::getDefaultEmailAddress($instanceName) => $senderName]); |
1457 | 1457 | if ($initiatorEmailAddress !== null) { |
1458 | 1458 | $message->setReplyTo([$initiatorEmailAddress => $initiatorDisplayName]); |
1459 | - $emailTemplate->addFooter($instanceName . ' - ' . $this->defaults->getSlogan()); |
|
1459 | + $emailTemplate->addFooter($instanceName.' - '.$this->defaults->getSlogan()); |
|
1460 | 1460 | } else { |
1461 | 1461 | $emailTemplate->addFooter(); |
1462 | 1462 | } |
@@ -81,14 +81,14 @@ discard block |
||
81 | 81 | $shares = array_merge($shares, $this->shareManager->getSharedWith($user->getUID(), IShare::TYPE_ROOM, null, -1)); |
82 | 82 | |
83 | 83 | // filter out excluded shares and group shares that includes self |
84 | - $shares = array_filter($shares, function (\OCP\Share\IShare $share) use ($user) { |
|
84 | + $shares = array_filter($shares, function(\OCP\Share\IShare $share) use ($user) { |
|
85 | 85 | return $share->getPermissions() > 0 && $share->getShareOwner() !== $user->getUID(); |
86 | 86 | }); |
87 | 87 | |
88 | 88 | $superShares = $this->buildSuperShares($shares, $user); |
89 | 89 | |
90 | 90 | $mounts = []; |
91 | - $view = new View('/' . $user->getUID() . '/files'); |
|
91 | + $view = new View('/'.$user->getUID().'/files'); |
|
92 | 92 | $ownerViews = []; |
93 | 93 | $sharingDisabledForUser = $this->shareManager->sharingDisabledForUser($user->getUID()); |
94 | 94 | $foldersExistCache = new CappedMemoryCache(); |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | |
107 | 107 | $owner = $parentShare->getShareOwner(); |
108 | 108 | if (!isset($ownerViews[$owner])) { |
109 | - $ownerViews[$owner] = new View('/' . $parentShare->getShareOwner() . '/files'); |
|
109 | + $ownerViews[$owner] = new View('/'.$parentShare->getShareOwner().'/files'); |
|
110 | 110 | } |
111 | 111 | $mount = new SharedMount( |
112 | 112 | '\OCA\Files_Sharing\SharedStorage', |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | $result = []; |
156 | 156 | // sort by stime, the super share will be based on the least recent share |
157 | 157 | foreach ($tmp as &$tmp2) { |
158 | - @usort($tmp2, function ($a, $b) { |
|
158 | + @usort($tmp2, function($a, $b) { |
|
159 | 159 | $aTime = $a->getShareTime()->getTimestamp(); |
160 | 160 | $bTime = $b->getShareTime()->getTimestamp(); |
161 | 161 | if ($aTime === $bTime) { |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | // null groups which usually appear with group backend |
223 | 223 | // caching inconsistencies |
224 | 224 | $this->logger->debug( |
225 | - 'Could not adjust share target for share ' . $share->getId() . ' to make it consistent: ' . $e->getMessage(), |
|
225 | + 'Could not adjust share target for share '.$share->getId().' to make it consistent: '.$e->getMessage(), |
|
226 | 226 | ['app' => 'files_sharing'] |
227 | 227 | ); |
228 | 228 | } |
@@ -150,17 +150,17 @@ discard block |
||
150 | 150 | * @return Mount|null |
151 | 151 | * @throws \Doctrine\DBAL\DBALException |
152 | 152 | */ |
153 | - public function addShare($remote, $token, $password, $name, $owner, $shareType, $accepted=false, $user = null, $remoteId = -1, $parent = -1) { |
|
153 | + public function addShare($remote, $token, $password, $name, $owner, $shareType, $accepted = false, $user = null, $remoteId = -1, $parent = -1) { |
|
154 | 154 | $user = $user ? $user : $this->uid; |
155 | 155 | $accepted = $accepted ? IShare::STATUS_ACCEPTED : IShare::STATUS_PENDING; |
156 | - $name = Filesystem::normalizePath('/' . $name); |
|
156 | + $name = Filesystem::normalizePath('/'.$name); |
|
157 | 157 | |
158 | 158 | if ($accepted !== IShare::STATUS_ACCEPTED) { |
159 | 159 | // To avoid conflicts with the mount point generation later, |
160 | 160 | // we only use a temporary mount point name here. The real |
161 | 161 | // mount point name will be generated when accepting the share, |
162 | 162 | // using the original share item name. |
163 | - $tmpMountPointName = '{{TemporaryMountPointName#' . $name . '}}'; |
|
163 | + $tmpMountPointName = '{{TemporaryMountPointName#'.$name.'}}'; |
|
164 | 164 | $mountPoint = $tmpMountPointName; |
165 | 165 | $hash = md5($tmpMountPointName); |
166 | 166 | $data = [ |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | $i = 1; |
181 | 181 | while (!$this->connection->insertIfNotExist('*PREFIX*share_external', $data, ['user', 'mountpoint_hash'])) { |
182 | 182 | // The external share already exists for the user |
183 | - $data['mountpoint'] = $tmpMountPointName . '-' . $i; |
|
183 | + $data['mountpoint'] = $tmpMountPointName.'-'.$i; |
|
184 | 184 | $data['mountpoint_hash'] = md5($data['mountpoint']); |
185 | 185 | $i++; |
186 | 186 | } |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | } |
189 | 189 | |
190 | 190 | $mountPoint = Files::buildNotExistingFileName('/', $name); |
191 | - $mountPoint = Filesystem::normalizePath('/' . $mountPoint); |
|
191 | + $mountPoint = Filesystem::normalizePath('/'.$mountPoint); |
|
192 | 192 | $hash = md5($mountPoint); |
193 | 193 | |
194 | 194 | $this->writeShareToDb($remote, $token, $password, $name, $owner, $user, $mountPoint, $hash, $accepted, $remoteId, $parent, $shareType); |
@@ -247,9 +247,9 @@ discard block |
||
247 | 247 | $validShare = is_array($share) && isset($share['share_type']) && isset($share['user']); |
248 | 248 | |
249 | 249 | // check if the user is allowed to access it |
250 | - if ($validShare && (int)$share['share_type'] === IShare::TYPE_USER && $share['user'] === $this->uid) { |
|
250 | + if ($validShare && (int) $share['share_type'] === IShare::TYPE_USER && $share['user'] === $this->uid) { |
|
251 | 251 | return $share; |
252 | - } elseif ($validShare && (int)$share['share_type'] === IShare::TYPE_GROUP) { |
|
252 | + } elseif ($validShare && (int) $share['share_type'] === IShare::TYPE_GROUP) { |
|
253 | 253 | $user = $this->userManager->get($this->uid); |
254 | 254 | if ($this->groupManager->get($share['user'])->inGroup($user)) { |
255 | 255 | return $share; |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | $hash = md5($mountPoint); |
278 | 278 | $userShareAccepted = false; |
279 | 279 | |
280 | - if ((int)$share['share_type'] === IShare::TYPE_USER) { |
|
280 | + if ((int) $share['share_type'] === IShare::TYPE_USER) { |
|
281 | 281 | $acceptShare = $this->connection->prepare(' |
282 | 282 | UPDATE `*PREFIX*share_external` |
283 | 283 | SET `accepted` = ?, |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | $share = $this->getShare($id); |
322 | 322 | $result = false; |
323 | 323 | |
324 | - if ($share && (int)$share['share_type'] === IShare::TYPE_USER) { |
|
324 | + if ($share && (int) $share['share_type'] === IShare::TYPE_USER) { |
|
325 | 325 | $removeShare = $this->connection->prepare(' |
326 | 326 | DELETE FROM `*PREFIX*share_external` WHERE `id` = ? AND `user` = ?'); |
327 | 327 | $removeShare->execute([$id, $this->uid]); |
@@ -329,7 +329,7 @@ discard block |
||
329 | 329 | |
330 | 330 | $this->processNotification($id); |
331 | 331 | $result = true; |
332 | - } elseif ($share && (int)$share['share_type'] === IShare::TYPE_GROUP) { |
|
332 | + } elseif ($share && (int) $share['share_type'] === IShare::TYPE_GROUP) { |
|
333 | 333 | $result = $this->writeShareToDb( |
334 | 334 | $share['remote'], |
335 | 335 | $share['share_token'], |
@@ -379,7 +379,7 @@ discard block |
||
379 | 379 | $federationEndpoints = $this->discoveryService->discover($remote, 'FEDERATED_SHARING'); |
380 | 380 | $endpoint = isset($federationEndpoints['share']) ? $federationEndpoints['share'] : '/ocs/v2.php/cloud/shares'; |
381 | 381 | |
382 | - $url = rtrim($remote, '/') . $endpoint . '/' . $remoteId . '/' . $feedback . '?format=' . Share::RESPONSE_FORMAT; |
|
382 | + $url = rtrim($remote, '/').$endpoint.'/'.$remoteId.'/'.$feedback.'?format='.Share::RESPONSE_FORMAT; |
|
383 | 383 | $fields = ['token' => $token]; |
384 | 384 | |
385 | 385 | $client = $this->clientService->newClient(); |
@@ -451,13 +451,13 @@ discard block |
||
451 | 451 | * @return string |
452 | 452 | */ |
453 | 453 | protected function stripPath($path) { |
454 | - $prefix = '/' . $this->uid . '/files'; |
|
454 | + $prefix = '/'.$this->uid.'/files'; |
|
455 | 455 | return rtrim(substr($path, strlen($prefix)), '/'); |
456 | 456 | } |
457 | 457 | |
458 | 458 | public function getMount($data) { |
459 | 459 | $data['manager'] = $this; |
460 | - $mountPoint = '/' . $this->uid . '/files' . $data['mountpoint']; |
|
460 | + $mountPoint = '/'.$this->uid.'/files'.$data['mountpoint']; |
|
461 | 461 | $data['mountpoint'] = $mountPoint; |
462 | 462 | $data['certificateManager'] = \OC::$server->getCertificateManager($this->uid); |
463 | 463 | return new Mount(self::STORAGE, $mountPoint, $data, $this, $this->storageLoader); |
@@ -497,7 +497,7 @@ discard block |
||
497 | 497 | WHERE `mountpoint_hash` = ? |
498 | 498 | AND `user` = ? |
499 | 499 | '); |
500 | - $result = (bool)$query->execute([$target, $targetHash, $sourceHash, $this->uid]); |
|
500 | + $result = (bool) $query->execute([$target, $targetHash, $sourceHash, $this->uid]); |
|
501 | 501 | |
502 | 502 | return $result; |
503 | 503 | } |
@@ -517,7 +517,7 @@ discard block |
||
517 | 517 | |
518 | 518 | $share = $getShare->fetch(); |
519 | 519 | $getShare->closeCursor(); |
520 | - if ($result && $share !== false && (int)$share['share_type'] === IShare::TYPE_USER) { |
|
520 | + if ($result && $share !== false && (int) $share['share_type'] === IShare::TYPE_USER) { |
|
521 | 521 | try { |
522 | 522 | $this->sendFeedbackToRemote($share['remote'], $share['share_token'], $share['remote_id'], 'decline'); |
523 | 523 | } catch (\Throwable $e) { |
@@ -529,13 +529,13 @@ discard block |
||
529 | 529 | DELETE FROM `*PREFIX*share_external` |
530 | 530 | WHERE `id` = ? |
531 | 531 | '); |
532 | - $result = (bool)$query->execute([(int)$share['id']]); |
|
533 | - } elseif ($result && (int)$share['share_type'] === IShare::TYPE_GROUP) { |
|
532 | + $result = (bool) $query->execute([(int) $share['id']]); |
|
533 | + } elseif ($result && (int) $share['share_type'] === IShare::TYPE_GROUP) { |
|
534 | 534 | $query = $this->connection->prepare(' |
535 | 535 | UPDATE `*PREFIX*share_external` |
536 | 536 | SET `accepted` = ? |
537 | 537 | WHERE `id` = ?'); |
538 | - $result = (bool)$query->execute([0, (int)$share['id']]); |
|
538 | + $result = (bool) $query->execute([0, (int) $share['id']]); |
|
539 | 539 | } |
540 | 540 | |
541 | 541 | if ($result) { |
@@ -559,7 +559,7 @@ discard block |
||
559 | 559 | |
560 | 560 | |
561 | 561 | $query->delete('federated_reshares') |
562 | - ->where($query->expr()->in('share_id', $query->createFunction('(' . $select . ')'))); |
|
562 | + ->where($query->expr()->in('share_id', $query->createFunction('('.$select.')'))); |
|
563 | 563 | $query->execute(); |
564 | 564 | |
565 | 565 | $deleteReShares = $this->connection->getQueryBuilder(); |
@@ -592,7 +592,7 @@ discard block |
||
592 | 592 | DELETE FROM `*PREFIX*share_external` |
593 | 593 | WHERE `user` = ? |
594 | 594 | '); |
595 | - return (bool)$query->execute([$uid]); |
|
595 | + return (bool) $query->execute([$uid]); |
|
596 | 596 | } |
597 | 597 | |
598 | 598 | /** |
@@ -632,7 +632,7 @@ discard block |
||
632 | 632 | $query = 'SELECT `id`, `remote`, `remote_id`, `share_token`, `name`, `owner`, `user`, `mountpoint`, `accepted` |
633 | 633 | FROM `*PREFIX*share_external` |
634 | 634 | WHERE (`user` = ? OR `user` IN (?))'; |
635 | - $parameters = [$this->uid, implode(',',$userGroups)]; |
|
635 | + $parameters = [$this->uid, implode(',', $userGroups)]; |
|
636 | 636 | if (!is_null($accepted)) { |
637 | 637 | $query .= ' AND `accepted` = ?'; |
638 | 638 | $parameters[] = (int) $accepted; |
@@ -69,7 +69,7 @@ |
||
69 | 69 | |
70 | 70 | $query = $this->connection->getQueryBuilder(); |
71 | 71 | $query->update('share') |
72 | - ->set('share_type', $query->createNamedParameter(IShare::TYPE_GUEST)) |
|
72 | + ->set('share_type', $query->createNamedParameter(IShare::TYPE_GUEST)) |
|
73 | 73 | ->where($query->expr()->eq('share_type', $query->createNamedParameter(IShare::TYPE_EMAIL))); |
74 | 74 | $query->execute(); |
75 | 75 | } |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | // for backward compatibility make sure that the remote url stored in the |
184 | 184 | // database ends with a trailing slash |
185 | 185 | if (substr($remote, -1) !== '/') { |
186 | - $remote = $remote . '/'; |
|
186 | + $remote = $remote.'/'; |
|
187 | 187 | } |
188 | 188 | |
189 | 189 | $token = $share->getShareSecret(); |
@@ -210,23 +210,23 @@ discard block |
||
210 | 210 | |
211 | 211 | // FIXME this should be a method in the user management instead |
212 | 212 | if ($shareType === IShare::TYPE_USER) { |
213 | - $this->logger->debug('shareWith before, ' . $shareWith, ['app' => 'files_sharing']); |
|
213 | + $this->logger->debug('shareWith before, '.$shareWith, ['app' => 'files_sharing']); |
|
214 | 214 | Util::emitHook( |
215 | 215 | '\OCA\Files_Sharing\API\Server2Server', |
216 | 216 | 'preLoginNameUsedAsUserName', |
217 | 217 | ['uid' => &$shareWith] |
218 | 218 | ); |
219 | - $this->logger->debug('shareWith after, ' . $shareWith, ['app' => 'files_sharing']); |
|
219 | + $this->logger->debug('shareWith after, '.$shareWith, ['app' => 'files_sharing']); |
|
220 | 220 | |
221 | 221 | if (!$this->userManager->userExists($shareWith)) { |
222 | - throw new ProviderCouldNotAddShareException('User does not exists', '',Http::STATUS_BAD_REQUEST); |
|
222 | + throw new ProviderCouldNotAddShareException('User does not exists', '', Http::STATUS_BAD_REQUEST); |
|
223 | 223 | } |
224 | 224 | |
225 | 225 | \OC_Util::setupFS($shareWith); |
226 | 226 | } |
227 | 227 | |
228 | 228 | if ($shareType === IShare::TYPE_GROUP && !$this->groupManager->groupExists($shareWith)) { |
229 | - throw new ProviderCouldNotAddShareException('Group does not exists', '',Http::STATUS_BAD_REQUEST); |
|
229 | + throw new ProviderCouldNotAddShareException('Group does not exists', '', Http::STATUS_BAD_REQUEST); |
|
230 | 230 | } |
231 | 231 | |
232 | 232 | $externalManager = new \OCA\Files_Sharing\External\Manager( |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | ); |
245 | 245 | |
246 | 246 | try { |
247 | - $externalManager->addShare($remote, $token, '', $name, $owner, $shareType,false, $shareWith, $remoteId); |
|
247 | + $externalManager->addShare($remote, $token, '', $name, $owner, $shareType, false, $shareWith, $remoteId); |
|
248 | 248 | $shareId = \OC::$server->getDatabaseConnection()->lastInsertId('*PREFIX*share_external'); |
249 | 249 | |
250 | 250 | if ($shareType === IShare::TYPE_USER) { |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | ->setType('remote_share') |
254 | 254 | ->setSubject(RemoteShares::SUBJECT_REMOTE_SHARE_RECEIVED, [$ownerFederatedId, trim($name, '/')]) |
255 | 255 | ->setAffectedUser($shareWith) |
256 | - ->setObject('remote_share', (int)$shareId, $name); |
|
256 | + ->setObject('remote_share', (int) $shareId, $name); |
|
257 | 257 | \OC::$server->getActivityManager()->publish($event); |
258 | 258 | $this->notifyAboutNewShare($shareWith, $shareId, $ownerFederatedId, $sharedByFederatedId, $name, $sharedBy, $owner); |
259 | 259 | } else { |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | ->setType('remote_share') |
265 | 265 | ->setSubject(RemoteShares::SUBJECT_REMOTE_SHARE_RECEIVED, [$ownerFederatedId, trim($name, '/')]) |
266 | 266 | ->setAffectedUser($user->getUID()) |
267 | - ->setObject('remote_share', (int)$shareId, $name); |
|
267 | + ->setObject('remote_share', (int) $shareId, $name); |
|
268 | 268 | \OC::$server->getActivityManager()->publish($event); |
269 | 269 | $this->notifyAboutNewShare($user->getUID(), $shareId, $ownerFederatedId, $sharedByFederatedId, $name, $sharedBy, $owner); |
270 | 270 | } |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | 'level' => ILogger::ERROR, |
277 | 277 | 'app' => 'files_sharing' |
278 | 278 | ]); |
279 | - throw new ProviderCouldNotAddShareException('internal server error, was not able to add share from ' . $remote, '', HTTP::STATUS_INTERNAL_SERVER_ERROR); |
|
279 | + throw new ProviderCouldNotAddShareException('internal server error, was not able to add share from '.$remote, '', HTTP::STATUS_INTERNAL_SERVER_ERROR); |
|
280 | 280 | } |
281 | 281 | } |
282 | 282 | |
@@ -351,12 +351,12 @@ discard block |
||
351 | 351 | |
352 | 352 | $declineAction = $notification->createAction(); |
353 | 353 | $declineAction->setLabel('decline') |
354 | - ->setLink($this->urlGenerator->getAbsoluteURL($this->urlGenerator->linkTo('', 'ocs/v2.php/apps/files_sharing/api/v1/remote_shares/pending/' . $shareId)), 'DELETE'); |
|
354 | + ->setLink($this->urlGenerator->getAbsoluteURL($this->urlGenerator->linkTo('', 'ocs/v2.php/apps/files_sharing/api/v1/remote_shares/pending/'.$shareId)), 'DELETE'); |
|
355 | 355 | $notification->addAction($declineAction); |
356 | 356 | |
357 | 357 | $acceptAction = $notification->createAction(); |
358 | 358 | $acceptAction->setLabel('accept') |
359 | - ->setLink($this->urlGenerator->getAbsoluteURL($this->urlGenerator->linkTo('', 'ocs/v2.php/apps/files_sharing/api/v1/remote_shares/pending/' . $shareId)), 'POST'); |
|
359 | + ->setLink($this->urlGenerator->getAbsoluteURL($this->urlGenerator->linkTo('', 'ocs/v2.php/apps/files_sharing/api/v1/remote_shares/pending/'.$shareId)), 'POST'); |
|
360 | 360 | $notification->addAction($acceptAction); |
361 | 361 | |
362 | 362 | $this->notificationManager->notify($notification); |
@@ -414,7 +414,7 @@ discard block |
||
414 | 414 | */ |
415 | 415 | protected function executeAcceptShare(IShare $share) { |
416 | 416 | try { |
417 | - $fileId = (int)$share->getNode()->getId(); |
|
417 | + $fileId = (int) $share->getNode()->getId(); |
|
418 | 418 | list($file, $link) = $this->getFile($this->getCorrectUid($share), $fileId); |
419 | 419 | } catch (\Exception $e) { |
420 | 420 | throw new ShareNotFound(); |
@@ -490,7 +490,7 @@ discard block |
||
490 | 490 | $this->federatedShareProvider->removeShareFromTable($share); |
491 | 491 | |
492 | 492 | try { |
493 | - $fileId = (int)$share->getNode()->getId(); |
|
493 | + $fileId = (int) $share->getNode()->getId(); |
|
494 | 494 | list($file, $link) = $this->getFile($this->getCorrectUid($share), $fileId); |
495 | 495 | } catch (\Exception $e) { |
496 | 496 | throw new ShareNotFound(); |
@@ -582,10 +582,10 @@ discard block |
||
582 | 582 | // delete all child in case of a group share |
583 | 583 | $qb = $this->connection->getQueryBuilder(); |
584 | 584 | $qb->delete('share_external') |
585 | - ->where($qb->expr()->eq('parent', $qb->createNamedParameter((int)$share['id']))); |
|
585 | + ->where($qb->expr()->eq('parent', $qb->createNamedParameter((int) $share['id']))); |
|
586 | 586 | $qb->execute(); |
587 | 587 | |
588 | - if ((int)$share['share_type'] === IShare::TYPE_USER) { |
|
588 | + if ((int) $share['share_type'] === IShare::TYPE_USER) { |
|
589 | 589 | if ($share['accepted']) { |
590 | 590 | $path = trim($mountpoint, '/'); |
591 | 591 | } else { |
@@ -594,7 +594,7 @@ discard block |
||
594 | 594 | $notification = $this->notificationManager->createNotification(); |
595 | 595 | $notification->setApp('files_sharing') |
596 | 596 | ->setUser($share['user']) |
597 | - ->setObject('remote_share', (int)$share['id']); |
|
597 | + ->setObject('remote_share', (int) $share['id']); |
|
598 | 598 | $this->notificationManager->markProcessed($notification); |
599 | 599 | |
600 | 600 | $event = $this->activityManager->generateEvent(); |
@@ -602,7 +602,7 @@ discard block |
||
602 | 602 | ->setType('remote_share') |
603 | 603 | ->setSubject(RemoteShares::SUBJECT_REMOTE_SHARE_UNSHARED, [$owner->getId(), $path]) |
604 | 604 | ->setAffectedUser($user) |
605 | - ->setObject('remote_share', (int)$share['id'], $path); |
|
605 | + ->setObject('remote_share', (int) $share['id'], $path); |
|
606 | 606 | \OC::$server->getActivityManager()->publish($event); |
607 | 607 | } |
608 | 608 | } |
@@ -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 |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | $output = $output ?? new NullOutput(); |
91 | 91 | $sourceUid = $sourceUser->getUID(); |
92 | 92 | $destinationUid = $destinationUser->getUID(); |
93 | - $sourcePath = rtrim($sourceUid . '/files/' . $path, '/'); |
|
93 | + $sourcePath = rtrim($sourceUid.'/files/'.$path, '/'); |
|
94 | 94 | |
95 | 95 | // target user has to be ready |
96 | 96 | if ($destinationUser->getLastLogin() === 0 || !$this->encryptionManager->isReadyForUser($destinationUid)) { |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | OutputInterface $output): void { |
194 | 194 | $output->writeln('Validating quota'); |
195 | 195 | $size = $view->getFileInfo($sourcePath, false)->getSize(false); |
196 | - $freeSpace = $view->free_space($destinationUid . '/files/'); |
|
196 | + $freeSpace = $view->free_space($destinationUid.'/files/'); |
|
197 | 197 | if ($size > $freeSpace) { |
198 | 198 | $output->writeln('<error>Target user does not have enough free space available.</error>'); |
199 | 199 | throw new \Exception('Execution terminated.'); |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | |
206 | 206 | $encryptedFiles = []; |
207 | 207 | $this->walkFiles($view, $sourcePath, |
208 | - function (FileInfo $fileInfo) use ($progress) { |
|
208 | + function(FileInfo $fileInfo) use ($progress) { |
|
209 | 209 | if ($fileInfo->getType() === FileInfo::TYPE_FOLDER) { |
210 | 210 | // only analyze into folders from main storage, |
211 | 211 | if (!$fileInfo->getStorage()->instanceOfStorage(IHomeStorage::class)) { |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | $output->writeln("<error>Some files are encrypted - please decrypt them first.</error>"); |
228 | 228 | foreach ($encryptedFiles as $encryptedFile) { |
229 | 229 | /** @var FileInfo $encryptedFile */ |
230 | - $output->writeln(" " . $encryptedFile->getPath()); |
|
230 | + $output->writeln(" ".$encryptedFile->getPath()); |
|
231 | 231 | } |
232 | 232 | throw new \Exception('Execution terminated.'); |
233 | 233 | } |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | // Else only the content inside folder is transferred which is not correct. |
272 | 272 | if ($sourcePath !== "$sourceUid/files") { |
273 | 273 | $view->mkdir($finalTarget); |
274 | - $finalTarget = $finalTarget . '/' . basename($sourcePath); |
|
274 | + $finalTarget = $finalTarget.'/'.basename($sourcePath); |
|
275 | 275 | } |
276 | 276 | if ($view->rename($sourcePath, $finalTarget) === false) { |
277 | 277 | throw new TransferOwnershipException("Could not transfer files.", 1); |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | if ($share->getShareType() === IShare::TYPE_USER && |
295 | 295 | $share->getSharedWith() === $destinationUid) { |
296 | 296 | // Unmount the shares before deleting, so we don't try to get the storage later on. |
297 | - $shareMountPoint = $this->mountManager->find('/' . $destinationUid . '/files' . $share->getTarget()); |
|
297 | + $shareMountPoint = $this->mountManager->find('/'.$destinationUid.'/files'.$share->getTarget()); |
|
298 | 298 | if ($shareMountPoint) { |
299 | 299 | $this->mountManager->removeMount($shareMountPoint->getMountPoint()); |
300 | 300 | } |
@@ -310,9 +310,9 @@ discard block |
||
310 | 310 | $this->shareManager->updateShare($share); |
311 | 311 | } |
312 | 312 | } catch (\OCP\Files\NotFoundException $e) { |
313 | - $output->writeln('<error>Share with id ' . $share->getId() . ' points at deleted file, skipping</error>'); |
|
313 | + $output->writeln('<error>Share with id '.$share->getId().' points at deleted file, skipping</error>'); |
|
314 | 314 | } catch (\Throwable $e) { |
315 | - $output->writeln('<error>Could not restore share with id ' . $share->getId() . ':' . $e->getTraceAsString() . '</error>'); |
|
315 | + $output->writeln('<error>Could not restore share with id '.$share->getId().':'.$e->getTraceAsString().'</error>'); |
|
316 | 316 | } |
317 | 317 | $progress->advance(); |
318 | 318 | } |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | public function get($search, $itemType, $itemId, $sorter = null, $shareTypes = [IShare::TYPE_USER], $limit = 10): DataResponse { |
76 | 76 | // if enumeration/user listings are disabled, we'll receive an empty |
77 | 77 | // result from search() – thus nothing else to do here. |
78 | - [$results,] = $this->collaboratorSearch->search($search, $shareTypes, false, $limit, 0); |
|
78 | + [$results, ] = $this->collaboratorSearch->search($search, $shareTypes, false, $limit, 0); |
|
79 | 79 | |
80 | 80 | $event = new AutoCompleteEvent([ |
81 | 81 | 'search' => $search, |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | 'shareTypes' => $shareTypes, |
87 | 87 | 'limit' => $limit, |
88 | 88 | ]); |
89 | - $this->dispatcher->dispatch(IManager::class . '::filterResults', $event); |
|
89 | + $this->dispatcher->dispatch(IManager::class.'::filterResults', $event); |
|
90 | 90 | $results = $event->getResults(); |
91 | 91 | |
92 | 92 | $exactMatches = $results['exact']; |