@@ -36,7 +36,7 @@ |
||
36 | 36 | $l = \OC::$server->getL10N('federation'); |
37 | 37 | $this->parameterList = $missingParameters; |
38 | 38 | $parameterList = implode(',', $missingParameters); |
39 | - $message = 'Parameters missing in order to complete the request. Missing Parameters: ' . $parameterList; |
|
39 | + $message = 'Parameters missing in order to complete the request. Missing Parameters: '.$parameterList; |
|
40 | 40 | $hint = $l->t('Parameters missing in order to complete the request. Missing Parameters: "%s"', [$parameterList]); |
41 | 41 | parent::__construct($message, $hint); |
42 | 42 | } |
@@ -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,7 +181,7 @@ 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 | } |
@@ -250,13 +250,13 @@ discard block |
||
250 | 250 | } |
251 | 251 | catch (\Exception $e) { |
252 | 252 | return new JSONResponse( |
253 | - ['message' => 'Internal error at ' . $this->urlGenerator->getBaseUrl()], |
|
253 | + ['message' => 'Internal error at '.$this->urlGenerator->getBaseUrl()], |
|
254 | 254 | Http::STATUS_BAD_REQUEST |
255 | 255 | ); |
256 | 256 | } |
257 | 257 | |
258 | 258 | |
259 | - return new JSONResponse([],Http::STATUS_CREATED); |
|
259 | + return new JSONResponse([], Http::STATUS_CREATED); |
|
260 | 260 | |
261 | 261 | } |
262 | 262 | |
@@ -269,13 +269,13 @@ discard block |
||
269 | 269 | private function mapUid($uid) { |
270 | 270 | \OC::$server->getURLGenerator()->linkToDocs('key'); |
271 | 271 | // FIXME this should be a method in the user management instead |
272 | - $this->logger->debug('shareWith before, ' . $uid, ['app' => $this->appName]); |
|
272 | + $this->logger->debug('shareWith before, '.$uid, ['app' => $this->appName]); |
|
273 | 273 | \OCP\Util::emitHook( |
274 | 274 | '\OCA\Files_Sharing\API\Server2Server', |
275 | 275 | 'preLoginNameUsedAsUserName', |
276 | 276 | array('uid' => &$uid) |
277 | 277 | ); |
278 | - $this->logger->debug('shareWith after, ' . $uid, ['app' => $this->appName]); |
|
278 | + $this->logger->debug('shareWith after, '.$uid, ['app' => $this->appName]); |
|
279 | 279 | |
280 | 280 | return $uid; |
281 | 281 | } |
@@ -180,16 +180,16 @@ discard block |
||
180 | 180 | } |
181 | 181 | |
182 | 182 | // FIXME this should be a method in the user management instead |
183 | - $this->logger->debug('shareWith before, ' . $shareWith, ['app' => 'files_sharing']); |
|
183 | + $this->logger->debug('shareWith before, '.$shareWith, ['app' => 'files_sharing']); |
|
184 | 184 | Util::emitHook( |
185 | 185 | '\OCA\Files_Sharing\API\Server2Server', |
186 | 186 | 'preLoginNameUsedAsUserName', |
187 | 187 | array('uid' => &$shareWith) |
188 | 188 | ); |
189 | - $this->logger->debug('shareWith after, ' . $shareWith, ['app' => 'files_sharing']); |
|
189 | + $this->logger->debug('shareWith after, '.$shareWith, ['app' => 'files_sharing']); |
|
190 | 190 | |
191 | 191 | if (!$this->userManager->userExists($shareWith)) { |
192 | - throw new ProviderCouldNotAddShareException('User does not exists', '',Http::STATUS_BAD_REQUEST); |
|
192 | + throw new ProviderCouldNotAddShareException('User does not exists', '', Http::STATUS_BAD_REQUEST); |
|
193 | 193 | } |
194 | 194 | |
195 | 195 | \OC_Util::setupFS($shareWith); |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | ->setType('remote_share') |
216 | 216 | ->setSubject(RemoteShares::SUBJECT_REMOTE_SHARE_RECEIVED, [$ownerFederatedId, trim($name, '/')]) |
217 | 217 | ->setAffectedUser($shareWith) |
218 | - ->setObject('remote_share', (int)$shareId, $name); |
|
218 | + ->setObject('remote_share', (int) $shareId, $name); |
|
219 | 219 | \OC::$server->getActivityManager()->publish($event); |
220 | 220 | |
221 | 221 | $notification = $this->notificationManager->createNotification(); |
@@ -227,12 +227,12 @@ discard block |
||
227 | 227 | |
228 | 228 | $declineAction = $notification->createAction(); |
229 | 229 | $declineAction->setLabel('decline') |
230 | - ->setLink($this->urlGenerator->getAbsoluteURL($this->urlGenerator->linkTo('', 'ocs/v2.php/apps/files_sharing/api/v1/remote_shares/pending/' . $shareId)), 'DELETE'); |
|
230 | + ->setLink($this->urlGenerator->getAbsoluteURL($this->urlGenerator->linkTo('', 'ocs/v2.php/apps/files_sharing/api/v1/remote_shares/pending/'.$shareId)), 'DELETE'); |
|
231 | 231 | $notification->addAction($declineAction); |
232 | 232 | |
233 | 233 | $acceptAction = $notification->createAction(); |
234 | 234 | $acceptAction->setLabel('accept') |
235 | - ->setLink($this->urlGenerator->getAbsoluteURL($this->urlGenerator->linkTo('', 'ocs/v2.php/apps/files_sharing/api/v1/remote_shares/pending/' . $shareId)), 'POST'); |
|
235 | + ->setLink($this->urlGenerator->getAbsoluteURL($this->urlGenerator->linkTo('', 'ocs/v2.php/apps/files_sharing/api/v1/remote_shares/pending/'.$shareId)), 'POST'); |
|
236 | 236 | $notification->addAction($acceptAction); |
237 | 237 | |
238 | 238 | $this->notificationManager->notify($notification); |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | 'level' => Util::ERROR, |
245 | 245 | 'app' => 'files_sharing' |
246 | 246 | ]); |
247 | - throw new ProviderCouldNotAddShareException('internal server error, was not able to add share from ' . $remote, '', HTTP::STATUS_INTERNAL_SERVER_ERROR); |
|
247 | + throw new ProviderCouldNotAddShareException('internal server error, was not able to add share from '.$remote, '', HTTP::STATUS_INTERNAL_SERVER_ERROR); |
|
248 | 248 | } |
249 | 249 | } |
250 | 250 | |
@@ -334,7 +334,7 @@ discard block |
||
334 | 334 | */ |
335 | 335 | protected function executeAcceptShare(IShare $share) { |
336 | 336 | try { |
337 | - $fileId = (int)$share->getNode()->getId(); |
|
337 | + $fileId = (int) $share->getNode()->getId(); |
|
338 | 338 | list($file, $link) = $this->getFile($this->getCorrectUid($share), $fileId); |
339 | 339 | } catch (\Exception $e) { |
340 | 340 | throw new ShareNotFoundException(); |
@@ -407,7 +407,7 @@ discard block |
||
407 | 407 | $this->federatedShareProvider->removeShareFromTable($share); |
408 | 408 | |
409 | 409 | try { |
410 | - $fileId = (int)$share->getNode()->getId(); |
|
410 | + $fileId = (int) $share->getNode()->getId(); |
|
411 | 411 | list($file, $link) = $this->getFile($this->getCorrectUid($share), $fileId); |
412 | 412 | } catch (\Exception $e) { |
413 | 413 | throw new ShareNotFoundException(); |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | if ($remoteShare) { |
194 | 194 | try { |
195 | 195 | $ownerCloudId = $this->cloudIdManager->getCloudId($remoteShare['owner'], $remoteShare['remote']); |
196 | - $shareId = $this->addShareToDB($itemSource, $itemType, $shareWith, $sharedBy, $ownerCloudId->getId(), $permissions, 'tmp_token_' . time()); |
|
196 | + $shareId = $this->addShareToDB($itemSource, $itemType, $shareWith, $sharedBy, $ownerCloudId->getId(), $permissions, 'tmp_token_'.time()); |
|
197 | 197 | $share->setId($shareId); |
198 | 198 | list($token, $remoteId) = $this->askOwnerToReShare($shareWith, $share, $shareId); |
199 | 199 | // remote share was create successfully if we get a valid token as return |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | $failure = true; |
274 | 274 | } |
275 | 275 | |
276 | - if($failure) { |
|
276 | + if ($failure) { |
|
277 | 277 | $this->removeShareFromTableById($shareId); |
278 | 278 | $message_t = $this->l->t('Sharing %s failed, could not find %s, maybe the server is currently unreachable or uses a self-signed certificate.', |
279 | 279 | [$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(); |
@@ -622,7 +622,7 @@ discard block |
||
622 | 622 | ); |
623 | 623 | } |
624 | 624 | |
625 | - $qb->innerJoin('s', 'filecache' ,'f', $qb->expr()->eq('s.file_source', 'f.fileid')); |
|
625 | + $qb->innerJoin('s', 'filecache', 'f', $qb->expr()->eq('s.file_source', 'f.fileid')); |
|
626 | 626 | $qb->andWhere($qb->expr()->eq('f.parent', $qb->createNamedParameter($node->getId()))); |
627 | 627 | |
628 | 628 | $qb->orderBy('id'); |
@@ -685,7 +685,7 @@ discard block |
||
685 | 685 | |
686 | 686 | $cursor = $qb->execute(); |
687 | 687 | $shares = []; |
688 | - while($data = $cursor->fetch()) { |
|
688 | + while ($data = $cursor->fetch()) { |
|
689 | 689 | $shares[] = $this->createShareObject($data); |
690 | 690 | } |
691 | 691 | $cursor->closeCursor(); |
@@ -709,7 +709,7 @@ discard block |
||
709 | 709 | $cursor->closeCursor(); |
710 | 710 | |
711 | 711 | if ($data === false) { |
712 | - throw new ShareNotFoundException('Can not find share with ID: ' . $id); |
|
712 | + throw new ShareNotFoundException('Can not find share with ID: '.$id); |
|
713 | 713 | } |
714 | 714 | |
715 | 715 | try { |
@@ -737,7 +737,7 @@ discard block |
||
737 | 737 | ->execute(); |
738 | 738 | |
739 | 739 | $shares = []; |
740 | - while($data = $cursor->fetch()) { |
|
740 | + while ($data = $cursor->fetch()) { |
|
741 | 741 | $shares[] = $this->createShareObject($data); |
742 | 742 | } |
743 | 743 | $cursor->closeCursor(); |
@@ -776,7 +776,7 @@ discard block |
||
776 | 776 | |
777 | 777 | $cursor = $qb->execute(); |
778 | 778 | |
779 | - while($data = $cursor->fetch()) { |
|
779 | + while ($data = $cursor->fetch()) { |
|
780 | 780 | $shares[] = $this->createShareObject($data); |
781 | 781 | } |
782 | 782 | $cursor->closeCursor(); |
@@ -853,15 +853,15 @@ discard block |
||
853 | 853 | private function createShareObject($data) { |
854 | 854 | |
855 | 855 | $share = new Share($this->rootFolder, $this->userManager); |
856 | - $share->setId((int)$data['id']) |
|
857 | - ->setShareType((int)$data['share_type']) |
|
858 | - ->setPermissions((int)$data['permissions']) |
|
856 | + $share->setId((int) $data['id']) |
|
857 | + ->setShareType((int) $data['share_type']) |
|
858 | + ->setPermissions((int) $data['permissions']) |
|
859 | 859 | ->setTarget($data['file_target']) |
860 | - ->setMailSend((bool)$data['mail_send']) |
|
860 | + ->setMailSend((bool) $data['mail_send']) |
|
861 | 861 | ->setToken($data['token']); |
862 | 862 | |
863 | 863 | $shareTime = new \DateTime(); |
864 | - $shareTime->setTimestamp((int)$data['stime']); |
|
864 | + $shareTime->setTimestamp((int) $data['stime']); |
|
865 | 865 | $share->setShareTime($shareTime); |
866 | 866 | $share->setSharedWith($data['share_with']); |
867 | 867 | |
@@ -871,13 +871,13 @@ discard block |
||
871 | 871 | } else { |
872 | 872 | //OLD SHARE |
873 | 873 | $share->setSharedBy($data['uid_owner']); |
874 | - $path = $this->getNode($share->getSharedBy(), (int)$data['file_source']); |
|
874 | + $path = $this->getNode($share->getSharedBy(), (int) $data['file_source']); |
|
875 | 875 | |
876 | 876 | $owner = $path->getOwner(); |
877 | 877 | $share->setShareOwner($owner->getUID()); |
878 | 878 | } |
879 | 879 | |
880 | - $share->setNodeId((int)$data['file_source']); |
|
880 | + $share->setNodeId((int) $data['file_source']); |
|
881 | 881 | $share->setNodeType($data['item_type']); |
882 | 882 | |
883 | 883 | $share->setProviderId($this->identifier()); |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | $owner = isset($_POST['owner']) ? $_POST['owner'] : null; |
150 | 150 | $sharedBy = isset($_POST['sharedBy']) ? $_POST['sharedBy'] : null; |
151 | 151 | $shareWith = isset($_POST['shareWith']) ? $_POST['shareWith'] : null; |
152 | - $remoteId = isset($_POST['remoteId']) ? (int)$_POST['remoteId'] : null; |
|
152 | + $remoteId = isset($_POST['remoteId']) ? (int) $_POST['remoteId'] : null; |
|
153 | 153 | $sharedByFederatedId = isset($_POST['sharedByFederatedId']) ? $_POST['sharedByFederatedId'] : null; |
154 | 154 | $ownerFederatedId = isset($_POST['ownerFederatedId']) ? $_POST['ownerFederatedId'] : null; |
155 | 155 | |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | } catch (ProviderCouldNotAddShareException $e) { |
185 | 185 | throw new OCSException($e->getMessage(), $e->getCode()); |
186 | 186 | } catch (\Exception $e) { |
187 | - throw new OCSException('internal server error, was not able to add share from ' . $remote, 500); |
|
187 | + throw new OCSException('internal server error, was not able to add share from '.$remote, 500); |
|
188 | 188 | } |
189 | 189 | |
190 | 190 | return new Http\DataResponse(); |
@@ -206,8 +206,8 @@ discard block |
||
206 | 206 | |
207 | 207 | $token = $this->request->getParam('token', null); |
208 | 208 | $shareWith = $this->request->getParam('shareWith', null); |
209 | - $permission = (int)$this->request->getParam('permission', null); |
|
210 | - $remoteId = (int)$this->request->getParam('remoteId', null); |
|
209 | + $permission = (int) $this->request->getParam('permission', null); |
|
210 | + $remoteId = (int) $this->request->getParam('remoteId', null); |
|
211 | 211 | |
212 | 212 | if ($id === null || |
213 | 213 | $token === null || |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | $share->setSharedWith($shareWith); |
243 | 243 | try { |
244 | 244 | $result = $this->federatedShareProvider->create($share); |
245 | - $this->federatedShareProvider->storeRemoteId((int)$result->getId(), $remoteId); |
|
245 | + $this->federatedShareProvider->storeRemoteId((int) $result->getId(), $remoteId); |
|
246 | 246 | return new Http\DataResponse([ |
247 | 247 | 'token' => $result->getToken(), |
248 | 248 | 'remoteId' => $result->getId() |
@@ -284,9 +284,9 @@ discard block |
||
284 | 284 | } catch (ProviderDoesNotExistsException $e) { |
285 | 285 | throw new OCSException('Server does not support federated cloud sharing', 503); |
286 | 286 | } catch (ShareNotFoundException $e) { |
287 | - $this->logger->debug('Share not found: ' . $e->getMessage()); |
|
287 | + $this->logger->debug('Share not found: '.$e->getMessage()); |
|
288 | 288 | } catch (\Exception $e) { |
289 | - $this->logger->debug('internal server error, can not process notification: ' . $e->getMessage()); |
|
289 | + $this->logger->debug('internal server error, can not process notification: '.$e->getMessage()); |
|
290 | 290 | } |
291 | 291 | |
292 | 292 | return new Http\DataResponse(); |
@@ -317,9 +317,9 @@ discard block |
||
317 | 317 | } catch (ProviderDoesNotExistsException $e) { |
318 | 318 | throw new OCSException('Server does not support federated cloud sharing', 503); |
319 | 319 | } catch (ShareNotFoundException $e) { |
320 | - $this->logger->debug('Share not found: ' . $e->getMessage()); |
|
320 | + $this->logger->debug('Share not found: '.$e->getMessage()); |
|
321 | 321 | } catch (\Exception $e) { |
322 | - $this->logger->debug('internal server error, can not process notification: ' . $e->getMessage()); |
|
322 | + $this->logger->debug('internal server error, can not process notification: '.$e->getMessage()); |
|
323 | 323 | } |
324 | 324 | |
325 | 325 | return new Http\DataResponse(); |
@@ -387,7 +387,7 @@ discard block |
||
387 | 387 | $notification = $notificationManager->createNotification(); |
388 | 388 | $notification->setApp('files_sharing') |
389 | 389 | ->setUser($share['user']) |
390 | - ->setObject('remote_share', (int)$share['id']); |
|
390 | + ->setObject('remote_share', (int) $share['id']); |
|
391 | 391 | $notificationManager->markProcessed($notification); |
392 | 392 | |
393 | 393 | $event = \OC::$server->getActivityManager()->generateEvent(); |
@@ -395,7 +395,7 @@ discard block |
||
395 | 395 | ->setType('remote_share') |
396 | 396 | ->setSubject(RemoteShares::SUBJECT_REMOTE_SHARE_UNSHARED, [$owner->getId(), $path]) |
397 | 397 | ->setAffectedUser($user) |
398 | - ->setObject('remote_share', (int)$share['id'], $path); |
|
398 | + ->setObject('remote_share', (int) $share['id'], $path); |
|
399 | 399 | \OC::$server->getActivityManager()->publish($event); |
400 | 400 | } |
401 | 401 | |
@@ -519,7 +519,7 @@ discard block |
||
519 | 519 | $validPermission = ctype_digit($permissions); |
520 | 520 | $validToken = $this->verifyShare($share, $token); |
521 | 521 | if ($validPermission && $validToken) { |
522 | - $this->updatePermissionsInDatabase($share, (int)$permissions); |
|
522 | + $this->updatePermissionsInDatabase($share, (int) $permissions); |
|
523 | 523 | } else { |
524 | 524 | throw new OCSBadRequestException(); |
525 | 525 | } |