Completed
Pull Request — master (#4382)
by Lukas
30:30 queued 13:19
created
apps/sharebymail/lib/ShareByMailProvider.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -244,11 +244,11 @@  discard block
 block discarded – undo
244 244
 					$share->getSharedWith()
245 245
 			);
246 246
 		} catch (HintException $hintException) {
247
-			$this->logger->error('Failed to send share by mail: ' . $hintException->getMessage());
247
+			$this->logger->error('Failed to send share by mail: '.$hintException->getMessage());
248 248
 			$this->removeShareFromTable($shareId);
249 249
 			throw $hintException;
250 250
 		} catch (\Exception $e) {
251
-			$this->logger->error('Failed to send share by mail: ' . $e->getMessage());
251
+			$this->logger->error('Failed to send share by mail: '.$e->getMessage());
252 252
 			$this->removeShareFromTable($shareId);
253 253
 			throw new HintException('Failed to send share by mail',
254 254
 				$this->l->t('Failed to send share by E-mail'));
@@ -276,9 +276,9 @@  discard block
 block discarded – undo
276 276
 		$ownerDisplayName = ($ownerUser instanceof IUser) ? $ownerUser->getDisplayName() : $owner;
277 277
 		$initiatorDisplayName = ($initiatorUser instanceof IUser) ? $initiatorUser->getDisplayName() : $initiator;
278 278
 		if ($owner === $initiator) {
279
-			$subject = (string)$this->l->t('%s shared »%s« with you', array($ownerDisplayName, $filename));
279
+			$subject = (string) $this->l->t('%s shared »%s« with you', array($ownerDisplayName, $filename));
280 280
 		} else {
281
-			$subject = (string)$this->l->t('%s shared »%s« with you on behalf of %s', array($ownerDisplayName, $filename, $initiatorDisplayName));
281
+			$subject = (string) $this->l->t('%s shared »%s« with you on behalf of %s', array($ownerDisplayName, $filename, $initiatorDisplayName));
282 282
 		}
283 283
 
284 284
 		$message = $this->mailer->createMessage();
@@ -291,11 +291,11 @@  discard block
 block discarded – undo
291 291
 		if ($owner === $initiator) {
292 292
 			$text = $this->l->t('%s shared »%s« with you.', [$ownerDisplayName, $filename]);
293 293
 		} else {
294
-			$text= $this->l->t('%s shared »%s« with you on behalf of %s.', [$ownerDisplayName, $filename, $initiator]);
294
+			$text = $this->l->t('%s shared »%s« with you on behalf of %s.', [$ownerDisplayName, $filename, $initiator]);
295 295
 		}
296 296
 
297 297
 		$emailTemplate->addBodyText(
298
-			$text . ' ' . $this->l->t('Click the button below to open it.'),
298
+			$text.' '.$this->l->t('Click the button below to open it.'),
299 299
 			$text
300 300
 		);
301 301
 
@@ -320,9 +320,9 @@  discard block
 block discarded – undo
320 320
 		// The "Reply-To" is set to the sharer if an mail address is configured
321 321
 		// also the default footer contains a "Do not reply" which needs to be adjusted.
322 322
 		$ownerEmail = $ownerUser->getEMailAddress();
323
-		if($ownerEmail !== null) {
323
+		if ($ownerEmail !== null) {
324 324
 			$message->setReplyTo([$ownerEmail => $ownerDisplayName]);
325
-			$emailTemplate->addFooter($instanceName . ' - ' . $this->defaults->getSlogan());
325
+			$emailTemplate->addFooter($instanceName.' - '.$this->defaults->getSlogan());
326 326
 		} else {
327 327
 			$emailTemplate->addFooter();
328 328
 		}
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
 
349 349
 		$initiatorUser = $this->userManager->get($initiator);
350 350
 		$initiatorDisplayName = ($initiatorUser instanceof IUser) ? $initiatorUser->getDisplayName() : $initiator;
351
-		$subject = (string)$this->l->t('Password to access »%s« shared to you by %s', [$filename, $initiatorDisplayName]);
351
+		$subject = (string) $this->l->t('Password to access »%s« shared to you by %s', [$filename, $initiatorDisplayName]);
352 352
 
353 353
 		$message = $this->mailer->createMessage();
354 354
 
@@ -381,7 +381,7 @@  discard block
 block discarded – undo
381 381
 	 */
382 382
 	protected function generateToken() {
383 383
 		$token = $this->secureRandom->generate(
384
-			15, ISecureRandom::CHAR_LOWER . ISecureRandom::CHAR_UPPER . ISecureRandom::CHAR_DIGITS);
384
+			15, ISecureRandom::CHAR_LOWER.ISecureRandom::CHAR_UPPER.ISecureRandom::CHAR_DIGITS);
385 385
 		return $token;
386 386
 	}
387 387
 
@@ -402,7 +402,7 @@  discard block
 block discarded – undo
402 402
 			->orderBy('id');
403 403
 
404 404
 		$cursor = $qb->execute();
405
-		while($data = $cursor->fetch()) {
405
+		while ($data = $cursor->fetch()) {
406 406
 			$children[] = $this->createShareObject($data);
407 407
 		}
408 408
 		$cursor->closeCursor();
@@ -445,7 +445,7 @@  discard block
 block discarded – undo
445 445
 		$qb->execute();
446 446
 		$id = $qb->getLastInsertId();
447 447
 
448
-		return (int)$id;
448
+		return (int) $id;
449 449
 	}
450 450
 
451 451
 	/**
@@ -462,7 +462,7 @@  discard block
 block discarded – undo
462 462
 		// a real password was given
463 463
 		$validPassword = $plainTextPassword !== null && $plainTextPassword !== '';
464 464
 
465
-		if($validPassword && $originalShare->getPassword() !== $share->getPassword()) {
465
+		if ($validPassword && $originalShare->getPassword() !== $share->getPassword()) {
466 466
 			$this->sendPassword($share->getNode()->getName(), $share->getSharedBy(), $share->getSharedWith(), $plainTextPassword);
467 467
 		}
468 468
 		/*
@@ -556,7 +556,7 @@  discard block
 block discarded – undo
556 556
 
557 557
 		$cursor = $qb->execute();
558 558
 		$shares = [];
559
-		while($data = $cursor->fetch()) {
559
+		while ($data = $cursor->fetch()) {
560 560
 			$shares[] = $this->createShareObject($data);
561 561
 		}
562 562
 		$cursor->closeCursor();
@@ -608,7 +608,7 @@  discard block
 block discarded – undo
608 608
 			->execute();
609 609
 
610 610
 		$shares = [];
611
-		while($data = $cursor->fetch()) {
611
+		while ($data = $cursor->fetch()) {
612 612
 			$shares[] = $this->createShareObject($data);
613 613
 		}
614 614
 		$cursor->closeCursor();
@@ -647,7 +647,7 @@  discard block
 block discarded – undo
647 647
 
648 648
 		$cursor = $qb->execute();
649 649
 
650
-		while($data = $cursor->fetch()) {
650
+		while ($data = $cursor->fetch()) {
651 651
 			$shares[] = $this->createShareObject($data);
652 652
 		}
653 653
 		$cursor->closeCursor();
@@ -710,15 +710,15 @@  discard block
 block discarded – undo
710 710
 	protected function createShareObject($data) {
711 711
 
712 712
 		$share = new Share($this->rootFolder, $this->userManager);
713
-		$share->setId((int)$data['id'])
714
-			->setShareType((int)$data['share_type'])
715
-			->setPermissions((int)$data['permissions'])
713
+		$share->setId((int) $data['id'])
714
+			->setShareType((int) $data['share_type'])
715
+			->setPermissions((int) $data['permissions'])
716 716
 			->setTarget($data['file_target'])
717
-			->setMailSend((bool)$data['mail_send'])
717
+			->setMailSend((bool) $data['mail_send'])
718 718
 			->setToken($data['token']);
719 719
 
720 720
 		$shareTime = new \DateTime();
721
-		$shareTime->setTimestamp((int)$data['stime']);
721
+		$shareTime->setTimestamp((int) $data['stime']);
722 722
 		$share->setShareTime($shareTime);
723 723
 		$share->setSharedWith($data['share_with']);
724 724
 		$share->setPassword($data['password']);
@@ -729,7 +729,7 @@  discard block
 block discarded – undo
729 729
 		} else {
730 730
 			//OLD SHARE
731 731
 			$share->setSharedBy($data['uid_owner']);
732
-			$path = $this->getNode($share->getSharedBy(), (int)$data['file_source']);
732
+			$path = $this->getNode($share->getSharedBy(), (int) $data['file_source']);
733 733
 
734 734
 			$owner = $path->getOwner();
735 735
 			$share->setShareOwner($owner->getUID());
@@ -742,7 +742,7 @@  discard block
 block discarded – undo
742 742
 			}
743 743
 		}
744 744
 
745
-		$share->setNodeId((int)$data['file_source']);
745
+		$share->setNodeId((int) $data['file_source']);
746 746
 		$share->setNodeType($data['item_type']);
747 747
 
748 748
 		$share->setProviderId($this->identifier());
@@ -861,7 +861,7 @@  discard block
 block discarded – undo
861 861
 			);
862 862
 		}
863 863
 
864
-		$qb->innerJoin('s', 'filecache' ,'f', $qb->expr()->eq('s.file_source', 'f.fileid'));
864
+		$qb->innerJoin('s', 'filecache', 'f', $qb->expr()->eq('s.file_source', 'f.fileid'));
865 865
 		$qb->andWhere($qb->expr()->eq('f.parent', $qb->createNamedParameter($node->getId())));
866 866
 
867 867
 		$qb->orderBy('id');
Please login to merge, or discard this patch.