Completed
Pull Request — master (#4692)
by Björn
28:51 queued 03:35
created
apps/sharebymail/lib/ShareByMailProvider.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -209,10 +209,10 @@  discard block
 block discarded – undo
209 209
 		}
210 210
 
211 211
 		$passwordPolicy = $this->getPasswordPolicy();
212
-		$passwordCharset = ISecureRandom::CHAR_LOWER . ISecureRandom::CHAR_UPPER . ISecureRandom::CHAR_DIGITS;
212
+		$passwordCharset = ISecureRandom::CHAR_LOWER.ISecureRandom::CHAR_UPPER.ISecureRandom::CHAR_DIGITS;
213 213
 		$passwordLength = 8;
214 214
 		if (!empty($passwordPolicy)) {
215
-			$passwordLength = (int)$passwordPolicy['minLength'] > 0 ? (int)$passwordPolicy['minLength'] : $passwordLength;
215
+			$passwordLength = (int) $passwordPolicy['minLength'] > 0 ? (int) $passwordPolicy['minLength'] : $passwordLength;
216 216
 			$passwordCharset .= $passwordPolicy['enforceSpecialCharacters'] ? ISecureRandom::CHAR_SYMBOLS : '';
217 217
 		}
218 218
 
@@ -350,11 +350,11 @@  discard block
 block discarded – undo
350 350
 				$share->getSharedWith()
351 351
 			);
352 352
 		} catch (HintException $hintException) {
353
-			$this->logger->error('Failed to send share by mail: ' . $hintException->getMessage());
353
+			$this->logger->error('Failed to send share by mail: '.$hintException->getMessage());
354 354
 			$this->removeShareFromTable($shareId);
355 355
 			throw $hintException;
356 356
 		} catch (\Exception $e) {
357
-			$this->logger->error('Failed to send share by mail: ' . $e->getMessage());
357
+			$this->logger->error('Failed to send share by mail: '.$e->getMessage());
358 358
 			$this->removeShareFromTable($shareId);
359 359
 			throw new HintException('Failed to send share by mail',
360 360
 				$this->l->t('Failed to send share by E-mail'));
@@ -379,7 +379,7 @@  discard block
 block discarded – undo
379 379
 											$shareWith) {
380 380
 		$initiatorUser = $this->userManager->get($initiator);
381 381
 		$initiatorDisplayName = ($initiatorUser instanceof IUser) ? $initiatorUser->getDisplayName() : $initiator;
382
-		$subject = (string)$this->l->t('%s shared »%s« with you', array($initiatorDisplayName, $filename));
382
+		$subject = (string) $this->l->t('%s shared »%s« with you', array($initiatorDisplayName, $filename));
383 383
 
384 384
 		$message = $this->mailer->createMessage();
385 385
 
@@ -390,7 +390,7 @@  discard block
 block discarded – undo
390 390
 		$text = $this->l->t('%s shared »%s« with you.', [$initiatorDisplayName, $filename]);
391 391
 
392 392
 		$emailTemplate->addBodyText(
393
-			$text . ' ' . $this->l->t('Click the button below to open it.'),
393
+			$text.' '.$this->l->t('Click the button below to open it.'),
394 394
 			$text
395 395
 		);
396 396
 		$emailTemplate->addBodyButton(
@@ -414,9 +414,9 @@  discard block
 block discarded – undo
414 414
 		// The "Reply-To" is set to the sharer if an mail address is configured
415 415
 		// also the default footer contains a "Do not reply" which needs to be adjusted.
416 416
 		$initiatorEmail = $initiatorUser->getEMailAddress();
417
-		if($initiatorEmail !== null) {
417
+		if ($initiatorEmail !== null) {
418 418
 			$message->setReplyTo([$initiatorEmail => $initiatorDisplayName]);
419
-			$emailTemplate->addFooter($instanceName . ' - ' . $this->defaults->getSlogan());
419
+			$emailTemplate->addFooter($instanceName.' - '.$this->defaults->getSlogan());
420 420
 		} else {
421 421
 			$emailTemplate->addFooter();
422 422
 		}
@@ -448,7 +448,7 @@  discard block
 block discarded – undo
448 448
 		$initiatorDisplayName = ($initiatorUser instanceof IUser) ? $initiatorUser->getDisplayName() : $initiator;
449 449
 		$initiatorEmailAddress = ($initiatorUser instanceof IUser) ? $initiatorUser->getEMailAddress() : null;
450 450
 
451
-		$subject = (string)$this->l->t('Password to access »%s« shared to you by %s', [$filename, $initiatorDisplayName]);
451
+		$subject = (string) $this->l->t('Password to access »%s« shared to you by %s', [$filename, $initiatorDisplayName]);
452 452
 		$plainBodyPart = $this->l->t("%s shared »%s« with you.\nYou should have already received a separate mail with a link to access it.\n", [$initiatorDisplayName, $filename]);
453 453
 		$htmlBodyPart = $this->l->t('%s shared »%s« with you. You should have already received a separate mail with a link to access it.', [$initiatorDisplayName, $filename]);
454 454
 
@@ -498,7 +498,7 @@  discard block
 block discarded – undo
498 498
 			);
499 499
 		}
500 500
 
501
-		$subject = (string)$this->l->t('Password to access »%s« shared with %s', [$filename, $shareWith]);
501
+		$subject = (string) $this->l->t('Password to access »%s« shared with %s', [$filename, $shareWith]);
502 502
 		$bodyPart = $this->l->t("You just shared »%s« with %s. The share was already send to the recipient. Due to the security policies defined by the administrator of %s each share needs to be protected by password and it is not allowed to send the password directly to the recipient. Therefore you need to forward the password manually to the recipient.", [$filename, $shareWith, $this->defaults->getName()]);
503 503
 
504 504
 		$message = $this->mailer->createMessage();
@@ -532,7 +532,7 @@  discard block
 block discarded – undo
532 532
 	 */
533 533
 	protected function generateToken($size = 15) {
534 534
 		$token = $this->secureRandom->generate(
535
-			$size, ISecureRandom::CHAR_LOWER . ISecureRandom::CHAR_UPPER . ISecureRandom::CHAR_DIGITS);
535
+			$size, ISecureRandom::CHAR_LOWER.ISecureRandom::CHAR_UPPER.ISecureRandom::CHAR_DIGITS);
536 536
 		return $token;
537 537
 	}
