Completed
Pull Request — master (#6788)
by Markus
14:10
created
lib/private/Security/RateLimiting/Limiter.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -60,8 +60,8 @@  discard block
 block discarded – undo
60 60
 							  $userIdentifier,
61 61
 							  $period,
62 62
 							  $limit) {
63
-		$existingAttempts = $this->backend->getAttempts($methodIdentifier, $userIdentifier, (int)$period);
64
-		if ($existingAttempts >= (int)$limit) {
63
+		$existingAttempts = $this->backend->getAttempts($methodIdentifier, $userIdentifier, (int) $period);
64
+		if ($existingAttempts >= (int) $limit) {
65 65
 			throw new RateLimitExceededException();
66 66
 		}
67 67
 
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 										$ip) {
84 84
 		$ipSubnet = (new IpAddress($ip))->getSubnet();
85 85
 
86
-		$anonHashIdentifier = hash('sha512', 'anon::' . $identifier . $ipSubnet);
86
+		$anonHashIdentifier = hash('sha512', 'anon::'.$identifier.$ipSubnet);
87 87
 		$this->register($identifier, $anonHashIdentifier, $anonPeriod, $anonLimit);
88 88
 	}
89 89
 
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 										$userLimit,
101 101
 										$userPeriod,
102 102
 										IUser $user) {
103
-		$userHashIdentifier = hash('sha512', 'user::' . $identifier . $user->getUID());
103
+		$userHashIdentifier = hash('sha512', 'user::'.$identifier.$user->getUID());
104 104
 		$this->register($identifier, $userHashIdentifier, $userPeriod, $userLimit);
105 105
 	}
106 106
 }
Please login to merge, or discard this patch.
lib/private/AppFramework/Utility/ControllerMethodReflector.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -40,19 +40,19 @@  discard block
 block discarded – undo
40 40
 	 * @param object $object an object or classname
41 41
 	 * @param string $method the method which we want to inspect
42 42
 	 */
