@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | $ocsStatus = isset($status['ocs']); |
| 118 | 118 | $ocsSuccess = $ocsStatus && ($status['ocs']['meta']['statuscode'] === 100 || $status['ocs']['meta']['statuscode'] === 200); |
| 119 | 119 | |
| 120 | - if ($result['success'] && (!$ocsStatus ||$ocsSuccess)) { |
|
| 120 | + if ($result['success'] && (!$ocsStatus || $ocsSuccess)) { |
|
| 121 | 121 | \OC_Hook::emit('OCP\Share', 'federated_share_added', ['server' => $remote]); |
| 122 | 122 | return true; |
| 123 | 123 | } |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | return [$ocmResult['token'], $ocmResult['providerId']]; |
| 161 | 161 | } |
| 162 | 162 | |
| 163 | - $result = $this->tryLegacyEndPoint(rtrim($remote, '/'), '/' . $id . '/reshare', $fields); |
|
| 163 | + $result = $this->tryLegacyEndPoint(rtrim($remote, '/'), '/'.$id.'/reshare', $fields); |
|
| 164 | 164 | $status = json_decode($result['result'], true); |
| 165 | 165 | |
| 166 | 166 | $httpRequestSuccessful = $result['success']; |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | if ($httpRequestSuccessful && $ocsCallSuccessful && $validToken && $validRemoteId) { |
| 172 | 172 | return [ |
| 173 | 173 | $status['ocs']['data']['token'], |
| 174 | - (int)$status['ocs']['data']['remoteId'] |
|
| 174 | + (int) $status['ocs']['data']['remoteId'] |
|
| 175 | 175 | ]; |
| 176 | 176 | } |
| 177 | 177 | |
@@ -258,7 +258,7 @@ discard block |
||
| 258 | 258 | $fields[$key] = $value; |
| 259 | 259 | } |
| 260 | 260 | |
| 261 | - $result = $this->tryHttpPostToShareEndpoint(rtrim($remote, '/'), '/' . $remoteId . '/' . $action, $fields, $action); |
|
| 261 | + $result = $this->tryHttpPostToShareEndpoint(rtrim($remote, '/'), '/'.$remoteId.'/'.$action, $fields, $action); |
|
| 262 | 262 | $status = json_decode($result['result'], true); |
| 263 | 263 | |
| 264 | 264 | if ($result['success'] && |
@@ -306,10 +306,10 @@ discard block |
||
| 306 | 306 | * @return array |
| 307 | 307 | * @throws \Exception |
| 308 | 308 | */ |
| 309 | - protected function tryHttpPostToShareEndpoint($remoteDomain, $urlSuffix, array $fields, $action="share") { |
|
| 309 | + protected function tryHttpPostToShareEndpoint($remoteDomain, $urlSuffix, array $fields, $action = "share") { |
|
| 310 | 310 | |
| 311 | 311 | if ($this->addressHandler->urlContainProtocol($remoteDomain) === false) { |
| 312 | - $remoteDomain = 'https://' . $remoteDomain; |
|
| 312 | + $remoteDomain = 'https://'.$remoteDomain; |
|
| 313 | 313 | } |
| 314 | 314 | |
| 315 | 315 | $result = [ |
@@ -348,7 +348,7 @@ discard block |
||
| 348 | 348 | $federationEndpoints = $this->discoveryService->discover($remoteDomain, 'FEDERATED_SHARING'); |
| 349 | 349 | $endpoint = isset($federationEndpoints['share']) ? $federationEndpoints['share'] : '/ocs/v2.php/cloud/shares'; |
| 350 | 350 | try { |
| 351 | - $response = $client->post($remoteDomain . $endpoint . $urlSuffix . '?format=' . self::RESPONSE_FORMAT, [ |
|
| 351 | + $response = $client->post($remoteDomain.$endpoint.$urlSuffix.'?format='.self::RESPONSE_FORMAT, [ |
|
| 352 | 352 | 'body' => $fields, |
| 353 | 353 | 'timeout' => 10, |
| 354 | 354 | 'connect_timeout' => 10, |
@@ -405,7 +405,7 @@ discard block |
||
| 405 | 405 | switch ($action) { |
| 406 | 406 | case 'share': |
| 407 | 407 | $share = $this->cloudFederationFactory->getCloudFederationShare( |
| 408 | - $fields['shareWith'] . '@' . $remoteDomain, |
|
| 408 | + $fields['shareWith'].'@'.$remoteDomain, |
|
| 409 | 409 | $fields['name'], |
| 410 | 410 | '', |
| 411 | 411 | $fields['remoteId'], |
@@ -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) { |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | |
| 150 | 150 | if (!$this->userManager->userExists($shareWith)) { |
| 151 | 151 | return new JSONResponse( |
| 152 | - ['message' => 'User "' . $shareWith . '" does not exists at ' . $this->urlGenerator->getBaseUrl()], |
|
| 152 | + ['message' => 'User "'.$shareWith.'" does not exists at '.$this->urlGenerator->getBaseUrl()], |
|
| 153 | 153 | Http::STATUS_BAD_REQUEST |
| 154 | 154 | ); |
| 155 | 155 | } |
@@ -181,14 +181,14 @@ discard block |
||
| 181 | 181 | ); |
| 182 | 182 | } catch (\Exception $e) { |
| 183 | 183 | return new JSONResponse( |
| 184 | - ['message' => 'Internal error at ' . $this->urlGenerator->getBaseUrl()], |
|
| 184 | + ['message' => 'Internal error at '.$this->urlGenerator->getBaseUrl()], |
|
| 185 | 185 | Http::STATUS_BAD_REQUEST |
| 186 | 186 | ); |
| 187 | 187 | } |
| 188 | 188 | |
| 189 | 189 | $user = $this->userManager->get($shareWithLocalId); |
| 190 | 190 | $recipientDisplayName = ''; |
| 191 | - if($user) { |
|
| 191 | + if ($user) { |
|
| 192 | 192 | $recipientDisplayName = $user->getDisplayName(); |
| 193 | 193 | } |
| 194 | 194 | |
@@ -256,12 +256,12 @@ discard block |
||
| 256 | 256 | } |
| 257 | 257 | catch (\Exception $e) { |
| 258 | 258 | return new JSONResponse( |
| 259 | - ['message' => 'Internal error at ' . $this->urlGenerator->getBaseUrl()], |
|
| 259 | + ['message' => 'Internal error at '.$this->urlGenerator->getBaseUrl()], |
|
| 260 | 260 | Http::STATUS_BAD_REQUEST |
| 261 | 261 | ); |
| 262 | 262 | } |
| 263 | 263 | |
| 264 | - return new JSONResponse($result,Http::STATUS_CREATED); |
|
| 264 | + return new JSONResponse($result, Http::STATUS_CREATED); |
|
| 265 | 265 | |
| 266 | 266 | } |
| 267 | 267 | |
@@ -274,13 +274,13 @@ discard block |
||
| 274 | 274 | private function mapUid($uid) { |
| 275 | 275 | \OC::$server->getURLGenerator()->linkToDocs('key'); |
| 276 | 276 | // FIXME this should be a method in the user management instead |
| 277 | - $this->logger->debug('shareWith before, ' . $uid, ['app' => $this->appName]); |
|
| 277 | + $this->logger->debug('shareWith before, '.$uid, ['app' => $this->appName]); |
|
| 278 | 278 | \OCP\Util::emitHook( |
| 279 | 279 | '\OCA\Files_Sharing\API\Server2Server', |
| 280 | 280 | 'preLoginNameUsedAsUserName', |
| 281 | 281 | array('uid' => &$uid) |
| 282 | 282 | ); |
| 283 | - $this->logger->debug('shareWith after, ' . $uid, ['app' => $this->appName]); |
|
| 283 | + $this->logger->debug('shareWith after, '.$uid, ['app' => $this->appName]); |
|
| 284 | 284 | |
| 285 | 285 | return $uid; |
| 286 | 286 | } |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | // for backward compatibility make sure that the remote url stored in the |
| 165 | 165 | // database ends with a trailing slash |
| 166 | 166 | if (substr($remote, -1) !== '/') { |
| 167 | - $remote = $remote . '/'; |
|
| 167 | + $remote = $remote.'/'; |
|
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | $token = $share->getShareSecret(); |
@@ -190,16 +190,16 @@ discard block |
||
| 190 | 190 | } |
| 191 | 191 | |
| 192 | 192 | // FIXME this should be a method in the user management instead |
| 193 | - $this->logger->debug('shareWith before, ' . $shareWith, ['app' => 'files_sharing']); |
|
| 193 | + $this->logger->debug('shareWith before, '.$shareWith, ['app' => 'files_sharing']); |
|
| 194 | 194 | Util::emitHook( |
| 195 | 195 | '\OCA\Files_Sharing\API\Server2Server', |
| 196 | 196 | 'preLoginNameUsedAsUserName', |
| 197 | 197 | array('uid' => &$shareWith) |
| 198 | 198 | ); |
| 199 | - $this->logger->debug('shareWith after, ' . $shareWith, ['app' => 'files_sharing']); |
|
| 199 | + $this->logger->debug('shareWith after, '.$shareWith, ['app' => 'files_sharing']); |
|
| 200 | 200 | |
| 201 | 201 | if (!$this->userManager->userExists($shareWith)) { |
| 202 | - throw new ProviderCouldNotAddShareException('User does not exists', '',Http::STATUS_BAD_REQUEST); |
|
| 202 | + throw new ProviderCouldNotAddShareException('User does not exists', '', Http::STATUS_BAD_REQUEST); |
|
| 203 | 203 | } |
| 204 | 204 | |
| 205 | 205 | \OC_Util::setupFS($shareWith); |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | ->setType('remote_share') |
| 226 | 226 | ->setSubject(RemoteShares::SUBJECT_REMOTE_SHARE_RECEIVED, [$ownerFederatedId, trim($name, '/')]) |
| 227 | 227 | ->setAffectedUser($shareWith) |
| 228 | - ->setObject('remote_share', (int)$shareId, $name); |
|
| 228 | + ->setObject('remote_share', (int) $shareId, $name); |
|
| 229 | 229 | \OC::$server->getActivityManager()->publish($event); |
| 230 | 230 | |
| 231 | 231 | $notification = $this->notificationManager->createNotification(); |
@@ -237,12 +237,12 @@ discard block |
||
| 237 | 237 | |
| 238 | 238 | $declineAction = $notification->createAction(); |
| 239 | 239 | $declineAction->setLabel('decline') |
| 240 | - ->setLink($this->urlGenerator->getAbsoluteURL($this->urlGenerator->linkTo('', 'ocs/v2.php/apps/files_sharing/api/v1/remote_shares/pending/' . $shareId)), 'DELETE'); |
|
| 240 | + ->setLink($this->urlGenerator->getAbsoluteURL($this->urlGenerator->linkTo('', 'ocs/v2.php/apps/files_sharing/api/v1/remote_shares/pending/'.$shareId)), 'DELETE'); |
|
| 241 | 241 | $notification->addAction($declineAction); |
| 242 | 242 | |
| 243 | 243 | $acceptAction = $notification->createAction(); |
| 244 | 244 | $acceptAction->setLabel('accept') |
| 245 | - ->setLink($this->urlGenerator->getAbsoluteURL($this->urlGenerator->linkTo('', 'ocs/v2.php/apps/files_sharing/api/v1/remote_shares/pending/' . $shareId)), 'POST'); |
|
| 245 | + ->setLink($this->urlGenerator->getAbsoluteURL($this->urlGenerator->linkTo('', 'ocs/v2.php/apps/files_sharing/api/v1/remote_shares/pending/'.$shareId)), 'POST'); |
|
| 246 | 246 | $notification->addAction($acceptAction); |
| 247 | 247 | |
| 248 | 248 | $this->notificationManager->notify($notification); |
@@ -254,7 +254,7 @@ discard block |
||
| 254 | 254 | 'level' => ILogger::ERROR, |
| 255 | 255 | 'app' => 'files_sharing' |
| 256 | 256 | ]); |
| 257 | - throw new ProviderCouldNotAddShareException('internal server error, was not able to add share from ' . $remote, '', HTTP::STATUS_INTERNAL_SERVER_ERROR); |
|
| 257 | + throw new ProviderCouldNotAddShareException('internal server error, was not able to add share from '.$remote, '', HTTP::STATUS_INTERNAL_SERVER_ERROR); |
|
| 258 | 258 | } |
| 259 | 259 | } |
| 260 | 260 | |
@@ -351,7 +351,7 @@ discard block |
||
| 351 | 351 | */ |
| 352 | 352 | protected function executeAcceptShare(IShare $share) { |
| 353 | 353 | try { |
| 354 | - $fileId = (int)$share->getNode()->getId(); |
|
| 354 | + $fileId = (int) $share->getNode()->getId(); |
|
| 355 | 355 | list($file, $link) = $this->getFile($this->getCorrectUid($share), $fileId); |
| 356 | 356 | } catch (\Exception $e) { |
| 357 | 357 | throw new ShareNotFound(); |
@@ -429,7 +429,7 @@ discard block |
||
| 429 | 429 | $this->federatedShareProvider->removeShareFromTable($share); |
| 430 | 430 | |
| 431 | 431 | try { |
| 432 | - $fileId = (int)$share->getNode()->getId(); |
|
| 432 | + $fileId = (int) $share->getNode()->getId(); |
|
| 433 | 433 | list($file, $link) = $this->getFile($this->getCorrectUid($share), $fileId); |
| 434 | 434 | } catch (\Exception $e) { |
| 435 | 435 | throw new ShareNotFound(); |
@@ -530,7 +530,7 @@ discard block |
||
| 530 | 530 | $notification = $this->notificationManager->createNotification(); |
| 531 | 531 | $notification->setApp('files_sharing') |
| 532 | 532 | ->setUser($share['user']) |
| 533 | - ->setObject('remote_share', (int)$share['id']); |
|
| 533 | + ->setObject('remote_share', (int) $share['id']); |
|
| 534 | 534 | $this->notificationManager->markProcessed($notification); |
| 535 | 535 | |
| 536 | 536 | $event = $this->activityManager->generateEvent(); |
@@ -538,7 +538,7 @@ discard block |
||
| 538 | 538 | ->setType('remote_share') |
| 539 | 539 | ->setSubject(RemoteShares::SUBJECT_REMOTE_SHARE_UNSHARED, [$owner->getId(), $path]) |
| 540 | 540 | ->setAffectedUser($user) |
| 541 | - ->setObject('remote_share', (int)$share['id'], $path); |
|
| 541 | + ->setObject('remote_share', (int) $share['id'], $path); |
|
| 542 | 542 | \OC::$server->getActivityManager()->publish($event); |
| 543 | 543 | } |
| 544 | 544 | |
@@ -586,7 +586,7 @@ discard block |
||
| 586 | 586 | $owner = $share->getShareOwner(); |
| 587 | 587 | $currentServer = $this->addressHandler->generateRemoteURL(); |
| 588 | 588 | if ($this->addressHandler->compareAddresses($user, $remote, $owner, $currentServer)) { |
| 589 | - throw new ProviderCouldNotAddShareException('Resharing back to the owner is not allowed: ' . $id); |
|
| 589 | + throw new ProviderCouldNotAddShareException('Resharing back to the owner is not allowed: '.$id); |
|
| 590 | 590 | } |
| 591 | 591 | } catch (\Exception $e) { |
| 592 | 592 | throw new ProviderCouldNotAddShareException($e->getMessage()); |
@@ -600,10 +600,10 @@ discard block |
||
| 600 | 600 | $share->setSharedBy($share->getSharedWith()); |
| 601 | 601 | $share->setSharedWith($shareWith); |
| 602 | 602 | $result = $this->federatedShareProvider->create($share); |
| 603 | - $this->federatedShareProvider->storeRemoteId((int)$result->getId(), $senderId); |
|
| 603 | + $this->federatedShareProvider->storeRemoteId((int) $result->getId(), $senderId); |
|
| 604 | 604 | return ['token' => $result->getToken(), 'providerId' => $result->getId()]; |
| 605 | 605 | } else { |
| 606 | - throw new ProviderCouldNotAddShareException('resharing not allowed for share: ' . $id); |
|
| 606 | + throw new ProviderCouldNotAddShareException('resharing not allowed for share: '.$id); |
|
| 607 | 607 | } |
| 608 | 608 | |
| 609 | 609 | } |
@@ -649,7 +649,7 @@ discard block |
||
| 649 | 649 | */ |
| 650 | 650 | protected function ocmPermissions2ncPermissions(array $ocmPermissions) { |
| 651 | 651 | $ncPermissions = 0; |
| 652 | - foreach($ocmPermissions as $permission) { |
|
| 652 | + foreach ($ocmPermissions as $permission) { |
|
| 653 | 653 | switch (strtolower($permission)) { |
| 654 | 654 | case 'read': |
| 655 | 655 | $ncPermissions += Constants::PERMISSION_READ; |
@@ -664,7 +664,7 @@ discard block |
||
| 664 | 664 | throw new BadRequestException(['permission']); |
| 665 | 665 | } |
| 666 | 666 | |
| 667 | - error_log("new permissions: " . $ncPermissions); |
|
| 667 | + error_log("new permissions: ".$ncPermissions); |
|
| 668 | 668 | } |
| 669 | 669 | |
| 670 | 670 | return $ncPermissions; |