Completed
Pull Request — master (#8026)
by Joas
102:37 queued 79:28
created
lib/private/Mail/EMailTemplate.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -401,7 +401,7 @@  discard block
 block discarded – undo
401 401
 
402 402
 		$this->htmlBody .= vsprintf($this->heading, [htmlspecialchars($title)]);
403 403
 		if ($plainTitle !== false) {
404
-			$this->plainBody .= $plainTitle . PHP_EOL . PHP_EOL;
404
+			$this->plainBody .= $plainTitle.PHP_EOL.PHP_EOL;
405 405
 		}
406 406
 	}
407 407
 
@@ -436,7 +436,7 @@  discard block
 block discarded – undo
436 436
 
437 437
 		$this->htmlBody .= vsprintf($this->bodyText, [$text]);
438 438
 		if ($plainText !== false) {
439
-			$this->plainBody .= $plainText . PHP_EOL . PHP_EOL;
439
+			$this->plainBody .= $plainText.PHP_EOL.PHP_EOL;
440 440
 		}
441 441
 	}
442 442
 
@@ -464,18 +464,18 @@  discard block
 block discarded – undo
464 464
 
465 465
 		$htmlText = $text;
466 466
 		if ($metaInfo) {
467
-			$htmlText = '<em style="color:#777;">' . $metaInfo . '</em><br>' . $htmlText;
467
+			$htmlText = '<em style="color:#777;">'.$metaInfo.'</em><br>'.$htmlText;
468 468
 		}
469 469
 		if ($icon !== '') {
470
-			$icon = '<img src="' . htmlspecialchars($icon) . '" alt="&bull;">';
470
+			$icon = '<img src="'.htmlspecialchars($icon).'" alt="&bull;">';
471 471
 		} else {
472 472
 			$icon = '&bull;';
473 473
 		}
474 474
 		$this->htmlBody .= vsprintf($this->listItem, [$icon, $htmlText]);
475 475
 		if ($plainText !== false) {
476
-			$this->plainBody .= '  * ' . $plainText;
476
+			$this->plainBody .= '  * '.$plainText;
477 477
 			if ($plainMetaInfo !== false) {
478
-				$this->plainBody .= ' (' . $plainMetaInfo . ')';
478
+				$this->plainBody .= ' ('.$plainMetaInfo.')';
479 479
 			}
480 480
 			$this->plainBody .= PHP_EOL;
481 481
 		}
@@ -534,8 +534,8 @@  discard block
 block discarded – undo
534 534
 		$textColor = $this->themingDefaults->getTextColorPrimary();
535 535
 
536 536
 		$this->htmlBody .= vsprintf($this->buttonGroup, [$color, $color, $urlLeft, $color, $textColor, $textColor, $textLeft, $urlRight, $textRight]);
537
-		$this->plainBody .= $plainTextLeft . ': ' . $urlLeft . PHP_EOL;
538
-		$this->plainBody .= $plainTextRight . ': ' . $urlRight . PHP_EOL . PHP_EOL;
537
+		$this->plainBody .= $plainTextLeft.': '.$urlLeft.PHP_EOL;
538
+		$this->plainBody .= $plainTextRight.': '.$urlRight.PHP_EOL.PHP_EOL;
539 539
 
540 540
 	}
541 541
 
@@ -566,10 +566,10 @@  discard block
 block discarded – undo
566 566
 		$this->htmlBody .= vsprintf($this->button, [$color, $color, $url, $color, $textColor, $textColor, $text]);
567 567
 
568 568
 		if ($plainText !== false) {
569
-			$this->plainBody .= $plainText . ': ';
569
+			$this->plainBody .= $plainText.': ';
570 570
 		}
571 571
 
572
-		$this->plainBody .=  $url . PHP_EOL;
572
+		$this->plainBody .= $url.PHP_EOL;
573 573
 
574 574
 	}
575 575
 
@@ -593,8 +593,8 @@  discard block
 block discarded – undo
593 593
 	 * @param string $text If the text is empty the default "Name - Slogan<br>This is an automatically sent email" will be used
594 594
 	 */