538 538
 
@@ -553,7 +553,7 @@  discard block
 block discarded – undo
553 553
 			->orderBy('id');
554 554
 
555 555
 		$cursor = $qb->execute();
556
-		while($data = $cursor->fetch()) {
556
+		while ($data = $cursor->fetch()) {
557 557
 			$children[] = $this->createShareObject($data);
558 558
 		}
559 559
 		$cursor->closeCursor();
@@ -597,7 +597,7 @@  discard block
 block discarded – undo
597 597
 		$qb->execute();
598 598
 		$id = $qb->getLastInsertId();
599 599
 
600
-		return (int)$id;
600
+		return (int) $id;
601 601
 	}
602 602
 
603 603
 	/**
@@ -614,7 +614,7 @@  discard block
 block discarded – undo
614 614
 		// a real password was given
615 615
 		$validPassword = $plainTextPassword !== null && $plainTextPassword !== '';
616 616
 
617
-		if($validPassword && $originalShare->getPassword() !== $share->getPassword()) {
617
+		if ($validPassword && $originalShare->getPassword() !== $share->getPassword()) {
618 618
 			$this->sendPassword($share, $plainTextPassword);
619 619
 		}
620 620
 		/*
@@ -708,7 +708,7 @@  discard block
 block discarded – undo
708 708
 
709 709
 		$cursor = $qb->execute();
710 710
 		$shares = [];
711
-		while($data = $cursor->fetch()) {
711
+		while ($data = $cursor->fetch()) {
712 712
 			$shares[] = $this->createShareObject($data);
713 713
 		}
714 714
 		$cursor->closeCursor();
@@ -760,7 +760,7 @@  discard block
 block discarded – undo
760 760
 			->execute();
761 761
 
762 762
 		$shares = [];
763
-		while($data = $cursor->fetch()) {
763
+		while ($data = $cursor->fetch()) {
764 764
 			$shares[] = $this->createShareObject($data);
765 765
 		}
766 766
 		$cursor->closeCursor();
@@ -799,7 +799,7 @@  discard block
 block discarded – undo
799 799
 
800 800
 		$cursor = $qb->execute();
801 801
 
802
-		while($data = $cursor->fetch()) {
802
+		while ($data = $cursor->fetch()) {
803 803
 			$shares[] = $this->createShareObject($data);
804 804
 		}
805 805
 		$cursor->closeCursor();
@@ -862,15 +862,15 @@  discard block
 block discarded – undo
862 862
 	protected function createShareObject($data) {
863 863
 
864 864
 		$share = new Share($this->rootFolder, $this->userManager);
865
-		$share->setId((int)$data['id'])
866
-			->setShareType((int)$data['share_type'])
867
-			->setPermissions((int)$data['permissions'])
865
+		$share->setId((int) $data['id'])
866
+			->setShareType((int) $data['share_type'])
867
+			->setPermissions((int) $data['permissions'])
868 868
 			->setTarget($data['file_target'])
869
-			->setMailSend((bool)$data['mail_send'])
869
+			->setMailSend((bool) $data['mail_send'])
870 870
 			->setToken($data['token']);
871 871
 
872 872
 		$shareTime = new \DateTime();
873
-		$shareTime->setTimestamp((int)$data['stime']);
873
+		$shareTime->setTimestamp((int) $data['stime']);
874 874
 		$share->setShareTime($shareTime);
875 875
 		$share->setSharedWith($data['share_with']);
876 876
 		$share->setPassword($data['password']);
@@ -881,7 +881,7 @@  discard block
 block discarded – undo
881 881
 		} else {
882 882
 			//OLD SHARE
883 883
 			$share->setSharedBy($data['uid_owner']);
884
-			$path = $this->getNode($share->getSharedBy(), (int)$data['file_source']);
884
+			$path = $this->getNode($share->getSharedBy(), (int) $data['file_source']);
885 885
 
886 886
 			$owner = $path->getOwner();
887 887
 			$share->setShareOwner($owner->getUID());
@@ -894,7 +894,7 @@  discard block
 block discarded – undo
894 894
 			}
895 895
 		}
896 896
 
897
-		$share->setNodeId((int)$data['file_source']);
897
+		$share->setNodeId((int) $data['file_source']);
898 898
 		$share->setNodeType($data['item_type']);
899 899
 
900 900
 		$share->setProviderId($this->identifier());
@@ -1013,7 +1013,7 @@  discard block
 block discarded – undo
1013 1013
 			);
1014 1014
 		}
1015 1015
 
1016
-		$qb->innerJoin('s', 'filecache' ,'f', $qb->expr()->eq('s.file_source', 'f.fileid'));
1016
+		$qb->innerJoin('s', 'filecache', 'f', $qb->expr()->eq('s.file_source', 'f.fileid'));
1017 1017
 		$qb->andWhere($qb->expr()->eq('f.parent', $qb->createNamedParameter($node->getId())));
1018 1018
 
1019 1019
 		$qb->orderBy('id');
Please login to merge, or discard this patch.