Completed
Pull Request — master (#4106)
by Blizzz
15:12 queued 15s
created
apps/federatedfilesharing/lib/DiscoveryManager.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 	 * @return bool
63 63
 	 */
64 64
 	private function isSafeUrl($url) {
65
-		return (bool)preg_match('/^[\/\.A-Za-z0-9]+$/', $url);
65
+		return (bool) preg_match('/^[\/\.A-Za-z0-9]+$/', $url);
66 66
 	}
67 67
 
68 68
 	/**
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 	 */
77 77
 	private function discover($remote) {
78 78
 		// Check if something is in the cache
79
-		if($cacheData = $this->cache->get($remote)) {
79
+		if ($cacheData = $this->cache->get($remote)) {
80 80
 			return json_decode($cacheData, true);
81 81
 		}
82 82
 
@@ -88,22 +88,22 @@  discard block
 block discarded – undo
88 88
 
89 89
 		// Read the data from the response body
90 90
 		try {
91
-			$response = $this->client->get($remote . '/ocs-provider/', [
91
+			$response = $this->client->get($remote.'/ocs-provider/', [
92 92
 				'timeout' => 10,
93 93
 				'connect_timeout' => 10,
94 94
 			]);
95
-			if($response->getStatusCode() === 200) {
95
+			if ($response->getStatusCode() === 200) {
96 96
 				$decodedService = json_decode($response->getBody(), true);
97
-				if(is_array($decodedService)) {
97
+				if (is_array($decodedService)) {
98 98
 					$endpoints = [
99 99
 						'webdav',
100 100
 						'share',
101 101
 					];
102 102
 
103
-					foreach($endpoints as $endpoint) {
104
-						if(isset($decodedService['services']['FEDERATED_SHARING']['endpoints'][$endpoint])) {
105
-							$endpointUrl = (string)$decodedService['services']['FEDERATED_SHARING']['endpoints'][$endpoint];
106
-							if($this->isSafeUrl($endpointUrl)) {
103
+					foreach ($endpoints as $endpoint) {
104
+						if (isset($decodedService['services']['FEDERATED_SHARING']['endpoints'][$endpoint])) {
105
+							$endpointUrl = (string) $decodedService['services']['FEDERATED_SHARING']['endpoints'][$endpoint];
106
+							if ($this->isSafeUrl($endpointUrl)) {
107 107
 								$discoveredServices[$endpoint] = $endpointUrl;
108 108
 							}
109 109
 						}
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
 			return new JSONResponse(
152 152
 				['message' => 'No permission to access the share'],
153 153
 				Http::STATUS_BAD_REQUEST
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
 		$httpClient = $this->clientService->newClient();
190 190
 
191 191
 		try {
192
-			$response = $httpClient->post($remote . '/index.php/apps/federatedfilesharing/createFederatedShare',
192
+			$response = $httpClient->post($remote.'/index.php/apps/federatedfilesharing/createFederatedShare',
193 193
 				[
194 194
 					'body' =>
195 195
 						[
@@ -287,14 +287,14 @@  discard block
 block discarded – undo
287 287
 			// note: checkStorageAvailability will already remove the invalid share
288 288
 			Util::writeLog(
289 289
 				'federatedfilesharing',
290
-				'Invalid remote storage: ' . get_class($e) . ': ' . $e->getMessage(),
290
+				'Invalid remote storage: '.get_class($e).': '.$e->getMessage(),
291 291
 				Util::DEBUG
292 292
 			);
293 293
 			return new JSONResponse(['message' => $this->l->t('Could not authenticate to remote share, password might be wrong')], Http::STATUS_BAD_REQUEST);
294 294
 		} catch (\Exception $e) {
295 295
 			Util::writeLog(
296 296
 				'federatedfilesharing',
297
-				'Invalid remote storage: ' . get_class($e) . ': ' . $e->getMessage(),
297
+				'Invalid remote storage: '.get_class($e).': '.$e->getMessage(),
298 298
 				Util::DEBUG
299 299
 			);
300 300
 			$externalManager->removeShare($mount->getMountPoint());
@@ -313,14 +313,14 @@  discard block
 block discarded – undo
313 313
 			} catch (StorageInvalidException $e) {
314 314
 				Util::writeLog(
315 315
 					'federatedfilesharing',
316
-					'Invalid remote storage: ' . get_class($e) . ': ' . $e->getMessage(),
316
+					'Invalid remote storage: '.get_class($e).': '.$e->getMessage(),
317 317
 					Util::DEBUG
318 318
 				);
319 319
 				return new JSONResponse(['message' => $this->l->t('Storage not valid')], Http::STATUS_BAD_REQUEST);
320 320
 			} catch (\Exception $e) {
321 321
 				Util::writeLog(
322 322
 					'federatedfilesharing',
323
-					'Invalid remote storage: ' . get_class($e) . ': ' . $e->getMessage(),
323
+					'Invalid remote storage: '.get_class($e).': '.$e->getMessage(),
324 324
 					Util::DEBUG
325 325
 				);
326 326
 				return new JSONResponse(['message' => $this->l->t('Couldn\'t add remote share')], Http::STATUS_BAD_REQUEST);
Please login to merge, or discard this patch.
apps/federatedfilesharing/lib/BackgroundJob/RetryJob.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 		$token = $argument['token'];
106 106
 		$action = $argument['action'];
107 107
 		$data = json_decode($argument['data'], true);
108
-		$try = (int)$argument['try'] + 1;
108
+		$try = (int) $argument['try'] + 1;
109 109
 
110 110
 		$result = $this->notifications->sendUpdateToRemote($remote, $remoteId, $token, $action, $data, $try);
111 111
 		
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 				'token' => $argument['token'],
129 129
 				'data' => $argument['data'],
130 130
 				'action' => $argument['action'],
131
-				'try' => (int)$argument['try'] + 1,
131
+				'try' => (int) $argument['try'] + 1,
132 132
 				'lastRun' => time()
133 133
 			]
134 134
 		);
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 	 * @return bool
142 142
 	 */
143 143
 	protected function shouldRun(array $argument) {
144
-		$lastRun = (int)$argument['lastRun'];
144
+		$lastRun = (int) $argument['lastRun'];
145 145
 		return ((time() - $lastRun) > $this->interval);
146 146
 	}
147 147
 
Please login to merge, or discard this patch.
apps/federatedfilesharing/lib/TokenHandler.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@
 block discarded – undo
55 55
 	public function generateToken() {
56 56
 		$token = $this->secureRandom->generate(
57 57
 			self::TOKEN_LENGTH,
58
-			ISecureRandom::CHAR_LOWER . ISecureRandom::CHAR_UPPER . ISecureRandom::CHAR_DIGITS);
58
+			ISecureRandom::CHAR_LOWER.ISecureRandom::CHAR_UPPER.ISecureRandom::CHAR_DIGITS);
59 59
 		return $token;
60 60
 	}
61 61
 
Please login to merge, or discard this patch.
apps/federation/templates/settings-admin.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 	<em><?php p($l->t('Federation allows you to connect with other trusted servers to exchange the user directory. For example this will be used to auto-complete external users for federated sharing.')); ?></em>
12 12
 
13 13
 	<p>
14
-		<input id="autoAddServers" type="checkbox" class="checkbox" <?php if($_['autoAddServers']) p('checked'); ?> />
14
+		<input id="autoAddServers" type="checkbox" class="checkbox" <?php if ($_['autoAddServers']) p('checked'); ?> />
15 15
 		<label for="autoAddServers"><?php p($l->t('Add server automatically once a federated share was created successfully')); ?></label>
16 16
 	</p>
17 17
 
@@ -23,14 +23,14 @@  discard block
 block discarded – undo
23 23
 		<span class="msg"></span>
24 24
 	</p>
25 25
 	<ul id="listOfTrustedServers">
26
-		<?php foreach($_['trustedServers'] as $trustedServer) { ?>
26
+		<?php foreach ($_['trustedServers'] as $trustedServer) { ?>
27 27
 			<li id="<?php p($trustedServer['id']); ?>">
28
-				<?php if((int)$trustedServer['status'] === TrustedServers::STATUS_OK) { ?>
28
+				<?php if ((int) $trustedServer['status'] === TrustedServers::STATUS_OK) { ?>
29 29
 					<span class="status success"></span>
30 30
 				<?php
31
-				} elseif(
32
-					(int)$trustedServer['status'] === TrustedServers::STATUS_PENDING ||
33
-					(int)$trustedServer['status'] === TrustedServers::STATUS_ACCESS_REVOKED
31
+				} elseif (
32
+					(int) $trustedServer['status'] === TrustedServers::STATUS_PENDING ||
33
+					(int) $trustedServer['status'] === TrustedServers::STATUS_ACCESS_REVOKED
34 34
 				) { ?>
35 35
 					<span class="status indeterminate"></span>
36 36
 				<?php } else {?>
Please login to merge, or discard this patch.
apps/federation/lib/Controller/OCSAuthAPIController.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
  *
45 45
  * @package OCA\Federation\Controller
46 46
  */
47
-class OCSAuthAPIController extends OCSController{
47
+class OCSAuthAPIController extends OCSController {
48 48
 
49 49
 	/** @var ISecureRandom  */
50 50
 	private $secureRandom;
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 	 */
104 104
 	public function requestSharedSecret($url, $token) {
105 105
 		if ($this->trustedServers->isTrustedServer($url) === false) {
106
-			$this->logger->error('remote server not trusted (' . $url . ') while requesting shared secret', ['app' => 'federation']);
106
+			$this->logger->error('remote server not trusted ('.$url.') while requesting shared secret', ['app' => 'federation']);
107 107
 			throw new OCSForbiddenException();
108 108
 		}
109 109
 
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 		$localToken = $this->dbHandler->getToken($url);
113 113
 		if (strcmp($localToken, $token) > 0) {
114 114
 			$this->logger->info(
115
-				'remote server (' . $url . ') presented lower token. We will initiate the exchange of the shared secret.',
115
+				'remote server ('.$url.') presented lower token. We will initiate the exchange of the shared secret.',
116 116
 				['app' => 'federation']
117 117
 			);
118 118
 			throw new OCSForbiddenException();
@@ -151,14 +151,14 @@  discard block
 block discarded – undo
151 151
 	 */
152 152
 	public function getSharedSecret($url, $token) {
153 153
 		if ($this->trustedServers->isTrustedServer($url) === false) {
154
-			$this->logger->error('remote server not trusted (' . $url . ') while getting shared secret', ['app' => 'federation']);
154
+			$this->logger->error('remote server not trusted ('.$url.') while getting shared secret', ['app' => 'federation']);
155 155
 			throw new OCSForbiddenException();
156 156
 		}
157 157
 
158 158
 		if ($this->isValidToken($url, $token) === false) {
159 159
 			$expectedToken = $this->dbHandler->getToken($url);
160 160
 			$this->logger->error(
161
-				'remote server (' . $url . ') didn\'t send a valid token (got "' . $token . '" but expected "'. $expectedToken . '") while getting shared secret',
161
+				'remote server ('.$url.') didn\'t send a valid token (got "'.$token.'" but expected "'.$expectedToken.'") while getting shared secret',
162 162
 				['app' => 'federation']
163 163
 			);
164 164
 			throw new OCSForbiddenException();
Please login to merge, or discard this patch.
apps/federation/lib/AppInfo/Application.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -82,7 +82,7 @@
 block discarded – undo
82 82
 			);
83 83
 		});
84 84
 
85
-		$container->registerService('SettingsController', function (IAppContainer $c) {
85
+		$container->registerService('SettingsController', function(IAppContainer $c) {
86 86
 			$server = $c->getServer();
87 87
 			return new SettingsController(
88 88
 				$c->getAppName(),
Please login to merge, or discard this patch.
apps/federation/lib/Command/SyncFederationAddressBooks.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@
 block discarded – undo
60 60
 		$progress->start();
61 61
 		$this->syncService->syncThemAll(function($url, $ex) use ($progress, $output) {
62 62
 			if ($ex instanceof \Exception) {
63
-				$output->writeln("Error while syncing $url : " . $ex->getMessage());
63
+				$output->writeln("Error while syncing $url : ".$ex->getMessage());
64 64
 
65 65
 			} else {
66 66
 				$progress->advance();
Please login to merge, or discard this patch.
apps/federation/lib/TrustedServers.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
 		$client = $this->httpClientService->newClient();
222 222
 		try {
223 223
 			$result = $client->get(
224
-				$url . '/status.php',
224
+				$url.'/status.php',
225 225
 				[
226 226
 					'timeout' => 3,
227 227
 					'connect_timeout' => 3,
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
 
233 233
 			}
234 234
 		} catch (\Exception $e) {
235
-			$this->logger->debug('No Nextcloud server: ' . $e->getMessage());
235
+			$this->logger->debug('No Nextcloud server: '.$e->getMessage());
236 236
 			return false;
237 237
 		}
238 238
 
@@ -273,6 +273,6 @@  discard block
 block discarded – undo
273 273
 
274 274
 		}
275 275
 
276
-		return 'https://' . $url;
276
+		return 'https://'.$url;
277 277
 	}
278 278
 }
Please login to merge, or discard this patch.