595 595
 	public function addFooter($text = '') {
596
-		if($text === '') {
597
-			$text = $this->themingDefaults->getName() . ' - ' . $this->themingDefaults->getSlogan() . '<br>' . $this->l10n->t('This is an automatically sent email, please do not reply.');
596
+		if ($text === '') {
597
+			$text = $this->themingDefaults->getName().' - '.$this->themingDefaults->getSlogan().'<br>'.$this->l10n->t('This is an automatically sent email, please do not reply.');
598 598
 		}
599 599
 
600 600
 		if ($this->footerAdded) {
@@ -606,7 +606,7 @@  discard block
 block discarded – undo
606 606
 
607 607
 		$this->htmlBody .= vsprintf($this->footer, [$text]);
608 608
 		$this->htmlBody .= $this->tail;
609
-		$this->plainBody .= PHP_EOL . '-- ' . PHP_EOL;
609
+		$this->plainBody .= PHP_EOL.'-- '.PHP_EOL;
610 610
 		$this->plainBody .= str_replace('<br>', PHP_EOL, $text);
611 611
 	}
612 612
 
Please login to merge, or discard this patch.
apps/sharebymail/lib/ShareByMailProvider.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -210,10 +210,10 @@  discard block
 block discarded – undo
210 210
 		}
211 211
 
212 212
 		$passwordPolicy = $this->getPasswordPolicy();
213
-		$passwordCharset = ISecureRandom::CHAR_LOWER . ISecureRandom::CHAR_UPPER . ISecureRandom::CHAR_DIGITS;
213
+		$passwordCharset = ISecureRandom::CHAR_LOWER.ISecureRandom::CHAR_UPPER.ISecureRandom::CHAR_DIGITS;
214 214
 		$passwordLength = 8;
215 215
 		if (!empty($passwordPolicy)) {
216
-			$passwordLength = (int)$passwordPolicy['minLength'] > 0 ? (int)$passwordPolicy['minLength'] : $passwordLength;
216
+			$passwordLength = (int) $passwordPolicy['minLength'] > 0 ? (int) $passwordPolicy['minLength'] : $passwordLength;
217 217
 			$passwordCharset .= $passwordPolicy['enforceSpecialCharacters'] ? ISecureRandom::CHAR_SYMBOLS : '';
218 218
 		}
219 219
 
@@ -404,7 +404,7 @@  discard block
 block discarded – undo
404 404
 		$text = $this->l->t('%s shared »%s« with you.', [$initiatorDisplayName, $filename]);
405 405
 
406 406
 		$emailTemplate->addBodyText(
407
-			htmlspecialchars($text . ' ' . $this->l->t('Click the button below to open it.')),
407
+			htmlspecialchars($text.' '.$this->l->t('Click the button below to open it.')),
408 408
 			$text
409 409
 		);
410 410
 		$emailTemplate->addBodyButton(
@@ -428,9 +428,9 @@  discard block
 block discarded – undo
428 428
 		// The "Reply-To" is set to the sharer if an mail address is configured
429 429
 		// also the default footer contains a "Do not reply" which needs to be adjusted.
430 430
 		$initiatorEmail = $initiatorUser->getEMailAddress();
431
-		if($initiatorEmail !== null) {
431
+		if ($initiatorEmail !== null) {
432 432
 			$message->setReplyTo([$initiatorEmail => $initiatorDisplayName]);
433
-			$emailTemplate->addFooter($instanceName . ($this->defaults->getSlogan() !== '' ? ' - ' . $this->defaults->getSlogan() : ''));
433
+			$emailTemplate->addFooter($instanceName.($this->defaults->getSlogan() !== '' ? ' - '.$this->defaults->getSlogan() : ''));
434 434
 		} else {
435 435
 			$emailTemplate->addFooter();
436 436
 		}
@@ -491,7 +491,7 @@  discard block
 block discarded – undo
491 491
 		$message->setFrom([\OCP\Util::getDefaultEmailAddress($instanceName) => $senderName]);
492 492
 		if ($initiatorEmailAddress !== null) {
493 493
 			$message->setReplyTo([$initiatorEmailAddress => $initiatorDisplayName]);
494
-			$emailTemplate->addFooter($instanceName . ' - ' . $this->defaults->getSlogan());
494
+			$emailTemplate->addFooter($instanceName.' - '.$this->defaults->getSlogan());
495 495
 		} else {
496 496
 			$emailTemplate->addFooter();
497 497
 		}
@@ -586,7 +586,7 @@  discard block
 block discarded – undo
586 586
 			->orderBy('id');
587 587
 
588 588
 		$cursor = $qb->execute();
589
-		while($data = $cursor->fetch()) {
589
+		while ($data = $cursor->fetch()) {
590 590
 			$children[] = $this->createShareObject($data);
591 591
 		}
592 592
 		$cursor->closeCursor();
@@ -630,7 +630,7 @@  discard block
 block discarded – undo
630 630
 		$qb->execute();
631 631
 		$id = $qb->getLastInsertId();
632 632
 
633
-		return (int)$id;
633
+		return (int) $id;
634 634
 	}
635 635
 
636 636
 	/**
@@ -647,7 +647,7 @@  discard block
 block discarded – undo
647 647
 		// a real password was given
648 648
 		$validPassword = $plainTextPassword !== null && $plainTextPassword !== '';
649 649
 
650
-		if($validPassword && $originalShare->getPassword() !== $share->getPassword()) {
650
+		if ($validPassword && $originalShare->getPassword() !== $share->getPassword()) {
651 651
 			$this->sendPassword($share, $plainTextPassword);
652 652
 		}
653 653
 		/*
@@ -740,7 +740,7 @@  discard block
 block discarded – undo
740 740
 
741 741
 		$cursor = $qb->execute();
742 742
 		$shares = [];
743
-		while($data = $cursor->fetch()) {
743
+		while ($data = $cursor->fetch()) {
744 744
 			$shares[] = $this->createShareObject($data);
745 745
 		}
746 746
 		$cursor->closeCursor();
@@ -792,7 +792,7 @@  discard block
 block discarded – undo
792 792
 			->execute();
793 793
 
794 794
 		$shares = [];
795
-		while($data = $cursor->fetch()) {
795
+		while ($data = $cursor->fetch()) {
796 796
 			$shares[] = $this->createShareObject($data);
797 797
 		}
798 798
 		$cursor->closeCursor();
@@ -831,7 +831,7 @@  discard block
 block discarded – undo
831 831
 
832 832
 		$cursor = $qb->execute();
833 833
 
834
-		while($data = $cursor->fetch()) {
834
+		while ($data = $cursor->fetch()) {
835 835
 			$shares[] = $this->createShareObject($data);
836 836
 		}
837 837
 		$cursor->closeCursor();
@@ -894,15 +894,15 @@  discard block
 block discarded – undo
894 894
 	protected function createShareObject($data) {
895 895
 
896 896
 		$share = new Share($this->rootFolder, $this->userManager);
897
-		$share->setId((int)$data['id'])
898
-			->setShareType((int)$data['share_type'])
899
-			->setPermissions((int)$data['permissions'])
897
+		$share->setId((int) $data['id'])
898
+			->setShareType((int) $data['share_type'])
899
+			->setPermissions((int) $data['permissions'])
900 900
 			->setTarget($data['file_target'])
901
-			->setMailSend((bool)$data['mail_send'])
901
+			->setMailSend((bool) $data['mail_send'])
902 902
 			->setToken($data['token']);
903 903
 
904 904
 		$shareTime = new \DateTime();
905
-		$shareTime->setTimestamp((int)$data['stime']);
905
+		$shareTime->setTimestamp((int) $data['stime']);
906 906
 		$share->setShareTime($shareTime);
907 907
 		$share->setSharedWith($data['share_with']);
908 908
 		$share->setPassword($data['password']);
@@ -913,7 +913,7 @@  discard block
 block discarded – undo
913 913
 		} else {
914 914
 			//OLD SHARE
915 915
 			$share->setSharedBy($data['uid_owner']);
916
-			$path = $this->getNode($share->getSharedBy(), (int)$data['file_source']);
916
+			$path = $this->getNode($share->getSharedBy(), (int) $data['file_source']);
917 917
 
918 918
 			$owner = $path->getOwner();
919 919
 			$share->setShareOwner($owner->getUID());
@@ -926,7 +926,7 @@  discard block
 block discarded – undo
926 926
 			}
927 927
 		}
928 928
 
929
-		$share->setNodeId((int)$data['file_source']);
929
+		$share->setNodeId((int) $data['file_source']);
930 930
 		$share->setNodeType($data['item_type']);
931 931
 
932 932
 		$share->setProviderId($this->identifier());
@@ -1043,7 +1043,7 @@  discard block
 block discarded – undo
1043 1043
 			);
1044 1044
 		}
1045 1045
 
1046
-		$qb->innerJoin('s', 'filecache' ,'f', $qb->expr()->eq('s.file_source', 'f.fileid'));
1046
+		$qb->innerJoin('s', 'filecache', 'f', $qb->expr()->eq('s.file_source', 'f.fileid'));
1047 1047
 		$qb->andWhere($qb->expr()->eq('f.parent', $qb->createNamedParameter($node->getId())));
1048 1048
 
1049 1049
 		$qb->orderBy('id');
Please login to merge, or discard this patch.
lib/private/Share20/Manager.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
 
357 357
 		if ($fullId === null && $expirationDate === null && $this->shareApiLinkDefaultExpireDate()) {
358 358
 			$expirationDate = new \DateTime();
359
-			$expirationDate->setTime(0,0,0);
359
+			$expirationDate->setTime(0, 0, 0);
360 360
 			$expirationDate->add(new \DateInterval('P'.$this->shareApiLinkDefaultExpireDays().'D'));
361 361
 		}
362 362
 
@@ -368,7 +368,7 @@  discard block
 block discarded – undo
368 368
 
369 369
 			$date = new \DateTime();
370 370
 			$date->setTime(0, 0, 0);
371
-			$date->add(new \DateInterval('P' . $this->shareApiLinkDefaultExpireDays() . 'D'));
371
+			$date->add(new \DateInterval('P'.$this->shareApiLinkDefaultExpireDays().'D'));
372 372
 			if ($date < $expirationDate) {
373 373
 				$message = $this->l->t('Can’t set expiration date more than %s days in the future', [$this->shareApiLinkDefaultExpireDays()]);
374 374
 				throw new GenericShareException($message, $message, 404);
@@ -421,7 +421,7 @@  discard block
 block discarded – undo
421 421
 		 */
422 422
 		$provider = $this->factory->getProviderForType(\OCP\Share::SHARE_TYPE_USER);
423 423
 		$existingShares = $provider->getSharesByPath($share->getNode());
424
-		foreach($existingShares as $existingShare) {
424
+		foreach ($existingShares as $existingShare) {
425 425
 			// Ignore if it is the same share
426 426
 			try {
427 427
 				if ($existingShare->getFullId() === $share->getFullId()) {
@@ -478,7 +478,7 @@  discard block
 block discarded – undo
478 478
 		 */
479 479
 		$provider = $this->factory->getProviderForType(\OCP\Share::SHARE_TYPE_GROUP);
480 480
 		$existingShares = $provider->getSharesByPath($share->getNode());
481
-		foreach($existingShares as $existingShare) {
481
+		foreach ($existingShares as $existingShare) {
482 482
 			try {
483 483
 				if ($existingShare->getFullId() === $share->getFullId()) {
484 484
 					continue;
@@ -547,7 +547,7 @@  discard block
 block discarded – undo
547 547
 		// Make sure that we do not share a path that contains a shared mountpoint
548 548
 		if ($path instanceof \OCP\Files\Folder) {
549 549
 			$mounts = $this->mountManager->findIn($path->getPath());
550
-			foreach($mounts as $mount) {
550
+			foreach ($mounts as $mount) {
551 551
 				if ($mount->getStorage()->instanceOfStorage('\OCA\Files_Sharing\ISharedStorage')) {
552 552
 					throw new \InvalidArgumentException('Path contains files shared with you');
553 553
 				}
@@ -595,7 +595,7 @@  discard block
 block discarded – undo
595 595
 		$storage = $share->getNode()->getStorage();
596 596
 		if ($storage->instanceOfStorage('OCA\Files_Sharing\External\Storage')) {
597 597
 			$parent = $share->getNode()->getParent();
598
-			while($parent->getStorage()->instanceOfStorage('OCA\Files_Sharing\External\Storage')) {
598
+			while ($parent->getStorage()->instanceOfStorage('OCA\Files_Sharing\External\Storage')) {
599 599
 				$parent = $parent->getParent();
600 600
 			}
601 601
 			$share->setShareOwner($parent->getOwner()->getUID());
@@ -648,7 +648,7 @@  discard block
 block discarded – undo
648 648
 		}
649 649
 
650 650
 		// Generate the target
651
-		$target = $this->config->getSystemValue('share_folder', '/') .'/'. $share->getNode()->getName();
651
+		$target = $this->config->getSystemValue('share_folder', '/').'/'.$share->getNode()->getName();
652 652
 		$target = \OC\Files\Filesystem::normalizePath($target);
653 653
 		$share->setTarget($target);
654 654
 
@@ -671,7 +671,7 @@  discard block
 block discarded – undo
671 671
 
672 672
 		if ($share->getShareType() === \OCP\Share::SHARE_TYPE_USER) {
673 673
 			$mailSend = $share->getMailSend();
674
-			if($mailSend === true) {
674
+			if ($mailSend === true) {
675 675
 				$user = $this->userManager->get($share->getSharedWith());
676 676
 				if ($user !== null) {
677 677
 					$emailAddress = $user->getEMailAddress();
@@ -686,12 +686,12 @@  discard block
 block discarded – undo
686 686
 							$emailAddress,
687 687
 							$share->getExpirationDate()
688 688
 						);
689
-						$this->logger->debug('Send share notification to ' . $emailAddress . ' for share with ID ' . $share->getId(), ['app' => 'share']);
689
+						$this->logger->debug('Send share notification to '.$emailAddress.' for share with ID '.$share->getId(), ['app' => 'share']);
690 690
 					} else {
691
-						$this->logger->debug('Share notification not send to ' . $share->getSharedWith() . ' because email address is not set.', ['app' => 'share']);
691
+						$this->logger->debug('Share notification not send to '.$share->getSharedWith().' because email address is not set.', ['app' => 'share']);
692 692
 					}
693 693
 				} else {
694
-					$this->logger->debug('Share notification not send to ' . $share->getSharedWith() . ' because user could not be found.', ['app' => 'share']);
694
+					$this->logger->debug('Share notification not send to '.$share->getSharedWith().' because user could not be found.', ['app' => 'share']);
695 695
 				}
696 696
 			} else {
697 697
 				$this->logger->debug('Share notification not send because mailsend is false.', ['app' => 'share']);
@@ -735,7 +735,7 @@  discard block
 block discarded – undo
735 735
 		$text = $l->t('%s shared »%s« with you.', [$initiatorDisplayName, $filename]);
736 736
 
737 737
 		$emailTemplate->addBodyText(
738
-			htmlspecialchars($text . ' ' . $l->t('Click the button below to open it.')),
738
+			htmlspecialchars($text.' '.$l->t('Click the button below to open it.')),
739 739
 			$text
740 740
 		);
741 741
 		$emailTemplate->addBodyButton(
@@ -759,9 +759,9 @@  discard block
 block discarded – undo
759 759
 		// The "Reply-To" is set to the sharer if an mail address is configured
760 760
 		// also the default footer contains a "Do not reply" which needs to be adjusted.
761 761
 		$initiatorEmail = $initiatorUser->getEMailAddress();
762
-		if($initiatorEmail !== null) {
762
+		if ($initiatorEmail !== null) {
763 763
 			$message->setReplyTo([$initiatorEmail => $initiatorDisplayName]);
764
-			$emailTemplate->addFooter($instanceName . ($this->defaults->getSlogan() !== '' ? ' - ' . $this->defaults->getSlogan() : ''));
764
+			$emailTemplate->addFooter($instanceName.($this->defaults->getSlogan() !== '' ? ' - '.$this->defaults->getSlogan() : ''));
765 765
 		} else {
766 766
 			$emailTemplate->addFooter();
767 767
 		}
@@ -970,7 +970,7 @@  discard block
 block discarded – undo
970 970
 	 * @param string $recipientId
971 971
 	 */
972 972
 	public function deleteFromSelf(\OCP\Share\IShare $share, $recipientId) {
973
-		list($providerId, ) = $this->splitFullId($share->getFullId());
973
+		list($providerId,) = $this->splitFullId($share->getFullId());
974 974
 		$provider = $this->factory->getProvider($providerId);
975 975
 
976 976
 		$provider->deleteFromSelf($share, $recipientId);
@@ -993,7 +993,7 @@  discard block
 block discarded – undo
993 993
 		if ($share->getShareType() === \OCP\Share::SHARE_TYPE_GROUP) {
994 994
 			$sharedWith = $this->groupManager->get($share->getSharedWith());
995 995
 			if (is_null($sharedWith)) {
996
-				throw new \InvalidArgumentException('Group "' . $share->getSharedWith() . '" does not exist');
996
+				throw new \InvalidArgumentException('Group "'.$share->getSharedWith().'" does not exist');
997 997
 			}
998 998
 			$recipient = $this->userManager->get($recipientId);
999 999
 			if (!$sharedWith->inGroup($recipient)) {
@@ -1001,7 +1001,7 @@  discard block
 block discarded – undo
1001 1001
 			}
1002 1002
 		}
1003 1003
 
1004
-		list($providerId, ) = $this->splitFullId($share->getFullId());
1004
+		list($providerId,) = $this->splitFullId($share->getFullId());
1005 1005
 		$provider = $this->factory->getProvider($providerId);
1006 1006
 
1007 1007
 		$provider->move($share, $recipientId);
@@ -1048,7 +1048,7 @@  discard block
 block discarded – undo
1048 1048
 
1049 1049
 		$shares2 = [];
1050 1050
 
1051
-		while(true) {
1051
+		while (true) {
1052 1052
 			$added = 0;
1053 1053
 			foreach ($shares as $share) {
1054 1054
 
@@ -1153,7 +1153,7 @@  discard block
 block discarded – undo
1153 1153
 	 *
1154 1154
 	 * @return Share[]
1155 1155
 	 */
1156
-	public function getSharesByPath(\OCP\Files\Node $path, $page=0, $perPage=50) {
1156
+	public function getSharesByPath(\OCP\Files\Node $path, $page = 0, $perPage = 50) {
1157 1157
 		return [];
1158 1158
 	}
1159 1159
 
@@ -1168,7 +1168,7 @@  discard block
 block discarded – undo
1168 1168
 	public function getShareByToken($token) {
1169 1169
 		$share = null;
1170 1170
 		try {
1171
-			if($this->shareApiAllowLinks()) {
1171
+			if ($this->shareApiAllowLinks()) {
1172 1172
 				$provider = $this->factory->getProviderForType(\OCP\Share::SHARE_TYPE_LINK);
1173 1173
 				$share = $provider->getShareByToken($token);
1174 1174
 			}
@@ -1375,7 +1375,7 @@  discard block
 block discarded – undo
1375 1375
 			}
1376 1376
 			$al['users'][$owner] = [
1377 1377
 				'node_id' => $path->getId(),
1378
-				'node_path' => '/' . $ownerPath,
1378
+				'node_path' => '/'.$ownerPath,
1379 1379
 			];
1380 1380
 		} else {
1381 1381
 			$al['users'][] = $owner;
@@ -1475,7 +1475,7 @@  discard block
 block discarded – undo
1475 1475
 	 * @return int
1476 1476
 	 */
1477 1477
 	public function shareApiLinkDefaultExpireDays() {
1478
-		return (int)$this->config->getAppValue('core', 'shareapi_expire_after_n_days', '7');
1478
+		return (int) $this->config->getAppValue('core', 'shareapi_expire_after_n_days', '7');
1479 1479
 	}
1480 1480
 
1481 1481
 	/**
Please login to merge, or discard this patch.