Completed
Pull Request — master (#5342)
by Lukas
17:32
created
lib/private/Files/Config/UserMountCache.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -87,11 +87,11 @@  discard block
 block discarded – undo
87 87
 
88 88
 	public function registerMounts(IUser $user, array $mounts) {
89 89
 		// filter out non-proper storages coming from unit tests
90
-		$mounts = array_filter($mounts, function (IMountPoint $mount) {
90
+		$mounts = array_filter($mounts, function(IMountPoint $mount) {
91 91
 			return $mount instanceof SharedMount || $mount->getStorage() && $mount->getStorage()->getCache();
92 92
 		});
93 93
 		/** @var ICachedMountInfo[] $newMounts */
94
-		$newMounts = array_map(function (IMountPoint $mount) use ($user) {
94
+		$newMounts = array_map(function(IMountPoint $mount) use ($user) {
95 95
 			// filter out any storages which aren't scanned yet since we aren't interested in files from those storages (yet)
96 96
 			if ($mount->getStorageRootId() === -1) {
97 97
 				return null;
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 		$newMounts = array_values(array_filter($newMounts));
103 103
 
104 104
 		$cachedMounts = $this->getMountsForUser($user);
105
-		$mountDiff = function (ICachedMountInfo $mount1, ICachedMountInfo $mount2) {
105
+		$mountDiff = function(ICachedMountInfo $mount1, ICachedMountInfo $mount2) {
106 106
 			// since we are only looking for mounts for a specific user comparing on root id is enough
107 107
 			return $mount1->getRootId() - $mount2->getRootId();
108 108
 		};
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 			], ['root_id', 'user_id']);
164 164
 		} else {
165 165
 			// in some cases this is legitimate, like orphaned shares
166
-			$this->logger->debug('Could not get storage info for mount at ' . $mount->getMountPoint());
166
+			$this->logger->debug('Could not get storage info for mount at '.$mount->getMountPoint());
167 167
 		}
168 168
 	}
169 169
 
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
 		if (is_null($user)) {
195 195
 			return null;
196 196
 		}
197
-		return new CachedMountInfo($user, (int)$row['storage_id'], (int)$row['root_id'], $row['mount_point'], $row['mount_id'], isset($row['path']) ? $row['path'] : '');
197
+		return new CachedMountInfo($user, (int) $row['storage_id'], (int) $row['root_id'], $row['mount_point'], $row['mount_id'], isset($row['path']) ? $row['path'] : '');
198 198
 	}
199 199
 
200 200
 	/**
@@ -268,12 +268,12 @@  discard block
 block discarded – undo
268 268
 			$row = $query->execute()->fetch();
269 269
 			if (is_array($row)) {
270 270
 				$this->cacheInfoCache[$fileId] = [
271
-					(int)$row['storage'],
271
+					(int) $row['storage'],
272 272
 					$row['path'],
273
-					(int)$row['mimetype']
273
+					(int) $row['mimetype']
274 274
 				];
275 275
 			} else {
276
-				throw new NotFoundException('File with id "' . $fileId . '" not found');
276
+				throw new NotFoundException('File with id "'.$fileId.'" not found');
277 277
 			}
278 278
 		}
279 279
 		return $this->cacheInfoCache[$fileId];
@@ -294,13 +294,13 @@  discard block
 block discarded – undo
294 294
 		$mountsForStorage = $this->getMountsForStorageId($storageId, $user);
295 295
 
296 296
 		// filter mounts that are from the same storage but a different directory
297
-		return array_filter($mountsForStorage, function (ICachedMountInfo $mount) use ($internalPath, $fileId) {
297
+		return array_filter($mountsForStorage, function(ICachedMountInfo $mount) use ($internalPath, $fileId) {
298 298
 			if ($fileId === $mount->getRootId()) {
299 299
 				return true;
300 300
 			}
301 301
 			$internalMountPath = $mount->getRootInternalPath();
302 302
 
303
-			return $internalMountPath === '' || substr($internalPath, 0, strlen($internalMountPath) + 1) === $internalMountPath . '/';
303
+			return $internalMountPath === '' || substr($internalPath, 0, strlen($internalMountPath) + 1) === $internalMountPath.'/';
304 304
 		});
305 305
 	}
306 306
 
Please login to merge, or discard this patch.
settings/Controller/UsersController.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
 			}
336 336
 		}
337 337
 
338
-		$userIds = array_map(function (array $data) {
338
+		$userIds = array_map(function(array $data) {
339 339
 			return $data['name'];
340 340
 		}, $users);
341 341
 		$usedSpace = $this->userMountCache->getUsedSpaceForUsers($userIds);
@@ -361,7 +361,7 @@  discard block
 block discarded – undo
361 361
 		if ($email !== '' && !$this->mailer->validateMailAddress($email)) {
362 362
 			return new DataResponse(
363 363
 				[
364
-					'message' => (string)$this->l10n->t('Invalid mail address')
364
+					'message' => (string) $this->l10n->t('Invalid mail address')
365 365
 				],
366 366
 				Http::STATUS_UNPROCESSABLE_ENTITY
367 367
 			);
@@ -397,7 +397,7 @@  discard block
 block discarded – undo
397 397
 		if ($this->userManager->userExists($username)) {
398 398
 			return new DataResponse(
399 399
 				[
400
-					'message' => (string)$this->l10n->t('A user with that name already exists.')
400
+					'message' => (string) $this->l10n->t('A user with that name already exists.')
401 401
 				],
402 402
 				Http::STATUS_CONFLICT
403 403
 			);
@@ -408,7 +408,7 @@  discard block
 block discarded – undo
408 408
 			if ($email === '') {
409 409
 				return new DataResponse(
410 410
 					[
411
-						'message' => (string)$this->l10n->t('To send a password link to the user an email address is required.')
411
+						'message' => (string) $this->l10n->t('To send a password link to the user an email address is required.')
412 412
 					],
413 413
 					Http::STATUS_UNPROCESSABLE_ENTITY
414 414
 				);
@@ -427,7 +427,7 @@  discard block
 block discarded – undo
427 427
 			}
428 428
 			return new DataResponse(
429 429
 				[
430
-					'message' => (string)$message,
430
+					'message' => (string) $message,
431 431
 				],
432 432
 				Http::STATUS_FORBIDDEN
433 433
 			);
@@ -453,7 +453,7 @@  discard block
 block discarded – undo
453 453
 					$emailTemplate = $this->newUserMailHelper->generateTemplate($user, $generatePasswordResetToken);
454 454
 					$this->newUserMailHelper->sendMail($user, $emailTemplate);
455 455
 				} catch (\Exception $e) {
456
-					$this->log->error("Can't send new user mail to $email: " . $e->getMessage(), ['app' => 'settings']);
456
+					$this->log->error("Can't send new user mail to $email: ".$e->getMessage(), ['app' => 'settings']);
457 457
 				}
458 458
 			}
459 459
 			// fetch users groups
@@ -467,7 +467,7 @@  discard block
 block discarded – undo
467 467
 
468 468
 		return new DataResponse(
469 469
 			[
470
-				'message' => (string)$this->l10n->t('Unable to create user.')
470
+				'message' => (string) $this->l10n->t('Unable to create user.')
471 471
 			],
472 472
 			Http::STATUS_FORBIDDEN
473 473
 		);
@@ -490,7 +490,7 @@  discard block
 block discarded – undo
490 490
 				[
491 491
 					'status' => 'error',
492 492
 					'data' => [
493
-						'message' => (string)$this->l10n->t('Unable to delete user.')
493
+						'message' => (string) $this->l10n->t('Unable to delete user.')
494 494
 					]
495 495
 				],
496 496
 				Http::STATUS_FORBIDDEN
@@ -502,7 +502,7 @@  discard block
 block discarded – undo
502 502
 				[
503 503
 					'status' => 'error',
504 504
 					'data' => [
505
-						'message' => (string)$this->l10n->t('Authentication error')
505
+						'message' => (string) $this->l10n->t('Authentication error')
506 506
 					]
507 507
 				],
508 508
 				Http::STATUS_FORBIDDEN
@@ -527,7 +527,7 @@  discard block
 block discarded – undo
527 527
 			[
528 528
 				'status' => 'error',
529 529
 				'data' => [
530
-					'message' => (string)$this->l10n->t('Unable to delete user.')
530
+					'message' => (string) $this->l10n->t('Unable to delete user.')
531 531
 				]
532 532
 			],
533 533
 			Http::STATUS_FORBIDDEN
@@ -542,11 +542,11 @@  discard block
 block discarded – undo
542 542
 	 * @return DataResponse
543 543
 	 */
544 544
 	public function setEnabled($id, $enabled) {
545
-		$enabled = (bool)$enabled;
545
+		$enabled = (bool) $enabled;
546 546
 		if ($enabled) {
547
-			$errorMsgGeneral = (string)$this->l10n->t('Error while enabling user.');
547
+			$errorMsgGeneral = (string) $this->l10n->t('Error while enabling user.');
548 548
 		} else {
549
-			$errorMsgGeneral = (string)$this->l10n->t('Error while disabling user.');
549
+			$errorMsgGeneral = (string) $this->l10n->t('Error while disabling user.');
550 550
 		}
551 551
 
552 552
 		$userId = $this->userSession->getUser()->getUID();
@@ -569,7 +569,7 @@  discard block
 block discarded – undo
569 569
 					[
570 570
 						'status' => 'error',
571 571
 						'data' => [
572
-							'message' => (string)$this->l10n->t('Authentication error')
572
+							'message' => (string) $this->l10n->t('Authentication error')
573 573
 						]
574 574
 					],
575 575
 					Http::STATUS_FORBIDDEN
@@ -621,11 +621,11 @@  discard block
 block discarded – undo
621 621
 
622 622
 		$accountData = $this->accountManager->getUser($user);
623 623
 		$cloudId = $user->getCloudId();
624
-		$message = "Use my Federated Cloud ID to share with me: " . $cloudId;
624
+		$message = "Use my Federated Cloud ID to share with me: ".$cloudId;
625 625
 		$signature = $this->signMessage($user, $message);
626 626
 
627
-		$code = $message . ' ' . $signature;
628
-		$codeMd5 = $message . ' ' . md5($signature);
627
+		$code = $message.' '.$signature;
628
+		$codeMd5 = $message.' '.md5($signature);
629 629
 
630 630
 		switch ($account) {
631 631
 			case 'verify-twitter':
@@ -730,7 +730,7 @@  discard block
 block discarded – undo
730 730
 				[
731 731
 					'status' => 'error',
732 732
 					'data' => [
733
-						'message' => (string)$this->l10n->t('Invalid mail address')
733
+						'message' => (string) $this->l10n->t('Invalid mail address')
734 734
 					]
735 735
 				],
736 736
 				Http::STATUS_UNPROCESSABLE_ENTITY
@@ -774,7 +774,7 @@  discard block
 block discarded – undo
774 774
 						'websiteScope' => $data[AccountManager::PROPERTY_WEBSITE]['scope'],
775 775
 						'address' => $data[AccountManager::PROPERTY_ADDRESS]['value'],
776 776
 						'addressScope' => $data[AccountManager::PROPERTY_ADDRESS]['scope'],
777
-						'message' => (string)$this->l10n->t('Settings saved')
777
+						'message' => (string) $this->l10n->t('Settings saved')
778 778
 					]
779 779
 				],
780 780
 				Http::STATUS_OK
@@ -945,7 +945,7 @@  discard block
 block discarded – undo
945 945
 				[
946 946
 					'status' => 'error',
947 947
 					'data' => [
948
-						'message' => (string)$this->l10n->t('Forbidden')
948
+						'message' => (string) $this->l10n->t('Forbidden')
949 949
 					]
950 950
 				],
951 951
 				Http::STATUS_FORBIDDEN
@@ -957,7 +957,7 @@  discard block
 block discarded – undo
957 957
 				[
958 958
 					'status' => 'error',
959 959
 					'data' => [
960
-						'message' => (string)$this->l10n->t('Invalid mail address')
960
+						'message' => (string) $this->l10n->t('Invalid mail address')
961 961
 					]
962 962
 				],
963 963
 				Http::STATUS_UNPROCESSABLE_ENTITY
@@ -969,7 +969,7 @@  discard block
 block discarded – undo
969 969
 				[
970 970
 					'status' => 'error',
971 971
 					'data' => [
972
-						'message' => (string)$this->l10n->t('Invalid user')
972
+						'message' => (string) $this->l10n->t('Invalid user')
973 973
 					]
974 974
 				],
975 975
 				Http::STATUS_UNPROCESSABLE_ENTITY
@@ -982,7 +982,7 @@  discard block
 block discarded – undo
982 982
 				[
983 983
 					'status' => 'error',
984 984
 					'data' => [
985
-						'message' => (string)$this->l10n->t('Unable to change mail address')
985
+						'message' => (string) $this->l10n->t('Unable to change mail address')
986 986
 					]
987 987
 				],
988 988
 				Http::STATUS_FORBIDDEN
@@ -1000,7 +1000,7 @@  discard block
 block discarded – undo
1000 1000
 					'data' => [
1001 1001
 						'username' => $id,
1002 1002
 						'mailAddress' => $mailAddress,
1003
-						'message' => (string)$this->l10n->t('Email saved')
1003
+						'message' => (string) $this->l10n->t('Email saved')
1004 1004
 					]
1005 1005
 				],
1006 1006
 				Http::STATUS_OK
Please login to merge, or discard this patch.
settings/templates/users/part.userlist.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -1,15 +1,15 @@  discard block
 block discarded – undo
1
-<table id="userlist" class="hascontrols grid" data-groups="<?php p($_['allGroups']);?>">
1
+<table id="userlist" class="hascontrols grid" data-groups="<?php p($_['allGroups']); ?>">
2 2
 	<thead>
3 3
 		<tr>
4 4
 			<th id="headerAvatar" scope="col"></th>
5 5
 			<th id="headerName" scope="col"><?php p($l->t('Username'))?></th>
6
-			<th id="headerDisplayName" scope="col"><?php p($l->t( 'Full name' )); ?></th>
7
-			<th id="headerPassword" scope="col"><?php p($l->t( 'Password' )); ?></th>
8
-			<th class="mailAddress" scope="col"><?php p($l->t( 'Email' )); ?></th>
9
-			<th id="headerGroups" scope="col"><?php p($l->t( 'Groups' )); ?></th>
10
-		<?php if(is_array($_['subadmins']) || $_['subadmins']): ?>
6
+			<th id="headerDisplayName" scope="col"><?php p($l->t('Full name')); ?></th>
7
+			<th id="headerPassword" scope="col"><?php p($l->t('Password')); ?></th>
8
+			<th class="mailAddress" scope="col"><?php p($l->t('Email')); ?></th>
9
+			<th id="headerGroups" scope="col"><?php p($l->t('Groups')); ?></th>
10
+		<?php if (is_array($_['subadmins']) || $_['subadmins']): ?>
11 11
 			<th id="headerSubAdmins" scope="col"><?php p($l->t('Group admin for')); ?></th>
12
-		<?php endif;?>
12
+		<?php endif; ?>
13 13
 			<th id="headerQuota" scope="col"><?php p($l->t('Quota')); ?></th>
14 14
 			<th class="storageLocation" scope="col"><?php p($l->t('Storage location')); ?></th>
15 15
 			<th class="userBackend" scope="col"><?php p($l->t('User backend')); ?></th>
@@ -37,27 +37,27 @@  discard block
 block discarded – undo
37 37
 			<td class="groups"><div class="groupsListContainer multiselect button"
38 38
 				><span class="title groupsList"></span><span class="icon-triangle-s"></span></div>
39 39
 			</td>
40
-		<?php if(is_array($_['subadmins']) || $_['subadmins']): ?>
40
+		<?php if (is_array($_['subadmins']) || $_['subadmins']): ?>
41 41
 			<td class="subadmins"><div class="groupsListContainer multiselect button"
42 42
 				><span class="title groupsList"></span><span class="icon-triangle-s"></span></div>
43 43
 			</td>
44
-		<?php endif;?>
44
+		<?php endif; ?>
45 45
 			<td class="quota">
46 46
 				<div class="quota_progress_container"><div class="quota_progress"></div></div>
47 47
 				<select class="quota-user" data-inputtitle="<?php p($l->t('Please enter storage quota (ex: "512 MB" or "12 GB")')) ?>">
48 48
 					<option	value='default'>
49
-						<?php p($l->t('Default'));?>
49
+						<?php p($l->t('Default')); ?>
50 50
 					</option>
51 51
 					<option value='none'>
52
-						<?php p($l->t('Unlimited'));?>
52
+						<?php p($l->t('Unlimited')); ?>
53 53
 					</option>
54
-					<?php foreach($_['quota_preset'] as $preset):?>
55
-						<option value='<?php p($preset);?>'>
56
-							<?php p($preset);?>
54
+					<?php foreach ($_['quota_preset'] as $preset):?>
55
+						<option value='<?php p($preset); ?>'>
56
+							<?php p($preset); ?>
57 57
 						</option>
58
-					<?php endforeach;?>
58
+					<?php endforeach; ?>
59 59
 					<option value='other' data-new>
60
-						<?php p($l->t('Other'));?> ...
60
+						<?php p($l->t('Other')); ?> ...
61 61
 					</option>
62 62
 				</select>
63 63
 			</td>
Please login to merge, or discard this patch.