43
-	public function reflect($object, $method){
43
+	public function reflect($object, $method) {
44 44
 		$reflection = new \ReflectionMethod($object, $method);
45 45
 		$docs = $reflection->getDocComment();
46 46
 
47 47
 		// extract everything prefixed by @ and first letter uppercase
48 48
 		preg_match_all('/^\h+\*\h+@(?P<annotation>[A-Z]\w+)((?P<parameter>.*))?$/m', $docs, $matches);
49
-		foreach($matches['annotation'] as $key => $annontation) {
49
+		foreach ($matches['annotation'] as $key => $annontation) {
50 50
 			$annotationValue = $matches['parameter'][$key];
51
-			if(isset($annotationValue[0]) && $annotationValue[0] === '(' && $annotationValue[strlen($annotationValue) - 1] === ')') {
51
+			if (isset($annotationValue[0]) && $annotationValue[0] === '(' && $annotationValue[strlen($annotationValue) - 1] === ')') {
52 52
 				$cutString = substr($annotationValue, 1, -1);
53 53
 				$cutString = str_replace(' ', '', $cutString);
54 54
 				$splittedArray = explode(',', $cutString);
55
-				foreach($splittedArray as $annotationValues) {
55
+				foreach ($splittedArray as $annotationValues) {
56 56
 					list($key, $value) = explode('=', $annotationValues);
57 57
 					$this->annotations[$annontation][$key] = $value;
58 58
 				}
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 				}
77 77
 			}
78 78
 
79
-			if($param->isOptional()) {
79
+			if ($param->isOptional()) {
80 80
 				$default = $param->getDefaultValue();
81 81
 			} else {
82 82
 				$default = null;
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 	 * would return int or null if not existing
94 94
 	 */
95 95
 	public function getType($parameter) {
96
-		if(array_key_exists($parameter, $this->types)) {
96
+		if (array_key_exists($parameter, $this->types)) {
97 97
 			return $this->types[$parameter];
98 98
 		} else {
99 99
 			return null;
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 	 * @return string
125 125
 	 */
126 126
 	public function getAnnotationParameter($name, $key) {
127
-		if(isset($this->annotations[$name][$key])) {
127
+		if (isset($this->annotations[$name][$key])) {
128 128
 			return $this->annotations[$name][$key];
129 129
 		}
130 130
 
Please login to merge, or discard this patch.
lib/private/AppFramework/Middleware/Security/RateLimitingMiddleware.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -84,8 +84,8 @@  discard block
 block discarded – undo
84 84
 		$anonPeriod = $this->reflector->getAnnotationParameter('AnonRateThrottle', 'period');
85 85
 		$userLimit = $this->reflector->getAnnotationParameter('UserRateThrottle', 'limit');
86 86
 		$userPeriod = $this->reflector->getAnnotationParameter('UserRateThrottle', 'period');
87
-		$rateLimitIdentifier = get_class($controller) . '::' . $methodName;
88
-		if($userLimit !== '' && $userPeriod !== '' && $this->userSession->isLoggedIn()) {
87
+		$rateLimitIdentifier = get_class($controller).'::'.$methodName;
88
+		if ($userLimit !== '' && $userPeriod !== '' && $this->userSession->isLoggedIn()) {
89 89
 			$this->limiter->registerUserRequest(
90 90
 				$rateLimitIdentifier,
91 91
 				$userLimit,
@@ -106,8 +106,8 @@  discard block
 block discarded – undo
106 106
 	 * {@inheritDoc}
107 107
 	 */
108 108
 	public function afterException($controller, $methodName, \Exception $exception) {
109
-		if($exception instanceof RateLimitExceededException) {
110
-			if (stripos($this->request->getHeader('Accept'),'html') === false) {
109
+		if ($exception instanceof RateLimitExceededException) {
110
+			if (stripos($this->request->getHeader('Accept'), 'html') === false) {
111 111
 				$response = new JSONResponse(
112 112
 					[
113 113
 						'message' => $exception->getMessage(),
Please login to merge, or discard this patch.
lib/private/Security/RateLimiting/Backend/MemoryCache.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 	 */
55 55
 	private function hash($methodIdentifier,
56 56
 						  $userIdentifier) {
57
-		return hash('sha512', $methodIdentifier . $userIdentifier);
57
+		return hash('sha512', $methodIdentifier.$userIdentifier);
58 58
 	}
59 59
 
60 60
 	/**
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 	 */
64 64
 	private function getExistingAttempts($identifier) {
65 65
 		$cachedAttempts = json_decode($this->cache->get($identifier), true);
66
-		if(is_array($cachedAttempts)) {
66
+		if (is_array($cachedAttempts)) {
67 67
 			return $cachedAttempts;
68 68
 		}
69 69
 
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 		$currentTime = $this->timeFactory->getTime();
84 84
 		/** @var array $existingAttempts */
85 85
 		foreach ($existingAttempts as $attempt) {
86
-			if(($attempt + $seconds) > $currentTime) {
86
+			if (($attempt + $seconds) > $currentTime) {
87 87
 				$count++;
88 88
 			}
89 89
 		}
@@ -103,14 +103,14 @@  discard block
 block discarded – undo
103 103
 
104 104
 		// Unset all attempts older than $period
105 105
 		foreach ($existingAttempts as $key => $attempt) {
106
-			if(($attempt + $period) < $currentTime) {
106
+			if (($attempt + $period) < $currentTime) {
107 107
 				unset($existingAttempts[$key]);
108 108
 			}
109 109
 		}
110 110
 		$existingAttempts = array_values($existingAttempts);
111 111
 
112 112
 		// Store the new attempt
113
-		$existingAttempts[] = (string)$currentTime;
113
+		$existingAttempts[] = (string) $currentTime;
114 114
 		$this->cache->set($identifier, json_encode($existingAttempts));
115 115
 	}
116 116
 }
Please login to merge, or discard this patch.
lib/private/AppFramework/Middleware/Security/BruteForceMiddleware.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 	public function beforeController($controller, $methodName) {
62 62
 		parent::beforeController($controller, $methodName);
63 63
 
64
-		if($this->reflector->hasAnnotation('BruteForceProtection')) {
64
+		if ($this->reflector->hasAnnotation('BruteForceProtection')) {
65 65
 			$action = $this->reflector->getAnnotationParameter('BruteForceProtection', 'action');
66 66
 			$this->throttler->sleepDelay($this->request->getRemoteAddress(), $action);
67 67
 		}
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 	 * {@inheritDoc}
72 72
 	 */
73 73
 	public function afterController($controller, $methodName, Response $response) {
74
-		if($this->reflector->hasAnnotation('BruteForceProtection') && $response->isThrottled()) {
74
+		if ($this->reflector->hasAnnotation('BruteForceProtection') && $response->isThrottled()) {
75 75
 			$action = $this->reflector->getAnnotationParameter('BruteForceProtection', 'action');
76 76
 			$ip = $this->request->getRemoteAddress();
77 77
 			$this->throttler->sleepDelay($ip, $action);
Please login to merge, or discard this patch.
apps/federatedfilesharing/lib/Controller/MountPublicLinkController.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
 		$storedPassword = $share->getPassword();
148 148
 		$authenticated = $this->session->get('public_link_authenticated') === $share->getId() ||
149 149
 			$this->shareManager->checkPassword($share, $password);
150
-		if (!empty($storedPassword) && !$authenticated ) {
150
+		if (!empty($storedPassword) && !$authenticated) {
151 151
 			$response = new JSONResponse(
152 152
 				['message' => 'No permission to access the share'],
153 153
 				Http::STATUS_BAD_REQUEST
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
 		$httpClient = $this->clientService->newClient();
192 192
 
193 193
 		try {
194
-			$response = $httpClient->post($remote . '/index.php/apps/federatedfilesharing/createFederatedShare',
194
+			$response = $httpClient->post($remote.'/index.php/apps/federatedfilesharing/createFederatedShare',
195 195
 				[
196 196
 					'body' =>
197 197
 						[
@@ -285,14 +285,14 @@  discard block
 block discarded – undo
285 285
 			// note: checkStorageAvailability will already remove the invalid share
286 286
 			Util::writeLog(
287 287
 				'federatedfilesharing',
288
-				'Invalid remote storage: ' . get_class($e) . ': ' . $e->getMessage(),
288
+				'Invalid remote storage: '.get_class($e).': '.$e->getMessage(),
289 289
 				Util::DEBUG
290 290
 			);
291 291
 			return new JSONResponse(['message' => $this->l->t('Could not authenticate to remote share, password might be wrong')], Http::STATUS_BAD_REQUEST);
292 292
 		} catch (\Exception $e) {
293 293
 			Util::writeLog(
294 294
 				'federatedfilesharing',
295
-				'Invalid remote storage: ' . get_class($e) . ': ' . $e->getMessage(),
295
+				'Invalid remote storage: '.get_class($e).': '.$e->getMessage(),
296 296
 				Util::DEBUG
297 297
 			);
298 298
 			$externalManager->removeShare($mount->getMountPoint());
@@ -311,14 +311,14 @@  discard block
 block discarded – undo
311 311
 			} catch (StorageInvalidException $e) {
312 312
 				Util::writeLog(
313 313
 					'federatedfilesharing',
314
-					'Invalid remote storage: ' . get_class($e) . ': ' . $e->getMessage(),
314
+					'Invalid remote storage: '.get_class($e).': '.$e->getMessage(),
315 315
 					Util::DEBUG
316 316
 				);
317 317
 				return new JSONResponse(['message' => $this->l->t('Storage not valid')], Http::STATUS_BAD_REQUEST);
318 318
 			} catch (\Exception $e) {
319 319
 				Util::writeLog(
320 320
 					'federatedfilesharing',
321
-					'Invalid remote storage: ' . get_class($e) . ': ' . $e->getMessage(),
321
+					'Invalid remote storage: '.get_class($e).': '.$e->getMessage(),
322 322
 					Util::DEBUG
323 323
 				);
324 324
 				return new JSONResponse(['message' => $this->l->t('Couldn\'t add remote share')], Http::STATUS_BAD_REQUEST);
Please login to merge, or discard this patch.
settings/templates/users/part.grouplist.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -28,33 +28,33 @@
 block discarded – undo
28 28
 	</li>
29 29
 
30 30
 	<!-- The Admin Group -->
31
-	<?php foreach($_["adminGroup"] as $adminGroup): ?>
32
-		<li data-gid="admin" data-usercount="<?php if($adminGroup['usercount'] > 0) { p($adminGroup['usercount']); } ?>" class="isgroup">
31
+	<?php foreach ($_["adminGroup"] as $adminGroup): ?>
32
+		<li data-gid="admin" data-usercount="<?php if ($adminGroup['usercount'] > 0) { p($adminGroup['usercount']); } ?>" class="isgroup">
33 33
 			<a href="#"><span class="groupname"><?php p($l->t('Admins')); ?></span></a>
34 34
 			<span class="utils">
35
-				<span class="usercount"><?php if($adminGroup['usercount'] > 0) { p($adminGroup['usercount']); } ?></span>
35
+				<span class="usercount"><?php if ($adminGroup['usercount'] > 0) { p($adminGroup['usercount']); } ?></span>
36 36
 			</span>
37 37
 		</li>
38 38
 	<?php endforeach; ?>
39 39
 
40 40
 	<!-- Disabled Users -->
41 41
 	<?php $disabledUsersGroup = $_["disabledUsersGroup"] ?>
42
-	<li data-gid="_disabledUsers" data-usercount="<?php if($disabledUsersGroup['usercount'] > 0) { p($disabledUsersGroup['usercount']); } ?>" class="isgroup">
42
+	<li data-gid="_disabledUsers" data-usercount="<?php if ($disabledUsersGroup['usercount'] > 0) { p($disabledUsersGroup['usercount']); } ?>" class="isgroup">
43 43
 		<a href="#"><span class="groupname"><?php p($l->t('Disabled')); ?></span></a>
44 44
 		<span class="utils">
45
-			<span class="usercount"><?php if($disabledUsersGroup['usercount'] > 0) { p($disabledUsersGroup['usercount']); } ?></span>
45
+			<span class="usercount"><?php if ($disabledUsersGroup['usercount'] > 0) { p($disabledUsersGroup['usercount']); } ?></span>
46 46
 		</span>
47 47
 	</li>
48 48
 
49 49
 	<!--List of Groups-->
50
-	<?php foreach($_["groups"] as $group): ?>
50
+	<?php foreach ($_["groups"] as $group): ?>
51 51
 		<li data-gid="<?php p($group['name']) ?>" data-usercount="<?php p($group['usercount']) ?>" class="isgroup">
52 52
 			<a href="#" class="dorename">
53 53
 				<span class="groupname"><?php p($group['name']); ?></span>
54 54
 			</a>
55 55
 			<span class="utils">
56
-				<span class="usercount"><?php if($group['usercount'] > 0) { p($group['usercount']); } ?></span>
57
-				<?php if($_['isAdmin']): ?>
56
+				<span class="usercount"><?php if ($group['usercount'] > 0) { p($group['usercount']); } ?></span>
57
+				<?php if ($_['isAdmin']): ?>
58 58
 				<a href="#" class="action delete" original-title="<?php p($l->t('Delete'))?>">
59 59
 					<img src="<?php print_unescaped(image_path('core', 'actions/delete.svg')) ?>" />
60 60
 				</a>
Please login to merge, or discard this patch.
apps/files_external/lib/Controller/UserStoragesController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -198,7 +198,7 @@
 block discarded – undo
198 198
 		} catch (NotFoundException $e) {
199 199
 			return new DataResponse(
200 200
 				[
201
-					'message' => (string)$this->l10n->t('Storage with ID "%d" not found', array($id))
201
+					'message' => (string) $this->l10n->t('Storage with ID "%d" not found', array($id))
202 202
 				],
203 203
 				Http::STATUS_NOT_FOUND
204 204
 			);
Please login to merge, or discard this patch.
apps/files_external/lib/Controller/StoragesController.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 			$this->logger->logException($e);
128 128
 			return new DataResponse(
129 129
 				[
130
-					'message' => (string)$this->l10n->t('Invalid backend or authentication mechanism class')
130
+					'message' => (string) $this->l10n->t('Invalid backend or authentication mechanism class')
131 131
 				],
132 132
 				Http::STATUS_UNPROCESSABLE_ENTITY
133 133
 			);
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 		if ($mountPoint === '') {
147 147
 			return new DataResponse(
148 148
 				array(
149
-					'message' => (string)$this->l10n->t('Invalid mount point')
149
+					'message' => (string) $this->l10n->t('Invalid mount point')
150 150
 				),
151 151
 				Http::STATUS_UNPROCESSABLE_ENTITY
152 152
 			);
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
 			// objectstore must not be sent from client side
157 157
 			return new DataResponse(
158 158
 				array(
159
-					'message' => (string)$this->l10n->t('Objectstore forbidden')
159
+					'message' => (string) $this->l10n->t('Objectstore forbidden')
160 160
 				),
161 161
 				Http::STATUS_UNPROCESSABLE_ENTITY
162 162
 			);
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 			// invalid backend
171 171
 			return new DataResponse(
172 172
 				array(
173
-					'message' => (string)$this->l10n->t('Invalid storage backend "%s"', [
173
+					'message' => (string) $this->l10n->t('Invalid storage backend "%s"', [
174 174
 						$backend->getIdentifier()
175 175
 					])
176 176
 				),
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 			// not permitted to use backend
183 183
 			return new DataResponse(
184 184
 				array(
185
-					'message' => (string)$this->l10n->t('Not permitted to use backend "%s"', [
185
+					'message' => (string) $this->l10n->t('Not permitted to use backend "%s"', [
186 186
 						$backend->getIdentifier()
187 187
 					])
188 188
 				),
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
 			// not permitted to use auth mechanism
194 194
 			return new DataResponse(
195 195
 				array(
196
-					'message' => (string)$this->l10n->t('Not permitted to use authentication mechanism "%s"', [
196
+					'message' => (string) $this->l10n->t('Not permitted to use authentication mechanism "%s"', [
197 197
 						$authMechanism->getIdentifier()
198 198
 					])
199 199
 				),
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
 			// unsatisfied parameters
206 206
 			return new DataResponse(
207 207
 				array(
208
-					'message' => (string)$this->l10n->t('Unsatisfied backend parameters')
208
+					'message' => (string) $this->l10n->t('Unsatisfied backend parameters')
209 209
 				),
210 210
 				Http::STATUS_UNPROCESSABLE_ENTITY
211 211
 			);
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 			// unsatisfied parameters
215 215
 			return new DataResponse(
216 216
 				[
217
-					'message' => (string)$this->l10n->t('Unsatisfied authentication mechanism parameters')
217
+					'message' => (string) $this->l10n->t('Unsatisfied authentication mechanism parameters')
218 218
 				],
219 219
 				Http::STATUS_UNPROCESSABLE_ENTITY
220 220
 			);
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
 	 * @param StorageConfig $storage storage configuration
242 242
 	 * @param bool $testOnly whether to storage should only test the connection or do more things
243 243
 	 */
244
-	protected function updateStorageStatus(StorageConfig &$storage, $testOnly = true) {
244
+	protected function updateStorageStatus(StorageConfig & $storage, $testOnly = true) {
245 245
 		try {
246 246
 			$this->manipulateStorageConfig($storage);
247 247
 
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
 		} catch (NotFoundException $e) {
307 307
 			return new DataResponse(
308 308
 				[
309
-					'message' => (string)$this->l10n->t('Storage with ID "%d" not found', array($id))
309
+					'message' => (string) $this->l10n->t('Storage with ID "%d" not found', array($id))
310 310
 				],
311 311
 				Http::STATUS_NOT_FOUND
312 312
 			);
@@ -331,7 +331,7 @@  discard block
 block discarded – undo
331 331
 		} catch (NotFoundException $e) {
332 332
 			return new DataResponse(
333 333
 				[
334
-					'message' => (string)$this->l10n->t('Storage with ID "%d" not found', array($id))
334
+					'message' => (string) $this->l10n->t('Storage with ID "%d" not found', array($id))
335 335
 				],
336 336
 				Http::STATUS_NOT_FOUND
337 337
 			);
Please login to merge, or discard this patch.