Passed
Push — master ( f0dd71...c56a27 )
by Christoph
11:49 queued 12s
created
lib/private/Authentication/TwoFactorAuth/ProviderSet.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -72,7 +72,7 @@
 block discarded – undo
72 72
 	 * @return IProvider[]
73 73
 	 */
74 74
 	public function getPrimaryProviders(): array {
75
-		return array_filter($this->providers, function (IProvider $provider) {
75
+		return array_filter($this->providers, function(IProvider $provider) {
76 76
 			return !($provider instanceof BackupCodesProvider);
77 77
 		});
78 78
 	}
Please login to merge, or discard this patch.
lib/private/Authentication/TwoFactorAuth/Manager.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
 	 */
141 141
 	public function getLoginSetupProviders(IUser $user): array {
142 142
 		$providers = $this->providerLoader->getProviders($user);
143
-		return array_filter($providers, function (IProvider $provider) {
143
+		return array_filter($providers, function(IProvider $provider) {
144 144
 			return ($provider instanceof IActivatableAtLogin);
145 145
 		});
146 146
 	}
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
 
206 206
 		if (!empty($missing)) {
207 207
 			// There was at least one provider missing
208
-			$this->logger->alert(count($missing) . " two-factor auth providers failed to load", ['app' => 'core']);
208
+			$this->logger->alert(count($missing)." two-factor auth providers failed to load", ['app' => 'core']);
209 209
 
210 210
 			return true;
211 211
 		}
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
 		$fixedStates = $this->fixMissingProviderStates($providerStates, $providers, $user);
228 228
 		$isProviderMissing = $this->isProviderMissing($fixedStates, $providers);
229 229
 
230
-		$enabled = array_filter($providers, function (IProvider $provider) use ($fixedStates) {
230
+		$enabled = array_filter($providers, function(IProvider $provider) use ($fixedStates) {
231 231
 			return $fixedStates[$provider->getId()];
232 232
 		});
233 233
 		return new ProviderSet($enabled, $isProviderMissing);
Please login to merge, or discard this patch.
lib/private/Settings/Manager.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
 			}
181 181
 
182 182
 			if (!$setting instanceof ISettings) {
183
-				$this->log->logException(new \InvalidArgumentException('Invalid settings setting registered (' . $class . ')'), ['level' => ILogger::INFO]);
183
+				$this->log->logException(new \InvalidArgumentException('Invalid settings setting registered ('.$class.')'), ['level' => ILogger::INFO]);
184 184
 				continue;
185 185
 			}
186 186
 
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
 	 */
231 231
 	public function getAdminSettings($section, bool $subAdminOnly = false): array {
232 232
 		if ($subAdminOnly) {
233
-			$subAdminSettingsFilter = function (ISettings $settings) {
233
+			$subAdminSettingsFilter = function(ISettings $settings) {
234 234
 				return $settings instanceof ISubAdminSettings;
235 235
 			};
236 236
 			$appSettings = $this->getSettings('admin', $section, $subAdminSettingsFilter);
Please login to merge, or discard this patch.
lib/private/Share20/DefaultShareProvider.php 1 patch
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
 			$user = $this->userManager->get($recipient);
349 349
 
350 350
 			if (is_null($group)) {
351
-				throw new ProviderException('Group "' . $share->getSharedWith() . '" does not exist');
351
+				throw new ProviderException('Group "'.$share->getSharedWith().'" does not exist');
352 352
 			}
353 353
 
354 354
 			if (!$group->inGroup($user)) {
@@ -431,7 +431,7 @@  discard block
 block discarded – undo
431 431
 			->orderBy('id');
432 432
 
433 433
 		$cursor = $qb->execute();
434
-		while($data = $cursor->fetch()) {
434
+		while ($data = $cursor->fetch()) {
435 435
 			$children[] = $this->createShare($data);
436 436
 		}
437 437
 		$cursor->closeCursor();
@@ -476,7 +476,7 @@  discard block
 block discarded – undo
476 476
 			$user = $this->userManager->get($recipient);
477 477
 
478 478
 			if (is_null($group)) {
479
-				throw new ProviderException('Group "' . $share->getSharedWith() . '" does not exist');
479
+				throw new ProviderException('Group "'.$share->getSharedWith().'" does not exist');
480 480
 			}
481 481
 
482 482
 			if (!$group->inGroup($user)) {
@@ -679,7 +679,7 @@  discard block
 block discarded – undo
679 679
 			);
680 680
 		}
681 681
 
682
-		$qb->innerJoin('s', 'filecache' ,'f', $qb->expr()->eq('s.file_source', 'f.fileid'));
682
+		$qb->innerJoin('s', 'filecache', 'f', $qb->expr()->eq('s.file_source', 'f.fileid'));
683 683
 		$qb->andWhere($qb->expr()->eq('f.parent', $qb->createNamedParameter($node->getId())));
684 684
 
685 685
 		$qb->orderBy('id');
@@ -737,7 +737,7 @@  discard block
 block discarded – undo
737 737
 
738 738
 		$cursor = $qb->execute();
739 739
 		$shares = [];
740
-		while($data = $cursor->fetch()) {
740
+		while ($data = $cursor->fetch()) {
741 741
 			$shares[] = $this->createShare($data);
742 742
 		}
743 743
 		$cursor->closeCursor();
@@ -816,7 +816,7 @@  discard block
 block discarded – undo
816 816
 			->execute();
817 817
 
818 818
 		$shares = [];
819
-		while($data = $cursor->fetch()) {
819
+		while ($data = $cursor->fetch()) {
820 820
 			$shares[] = $this->createShare($data);
821 821
 		}
822 822
 		$cursor->closeCursor();
@@ -887,7 +887,7 @@  discard block
 block discarded – undo
887 887
 
888 888
 			$cursor = $qb->execute();
889 889
 
890
-			while($data = $cursor->fetch()) {
890
+			while ($data = $cursor->fetch()) {
891 891
 				if ($this->isAccessibleResult($data)) {
892 892
 					$shares[] = $this->createShare($data);
893 893
 				}
@@ -902,7 +902,7 @@  discard block
 block discarded – undo
902 902
 			$shares2 = [];
903 903
 
904 904
 			$start = 0;
905
-			while(true) {
905
+			while (true) {
906 906
 				$groups = array_slice($allGroups, $start, 100);
907 907
 				$start += 100;
908 908
 
@@ -933,8 +933,8 @@  discard block
 block discarded – undo
933 933
 				}
934 934
 
935 935
 
936
-				$groups = array_filter($groups, function ($group) { return $group instanceof IGroup; });
937
-				$groups = array_map(function (IGroup $group) { return $group->getGID(); }, $groups);
936
+				$groups = array_filter($groups, function($group) { return $group instanceof IGroup; });
937
+				$groups = array_map(function(IGroup $group) { return $group->getGID(); }, $groups);
938 938
 
939 939
 				$qb->andWhere($qb->expr()->eq('share_type', $qb->createNamedParameter(\OCP\Share::SHARE_TYPE_GROUP)))
940 940
 					->andWhere($qb->expr()->in('share_with', $qb->createNamedParameter(
@@ -947,7 +947,7 @@  discard block
 block discarded – undo
947 947
 					));
948 948
 
949 949
 				$cursor = $qb->execute();
950
-				while($data = $cursor->fetch()) {
950
+				while ($data = $cursor->fetch()) {
951 951
 					if ($offset > 0) {
952 952
 						$offset--;
953 953
 						continue;
@@ -1016,17 +1016,17 @@  discard block
 block discarded – undo
1016 1016
 	 */
1017 1017
 	private function createShare($data) {
1018 1018
 		$share = new Share($this->rootFolder, $this->userManager);
1019
-		$share->setId((int)$data['id'])
1020
-			->setShareType((int)$data['share_type'])
1021
-			->setPermissions((int)$data['permissions'])
1019
+		$share->setId((int) $data['id'])
1020
+			->setShareType((int) $data['share_type'])
1021
+			->setPermissions((int) $data['permissions'])
1022 1022
 			->setTarget($data['file_target'])
1023 1023
 			->setNote($data['note'])
1024
-			->setMailSend((bool)$data['mail_send'])
1025
-			->setStatus((int)$data['accepted'])
1024
+			->setMailSend((bool) $data['mail_send'])
1025
+			->setStatus((int) $data['accepted'])
1026 1026
 			->setLabel($data['label']);
1027 1027
 
1028 1028
 		$shareTime = new \DateTime();
1029
-		$shareTime->setTimestamp((int)$data['stime']);
1029
+		$shareTime->setTimestamp((int) $data['stime']);
1030 1030
 		$share->setShareTime($shareTime);
1031 1031
 
1032 1032
 		if ($share->getShareType() === \OCP\Share::SHARE_TYPE_USER) {
@@ -1039,14 +1039,14 @@  discard block
 block discarded – undo
1039 1039
 			$share->setSharedWith($data['share_with']);
1040 1040
 		} else if ($share->getShareType() === \OCP\Share::SHARE_TYPE_LINK) {
1041 1041
 			$share->setPassword($data['password']);
1042
-			$share->setSendPasswordByTalk((bool)$data['password_by_talk']);
1042
+			$share->setSendPasswordByTalk((bool) $data['password_by_talk']);
1043 1043
 			$share->setToken($data['token']);
1044 1044
 		}
1045 1045
 
1046 1046
 		$share->setSharedBy($data['uid_initiator']);
1047 1047
 		$share->setShareOwner($data['uid_owner']);
1048 1048
 
1049
-		$share->setNodeId((int)$data['file_source']);
1049
+		$share->setNodeId((int) $data['file_source']);
1050 1050
 		$share->setNodeType($data['item_type']);
1051 1051
 
1052 1052
 		if ($data['expiration'] !== null) {
@@ -1063,7 +1063,7 @@  discard block
 block discarded – undo
1063 1063
 		}
1064 1064
 
1065 1065
 		$share->setProviderId($this->identifier());
1066
-		$share->setHideDownload((int)$data['hide_download'] === 1);
1066
+		$share->setHideDownload((int) $data['hide_download'] === 1);
1067 1067
 
1068 1068
 		return $share;
1069 1069
 	}
@@ -1077,7 +1077,7 @@  discard block
 block discarded – undo
1077 1077
 		$result = [];
1078 1078
 
1079 1079
 		$start = 0;
1080
-		while(true) {
1080
+		while (true) {
1081 1081
 			/** @var Share[] $shareSlice */
1082 1082
 			$shareSlice = array_slice($shares, $start, 100);
1083 1083
 			$start += 100;
@@ -1092,7 +1092,7 @@  discard block
 block discarded – undo
1092 1092
 			$shareMap = [];
1093 1093
 
1094 1094
 			foreach ($shareSlice as $share) {
1095
-				$ids[] = (int)$share->getId();
1095
+				$ids[] = (int) $share->getId();
1096 1096
 				$shareMap[$share->getId()] = $share;
1097 1097
 			}
1098 1098
 
@@ -1109,9 +1109,9 @@  discard block
 block discarded – undo
1109 1109
 
1110 1110
 			$stmt = $query->execute();
1111 1111
 
1112
-			while($data = $stmt->fetch()) {
1113
-				$shareMap[$data['parent']]->setPermissions((int)$data['permissions']);
1114
-				$shareMap[$data['parent']]->setStatus((int)$data['accepted']);
1112
+			while ($data = $stmt->fetch()) {
1113
+				$shareMap[$data['parent']]->setPermissions((int) $data['permissions']);
1114
+				$shareMap[$data['parent']]->setStatus((int) $data['accepted']);
1115 1115
 				$shareMap[$data['parent']]->setTarget($data['file_target']);
1116 1116
 				$shareMap[$data['parent']]->setParent($data['parent']);
1117 1117
 			}
@@ -1187,7 +1187,7 @@  discard block
 block discarded – undo
1187 1187
 				)
1188 1188
 			);
1189 1189
 		} else {
1190
-			\OC::$server->getLogger()->logException(new \InvalidArgumentException('Default share provider tried to delete all shares for type: ' . $shareType));
1190
+			\OC::$server->getLogger()->logException(new \InvalidArgumentException('Default share provider tried to delete all shares for type: '.$shareType));
1191 1191
 			return;
1192 1192
 		}
1193 1193
 
@@ -1212,8 +1212,8 @@  discard block
 block discarded – undo
1212 1212
 
1213 1213
 		$cursor = $qb->execute();
1214 1214
 		$ids = [];
1215
-		while($row = $cursor->fetch()) {
1216
-			$ids[] = (int)$row['id'];
1215
+		while ($row = $cursor->fetch()) {
1216
+			$ids[] = (int) $row['id'];
1217 1217
 		}
1218 1218
 		$cursor->closeCursor();
1219 1219
 
@@ -1255,8 +1255,8 @@  discard block
 block discarded – undo
1255 1255
 
1256 1256
 		$cursor = $qb->execute();
1257 1257
 		$ids = [];
1258
-		while($row = $cursor->fetch()) {
1259
-			$ids[] = (int)$row['id'];
1258
+		while ($row = $cursor->fetch()) {
1259
+			$ids[] = (int) $row['id'];
1260 1260
 		}
1261 1261
 		$cursor->closeCursor();
1262 1262
 
@@ -1310,8 +1310,8 @@  discard block
 block discarded – undo
1310 1310
 
1311 1311
 		$users = [];
1312 1312
 		$link = false;
1313
-		while($row = $cursor->fetch()) {
1314
-			$type = (int)$row['share_type'];
1313
+		while ($row = $cursor->fetch()) {
1314
+			$type = (int) $row['share_type'];
1315 1315
 			if ($type === \OCP\Share::SHARE_TYPE_USER) {
1316 1316
 				$uid = $row['share_with'];
1317 1317
 				$users[$uid] = isset($users[$uid]) ? $users[$uid] : [];
@@ -1461,7 +1461,7 @@  discard block
 block discarded – undo
1461 1461
 			$message->setFrom([\OCP\Util::getDefaultEmailAddress($instanceName) => $senderName]);
1462 1462
 			if ($initiatorEmailAddress !== null) {
1463 1463
 				$message->setReplyTo([$initiatorEmailAddress => $initiatorDisplayName]);
1464
-				$emailTemplate->addFooter($instanceName . ' - ' . $this->defaults->getSlogan());
1464
+				$emailTemplate->addFooter($instanceName.' - '.$this->defaults->getSlogan());
1465 1465
 			} else {
1466 1466
 				$emailTemplate->addFooter();
1467 1467
 			}
@@ -1492,7 +1492,7 @@  discard block
 block discarded – undo
1492 1492
 			);
1493 1493
 
1494 1494
 		$cursor = $qb->execute();
1495
-		while($data = $cursor->fetch()) {
1495
+		while ($data = $cursor->fetch()) {
1496 1496
 			try {
1497 1497
 				$share = $this->createShare($data);
1498 1498
 			} catch (InvalidShare $e) {
Please login to merge, or discard this patch.
lib/private/Share20/Manager.php 1 patch
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
 			if ($share->getSharedWith() === null) {
235 235
 				throw new \InvalidArgumentException('SharedWith should not be empty');
236 236
 			}
237
-		}  else if ($share->getShareType() === \OCP\Share::SHARE_TYPE_REMOTE_GROUP) {
237
+		} else if ($share->getShareType() === \OCP\Share::SHARE_TYPE_REMOTE_GROUP) {
238 238
 			if ($share->getSharedWith() === null) {
239 239
 				throw new \InvalidArgumentException('SharedWith should not be empty');
240 240
 			}
@@ -395,7 +395,7 @@  discard block
 block discarded – undo
395 395
 
396 396
 		if ($fullId === null && $expirationDate === null && $this->shareApiInternalDefaultExpireDate()) {
397 397
 			$expirationDate = new \DateTime();
398
-			$expirationDate->setTime(0,0,0);
398
+			$expirationDate->setTime(0, 0, 0);
399 399
 			$expirationDate->add(new \DateInterval('P'.$this->shareApiInternalDefaultExpireDays().'D'));
400 400
 		}
401 401
 
@@ -407,7 +407,7 @@  discard block
 block discarded – undo
407 407
 
408 408
 			$date = new \DateTime();
409 409
 			$date->setTime(0, 0, 0);
410
-			$date->add(new \DateInterval('P' . $this->shareApiInternalDefaultExpireDays() . 'D'));
410
+			$date->add(new \DateInterval('P'.$this->shareApiInternalDefaultExpireDays().'D'));
411 411
 			if ($date < $expirationDate) {
412 412
 				$message = $this->l->t('Can’t set expiration date more than %s days in the future', [$this->shareApiInternalDefaultExpireDays()]);
413 413
 				throw new GenericShareException($message, $message, 404);
@@ -467,7 +467,7 @@  discard block
 block discarded – undo
467 467
 
468 468
 		if ($fullId === null && $expirationDate === null && $this->shareApiLinkDefaultExpireDate()) {
469 469
 			$expirationDate = new \DateTime();
470
-			$expirationDate->setTime(0,0,0);
470
+			$expirationDate->setTime(0, 0, 0);
471 471
 			$expirationDate->add(new \DateInterval('P'.$this->shareApiLinkDefaultExpireDays().'D'));
472 472
 		}
473 473
 
@@ -479,7 +479,7 @@  discard block
 block discarded – undo
479 479
 
480 480
 			$date = new \DateTime();
481 481
 			$date->setTime(0, 0, 0);
482
-			$date->add(new \DateInterval('P' . $this->shareApiLinkDefaultExpireDays() . 'D'));
482
+			$date->add(new \DateInterval('P'.$this->shareApiLinkDefaultExpireDays().'D'));
483 483
 			if ($date < $expirationDate) {
484 484
 				$message = $this->l->t('Can’t set expiration date more than %s days in the future', [$this->shareApiLinkDefaultExpireDays()]);
485 485
 				throw new GenericShareException($message, $message, 404);
@@ -532,7 +532,7 @@  discard block
 block discarded – undo
532 532
 		 */
533 533
 		$provider = $this->factory->getProviderForType(\OCP\Share::SHARE_TYPE_USER);
534 534
 		$existingShares = $provider->getSharesByPath($share->getNode());
535
-		foreach($existingShares as $existingShare) {
535
+		foreach ($existingShares as $existingShare) {
536 536
 			// Ignore if it is the same share
537 537
 			try {
538 538
 				if ($existingShare->getFullId() === $share->getFullId()) {
@@ -589,7 +589,7 @@  discard block
 block discarded – undo
589 589
 		 */
590 590
 		$provider = $this->factory->getProviderForType(\OCP\Share::SHARE_TYPE_GROUP);
591 591
 		$existingShares = $provider->getSharesByPath($share->getNode());
592
-		foreach($existingShares as $existingShare) {
592
+		foreach ($existingShares as $existingShare) {
593 593
 			try {
594 594
 				if ($existingShare->getFullId() === $share->getFullId()) {
595 595
 					continue;
@@ -658,7 +658,7 @@  discard block
 block discarded – undo
658 658
 		// Make sure that we do not share a path that contains a shared mountpoint
659 659
 		if ($path instanceof \OCP\Files\Folder) {
660 660
 			$mounts = $this->mountManager->findIn($path->getPath());
661
-			foreach($mounts as $mount) {
661
+			foreach ($mounts as $mount) {
662 662
 				if ($mount->getStorage()->instanceOfStorage('\OCA\Files_Sharing\ISharedStorage')) {
663 663
 					throw new \InvalidArgumentException('Path contains files shared with you');
664 664
 				}
@@ -706,7 +706,7 @@  discard block
 block discarded – undo
706 706
 		$storage = $share->getNode()->getStorage();
707 707
 		if ($storage->instanceOfStorage('OCA\Files_Sharing\External\Storage')) {
708 708
 			$parent = $share->getNode()->getParent();
709
-			while($parent->getStorage()->instanceOfStorage('OCA\Files_Sharing\External\Storage')) {
709
+			while ($parent->getStorage()->instanceOfStorage('OCA\Files_Sharing\External\Storage')) {
710 710
 				$parent = $parent->getParent();
711 711
 			}
712 712
 			$share->setShareOwner($parent->getOwner()->getUID());
@@ -767,7 +767,7 @@  discard block
 block discarded – undo
767 767
 		}
768 768
 
769 769
 		// Generate the target
770
-		$target = $this->config->getSystemValue('share_folder', '/') .'/'. $share->getNode()->getName();
770
+		$target = $this->config->getSystemValue('share_folder', '/').'/'.$share->getNode()->getName();
771 771
 		$target = \OC\Files\Filesystem::normalizePath($target);
772 772
 		$share->setTarget($target);
773 773
 
@@ -797,7 +797,7 @@  discard block
 block discarded – undo
797 797
 
798 798
 		if ($share->getShareType() === \OCP\Share::SHARE_TYPE_USER) {
799 799
 			$mailSend = $share->getMailSend();
800
-			if($mailSend === true) {
800
+			if ($mailSend === true) {
801 801
 				$user = $this->userManager->get($share->getSharedWith());
802 802
 				if ($user !== null) {
803 803
 					$emailAddress = $user->getEMailAddress();
@@ -812,12 +812,12 @@  discard block
 block discarded – undo
812 812
 							$emailAddress,
813 813
 							$share->getExpirationDate()
814 814
 						);
815
-						$this->logger->debug('Sent share notification to ' . $emailAddress . ' for share with ID ' . $share->getId(), ['app' => 'share']);
815
+						$this->logger->debug('Sent share notification to '.$emailAddress.' for share with ID '.$share->getId(), ['app' => 'share']);
816 816
 					} else {
817
-						$this->logger->debug('Share notification not sent to ' . $share->getSharedWith() . ' because email address is not set.', ['app' => 'share']);
817
+						$this->logger->debug('Share notification not sent to '.$share->getSharedWith().' because email address is not set.', ['app' => 'share']);
818 818
 					}
819 819
 				} else {
820
-					$this->logger->debug('Share notification not sent to ' . $share->getSharedWith() . ' because user could not be found.', ['app' => 'share']);
820
+					$this->logger->debug('Share notification not sent to '.$share->getSharedWith().' because user could not be found.', ['app' => 'share']);
821 821
 				}
822 822
 			} else {
823 823
 				$this->logger->debug('Share notification not sent because mailsend is false.', ['app' => 'share']);
@@ -864,7 +864,7 @@  discard block
 block discarded – undo
864 864
 		$text = $l->t('%1$s shared »%2$s« with you.', [$initiatorDisplayName, $filename]);
865 865
 
866 866
 		$emailTemplate->addBodyText(
867
-			htmlspecialchars($text . ' ' . $l->t('Click the button below to open it.')),
867
+			htmlspecialchars($text.' '.$l->t('Click the button below to open it.')),
868 868
 			$text
869 869
 		);
870 870
 		$emailTemplate->addBodyButton(
@@ -888,9 +888,9 @@  discard block
 block discarded – undo
888 888
 		// The "Reply-To" is set to the sharer if an mail address is configured
889 889
 		// also the default footer contains a "Do not reply" which needs to be adjusted.
890 890
 		$initiatorEmail = $initiatorUser->getEMailAddress();
891
-		if($initiatorEmail !== null) {
891
+		if ($initiatorEmail !== null) {
892 892
 			$message->setReplyTo([$initiatorEmail => $initiatorDisplayName]);
893
-			$emailTemplate->addFooter($instanceName . ($this->defaults->getSlogan() !== '' ? ' - ' . $this->defaults->getSlogan() : ''));
893
+			$emailTemplate->addFooter($instanceName.($this->defaults->getSlogan() !== '' ? ' - '.$this->defaults->getSlogan() : ''));
894 894
 		} else {
895 895
 			$emailTemplate->addFooter();
896 896
 		}
@@ -898,8 +898,8 @@  discard block
 block discarded – undo
898 898
 		$message->useTemplate($emailTemplate);
899 899
 		try {
900 900
 			$failedRecipients = $this->mailer->send($message);
901
-			if(!empty($failedRecipients)) {
902
-				$this->logger->error('Share notification mail could not be sent to: ' . implode(', ', $failedRecipients));
901
+			if (!empty($failedRecipients)) {
902
+				$this->logger->error('Share notification mail could not be sent to: '.implode(', ', $failedRecipients));
903 903
 				return;
904 904
 			}
905 905
 		} catch (\Exception $e) {
@@ -1153,7 +1153,7 @@  discard block
 block discarded – undo
1153 1153
 	 * @param string $recipientId
1154 1154
 	 */
1155 1155
 	public function deleteFromSelf(\OCP\Share\IShare $share, $recipientId) {
1156
-		list($providerId, ) = $this->splitFullId($share->getFullId());
1156
+		list($providerId,) = $this->splitFullId($share->getFullId());
1157 1157
 		$provider = $this->factory->getProvider($providerId);
1158 1158
 
1159 1159
 		$provider->deleteFromSelf($share, $recipientId);
@@ -1162,7 +1162,7 @@  discard block
 block discarded – undo
1162 1162
 	}
1163 1163
 
1164 1164
 	public function restoreShare(IShare $share, string $recipientId): IShare {
1165
-		list($providerId, ) = $this->splitFullId($share->getFullId());
1165
+		list($providerId,) = $this->splitFullId($share->getFullId());
1166 1166
 		$provider = $this->factory->getProvider($providerId);
1167 1167
 
1168 1168
 		return $provider->restore($share, $recipientId);
@@ -1183,7 +1183,7 @@  discard block
 block discarded – undo
1183 1183
 		if ($share->getShareType() === \OCP\Share::SHARE_TYPE_GROUP) {
1184 1184
 			$sharedWith = $this->groupManager->get($share->getSharedWith());
1185 1185
 			if (is_null($sharedWith)) {
1186
-				throw new \InvalidArgumentException('Group "' . $share->getSharedWith() . '" does not exist');
1186
+				throw new \InvalidArgumentException('Group "'.$share->getSharedWith().'" does not exist');
1187 1187
 			}
1188 1188
 			$recipient = $this->userManager->get($recipientId);
1189 1189
 			if (!$sharedWith->inGroup($recipient)) {
@@ -1191,7 +1191,7 @@  discard block
 block discarded – undo
1191 1191
 			}
1192 1192
 		}
1193 1193
 
1194
-		list($providerId, ) = $this->splitFullId($share->getFullId());
1194
+		list($providerId,) = $this->splitFullId($share->getFullId());
1195 1195
 		$provider = $this->factory->getProvider($providerId);
1196 1196
 
1197 1197
 		$provider->move($share, $recipientId);
@@ -1200,7 +1200,7 @@  discard block
 block discarded – undo
1200 1200
 	public function getSharesInFolder($userId, Folder $node, $reshares = false) {
1201 1201
 		$providers = $this->factory->getAllProviders();
1202 1202
 
1203
-		return array_reduce($providers, function ($shares, IShareProvider $provider) use ($userId, $node, $reshares) {
1203
+		return array_reduce($providers, function($shares, IShareProvider $provider) use ($userId, $node, $reshares) {
1204 1204
 			$newShares = $provider->getSharesInFolder($userId, $node, $reshares);
1205 1205
 			foreach ($newShares as $fid => $data) {
1206 1206
 				if (!isset($shares[$fid])) {
@@ -1238,7 +1238,7 @@  discard block
 block discarded – undo
1238 1238
 
1239 1239
 		$shares2 = [];
1240 1240
 
1241
-		while(true) {
1241
+		while (true) {
1242 1242
 			$added = 0;
1243 1243
 			foreach ($shares as $share) {
1244 1244
 
@@ -1318,12 +1318,12 @@  discard block
 block discarded – undo
1318 1318
 		$shares = $this->getSharedWith($userId, $shareType, $node, $limit, $offset);
1319 1319
 
1320 1320
 		// Only get deleted shares
1321
-		$shares = array_filter($shares, function (IShare $share) {
1321
+		$shares = array_filter($shares, function(IShare $share) {
1322 1322
 			return $share->getPermissions() === 0;
1323 1323
 		});
1324 1324
 
1325 1325
 		// Only get shares where the owner still exists
1326
-		$shares = array_filter($shares, function (IShare $share) {
1326
+		$shares = array_filter($shares, function(IShare $share) {
1327 1327
 			return $this->userManager->userExists($share->getShareOwner());
1328 1328
 		});
1329 1329
 
@@ -1362,7 +1362,7 @@  discard block
 block discarded – undo
1362 1362
 	 *
1363 1363
 	 * @return Share[]
1364 1364
 	 */
1365
-	public function getSharesByPath(\OCP\Files\Node $path, $page=0, $perPage=50) {
1365
+	public function getSharesByPath(\OCP\Files\Node $path, $page = 0, $perPage = 50) {
1366 1366
 		return [];
1367 1367
 	}
1368 1368
 
@@ -1381,7 +1381,7 @@  discard block
 block discarded – undo
1381 1381
 		}
1382 1382
 		$share = null;
1383 1383
 		try {
1384
-			if($this->shareApiAllowLinks()) {
1384
+			if ($this->shareApiAllowLinks()) {
1385 1385
 				$provider = $this->factory->getProviderForType(\OCP\Share::SHARE_TYPE_LINK);
1386 1386
 				$share = $provider->getShareByToken($token);
1387 1387
 			}
@@ -1608,7 +1608,7 @@  discard block
 block discarded – undo
1608 1608
 			}
1609 1609
 			$al['users'][$owner] = [
1610 1610
 				'node_id' => $path->getId(),
1611
-				'node_path' => '/' . $ownerPath,
1611
+				'node_path' => '/'.$ownerPath,
1612 1612
 			];
1613 1613
 		} else {
1614 1614
 			$al['users'][] = $owner;
@@ -1708,7 +1708,7 @@  discard block
 block discarded – undo
1708 1708
 	 * @return int
1709 1709
 	 */
1710 1710
 	public function shareApiLinkDefaultExpireDays() {
1711
-		return (int)$this->config->getAppValue('core', 'shareapi_expire_after_n_days', '7');
1711
+		return (int) $this->config->getAppValue('core', 'shareapi_expire_after_n_days', '7');
1712 1712
 	}
1713 1713
 
1714 1714
 	/**
@@ -1736,7 +1736,7 @@  discard block
 block discarded – undo
1736 1736
 	 * @return int
1737 1737
 	 */
1738 1738
 	public function shareApiInternalDefaultExpireDays(): int {
1739
-		return (int)$this->config->getAppValue('core', 'shareapi_internal_expire_after_n_days', '7');
1739
+		return (int) $this->config->getAppValue('core', 'shareapi_internal_expire_after_n_days', '7');
1740 1740
 	}
1741 1741
 
1742 1742
 	/**
Please login to merge, or discard this patch.
lib/private/User/Backend.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -39,14 +39,14 @@  discard block
 block discarded – undo
39 39
 	/**
40 40
 	 * actions that user backends can define
41 41
 	 */
42
-	const CREATE_USER		= 1;			// 1 << 0
43
-	const SET_PASSWORD		= 16;			// 1 << 4
44
-	const CHECK_PASSWORD	= 256;			// 1 << 8
45
-	const GET_HOME			= 4096;			// 1 << 12
46
-	const GET_DISPLAYNAME	= 65536;		// 1 << 16
47
-	const SET_DISPLAYNAME	= 1048576;		// 1 << 20
48
-	const PROVIDE_AVATAR	= 16777216;		// 1 << 24
49
-	const COUNT_USERS		= 268435456;	// 1 << 28
42
+	const CREATE_USER = 1; // 1 << 0
43
+	const SET_PASSWORD = 16; // 1 << 4
44
+	const CHECK_PASSWORD = 256; // 1 << 8
45
+	const GET_HOME = 4096; // 1 << 12
46
+	const GET_DISPLAYNAME	= 65536; // 1 << 16
47
+	const SET_DISPLAYNAME	= 1048576; // 1 << 20
48
+	const PROVIDE_AVATAR = 16777216; // 1 << 24
49
+	const COUNT_USERS = 268435456; // 1 << 28
50 50
 
51 51
 	protected $possibleActions = [
52 52
 		self::CREATE_USER => 'createUser',
@@ -68,8 +68,8 @@  discard block
 block discarded – undo
68 68
 	 */
69 69
 	public function getSupportedActions() {
70 70
 		$actions = 0;
71
-		foreach($this->possibleActions AS $action => $methodName) {
72
-			if(method_exists($this, $methodName)) {
71
+		foreach ($this->possibleActions AS $action => $methodName) {
72
+			if (method_exists($this, $methodName)) {
73 73
 				$actions |= $action;
74 74
 			}
75 75
 		}
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 	 * compared with self::CREATE_USER etc.
87 87
 	 */
88 88
 	public function implementsActions($actions) {
89
-		return (bool)($this->getSupportedActions() & $actions);
89
+		return (bool) ($this->getSupportedActions() & $actions);
90 90
 	}
91 91
 
92 92
 	/**
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
 	public function getDisplayNames($search = '', $limit = null, $offset = null) {
151 151
 		$displayNames = [];
152 152
 		$users = $this->getUsers($search, $limit, $offset);
153
-		foreach ( $users as $user) {
153
+		foreach ($users as $user) {
154 154
 			$displayNames[$user] = $user;
155 155
 		}
156 156
 		return $displayNames;
Please login to merge, or discard this patch.
lib/private/User/Manager.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 		$this->config = $config;
92 92
 		$this->dispatcher = $oldDispatcher;
93 93
 		$cachedUsers = &$this->cachedUsers;
94
-		$this->listen('\OC\User', 'postDelete', function ($user) use (&$cachedUsers) {
94
+		$this->listen('\OC\User', 'postDelete', function($user) use (&$cachedUsers) {
95 95
 			/** @var \OC\User\User $user */
96 96
 			unset($cachedUsers[$user->getUID()]);
97 97
 		});
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
 		$result = $this->checkPasswordNoLogging($loginName, $password);
203 203
 
204 204
 		if ($result === false) {
205
-			\OC::$server->getLogger()->warning('Login failed: \''. $loginName .'\' (Remote IP: \''. \OC::$server->getRequest()->getRemoteAddress(). '\')', ['app' => 'core']);
205
+			\OC::$server->getLogger()->warning('Login failed: \''.$loginName.'\' (Remote IP: \''.\OC::$server->getRequest()->getRemoteAddress().'\')', ['app' => 'core']);
206 206
 		}
207 207
 
208 208
 		return $result;
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
 			}
252 252
 		}
253 253
 
254
-		uasort($users, function ($a, $b) {
254
+		uasort($users, function($a, $b) {
255 255
 			/**
256 256
 			 * @var \OC\User\User $a
257 257
 			 * @var \OC\User\User $b
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
 			}
281 281
 		}
282 282
 
283
-		usort($users, function ($a, $b) {
283
+		usort($users, function($a, $b) {
284 284
 			/**
285 285
 			 * @var \OC\User\User $a
286 286
 			 * @var \OC\User\User $b
@@ -368,7 +368,7 @@  discard block
 block discarded – undo
368 368
 		$this->emit('\OC\User', 'preCreateUser', [$uid, $password]);
369 369
 		$this->eventDispatcher->dispatchTyped(new CreateUserEvent($uid, $password));
370 370
 		$state = $backend->createUser($uid, $password);
371
-		if($state === false) {
371
+		if ($state === false) {
372 372
 			throw new \InvalidArgumentException($l->t('Could not create user'));
373 373
 		}
374 374
 		$user = $this->getUserObject($uid, $backend);
@@ -395,13 +395,13 @@  discard block
 block discarded – undo
395 395
 		foreach ($this->backends as $backend) {
396 396
 			if ($backend->implementsActions(Backend::COUNT_USERS)) {
397 397
 				$backendUsers = $backend->countUsers();
398
-				if($backendUsers !== false) {
399
-					if($backend instanceof IUserBackend) {
398
+				if ($backendUsers !== false) {
399
+					if ($backend instanceof IUserBackend) {
400 400
 						$name = $backend->getBackendName();
401 401
 					} else {
402 402
 						$name = get_class($backend);
403 403
 					}
404
-					if(isset($userCountStatistics[$name])) {
404
+					if (isset($userCountStatistics[$name])) {
405 405
 						$userCountStatistics[$name] += $backendUsers;
406 406
 					} else {
407 407
 						$userCountStatistics[$name] = $backendUsers;
@@ -421,8 +421,8 @@  discard block
 block discarded – undo
421 421
 	 */
422 422
 	public function countUsersOfGroups(array $groups) {
423 423
 		$users = [];
424
-		foreach($groups as $group) {
425
-			$usersIds = array_map(function ($user) {
424
+		foreach ($groups as $group) {
425
+			$usersIds = array_map(function($user) {
426 426
 				return $user->getUID();
427 427
 			}, $group->getUsers());
428 428
 			$users = array_merge($users, $usersIds);
@@ -485,7 +485,7 @@  discard block
 block discarded – undo
485 485
 		$result->closeCursor();
486 486
 
487 487
 		if ($count !== false) {
488
-			$count = (int)$count;
488
+			$count = (int) $count;
489 489
 		} else {
490 490
 			$count = 0;
491 491
 		}
@@ -502,7 +502,7 @@  discard block
 block discarded – undo
502 502
 	 */
503 503
 	public function countDisabledUsersOfGroups(array $groups): int {
504 504
 		$queryBuilder = \OC::$server->getDatabaseConnection()->getQueryBuilder();
505
-		$queryBuilder->select($queryBuilder->createFunction('COUNT(DISTINCT ' . $queryBuilder->getColumnName('uid') . ')'))
505
+		$queryBuilder->select($queryBuilder->createFunction('COUNT(DISTINCT '.$queryBuilder->getColumnName('uid').')'))
506 506
 			->from('preferences', 'p')
507 507
 			->innerJoin('p', 'group_user', 'g', $queryBuilder->expr()->eq('p.userid', 'g.uid'))
508 508
 			->where($queryBuilder->expr()->eq('appid', $queryBuilder->createNamedParameter('core')))
@@ -515,7 +515,7 @@  discard block
 block discarded – undo
515 515
 		$result->closeCursor();
516 516
 
517 517
 		if ($count !== false) {
518
-			$count = (int)$count;
518
+			$count = (int) $count;
519 519
 		} else {
520 520
 			$count = 0;
521 521
 		}
@@ -539,7 +539,7 @@  discard block
 block discarded – undo
539 539
 
540 540
 		$query = $queryBuilder->execute();
541 541
 
542
-		$result = (int)$query->fetchColumn();
542
+		$result = (int) $query->fetchColumn();
543 543
 		$query->closeCursor();
544 544
 
545 545
 		return $result;
@@ -618,17 +618,17 @@  discard block
 block discarded – undo
618 618
 	public function getByEmail($email) {
619 619
 		$userIds = $this->config->getUsersForUserValueCaseInsensitive('settings', 'email', $email);
620 620
 
621
-		$users = array_map(function ($uid) {
621
+		$users = array_map(function($uid) {
622 622
 			return $this->get($uid);
623 623
 		}, $userIds);
624 624
 
625
-		return array_values(array_filter($users, function ($u) {
625
+		return array_values(array_filter($users, function($u) {
626 626
 			return ($u instanceof IUser);
627 627
 		}));
628 628
 	}
629 629
 
630 630
 	private function verifyUid(string $uid): bool {
631
-		$appdata = 'appdata_' . $this->config->getSystemValueString('instanceid');
631
+		$appdata = 'appdata_'.$this->config->getSystemValueString('instanceid');
632 632
 
633 633
 		if (\in_array($uid, [
634 634
 			'.htaccess',
@@ -640,8 +640,8 @@  discard block
 block discarded – undo
640 640
 			return false;
641 641
 		}
642 642
 
643
-		$dataDirectory = $this->config->getSystemValueString('datadirectory', \OC::$SERVERROOT . '/data');
643
+		$dataDirectory = $this->config->getSystemValueString('datadirectory', \OC::$SERVERROOT.'/data');
644 644
 
645
-		return !file_exists(rtrim($dataDirectory, '/') . '/' . $uid);
645
+		return !file_exists(rtrim($dataDirectory, '/').'/'.$uid);
646 646
 	}
647 647
 }
Please login to merge, or discard this patch.
lib/private/Share/Share.php 1 patch
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 
150 150
 		$select = self::createSelectStatement(self::FORMAT_NONE, $fileDependent);
151 151
 
152
-		$where .= ' `' . $column . '` = ? AND `item_type` = ? ';
152
+		$where .= ' `'.$column.'` = ? AND `item_type` = ? ';
153 153
 		$arguments = [$itemSource, $itemType];
154 154
 		// for link shares $user === null
155 155
 		if ($user !== null) {
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 			$arguments[] = $owner;
168 168
 		}
169 169
 
170
-		$query = \OC_DB::prepare('SELECT ' . $select . ' FROM `*PREFIX*share` '. $fileDependentWhere . $where);
170
+		$query = \OC_DB::prepare('SELECT '.$select.' FROM `*PREFIX*share` '.$fileDependentWhere.$where);
171 171
 
172 172
 		$result = \OC_DB::executeAudited($query, $arguments);
173 173
 
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
 			if ($fileDependent && !self::isFileReachable($row['path'], $row['storage_id'])) {
176 176
 				continue;
177 177
 			}
178
-			if ($fileDependent && (int)$row['file_parent'] === -1) {
178
+			if ($fileDependent && (int) $row['file_parent'] === -1) {
179 179
 				// if it is a mount point we need to get the path from the mount manager
180 180
 				$mountManager = \OC\Files\Filesystem::getMountManager();
181 181
 				$mountPoint = $mountManager->findByStorageId($row['storage_id']);
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
 					$row['path'] = $path;
187 187
 				} else {
188 188
 					\OC::$server->getLogger()->warning(
189
-						'Could not resolve mount point for ' . $row['storage_id'],
189
+						'Could not resolve mount point for '.$row['storage_id'],
190 190
 						['app' => 'OCP\Share']
191 191
 					);
192 192
 				}
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 		}
196 196
 
197 197
 		//if didn't found a result than let's look for a group share.
198
-		if(empty($shares) && $user !== null) {
198
+		if (empty($shares) && $user !== null) {
199 199
 			$userObject = \OC::$server->getUserManager()->get($user);
200 200
 			$groups = [];
201 201
 			if ($userObject) {
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
 			}
204 204
 
205 205
 			if (!empty($groups)) {
206
-				$where = $fileDependentWhere . ' WHERE `' . $column . '` = ? AND `item_type` = ? AND `share_with` in (?)';
206
+				$where = $fileDependentWhere.' WHERE `'.$column.'` = ? AND `item_type` = ? AND `share_with` in (?)';
207 207
 				$arguments = [$itemSource, $itemType, $groups];
208 208
 				$types = [null, null, IQueryBuilder::PARAM_STR_ARRAY];
209 209
 
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 				// class isn't static anymore...
218 218
 				$conn = \OC::$server->getDatabaseConnection();
219 219
 				$result = $conn->executeQuery(
220
-					'SELECT ' . $select . ' FROM `*PREFIX*share` ' . $where,
220
+					'SELECT '.$select.' FROM `*PREFIX*share` '.$where,
221 221
 					$arguments,
222 222
 					$types
223 223
 				);
@@ -351,12 +351,12 @@  discard block
 block discarded – undo
351 351
 		$currentUser = $owner ? $owner : \OC_User::getUser();
352 352
 		foreach ($items as $item) {
353 353
 			// delete the item with the expected share_type and owner
354
-			if ((int)$item['share_type'] === (int)$shareType && $item['uid_owner'] === $currentUser) {
354
+			if ((int) $item['share_type'] === (int) $shareType && $item['uid_owner'] === $currentUser) {
355 355
 				$toDelete = $item;
356 356
 				// if there is more then one result we don't have to delete the children
357 357
 				// but update their parent. For group shares the new parent should always be
358 358
 				// the original group share and not the db entry with the unique name
359
-			} else if ((int)$item['share_type'] === self::$shareTypeGroupUserUnique) {
359
+			} else if ((int) $item['share_type'] === self::$shareTypeGroupUserUnique) {
360 360
 				$newParent = $item['parent'];
361 361
 			} else {
362 362
 				$newParent = $item['id'];
@@ -415,7 +415,7 @@  discard block
 block discarded – undo
415 415
 	 */
416 416
 	protected static function unshareItem(array $item, $newParent = null) {
417 417
 
418
-		$shareType = (int)$item['share_type'];
418
+		$shareType = (int) $item['share_type'];
419 419
 		$shareWith = null;
420 420
 		if ($shareType !== \OCP\Share::SHARE_TYPE_LINK) {
421 421
 			$shareWith = $item['share_with'];
@@ -431,7 +431,7 @@  discard block
 block discarded – undo
431 431
 			'itemParent'    => $item['parent'],
432 432
 			'uidOwner'      => $item['uid_owner'],
433 433
 		];
434
-		if($item['item_type'] === 'file' || $item['item_type'] === 'folder') {
434
+		if ($item['item_type'] === 'file' || $item['item_type'] === 'folder') {
435 435
 			$hookParams['fileSource'] = $item['file_source'];
436 436
 			$hookParams['fileTarget'] = $item['file_target'];
437 437
 		}
@@ -441,7 +441,7 @@  discard block
 block discarded – undo
441 441
 		$deletedShares[] = $hookParams;
442 442
 		$hookParams['deletedShares'] = $deletedShares;
443 443
 		\OC_Hook::emit(\OCP\Share::class, 'post_unshare', $hookParams);
444
-		if ((int)$item['share_type'] === \OCP\Share::SHARE_TYPE_REMOTE && \OC::$server->getUserSession()->getUser()) {
444
+		if ((int) $item['share_type'] === \OCP\Share::SHARE_TYPE_REMOTE && \OC::$server->getUserSession()->getUser()) {
445 445
 			list(, $remote) = Helper::splitUserRemote($item['share_with']);
446 446
 			self::sendRemoteUnshare($remote, $item['id'], $item['token']);
447 447
 		}
@@ -605,7 +605,7 @@  discard block
 block discarded – undo
605 605
 		// Get filesystem root to add it to the file target and remove from the
606 606
 		// file source, match file_source with the file cache
607 607
 		if ($itemType == 'file' || $itemType == 'folder') {
608
-			if(!is_null($uidOwner)) {
608
+			if (!is_null($uidOwner)) {
609 609
 				$root = \OC\Files\Filesystem::getRoot();
610 610
 			} else {
611 611
 				$root = '';
@@ -750,7 +750,7 @@  discard block
 block discarded – undo
750 750
 		$result = $query->execute($queryArgs);
751 751
 		if ($result === false) {
752 752
 			\OCP\Util::writeLog('OCP\Share',
753
-				\OC_DB::getErrorMessage() . ', select=' . $select . ' where=',
753
+				\OC_DB::getErrorMessage().', select='.$select.' where=',
754 754
 				ILogger::ERROR);
755 755
 		}
756 756
 		$items = [];
@@ -792,14 +792,14 @@  discard block
 block discarded – undo
792 792
 						}
793 793
 						// Switch ids if sharing permission is granted on only
794 794
 						// one share to ensure correct parent is used if resharing
795
-						if (~(int)$items[$id]['permissions'] & \OCP\Constants::PERMISSION_SHARE
796
-							&& (int)$row['permissions'] & \OCP\Constants::PERMISSION_SHARE) {
795
+						if (~(int) $items[$id]['permissions'] & \OCP\Constants::PERMISSION_SHARE
796
+							&& (int) $row['permissions'] & \OCP\Constants::PERMISSION_SHARE) {
797 797
 							$items[$row['id']] = $items[$id];
798 798
 							$switchedItems[$id] = $row['id'];
799 799
 							unset($items[$id]);
800 800
 							$id = $row['id'];
801 801
 						}
802
-						$items[$id]['permissions'] |= (int)$row['permissions'];
802
+						$items[$id]['permissions'] |= (int) $row['permissions'];
803 803
 
804 804
 					}
805 805
 					continue;
@@ -813,8 +813,8 @@  discard block
 block discarded – undo
813 813
 					$query = \OC_DB::prepare('SELECT `file_target` FROM `*PREFIX*share` WHERE `id` = ?');
814 814
 					$parentResult = $query->execute([$row['parent']]);
815 815
 					if ($result === false) {
816
-						\OCP\Util::writeLog('OCP\Share', 'Can\'t select parent: ' .
817
-							\OC_DB::getErrorMessage() . ', select=' . $select . ' where=' . $where,
816
+						\OCP\Util::writeLog('OCP\Share', 'Can\'t select parent: '.
817
+							\OC_DB::getErrorMessage().', select='.$select.' where='.$where,
818 818
 							ILogger::ERROR);
819 819
 					} else {
820 820
 						$parentRow = $parentResult->fetchRow();
@@ -824,7 +824,7 @@  discard block
 block discarded – undo
824 824
 						$subPath = substr($row['path'], $pos);
825 825
 						$splitPath = explode('/', $subPath);
826 826
 						foreach (array_slice($splitPath, 2) as $pathPart) {
827
-							$tmpPath = $tmpPath . '/' . $pathPart;
827
+							$tmpPath = $tmpPath.'/'.$pathPart;
828 828
 						}
829 829
 						$row['path'] = $tmpPath;
830 830
 					}
@@ -843,7 +843,7 @@  discard block
 block discarded – undo
843 843
 				}
844 844
 			}
845 845
 
846
-			if($checkExpireDate) {
846
+			if ($checkExpireDate) {
847 847
 				if (self::expireItem($row)) {
848 848
 					continue;
849 849
 				}
@@ -854,11 +854,11 @@  discard block
 block discarded – undo
854 854
 			}
855 855
 			// Add display names to result
856 856
 			$row['share_with_displayname'] = $row['share_with'];
857
-			if ( isset($row['share_with']) && $row['share_with'] != '' &&
857
+			if (isset($row['share_with']) && $row['share_with'] != '' &&
858 858
 				$row['share_type'] === self::SHARE_TYPE_USER) {
859 859
 				$shareWithUser = \OC::$server->getUserManager()->get($row['share_with']);
860 860
 				$row['share_with_displayname'] = $shareWithUser === null ? $row['share_with'] : $shareWithUser->getDisplayName();
861
-			} else if(isset($row['share_with']) && $row['share_with'] != '' &&
861
+			} else if (isset($row['share_with']) && $row['share_with'] != '' &&
862 862
 				$row['share_type'] === self::SHARE_TYPE_REMOTE) {
863 863
 				$addressBookEntries = \OC::$server->getContactsManager()->search($row['share_with'], ['CLOUD']);
864 864
 				foreach ($addressBookEntries as $entry) {
@@ -869,7 +869,7 @@  discard block
 block discarded – undo
869 869
 					}
870 870
 				}
871 871
 			}
872
-			if ( isset($row['uid_owner']) && $row['uid_owner'] != '') {
872
+			if (isset($row['uid_owner']) && $row['uid_owner'] != '') {
873 873
 				$ownerUser = \OC::$server->getUserManager()->get($row['uid_owner']);
874 874
 				$row['displayname_owner'] = $ownerUser === null ? $row['uid_owner'] : $ownerUser->getDisplayName();
875 875
 			}
@@ -975,7 +975,7 @@  discard block
 block discarded – undo
975 975
 
976 976
 			// filter out invalid items, these can appear when subshare entries exist
977 977
 			// for a group in which the requested user isn't a member any more
978
-			$items = array_filter($items, function ($item) {
978
+			$items = array_filter($items, function($item) {
979 979
 				return $item['share_type'] !== self::$shareTypeGroupUserUnique;
980 980
 			});
981 981
 
@@ -1018,7 +1018,7 @@  discard block
 block discarded – undo
1018 1018
 				// for file/folder shares we need to compare file_source, otherwise we compare item_source
1019 1019
 				// only group shares if they already point to the same target, otherwise the file where shared
1020 1020
 				// before grouping of shares was added. In this case we don't group them toi avoid confusions
1021
-				if (( $fileSharing && $item['file_source'] === $r['file_source'] && $item['file_target'] === $r['file_target']) ||
1021
+				if (($fileSharing && $item['file_source'] === $r['file_source'] && $item['file_target'] === $r['file_target']) ||
1022 1022
 					(!$fileSharing && $item['item_source'] === $r['item_source'] && $item['item_target'] === $r['item_target'])) {
1023 1023
 					// add the first item to the list of grouped shares
1024 1024
 					if (!isset($result[$key]['grouped'])) {
@@ -1063,7 +1063,7 @@  discard block
 block discarded – undo
1063 1063
 		$groupItemTarget = $itemTarget = $fileSource = $parent = 0;
1064 1064
 
1065 1065
 		$result = self::checkReshare('test', $itemSource, self::SHARE_TYPE_USER, $shareWith, $uidOwner, $permissions, null, null);
1066
-		if(!empty($result)) {
1066
+		if (!empty($result)) {
1067 1067
 			$parent = $result['parent'];
1068 1068
 			$itemSource = $result['itemSource'];
1069 1069
 			$fileSource = $result['fileSource'];
@@ -1111,7 +1111,7 @@  discard block
 block discarded – undo
1111 1111
 				$fileTarget = $sourceExists['file_target'];
1112 1112
 				$itemTarget = $sourceExists['item_target'];
1113 1113
 
1114
-			} elseif(!$sourceExists)  {
1114
+			} elseif (!$sourceExists) {
1115 1115
 
1116 1116
 				$itemTarget = Helper::generateTarget($itemType, $itemSource, $userShareType, $user,
1117 1117
 					$uidOwner, $suggestedItemTarget, $parent);
@@ -1222,8 +1222,8 @@  discard block
 block discarded – undo
1222 1222
 
1223 1223
 		if ($checkReshare && $checkReshare['uid_owner'] !== \OC_User::getUser()) {
1224 1224
 			// Check if share permissions is granted
1225
-			if (self::isResharingAllowed() && (int)$checkReshare['permissions'] & \OCP\Constants::PERMISSION_SHARE) {
1226
-				if (~(int)$checkReshare['permissions'] & $permissions) {
1225
+			if (self::isResharingAllowed() && (int) $checkReshare['permissions'] & \OCP\Constants::PERMISSION_SHARE) {
1226
+				if (~(int) $checkReshare['permissions'] & $permissions) {
1227 1227
 					$message = 'Sharing %1$s failed, because the permissions exceed permissions granted to %2$s';
1228 1228
 					throw new \Exception(sprintf($message, $itemSourceName, $uidOwner));
1229 1229
 				} else {
@@ -1232,7 +1232,7 @@  discard block
 block discarded – undo
1232 1232
 
1233 1233
 					$result['expirationDate'] = $expirationDate;
1234 1234
 					// $checkReshare['expiration'] could be null and then is always less than any value
1235
-					if(isset($checkReshare['expiration']) && $checkReshare['expiration'] < $expirationDate) {
1235
+					if (isset($checkReshare['expiration']) && $checkReshare['expiration'] < $expirationDate) {
1236 1236
 						$result['expirationDate'] = $checkReshare['expiration'];
1237 1237
 					}
1238 1238
 
@@ -1312,7 +1312,7 @@  discard block
 block discarded – undo
1312 1312
 
1313 1313
 		$id = false;
1314 1314
 		if ($result) {
1315
-			$id =  \OC::$server->getDatabaseConnection()->lastInsertId('*PREFIX*share');
1315
+			$id = \OC::$server->getDatabaseConnection()->lastInsertId('*PREFIX*share');
1316 1316
 		}
1317 1317
 
1318 1318
 		return $id;
@@ -1414,7 +1414,7 @@  discard block
 block discarded – undo
1414 1414
 	 * @param array $parameters additional format parameters
1415 1415
 	 * @return array format result
1416 1416
 	 */
1417
-	private static function formatResult($items, $column, $backend, $format = self::FORMAT_NONE , $parameters = null) {
1417
+	private static function formatResult($items, $column, $backend, $format = self::FORMAT_NONE, $parameters = null) {
1418 1418
 		if ($format === self::FORMAT_NONE) {
1419 1419
 			return $items;
1420 1420
 		} else if ($format === self::FORMAT_STATUSES) {
@@ -1471,13 +1471,13 @@  discard block
 block discarded – undo
1471 1471
 		$try = 0;
1472 1472
 		$discoveryService = \OC::$server->query(\OCP\OCS\IDiscoveryService::class);
1473 1473
 		while ($result['success'] === false && $try < 2) {
1474
-			$federationEndpoints = $discoveryService->discover($protocol . $remoteDomain, 'FEDERATED_SHARING');
1474
+			$federationEndpoints = $discoveryService->discover($protocol.$remoteDomain, 'FEDERATED_SHARING');
1475 1475
 			$endpoint = isset($federationEndpoints['share']) ? $federationEndpoints['share'] : '/ocs/v2.php/cloud/shares';
1476 1476
 			$client = \OC::$server->getHTTPClientService()->newClient();
1477 1477
 
1478 1478
 			try {
1479 1479
 				$response = $client->post(
1480
-					$protocol . $remoteDomain . $endpoint . $urlSuffix . '?format=' . self::RESPONSE_FORMAT,
1480
+					$protocol.$remoteDomain.$endpoint.$urlSuffix.'?format='.self::RESPONSE_FORMAT,
1481 1481
 					[
1482 1482
 						'body' => $fields,
1483 1483
 						'connect_timeout' => 10,
@@ -1518,7 +1518,7 @@  discard block
 block discarded – undo
1518 1518
 	 * @return int
1519 1519
 	 */
1520 1520
 	public static function getExpireInterval() {
1521
-		return (int)\OC::$server->getConfig()->getAppValue('core', 'shareapi_expire_after_n_days', '7');
1521
+		return (int) \OC::$server->getConfig()->getAppValue('core', 'shareapi_expire_after_n_days', '7');
1522 1522
 	}
1523 1523
 
1524 1524
 	/**
Please login to merge, or discard this patch.
lib/private/SubAdmin.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -60,10 +60,10 @@  discard block
 block discarded – undo
60 60
 		$this->groupManager = $groupManager;
61 61
 		$this->dbConn = $dbConn;
62 62
 
63
-		$this->userManager->listen('\OC\User', 'postDelete', function ($user) {
63
+		$this->userManager->listen('\OC\User', 'postDelete', function($user) {
64 64
 			$this->post_deleteUser($user);
65 65
 		});
66
-		$this->groupManager->listen('\OC\Group', 'postDelete', function ($group) {
66
+		$this->groupManager->listen('\OC\Group', 'postDelete', function($group) {
67 67
 			$this->post_deleteGroup($group);
68 68
 		});
69 69
 	}
@@ -118,9 +118,9 @@  discard block
 block discarded – undo
118 118
 			->execute();
119 119
 
120 120
 		$groups = [];
121
-		while($row = $result->fetch()) {
121
+		while ($row = $result->fetch()) {
122 122
 			$group = $this->groupManager->get($row['gid']);
123
-			if(!is_null($group)) {
123
+			if (!is_null($group)) {
124 124
 				$groups[$group->getGID()] = $group;
125 125
 			}
126 126
 		}
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 	 * @return array ['displayName' => displayname]
136 136
 	 */
137 137
 	public function getSubAdminsGroupsName(IUser $user): array {
138
-		return array_map(function ($group) {
138
+		return array_map(function($group) {
139 139
 			return ['displayName' => $group->getDisplayName()];
140 140
 		}, $this->getSubAdminsGroups($user));
141 141
 	}
@@ -154,9 +154,9 @@  discard block
 block discarded – undo
154 154
 			->execute();
155 155
 
156 156
 		$users = [];
157
-		while($row = $result->fetch()) {
157
+		while ($row = $result->fetch()) {
158 158
 			$user = $this->userManager->get($row['uid']);
159
-			if(!is_null($user)) {
159
+			if (!is_null($user)) {
160 160
 				$users[] = $user;
161 161
 			}
162 162
 		}
@@ -177,10 +177,10 @@  discard block
 block discarded – undo
177 177
 			->execute();
178 178
 
179 179
 		$subadmins = [];
180
-		while($row = $result->fetch()) {
180
+		while ($row = $result->fetch()) {
181 181
 			$user = $this->userManager->get($row['uid']);
182 182
 			$group = $this->groupManager->get($row['gid']);
183
-			if(!is_null($user) && !is_null($group)) {
183
+			if (!is_null($user) && !is_null($group)) {
184 184
 				$subadmins[] = [
185 185
 					'user'  => $user,
186 186
 					'group' => $group
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
 			->andWhere($qb->expr()->eq('uid', $qb->createNamedParameter($user->getUID())))
211 211
 			->execute();
212 212
 
213
-		$fetch =  $result->fetch();
213
+		$fetch = $result->fetch();
214 214
 		$result->closeCursor();
215 215
 		$result = !empty($fetch) ? true : false;
216 216
 
@@ -249,15 +249,15 @@  discard block
 block discarded – undo
249 249
 	 * @return bool
250 250
 	 */
251 251
 	public function isUserAccessible(IUser $subadmin, IUser $user): bool {
252
-		if(!$this->isSubAdmin($subadmin)) {
252
+		if (!$this->isSubAdmin($subadmin)) {
253 253
 			return false;
254 254
 		}
255
-		if($this->groupManager->isAdmin($user->getUID())) {
255
+		if ($this->groupManager->isAdmin($user->getUID())) {
256 256
 			return false;
257 257
 		}
258 258
 		$accessibleGroups = $this->getSubAdminsGroups($subadmin);
259
-		foreach($accessibleGroups as $accessibleGroup) {
260
-			if($accessibleGroup->inGroup($user)) {
259
+		foreach ($accessibleGroups as $accessibleGroup) {
260
+			if ($accessibleGroup->inGroup($user)) {
261 261
 				return true;
262 262
 			}
263 263
 		}
Please login to merge, or discard this patch.