@@ -39,16 +39,16 @@ |
||
39 | 39 | } |
40 | 40 | |
41 | 41 | $cloudID = \OC::$server->getUserSession()->getUser()->getCloudId(); |
42 | -$url = 'https://nextcloud.com/federation#' . $cloudID; |
|
42 | +$url = 'https://nextcloud.com/federation#'.$cloudID; |
|
43 | 43 | $logoPath = \OC::$server->getURLGenerator()->imagePath('core', 'logo-icon.svg'); |
44 | 44 | $theme = \OC::$server->getThemingDefaults(); |
45 | 45 | $color = $theme->getMailHeaderColor(); |
46 | 46 | $textColor = "#ffffff"; |
47 | -if(\OC::$server->getAppManager()->isEnabledForUser("theming")) { |
|
47 | +if (\OC::$server->getAppManager()->isEnabledForUser("theming")) { |
|
48 | 48 | $logoPath = $theme->getLogo(); |
49 | 49 | try { |
50 | 50 | $util = \OC::$server->query("\OCA\Theming\Util"); |
51 | - if($util->invertTextColor($color)) { |
|
51 | + if ($util->invertTextColor($color)) { |
|
52 | 52 | $textColor = "#000000"; |
53 | 53 | } |
54 | 54 | } catch (OCP\AppFramework\QueryException $e) { |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | 'remoteId' => $shareId |
134 | 134 | ); |
135 | 135 | |
136 | - $result = $this->tryHttpPostToShareEndpoint(rtrim($remote, '/'), '/' . $id . '/reshare', $fields); |
|
136 | + $result = $this->tryHttpPostToShareEndpoint(rtrim($remote, '/'), '/'.$id.'/reshare', $fields); |
|
137 | 137 | $status = json_decode($result['result'], true); |
138 | 138 | |
139 | 139 | $httpRequestSuccessful = $result['success']; |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | if ($httpRequestSuccessful && $ocsCallSuccessful && $validToken && $validRemoteId) { |
145 | 145 | return [ |
146 | 146 | $status['ocs']['data']['token'], |
147 | - (int)$status['ocs']['data']['remoteId'] |
|
147 | + (int) $status['ocs']['data']['remoteId'] |
|
148 | 148 | ]; |
149 | 149 | } |
150 | 150 | |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | $fields[$key] = $value; |
229 | 229 | } |
230 | 230 | |
231 | - $result = $this->tryHttpPostToShareEndpoint(rtrim($remote, '/'), '/' . $remoteId . '/' . $action, $fields); |
|
231 | + $result = $this->tryHttpPostToShareEndpoint(rtrim($remote, '/'), '/'.$remoteId.'/'.$action, $fields); |
|
232 | 232 | $status = json_decode($result['result'], true); |
233 | 233 | |
234 | 234 | if ($result['success'] && |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | $client = $this->httpClientService->newClient(); |
280 | 280 | |
281 | 281 | if ($this->addressHandler->urlContainProtocol($remoteDomain) === false) { |
282 | - $remoteDomain = 'https://' . $remoteDomain; |
|
282 | + $remoteDomain = 'https://'.$remoteDomain; |
|
283 | 283 | } |
284 | 284 | |
285 | 285 | $result = [ |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | |
290 | 290 | $endpoint = $this->discoveryManager->getShareEndpoint($remoteDomain); |
291 | 291 | try { |
292 | - $response = $client->post($remoteDomain . $endpoint . $urlSuffix . '?format=' . self::RESPONSE_FORMAT, [ |
|
292 | + $response = $client->post($remoteDomain.$endpoint.$urlSuffix.'?format='.self::RESPONSE_FORMAT, [ |
|
293 | 293 | 'body' => $fields, |
294 | 294 | 'timeout' => 10, |
295 | 295 | 'connect_timeout' => 10, |
@@ -184,12 +184,12 @@ |
||
184 | 184 | } |
185 | 185 | |
186 | 186 | try { |
187 | - $this->getDisplayNameFromContact($user . '@http://' . $server); |
|
187 | + $this->getDisplayNameFromContact($user.'@http://'.$server); |
|
188 | 188 | } catch (\OutOfBoundsException $e) { |
189 | 189 | } |
190 | 190 | |
191 | 191 | try { |
192 | - $this->getDisplayNameFromContact($user . '@https://' . $server); |
|
192 | + $this->getDisplayNameFromContact($user.'@https://'.$server); |
|
193 | 193 | } catch (\OutOfBoundsException $e) { |
194 | 194 | } |
195 | 195 |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | if ($remoteShare) { |
183 | 183 | try { |
184 | 184 | $ownerCloudId = $this->cloudIdManager->getCloudId($remoteShare['owner'], $remoteShare['remote']); |
185 | - $shareId = $this->addShareToDB($itemSource, $itemType, $shareWith, $sharedBy, $ownerCloudId->getId(), $permissions, 'tmp_token_' . time()); |
|
185 | + $shareId = $this->addShareToDB($itemSource, $itemType, $shareWith, $sharedBy, $ownerCloudId->getId(), $permissions, 'tmp_token_'.time()); |
|
186 | 186 | $share->setId($shareId); |
187 | 187 | list($token, $remoteId) = $this->askOwnerToReShare($shareWith, $share, $shareId); |
188 | 188 | // remote share was create successfully if we get a valid token as return |
@@ -254,11 +254,11 @@ discard block |
||
254 | 254 | $failure = true; |
255 | 255 | } |
256 | 256 | } catch (\Exception $e) { |
257 | - $this->logger->error('Failed to notify remote server of federated share, removing share (' . $e->getMessage() . ')'); |
|
257 | + $this->logger->error('Failed to notify remote server of federated share, removing share ('.$e->getMessage().')'); |
|
258 | 258 | $failure = true; |
259 | 259 | } |
260 | 260 | |
261 | - if($failure) { |
|
261 | + if ($failure) { |
|
262 | 262 | $this->removeShareFromTableById($shareId); |
263 | 263 | $message_t = $this->l->t('Sharing %s failed, could not find %s, maybe the server is currently unreachable or uses a self-signed certificate.', |
264 | 264 | [$share->getNode()->getName(), $share->getSharedWith()]); |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | ->andWhere($query->expr()->eq('mountpoint', $query->createNamedParameter($share->getTarget()))); |
310 | 310 | $result = $query->execute()->fetchAll(); |
311 | 311 | |
312 | - if (isset($result[0]) && (int)$result[0]['remote_id'] > 0) { |
|
312 | + if (isset($result[0]) && (int) $result[0]['remote_id'] > 0) { |
|
313 | 313 | return $result[0]; |
314 | 314 | } |
315 | 315 | |
@@ -351,7 +351,7 @@ discard block |
||
351 | 351 | $qb->execute(); |
352 | 352 | $id = $qb->getLastInsertId(); |
353 | 353 | |
354 | - return (int)$id; |
|
354 | + return (int) $id; |
|
355 | 355 | } |
356 | 356 | |
357 | 357 | /** |
@@ -441,14 +441,14 @@ discard block |
||
441 | 441 | public function getRemoteId(IShare $share) { |
442 | 442 | $query = $this->dbConnection->getQueryBuilder(); |
443 | 443 | $query->select('remote_id')->from('federated_reshares') |
444 | - ->where($query->expr()->eq('share_id', $query->createNamedParameter((int)$share->getId()))); |
|
444 | + ->where($query->expr()->eq('share_id', $query->createNamedParameter((int) $share->getId()))); |
|
445 | 445 | $data = $query->execute()->fetch(); |
446 | 446 | |
447 | 447 | if (!is_array($data) || !isset($data['remote_id'])) { |
448 | 448 | throw new ShareNotFound(); |
449 | 449 | } |
450 | 450 | |
451 | - return (int)$data['remote_id']; |
|
451 | + return (int) $data['remote_id']; |
|
452 | 452 | } |
453 | 453 | |
454 | 454 | /** |
@@ -479,7 +479,7 @@ discard block |
||
479 | 479 | ->orderBy('id'); |
480 | 480 | |
481 | 481 | $cursor = $qb->execute(); |
482 | - while($data = $cursor->fetch()) { |
|
482 | + while ($data = $cursor->fetch()) { |
|
483 | 483 | $children[] = $this->createShareObject($data); |
484 | 484 | } |
485 | 485 | $cursor->closeCursor(); |
@@ -608,7 +608,7 @@ discard block |
||
608 | 608 | ); |
609 | 609 | } |
610 | 610 | |
611 | - $qb->innerJoin('s', 'filecache' ,'f', 's.file_source = f.fileid'); |
|
611 | + $qb->innerJoin('s', 'filecache', 'f', 's.file_source = f.fileid'); |
|
612 | 612 | $qb->andWhere($qb->expr()->eq('f.parent', $qb->createNamedParameter($node->getId()))); |
613 | 613 | |
614 | 614 | $qb->orderBy('id'); |
@@ -671,7 +671,7 @@ discard block |
||
671 | 671 | |
672 | 672 | $cursor = $qb->execute(); |
673 | 673 | $shares = []; |
674 | - while($data = $cursor->fetch()) { |
|
674 | + while ($data = $cursor->fetch()) { |
|
675 | 675 | $shares[] = $this->createShareObject($data); |
676 | 676 | } |
677 | 677 | $cursor->closeCursor(); |
@@ -723,7 +723,7 @@ discard block |
||
723 | 723 | ->execute(); |
724 | 724 | |
725 | 725 | $shares = []; |
726 | - while($data = $cursor->fetch()) { |
|
726 | + while ($data = $cursor->fetch()) { |
|
727 | 727 | $shares[] = $this->createShareObject($data); |
728 | 728 | } |
729 | 729 | $cursor->closeCursor(); |
@@ -762,7 +762,7 @@ discard block |
||
762 | 762 | |
763 | 763 | $cursor = $qb->execute(); |
764 | 764 | |
765 | - while($data = $cursor->fetch()) { |
|
765 | + while ($data = $cursor->fetch()) { |
|
766 | 766 | $shares[] = $this->createShareObject($data); |
767 | 767 | } |
768 | 768 | $cursor->closeCursor(); |
@@ -839,15 +839,15 @@ discard block |
||
839 | 839 | private function createShareObject($data) { |
840 | 840 | |
841 | 841 | $share = new Share($this->rootFolder, $this->userManager); |
842 | - $share->setId((int)$data['id']) |
|
843 | - ->setShareType((int)$data['share_type']) |
|
844 | - ->setPermissions((int)$data['permissions']) |
|
842 | + $share->setId((int) $data['id']) |
|
843 | + ->setShareType((int) $data['share_type']) |
|
844 | + ->setPermissions((int) $data['permissions']) |
|
845 | 845 | ->setTarget($data['file_target']) |
846 | - ->setMailSend((bool)$data['mail_send']) |
|
846 | + ->setMailSend((bool) $data['mail_send']) |
|
847 | 847 | ->setToken($data['token']); |
848 | 848 | |
849 | 849 | $shareTime = new \DateTime(); |
850 | - $shareTime->setTimestamp((int)$data['stime']); |
|
850 | + $shareTime->setTimestamp((int) $data['stime']); |
|
851 | 851 | $share->setShareTime($shareTime); |
852 | 852 | $share->setSharedWith($data['share_with']); |
853 | 853 | |
@@ -857,13 +857,13 @@ discard block |
||
857 | 857 | } else { |
858 | 858 | //OLD SHARE |
859 | 859 | $share->setSharedBy($data['uid_owner']); |
860 | - $path = $this->getNode($share->getSharedBy(), (int)$data['file_source']); |
|
860 | + $path = $this->getNode($share->getSharedBy(), (int) $data['file_source']); |
|
861 | 861 | |
862 | 862 | $owner = $path->getOwner(); |
863 | 863 | $share->setShareOwner($owner->getUID()); |
864 | 864 | } |
865 | 865 | |
866 | - $share->setNodeId((int)$data['file_source']); |
|
866 | + $share->setNodeId((int) $data['file_source']); |
|
867 | 867 | $share->setNodeType($data['item_type']); |
868 | 868 | |
869 | 869 | $share->setProviderId($this->identifier()); |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | * @return bool |
63 | 63 | */ |
64 | 64 | private function isSafeUrl($url) { |
65 | - return (bool)preg_match('/^[\/\.A-Za-z0-9]+$/', $url); |
|
65 | + return (bool) preg_match('/^[\/\.A-Za-z0-9]+$/', $url); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | /** |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | */ |
77 | 77 | private function discover($remote) { |
78 | 78 | // Check if something is in the cache |
79 | - if($cacheData = $this->cache->get($remote)) { |
|
79 | + if ($cacheData = $this->cache->get($remote)) { |
|
80 | 80 | return json_decode($cacheData, true); |
81 | 81 | } |
82 | 82 | |
@@ -88,22 +88,22 @@ discard block |
||
88 | 88 | |
89 | 89 | // Read the data from the response body |
90 | 90 | try { |
91 | - $response = $this->client->get($remote . '/ocs-provider/', [ |
|
91 | + $response = $this->client->get($remote.'/ocs-provider/', [ |
|
92 | 92 | 'timeout' => 10, |
93 | 93 | 'connect_timeout' => 10, |
94 | 94 | ]); |
95 | - if($response->getStatusCode() === 200) { |
|
95 | + if ($response->getStatusCode() === 200) { |
|
96 | 96 | $decodedService = json_decode($response->getBody(), true); |
97 | - if(is_array($decodedService)) { |
|
97 | + if (is_array($decodedService)) { |
|
98 | 98 | $endpoints = [ |
99 | 99 | 'webdav', |
100 | 100 | 'share', |
101 | 101 | ]; |
102 | 102 | |
103 | - foreach($endpoints as $endpoint) { |
|
104 | - if(isset($decodedService['services']['FEDERATED_SHARING']['endpoints'][$endpoint])) { |
|
105 | - $endpointUrl = (string)$decodedService['services']['FEDERATED_SHARING']['endpoints'][$endpoint]; |
|
106 | - if($this->isSafeUrl($endpointUrl)) { |
|
103 | + foreach ($endpoints as $endpoint) { |
|
104 | + if (isset($decodedService['services']['FEDERATED_SHARING']['endpoints'][$endpoint])) { |
|
105 | + $endpointUrl = (string) $decodedService['services']['FEDERATED_SHARING']['endpoints'][$endpoint]; |
|
106 | + if ($this->isSafeUrl($endpointUrl)) { |
|
107 | 107 | $discoveredServices[$endpoint] = $endpointUrl; |
108 | 108 | } |
109 | 109 | } |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | $storedPassword = $share->getPassword(); |
148 | 148 | $authenticated = $this->session->get('public_link_authenticated') === $share->getId() || |
149 | 149 | $this->shareManager->checkPassword($share, $password); |
150 | - if (!empty($storedPassword) && !$authenticated ) { |
|
150 | + if (!empty($storedPassword) && !$authenticated) { |
|
151 | 151 | return new JSONResponse( |
152 | 152 | ['message' => 'No permission to access the share'], |
153 | 153 | Http::STATUS_BAD_REQUEST |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | $httpClient = $this->clientService->newClient(); |
190 | 190 | |
191 | 191 | try { |
192 | - $response = $httpClient->post($remote . '/index.php/apps/federatedfilesharing/createFederatedShare', |
|
192 | + $response = $httpClient->post($remote.'/index.php/apps/federatedfilesharing/createFederatedShare', |
|
193 | 193 | [ |
194 | 194 | 'body' => |
195 | 195 | [ |
@@ -287,14 +287,14 @@ discard block |
||
287 | 287 | // note: checkStorageAvailability will already remove the invalid share |
288 | 288 | Util::writeLog( |
289 | 289 | 'federatedfilesharing', |
290 | - 'Invalid remote storage: ' . get_class($e) . ': ' . $e->getMessage(), |
|
290 | + 'Invalid remote storage: '.get_class($e).': '.$e->getMessage(), |
|
291 | 291 | Util::DEBUG |
292 | 292 | ); |
293 | 293 | return new JSONResponse(['message' => $this->l->t('Could not authenticate to remote share, password might be wrong')], Http::STATUS_BAD_REQUEST); |
294 | 294 | } catch (\Exception $e) { |
295 | 295 | Util::writeLog( |
296 | 296 | 'federatedfilesharing', |
297 | - 'Invalid remote storage: ' . get_class($e) . ': ' . $e->getMessage(), |
|
297 | + 'Invalid remote storage: '.get_class($e).': '.$e->getMessage(), |
|
298 | 298 | Util::DEBUG |
299 | 299 | ); |
300 | 300 | $externalManager->removeShare($mount->getMountPoint()); |
@@ -313,14 +313,14 @@ discard block |
||
313 | 313 | } catch (StorageInvalidException $e) { |
314 | 314 | Util::writeLog( |
315 | 315 | 'federatedfilesharing', |
316 | - 'Invalid remote storage: ' . get_class($e) . ': ' . $e->getMessage(), |
|
316 | + 'Invalid remote storage: '.get_class($e).': '.$e->getMessage(), |
|
317 | 317 | Util::DEBUG |
318 | 318 | ); |
319 | 319 | return new JSONResponse(['message' => $this->l->t('Storage not valid')], Http::STATUS_BAD_REQUEST); |
320 | 320 | } catch (\Exception $e) { |
321 | 321 | Util::writeLog( |
322 | 322 | 'federatedfilesharing', |
323 | - 'Invalid remote storage: ' . get_class($e) . ': ' . $e->getMessage(), |
|
323 | + 'Invalid remote storage: '.get_class($e).': '.$e->getMessage(), |
|
324 | 324 | Util::DEBUG |
325 | 325 | ); |
326 | 326 | return new JSONResponse(['message' => $this->l->t('Couldn\'t add remote share')], Http::STATUS_BAD_REQUEST); |
@@ -127,24 +127,24 @@ discard block |
||
127 | 127 | $owner = isset($_POST['owner']) ? $_POST['owner'] : null; |
128 | 128 | $sharedBy = isset($_POST['sharedBy']) ? $_POST['sharedBy'] : null; |
129 | 129 | $shareWith = isset($_POST['shareWith']) ? $_POST['shareWith'] : null; |
130 | - $remoteId = isset($_POST['remoteId']) ? (int)$_POST['remoteId'] : null; |
|
130 | + $remoteId = isset($_POST['remoteId']) ? (int) $_POST['remoteId'] : null; |
|
131 | 131 | $sharedByFederatedId = isset($_POST['sharedByFederatedId']) ? $_POST['sharedByFederatedId'] : null; |
132 | 132 | $ownerFederatedId = isset($_POST['ownerFederatedId']) ? $_POST['ownerFederatedId'] : null; |
133 | 133 | |
134 | 134 | if ($remote && $token && $name && $owner && $remoteId && $shareWith) { |
135 | 135 | |
136 | - if(!\OCP\Util::isValidFileName($name)) { |
|
136 | + if (!\OCP\Util::isValidFileName($name)) { |
|
137 | 137 | throw new OCSException('The mountpoint name contains invalid characters.', 400); |
138 | 138 | } |
139 | 139 | |
140 | 140 | // FIXME this should be a method in the user management instead |
141 | - \OCP\Util::writeLog('files_sharing', 'shareWith before, ' . $shareWith, \OCP\Util::DEBUG); |
|
141 | + \OCP\Util::writeLog('files_sharing', 'shareWith before, '.$shareWith, \OCP\Util::DEBUG); |
|
142 | 142 | \OCP\Util::emitHook( |
143 | 143 | '\OCA\Files_Sharing\API\Server2Server', |
144 | 144 | 'preLoginNameUsedAsUserName', |
145 | 145 | array('uid' => &$shareWith) |
146 | 146 | ); |
147 | - \OCP\Util::writeLog('files_sharing', 'shareWith after, ' . $shareWith, \OCP\Util::DEBUG); |
|
147 | + \OCP\Util::writeLog('files_sharing', 'shareWith after, '.$shareWith, \OCP\Util::DEBUG); |
|
148 | 148 | |
149 | 149 | if (!\OCP\User::userExists($shareWith)) { |
150 | 150 | throw new OCSException('User does not exists', 400); |
@@ -199,20 +199,20 @@ discard block |
||
199 | 199 | |
200 | 200 | $declineAction = $notification->createAction(); |
201 | 201 | $declineAction->setLabel('decline') |
202 | - ->setLink($urlGenerator->getAbsoluteURL($urlGenerator->linkTo('', 'ocs/v1.php/apps/files_sharing/api/v1/remote_shares/pending/' . $shareId)), 'DELETE'); |
|
202 | + ->setLink($urlGenerator->getAbsoluteURL($urlGenerator->linkTo('', 'ocs/v1.php/apps/files_sharing/api/v1/remote_shares/pending/'.$shareId)), 'DELETE'); |
|
203 | 203 | $notification->addAction($declineAction); |
204 | 204 | |
205 | 205 | $acceptAction = $notification->createAction(); |
206 | 206 | $acceptAction->setLabel('accept') |
207 | - ->setLink($urlGenerator->getAbsoluteURL($urlGenerator->linkTo('', 'ocs/v1.php/apps/files_sharing/api/v1/remote_shares/pending/' . $shareId)), 'POST'); |
|
207 | + ->setLink($urlGenerator->getAbsoluteURL($urlGenerator->linkTo('', 'ocs/v1.php/apps/files_sharing/api/v1/remote_shares/pending/'.$shareId)), 'POST'); |
|
208 | 208 | $notification->addAction($acceptAction); |
209 | 209 | |
210 | 210 | $notificationManager->notify($notification); |
211 | 211 | |
212 | 212 | return new Http\DataResponse(); |
213 | 213 | } catch (\Exception $e) { |
214 | - \OCP\Util::writeLog('files_sharing', 'server can not add remote share, ' . $e->getMessage(), \OCP\Util::ERROR); |
|
215 | - throw new OCSException('internal server error, was not able to add share from ' . $remote, 500); |
|
214 | + \OCP\Util::writeLog('files_sharing', 'server can not add remote share, '.$e->getMessage(), \OCP\Util::ERROR); |
|
215 | + throw new OCSException('internal server error, was not able to add share from '.$remote, 500); |
|
216 | 216 | } |
217 | 217 | } |
218 | 218 | |
@@ -235,8 +235,8 @@ discard block |
||
235 | 235 | |
236 | 236 | $token = $this->request->getParam('token', null); |
237 | 237 | $shareWith = $this->request->getParam('shareWith', null); |
238 | - $permission = (int)$this->request->getParam('permission', null); |
|
239 | - $remoteId = (int)$this->request->getParam('remoteId', null); |
|
238 | + $permission = (int) $this->request->getParam('permission', null); |
|
239 | + $remoteId = (int) $this->request->getParam('remoteId', null); |
|
240 | 240 | |
241 | 241 | if ($id === null || |
242 | 242 | $token === null || |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | list($user, $remote) = $this->addressHandler->splitUserRemote($shareWith); |
258 | 258 | $owner = $share->getShareOwner(); |
259 | 259 | $currentServer = $this->addressHandler->generateRemoteURL(); |
260 | - if ($this->addressHandler->compareAddresses($user, $remote,$owner , $currentServer)) { |
|
260 | + if ($this->addressHandler->compareAddresses($user, $remote, $owner, $currentServer)) { |
|
261 | 261 | throw new OCSForbiddenException(); |
262 | 262 | } |
263 | 263 | |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | $share->setSharedWith($shareWith); |
272 | 272 | try { |
273 | 273 | $result = $this->federatedShareProvider->create($share); |
274 | - $this->federatedShareProvider->storeRemoteId((int)$result->getId(), $remoteId); |
|
274 | + $this->federatedShareProvider->storeRemoteId((int) $result->getId(), $remoteId); |
|
275 | 275 | return new Http\DataResponse([ |
276 | 276 | 'token' => $result->getToken(), |
277 | 277 | 'remoteId' => $result->getId() |
@@ -359,7 +359,7 @@ discard block |
||
359 | 359 | return new Http\DataResponse(); |
360 | 360 | } |
361 | 361 | |
362 | - if($this->verifyShare($share, $token)) { |
|
362 | + if ($this->verifyShare($share, $token)) { |
|
363 | 363 | if ($share->getShareOwner() !== $share->getSharedBy()) { |
364 | 364 | list(, $remote) = $this->addressHandler->splitUserRemote($share->getSharedBy()); |
365 | 365 | $remoteId = $this->federatedShareProvider->getRemoteId($share); |
@@ -398,7 +398,7 @@ discard block |
||
398 | 398 | * @return string |
399 | 399 | */ |
400 | 400 | protected function getCorrectUid(Share\IShare $share) { |
401 | - if($this->userManager->userExists($share->getShareOwner())) { |
|
401 | + if ($this->userManager->userExists($share->getShareOwner())) { |
|
402 | 402 | return $share->getShareOwner(); |
403 | 403 | } |
404 | 404 | |
@@ -598,7 +598,7 @@ discard block |
||
598 | 598 | $validPermission = ctype_digit($permissions); |
599 | 599 | $validToken = $this->verifyShare($share, $token); |
600 | 600 | if ($validPermission && $validToken) { |
601 | - $this->updatePermissionsInDatabase($share, (int)$permissions); |
|
601 | + $this->updatePermissionsInDatabase($share, (int) $permissions); |
|
602 | 602 | } else { |
603 | 603 | throw new OCSBadRequestException(); |
604 | 604 | } |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | $token = $argument['token']; |
106 | 106 | $action = $argument['action']; |
107 | 107 | $data = json_decode($argument['data'], true); |
108 | - $try = (int)$argument['try'] + 1; |
|
108 | + $try = (int) $argument['try'] + 1; |
|
109 | 109 | |
110 | 110 | $result = $this->notifications->sendUpdateToRemote($remote, $remoteId, $token, $action, $data, $try); |
111 | 111 | |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | 'token' => $argument['token'], |
129 | 129 | 'data' => $argument['data'], |
130 | 130 | 'action' => $argument['action'], |
131 | - 'try' => (int)$argument['try'] + 1, |
|
131 | + 'try' => (int) $argument['try'] + 1, |
|
132 | 132 | 'lastRun' => time() |
133 | 133 | ] |
134 | 134 | ); |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | * @return bool |
142 | 142 | */ |
143 | 143 | protected function shouldRun(array $argument) { |
144 | - $lastRun = (int)$argument['lastRun']; |
|
144 | + $lastRun = (int) $argument['lastRun']; |
|
145 | 145 | return ((time() - $lastRun) > $this->interval); |
146 | 146 | } |
147 | 147 |
@@ -55,7 +55,7 @@ |
||
55 | 55 | public function generateToken() { |
56 | 56 | $token = $this->secureRandom->generate( |
57 | 57 | self::TOKEN_LENGTH, |
58 | - ISecureRandom::CHAR_LOWER . ISecureRandom::CHAR_UPPER . ISecureRandom::CHAR_DIGITS); |
|
58 | + ISecureRandom::CHAR_LOWER.ISecureRandom::CHAR_UPPER.ISecureRandom::CHAR_DIGITS); |
|
59 | 59 | return $token; |
60 | 60 | } |
61 | 61 |