@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | if ($remoteShare) { |
| 193 | 193 | try { |
| 194 | 194 | $ownerCloudId = $this->cloudIdManager->getCloudId($remoteShare['owner'], $remoteShare['remote']); |
| 195 | - $shareId = $this->addShareToDB($itemSource, $itemType, $shareWith, $sharedBy, $ownerCloudId->getId(), $permissions, 'tmp_token_' . time()); |
|
| 195 | + $shareId = $this->addShareToDB($itemSource, $itemType, $shareWith, $sharedBy, $ownerCloudId->getId(), $permissions, 'tmp_token_'.time()); |
|
| 196 | 196 | $share->setId($shareId); |
| 197 | 197 | list($token, $remoteId) = $this->askOwnerToReShare($shareWith, $share, $shareId); |
| 198 | 198 | // remote share was create successfully if we get a valid token as return |
@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | $failure = true; |
| 273 | 273 | } |
| 274 | 274 | |
| 275 | - if($failure) { |
|
| 275 | + if ($failure) { |
|
| 276 | 276 | $this->removeShareFromTableById($shareId); |
| 277 | 277 | $message_t = $this->l->t('Sharing %s failed, could not find %s, maybe the server is currently unreachable or uses a self-signed certificate.', |
| 278 | 278 | [$share->getNode()->getName(), $share->getSharedWith()]); |
@@ -324,7 +324,7 @@ discard block |
||
| 324 | 324 | ->andWhere($query->expr()->eq('mountpoint', $query->createNamedParameter($share->getTarget()))); |
| 325 | 325 | $result = $query->execute()->fetchAll(); |
| 326 | 326 | |
| 327 | - if (isset($result[0]) && (int)$result[0]['remote_id'] > 0) { |
|
| 327 | + if (isset($result[0]) && (int) $result[0]['remote_id'] > 0) { |
|
| 328 | 328 | return $result[0]; |
| 329 | 329 | } |
| 330 | 330 | |
@@ -366,7 +366,7 @@ discard block |
||
| 366 | 366 | $qb->execute(); |
| 367 | 367 | $id = $qb->getLastInsertId(); |
| 368 | 368 | |
| 369 | - return (int)$id; |
|
| 369 | + return (int) $id; |
|
| 370 | 370 | } |
| 371 | 371 | |
| 372 | 372 | /** |
@@ -456,14 +456,14 @@ discard block |
||
| 456 | 456 | public function getRemoteId(IShare $share) { |
| 457 | 457 | $query = $this->dbConnection->getQueryBuilder(); |
| 458 | 458 | $query->select('remote_id')->from('federated_reshares') |
| 459 | - ->where($query->expr()->eq('share_id', $query->createNamedParameter((int)$share->getId()))); |
|
| 459 | + ->where($query->expr()->eq('share_id', $query->createNamedParameter((int) $share->getId()))); |
|
| 460 | 460 | $data = $query->execute()->fetch(); |
| 461 | 461 | |
| 462 | 462 | if (!is_array($data) || !isset($data['remote_id'])) { |
| 463 | 463 | throw new ShareNotFound(); |
| 464 | 464 | } |
| 465 | 465 | |
| 466 | - return (int)$data['remote_id']; |
|
| 466 | + return (int) $data['remote_id']; |
|
| 467 | 467 | } |
| 468 | 468 | |
| 469 | 469 | /** |
@@ -494,7 +494,7 @@ discard block |
||
| 494 | 494 | ->orderBy('id'); |
| 495 | 495 | |
| 496 | 496 | $cursor = $qb->execute(); |
| 497 | - while($data = $cursor->fetch()) { |
|
| 497 | + while ($data = $cursor->fetch()) { |
|
| 498 | 498 | $children[] = $this->createShareObject($data); |
| 499 | 499 | } |
| 500 | 500 | $cursor->closeCursor(); |
@@ -612,7 +612,7 @@ discard block |
||
| 612 | 612 | ); |
| 613 | 613 | } |
| 614 | 614 | |
| 615 | - $qb->innerJoin('s', 'filecache' ,'f', $qb->expr()->eq('s.file_source', 'f.fileid')); |
|
| 615 | + $qb->innerJoin('s', 'filecache', 'f', $qb->expr()->eq('s.file_source', 'f.fileid')); |
|
| 616 | 616 | $qb->andWhere($qb->expr()->eq('f.parent', $qb->createNamedParameter($node->getId()))); |
| 617 | 617 | |
| 618 | 618 | $qb->orderBy('id'); |
@@ -675,7 +675,7 @@ discard block |
||
| 675 | 675 | |
| 676 | 676 | $cursor = $qb->execute(); |
| 677 | 677 | $shares = []; |
| 678 | - while($data = $cursor->fetch()) { |
|
| 678 | + while ($data = $cursor->fetch()) { |
|
| 679 | 679 | $shares[] = $this->createShareObject($data); |
| 680 | 680 | } |
| 681 | 681 | $cursor->closeCursor(); |
@@ -699,7 +699,7 @@ discard block |
||
| 699 | 699 | $cursor->closeCursor(); |
| 700 | 700 | |
| 701 | 701 | if ($data === false) { |
| 702 | - throw new ShareNotFound('Can not find share with ID: ' . $id); |
|
| 702 | + throw new ShareNotFound('Can not find share with ID: '.$id); |
|
| 703 | 703 | } |
| 704 | 704 | |
| 705 | 705 | try { |
@@ -727,7 +727,7 @@ discard block |
||
| 727 | 727 | ->execute(); |
| 728 | 728 | |
| 729 | 729 | $shares = []; |
| 730 | - while($data = $cursor->fetch()) { |
|
| 730 | + while ($data = $cursor->fetch()) { |
|
| 731 | 731 | $shares[] = $this->createShareObject($data); |
| 732 | 732 | } |
| 733 | 733 | $cursor->closeCursor(); |
@@ -766,7 +766,7 @@ discard block |
||
| 766 | 766 | |
| 767 | 767 | $cursor = $qb->execute(); |
| 768 | 768 | |
| 769 | - while($data = $cursor->fetch()) { |
|
| 769 | + while ($data = $cursor->fetch()) { |
|
| 770 | 770 | $shares[] = $this->createShareObject($data); |
| 771 | 771 | } |
| 772 | 772 | $cursor->closeCursor(); |
@@ -843,15 +843,15 @@ discard block |
||
| 843 | 843 | private function createShareObject($data) { |
| 844 | 844 | |
| 845 | 845 | $share = new Share($this->rootFolder, $this->userManager); |
| 846 | - $share->setId((int)$data['id']) |
|
| 847 | - ->setShareType((int)$data['share_type']) |
|
| 848 | - ->setPermissions((int)$data['permissions']) |
|
| 846 | + $share->setId((int) $data['id']) |
|
| 847 | + ->setShareType((int) $data['share_type']) |
|
| 848 | + ->setPermissions((int) $data['permissions']) |
|
| 849 | 849 | ->setTarget($data['file_target']) |
| 850 | - ->setMailSend((bool)$data['mail_send']) |
|
| 850 | + ->setMailSend((bool) $data['mail_send']) |
|
| 851 | 851 | ->setToken($data['token']); |
| 852 | 852 | |
| 853 | 853 | $shareTime = new \DateTime(); |
| 854 | - $shareTime->setTimestamp((int)$data['stime']); |
|
| 854 | + $shareTime->setTimestamp((int) $data['stime']); |
|
| 855 | 855 | $share->setShareTime($shareTime); |
| 856 | 856 | $share->setSharedWith($data['share_with']); |
| 857 | 857 | |
@@ -861,13 +861,13 @@ discard block |
||
| 861 | 861 | } else { |
| 862 | 862 | //OLD SHARE |
| 863 | 863 | $share->setSharedBy($data['uid_owner']); |
| 864 | - $path = $this->getNode($share->getSharedBy(), (int)$data['file_source']); |
|
| 864 | + $path = $this->getNode($share->getSharedBy(), (int) $data['file_source']); |
|
| 865 | 865 | |
| 866 | 866 | $owner = $path->getOwner(); |
| 867 | 867 | $share->setShareOwner($owner->getUID()); |
| 868 | 868 | } |
| 869 | 869 | |
| 870 | - $share->setNodeId((int)$data['file_source']); |
|
| 870 | + $share->setNodeId((int) $data['file_source']); |
|
| 871 | 871 | $share->setNodeType($data['item_type']); |
| 872 | 872 | |
| 873 | 873 | $share->setProviderId($this->identifier()); |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | $owner = isset($_POST['owner']) ? $_POST['owner'] : null; |
| 146 | 146 | $sharedBy = isset($_POST['sharedBy']) ? $_POST['sharedBy'] : null; |
| 147 | 147 | $shareWith = isset($_POST['shareWith']) ? $_POST['shareWith'] : null; |
| 148 | - $remoteId = isset($_POST['remoteId']) ? (int)$_POST['remoteId'] : null; |
|
| 148 | + $remoteId = isset($_POST['remoteId']) ? (int) $_POST['remoteId'] : null; |
|
| 149 | 149 | $sharedByFederatedId = isset($_POST['sharedByFederatedId']) ? $_POST['sharedByFederatedId'] : null; |
| 150 | 150 | $ownerFederatedId = isset($_POST['ownerFederatedId']) ? $_POST['ownerFederatedId'] : null; |
| 151 | 151 | |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | } catch (ProviderCouldNotAddShareException $e) { |
| 181 | 181 | throw new OCSException($e->getMessage(), 400); |
| 182 | 182 | } catch (\Exception $e) { |
| 183 | - throw new OCSException('internal server error, was not able to add share from ' . $remote, 500); |
|
| 183 | + throw new OCSException('internal server error, was not able to add share from '.$remote, 500); |
|
| 184 | 184 | } |
| 185 | 185 | |
| 186 | 186 | return new Http\DataResponse(); |
@@ -202,8 +202,8 @@ discard block |
||
| 202 | 202 | |
| 203 | 203 | $token = $this->request->getParam('token', null); |
| 204 | 204 | $shareWith = $this->request->getParam('shareWith', null); |
| 205 | - $permission = (int)$this->request->getParam('permission', null); |
|
| 206 | - $remoteId = (int)$this->request->getParam('remoteId', null); |
|
| 205 | + $permission = (int) $this->request->getParam('permission', null); |
|
| 206 | + $remoteId = (int) $this->request->getParam('remoteId', null); |
|
| 207 | 207 | |
| 208 | 208 | if ($id === null || |
| 209 | 209 | $token === null || |
@@ -231,9 +231,9 @@ discard block |
||
| 231 | 231 | } catch (ProviderDoesNotExistsException $e) { |
| 232 | 232 | throw new OCSException('Server does not support federated cloud sharing', 503); |
| 233 | 233 | } catch (ShareNotFound $e) { |
| 234 | - $this->logger->debug('Share not found: ' . $e->getMessage()); |
|
| 234 | + $this->logger->debug('Share not found: '.$e->getMessage()); |
|
| 235 | 235 | } catch (\Exception $e) { |
| 236 | - $this->logger->debug('internal server error, can not process notification: ' . $e->getMessage()); |
|
| 236 | + $this->logger->debug('internal server error, can not process notification: '.$e->getMessage()); |
|
| 237 | 237 | } |
| 238 | 238 | |
| 239 | 239 | throw new OCSBadRequestException(); |
@@ -267,9 +267,9 @@ discard block |
||
| 267 | 267 | } catch (ProviderDoesNotExistsException $e) { |
| 268 | 268 | throw new OCSException('Server does not support federated cloud sharing', 503); |
| 269 | 269 | } catch (ShareNotFound $e) { |
| 270 | - $this->logger->debug('Share not found: ' . $e->getMessage()); |
|
| 270 | + $this->logger->debug('Share not found: '.$e->getMessage()); |
|
| 271 | 271 | } catch (\Exception $e) { |
| 272 | - $this->logger->debug('internal server error, can not process notification: ' . $e->getMessage()); |
|
| 272 | + $this->logger->debug('internal server error, can not process notification: '.$e->getMessage()); |
|
| 273 | 273 | } |
| 274 | 274 | |
| 275 | 275 | return new Http\DataResponse(); |
@@ -300,9 +300,9 @@ discard block |
||
| 300 | 300 | } catch (ProviderDoesNotExistsException $e) { |
| 301 | 301 | throw new OCSException('Server does not support federated cloud sharing', 503); |
| 302 | 302 | } catch (ShareNotFound $e) { |
| 303 | - $this->logger->debug('Share not found: ' . $e->getMessage()); |
|
| 303 | + $this->logger->debug('Share not found: '.$e->getMessage()); |
|
| 304 | 304 | } catch (\Exception $e) { |
| 305 | - $this->logger->debug('internal server error, can not process notification: ' . $e->getMessage()); |
|
| 305 | + $this->logger->debug('internal server error, can not process notification: '.$e->getMessage()); |
|
| 306 | 306 | } |
| 307 | 307 | |
| 308 | 308 | return new Http\DataResponse(); |
@@ -331,7 +331,7 @@ discard block |
||
| 331 | 331 | $notification = ['sharedSecret' => $token]; |
| 332 | 332 | $provider->notificationReceived('SHARE_UNSHARED', $id, $notification); |
| 333 | 333 | } catch (\Exception $e) { |
| 334 | - $this->logger->debug('processing unshare notification failed: ' . $e->getMessage()); |
|
| 334 | + $this->logger->debug('processing unshare notification failed: '.$e->getMessage()); |
|
| 335 | 335 | } |
| 336 | 336 | |
| 337 | 337 | return new Http\DataResponse(); |
@@ -404,7 +404,7 @@ discard block |
||
| 404 | 404 | |
| 405 | 405 | try { |
| 406 | 406 | $provider = $this->cloudFederationProviderManager->getCloudFederationProvider('file'); |
| 407 | - $ocmPermissions = $this->ncPermissions2ocmPermissions((int)$ncPermissions); |
|
| 407 | + $ocmPermissions = $this->ncPermissions2ocmPermissions((int) $ncPermissions); |
|
| 408 | 408 | $notification = ['sharedSecret' => $token, 'permission' => $ocmPermissions]; |
| 409 | 409 | $provider->notificationReceived('RESHARE_CHANGE_PERMISSION', $id, $notification); |
| 410 | 410 | } catch (\Exception $e) { |
@@ -134,18 +134,18 @@ discard block |
||
| 134 | 134 | * @return Mount|null |
| 135 | 135 | * @throws \Doctrine\DBAL\DBALException |
| 136 | 136 | */ |
| 137 | - public function addShare($remote, $token, $password, $name, $owner, $shareType, $accepted=false, $user = null, $remoteId = -1, $parent = -1) { |
|
| 137 | + public function addShare($remote, $token, $password, $name, $owner, $shareType, $accepted = false, $user = null, $remoteId = -1, $parent = -1) { |
|
| 138 | 138 | |
| 139 | 139 | $user = $user ? $user : $this->uid; |
| 140 | 140 | $accepted = $accepted ? 1 : 0; |
| 141 | - $name = Filesystem::normalizePath('/' . $name); |
|
| 141 | + $name = Filesystem::normalizePath('/'.$name); |
|
| 142 | 142 | |
| 143 | 143 | if (!$accepted) { |
| 144 | 144 | // To avoid conflicts with the mount point generation later, |
| 145 | 145 | // we only use a temporary mount point name here. The real |
| 146 | 146 | // mount point name will be generated when accepting the share, |
| 147 | 147 | // using the original share item name. |
| 148 | - $tmpMountPointName = '{{TemporaryMountPointName#' . $name . '}}'; |
|
| 148 | + $tmpMountPointName = '{{TemporaryMountPointName#'.$name.'}}'; |
|
| 149 | 149 | $mountPoint = $tmpMountPointName; |
| 150 | 150 | $hash = md5($tmpMountPointName); |
| 151 | 151 | $data = [ |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | $i = 1; |
| 166 | 166 | while (!$this->connection->insertIfNotExist('*PREFIX*share_external', $data, ['user', 'mountpoint_hash'])) { |
| 167 | 167 | // The external share already exists for the user |
| 168 | - $data['mountpoint'] = $tmpMountPointName . '-' . $i; |
|
| 168 | + $data['mountpoint'] = $tmpMountPointName.'-'.$i; |
|
| 169 | 169 | $data['mountpoint_hash'] = md5($data['mountpoint']); |
| 170 | 170 | $i++; |
| 171 | 171 | } |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | } |
| 174 | 174 | |
| 175 | 175 | $mountPoint = Files::buildNotExistingFileName('/', $name); |
| 176 | - $mountPoint = Filesystem::normalizePath('/' . $mountPoint); |
|
| 176 | + $mountPoint = Filesystem::normalizePath('/'.$mountPoint); |
|
| 177 | 177 | $hash = md5($mountPoint); |
| 178 | 178 | |
| 179 | 179 | $query = $this->connection->prepare(' |
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | $mountPoint = Filesystem::normalizePath($mountPoint); |
| 228 | 228 | $hash = md5($mountPoint); |
| 229 | 229 | |
| 230 | - if($share['share_type'] === \OCP\Share::SHARE_TYPE_USER) { |
|
| 230 | + if ($share['share_type'] === \OCP\Share::SHARE_TYPE_USER) { |
|
| 231 | 231 | $acceptShare = $this->connection->prepare(' |
| 232 | 232 | UPDATE `*PREFIX*share_external` |
| 233 | 233 | SET `accepted` = ?, |
@@ -298,14 +298,14 @@ discard block |
||
| 298 | 298 | |
| 299 | 299 | $result = $this->tryOCMEndPoint($remote, $token, $remoteId, $feedback); |
| 300 | 300 | |
| 301 | - if($result === true) { |
|
| 301 | + if ($result === true) { |
|
| 302 | 302 | return true; |
| 303 | 303 | } |
| 304 | 304 | |
| 305 | 305 | $federationEndpoints = $this->discoveryService->discover($remote, 'FEDERATED_SHARING'); |
| 306 | 306 | $endpoint = isset($federationEndpoints['share']) ? $federationEndpoints['share'] : '/ocs/v2.php/cloud/shares'; |
| 307 | 307 | |
| 308 | - $url = rtrim($remote, '/') . $endpoint . '/' . $remoteId . '/' . $feedback . '?format=' . \OCP\Share::RESPONSE_FORMAT; |
|
| 308 | + $url = rtrim($remote, '/').$endpoint.'/'.$remoteId.'/'.$feedback.'?format='.\OCP\Share::RESPONSE_FORMAT; |
|
| 309 | 309 | $fields = array('token' => $token); |
| 310 | 310 | |
| 311 | 311 | $client = $this->clientService->newClient(); |
@@ -378,13 +378,13 @@ discard block |
||
| 378 | 378 | * @return string |
| 379 | 379 | */ |
| 380 | 380 | protected function stripPath($path) { |
| 381 | - $prefix = '/' . $this->uid . '/files'; |
|
| 381 | + $prefix = '/'.$this->uid.'/files'; |
|
| 382 | 382 | return rtrim(substr($path, strlen($prefix)), '/'); |
| 383 | 383 | } |
| 384 | 384 | |
| 385 | 385 | public function getMount($data) { |
| 386 | 386 | $data['manager'] = $this; |
| 387 | - $mountPoint = '/' . $this->uid . '/files' . $data['mountpoint']; |
|
| 387 | + $mountPoint = '/'.$this->uid.'/files'.$data['mountpoint']; |
|
| 388 | 388 | $data['mountpoint'] = $mountPoint; |
| 389 | 389 | $data['certificateManager'] = \OC::$server->getCertificateManager($this->uid); |
| 390 | 390 | return new Mount(self::STORAGE, $mountPoint, $data, $this, $this->storageLoader); |
@@ -424,7 +424,7 @@ discard block |
||
| 424 | 424 | WHERE `mountpoint_hash` = ? |
| 425 | 425 | AND `user` = ? |
| 426 | 426 | '); |
| 427 | - $result = (bool)$query->execute(array($target, $targetHash, $sourceHash, $this->uid)); |
|
| 427 | + $result = (bool) $query->execute(array($target, $targetHash, $sourceHash, $this->uid)); |
|
| 428 | 428 | |
| 429 | 429 | return $result; |
| 430 | 430 | } |
@@ -459,9 +459,9 @@ discard block |
||
| 459 | 459 | WHERE `mountpoint_hash` = ? |
| 460 | 460 | AND `user` = ? |
| 461 | 461 | '); |
| 462 | - $result = (bool)$query->execute(array($hash, $this->uid)); |
|
| 462 | + $result = (bool) $query->execute(array($hash, $this->uid)); |
|
| 463 | 463 | |
| 464 | - if($result) { |
|
| 464 | + if ($result) { |
|
| 465 | 465 | $this->removeReShares($id); |
| 466 | 466 | } |
| 467 | 467 | |
@@ -482,7 +482,7 @@ discard block |
||
| 482 | 482 | |
| 483 | 483 | |
| 484 | 484 | $query->delete('federated_reshares') |
| 485 | - ->where($query->expr()->in('share_id', $query->createFunction('(' . $select . ')'))); |
|
| 485 | + ->where($query->expr()->in('share_id', $query->createFunction('('.$select.')'))); |
|
| 486 | 486 | $query->execute(); |
| 487 | 487 | |
| 488 | 488 | $deleteReShares = $this->connection->getQueryBuilder(); |
@@ -506,7 +506,7 @@ discard block |
||
| 506 | 506 | |
| 507 | 507 | if ($result) { |
| 508 | 508 | $shares = $getShare->fetchAll(); |
| 509 | - foreach($shares as $share) { |
|
| 509 | + foreach ($shares as $share) { |
|
| 510 | 510 | $this->sendFeedbackToRemote($share['remote'], $share['share_token'], $share['remote_id'], 'decline'); |
| 511 | 511 | } |
| 512 | 512 | } |
@@ -515,7 +515,7 @@ discard block |
||
| 515 | 515 | DELETE FROM `*PREFIX*share_external` |
| 516 | 516 | WHERE `user` = ? |
| 517 | 517 | '); |
| 518 | - return (bool)$query->execute(array($uid)); |
|
| 518 | + return (bool) $query->execute(array($uid)); |
|
| 519 | 519 | } |
| 520 | 520 | |
| 521 | 521 | /** |
@@ -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($shareWithLocalId)) { |
|
| 168 | + if (!$this->groupManager->groupExists($shareWithLocalId)) { |
|
| 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($shareWithLocalId); |
| 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 | |
@@ -287,13 +287,13 @@ discard block |
||
| 287 | 287 | private function mapUid($uid) { |
| 288 | 288 | \OC::$server->getURLGenerator()->linkToDocs('key'); |
| 289 | 289 | // FIXME this should be a method in the user management instead |
| 290 | - $this->logger->debug('shareWith before, ' . $uid, ['app' => $this->appName]); |
|
| 290 | + $this->logger->debug('shareWith before, '.$uid, ['app' => $this->appName]); |
|
| 291 | 291 | \OCP\Util::emitHook( |
| 292 | 292 | '\OCA\Files_Sharing\API\Server2Server', |
| 293 | 293 | 'preLoginNameUsedAsUserName', |
| 294 | 294 | array('uid' => &$uid) |
| 295 | 295 | ); |
| 296 | - $this->logger->debug('shareWith after, ' . $uid, ['app' => $this->appName]); |
|
| 296 | + $this->logger->debug('shareWith after, '.$uid, ['app' => $this->appName]); |
|
| 297 | 297 | |
| 298 | 298 | return $uid; |
| 299 | 299 | } |
@@ -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(); |
@@ -199,16 +199,16 @@ discard block |
||
| 199 | 199 | } |
| 200 | 200 | |
| 201 | 201 | // FIXME this should be a method in the user management instead |
| 202 | - $this->logger->debug('shareWith before, ' . $shareWith, ['app' => 'files_sharing']); |
|
| 202 | + $this->logger->debug('shareWith before, '.$shareWith, ['app' => 'files_sharing']); |
|
| 203 | 203 | Util::emitHook( |
| 204 | 204 | '\OCA\Files_Sharing\API\Server2Server', |
| 205 | 205 | 'preLoginNameUsedAsUserName', |
| 206 | 206 | array('uid' => &$shareWith) |
| 207 | 207 | ); |
| 208 | - $this->logger->debug('shareWith after, ' . $shareWith, ['app' => 'files_sharing']); |
|
| 208 | + $this->logger->debug('shareWith after, '.$shareWith, ['app' => 'files_sharing']); |
|
| 209 | 209 | |
| 210 | 210 | if (!$this->userManager->userExists($shareWith)) { |
| 211 | - throw new ProviderCouldNotAddShareException('User does not exists', '',Http::STATUS_BAD_REQUEST); |
|
| 211 | + throw new ProviderCouldNotAddShareException('User does not exists', '', Http::STATUS_BAD_REQUEST); |
|
| 212 | 212 | } |
| 213 | 213 | |
| 214 | 214 | \OC_Util::setupFS($shareWith); |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | ); |
| 227 | 227 | |
| 228 | 228 | try { |
| 229 | - $externalManager->addShare($remote, $token, '', $name, $owner, $shareType,false, $shareWith, $remoteId); |
|
| 229 | + $externalManager->addShare($remote, $token, '', $name, $owner, $shareType, false, $shareWith, $remoteId); |
|
| 230 | 230 | $shareId = \OC::$server->getDatabaseConnection()->lastInsertId('*PREFIX*share_external'); |
| 231 | 231 | |
| 232 | 232 | $event = $this->activityManager->generateEvent(); |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | ->setType('remote_share') |
| 235 | 235 | ->setSubject(RemoteShares::SUBJECT_REMOTE_SHARE_RECEIVED, [$ownerFederatedId, trim($name, '/')]) |
| 236 | 236 | ->setAffectedUser($shareWith) |
| 237 | - ->setObject('remote_share', (int)$shareId, $name); |
|
| 237 | + ->setObject('remote_share', (int) $shareId, $name); |
|
| 238 | 238 | \OC::$server->getActivityManager()->publish($event); |
| 239 | 239 | |
| 240 | 240 | if ($shareType === Share::SHARE_TYPE_USER) { |
@@ -252,7 +252,7 @@ discard block |
||
| 252 | 252 | 'level' => ILogger::ERROR, |
| 253 | 253 | 'app' => 'files_sharing' |
| 254 | 254 | ]); |
| 255 | - throw new ProviderCouldNotAddShareException('internal server error, was not able to add share from ' . $remote, '', HTTP::STATUS_INTERNAL_SERVER_ERROR); |
|
| 255 | + throw new ProviderCouldNotAddShareException('internal server error, was not able to add share from '.$remote, '', HTTP::STATUS_INTERNAL_SERVER_ERROR); |
|
| 256 | 256 | } |
| 257 | 257 | } |
| 258 | 258 | |
@@ -329,12 +329,12 @@ discard block |
||
| 329 | 329 | |
| 330 | 330 | $declineAction = $notification->createAction(); |
| 331 | 331 | $declineAction->setLabel('decline') |
| 332 | - ->setLink($this->urlGenerator->getAbsoluteURL($this->urlGenerator->linkTo('', 'ocs/v2.php/apps/files_sharing/api/v1/remote_shares/pending/' . $shareId)), 'DELETE'); |
|
| 332 | + ->setLink($this->urlGenerator->getAbsoluteURL($this->urlGenerator->linkTo('', 'ocs/v2.php/apps/files_sharing/api/v1/remote_shares/pending/'.$shareId)), 'DELETE'); |
|
| 333 | 333 | $notification->addAction($declineAction); |
| 334 | 334 | |
| 335 | 335 | $acceptAction = $notification->createAction(); |
| 336 | 336 | $acceptAction->setLabel('accept') |
| 337 | - ->setLink($this->urlGenerator->getAbsoluteURL($this->urlGenerator->linkTo('', 'ocs/v2.php/apps/files_sharing/api/v1/remote_shares/pending/' . $shareId)), 'POST'); |
|
| 337 | + ->setLink($this->urlGenerator->getAbsoluteURL($this->urlGenerator->linkTo('', 'ocs/v2.php/apps/files_sharing/api/v1/remote_shares/pending/'.$shareId)), 'POST'); |
|
| 338 | 338 | $notification->addAction($acceptAction); |
| 339 | 339 | |
| 340 | 340 | $this->notificationManager->notify($notification); |
@@ -394,7 +394,7 @@ discard block |
||
| 394 | 394 | */ |
| 395 | 395 | protected function executeAcceptShare(IShare $share) { |
| 396 | 396 | try { |
| 397 | - $fileId = (int)$share->getNode()->getId(); |
|
| 397 | + $fileId = (int) $share->getNode()->getId(); |
|
| 398 | 398 | list($file, $link) = $this->getFile($this->getCorrectUid($share), $fileId); |
| 399 | 399 | } catch (\Exception $e) { |
| 400 | 400 | throw new ShareNotFound(); |
@@ -472,7 +472,7 @@ discard block |
||
| 472 | 472 | $this->federatedShareProvider->removeShareFromTable($share); |
| 473 | 473 | |
| 474 | 474 | try { |
| 475 | - $fileId = (int)$share->getNode()->getId(); |
|
| 475 | + $fileId = (int) $share->getNode()->getId(); |
|
| 476 | 476 | list($file, $link) = $this->getFile($this->getCorrectUid($share), $fileId); |
| 477 | 477 | } catch (\Exception $e) { |
| 478 | 478 | throw new ShareNotFound(); |
@@ -573,7 +573,7 @@ discard block |
||
| 573 | 573 | $notification = $this->notificationManager->createNotification(); |
| 574 | 574 | $notification->setApp('files_sharing') |
| 575 | 575 | ->setUser($share['user']) |
| 576 | - ->setObject('remote_share', (int)$share['id']); |
|
| 576 | + ->setObject('remote_share', (int) $share['id']); |
|
| 577 | 577 | $this->notificationManager->markProcessed($notification); |
| 578 | 578 | |
| 579 | 579 | $event = $this->activityManager->generateEvent(); |
@@ -581,7 +581,7 @@ discard block |
||
| 581 | 581 | ->setType('remote_share') |
| 582 | 582 | ->setSubject(RemoteShares::SUBJECT_REMOTE_SHARE_UNSHARED, [$owner->getId(), $path]) |
| 583 | 583 | ->setAffectedUser($user) |
| 584 | - ->setObject('remote_share', (int)$share['id'], $path); |
|
| 584 | + ->setObject('remote_share', (int) $share['id'], $path); |
|
| 585 | 585 | \OC::$server->getActivityManager()->publish($event); |
| 586 | 586 | } |
| 587 | 587 | |
@@ -629,7 +629,7 @@ discard block |
||
| 629 | 629 | $owner = $share->getShareOwner(); |
| 630 | 630 | $currentServer = $this->addressHandler->generateRemoteURL(); |
| 631 | 631 | if ($this->addressHandler->compareAddresses($user, $remote, $owner, $currentServer)) { |
| 632 | - throw new ProviderCouldNotAddShareException('Resharing back to the owner is not allowed: ' . $id); |
|
| 632 | + throw new ProviderCouldNotAddShareException('Resharing back to the owner is not allowed: '.$id); |
|
| 633 | 633 | } |
| 634 | 634 | } catch (\Exception $e) { |
| 635 | 635 | throw new ProviderCouldNotAddShareException($e->getMessage()); |
@@ -643,10 +643,10 @@ discard block |
||
| 643 | 643 | $share->setSharedBy($share->getSharedWith()); |
| 644 | 644 | $share->setSharedWith($shareWith); |
| 645 | 645 | $result = $this->federatedShareProvider->create($share); |
| 646 | - $this->federatedShareProvider->storeRemoteId((int)$result->getId(), $senderId); |
|
| 646 | + $this->federatedShareProvider->storeRemoteId((int) $result->getId(), $senderId); |
|
| 647 | 647 | return ['token' => $result->getToken(), 'providerId' => $result->getId()]; |
| 648 | 648 | } else { |
| 649 | - throw new ProviderCouldNotAddShareException('resharing not allowed for share: ' . $id); |
|
| 649 | + throw new ProviderCouldNotAddShareException('resharing not allowed for share: '.$id); |
|
| 650 | 650 | } |
| 651 | 651 | |
| 652 | 652 | } |
@@ -692,7 +692,7 @@ discard block |
||
| 692 | 692 | */ |
| 693 | 693 | protected function ocmPermissions2ncPermissions(array $ocmPermissions) { |
| 694 | 694 | $ncPermissions = 0; |
| 695 | - foreach($ocmPermissions as $permission) { |
|
| 695 | + foreach ($ocmPermissions as $permission) { |
|
| 696 | 696 | switch (strtolower($permission)) { |
| 697 | 697 | case 'read': |
| 698 | 698 | $ncPermissions += Constants::PERMISSION_READ; |
@@ -707,7 +707,7 @@ discard block |
||
| 707 | 707 | throw new BadRequestException(['permission']); |
| 708 | 708 | } |
| 709 | 709 | |
| 710 | - error_log("new permissions: " . $ncPermissions); |
|
| 710 | + error_log("new permissions: ".$ncPermissions); |
|
| 711 | 711 | } |
| 712 | 712 | |
| 713 | 713 | return $ncPermissions; |