Completed
Push — master ( 89fdd0...fb17f1 )
by Morris
28:03 queued 12:49
created
apps/encryption/lib/Controller/StatusController.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -72,28 +72,28 @@
 block discarded – undo
72 72
 
73 73
 		$status = 'error';
74 74
 		$message = 'no valid init status';
75
-		switch( $this->session->getStatus()) {
75
+		switch ($this->session->getStatus()) {
76 76
 			case Session::INIT_EXECUTED:
77 77
 				$status = 'interactionNeeded';
78
-				$message = (string)$this->l->t(
78
+				$message = (string) $this->l->t(
79 79
 					'Invalid private key for encryption app. Please update your private key password in your personal settings to recover access to your encrypted files.'
80 80
 				);
81 81
 				break;
82 82
 			case Session::NOT_INITIALIZED:
83 83
 				$status = 'interactionNeeded';
84 84
 				if ($this->encryptionManager->isEnabled()) {
85
-					$message = (string)$this->l->t(
85
+					$message = (string) $this->l->t(
86 86
 						'Encryption App is enabled, but your keys are not initialized. Please log-out and log-in again.'
87 87
 					);
88 88
 				} else {
89
-					$message = (string)$this->l->t(
89
+					$message = (string) $this->l->t(
90 90
 						'Please enable server side encryption in the admin settings in order to use the encryption module.'
91 91
 					);
92 92
 				}
93 93
 				break;
94 94
 			case Session::INIT_SUCCESSFUL:
95 95
 				$status = 'success';
96
-				$message = (string)$this->l->t('Encryption app is enabled and ready');
96
+				$message = (string) $this->l->t('Encryption app is enabled and ready');
97 97
 		}
98 98
 
99 99
 		return new DataResponse(
Please login to merge, or discard this patch.
core/Command/Encryption/ChangeKeyStorageRoot.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 		}
144 144
 
145 145
 		$result = $this->rootView->file_put_contents(
146
-			$newRoot . '/' . Storage::KEY_STORAGE_MARKER,
146
+			$newRoot.'/'.Storage::KEY_STORAGE_MARKER,
147 147
 			'Nextcloud will detect this folder as key storage root only if this file exists'
148 148
 		);
149 149
 
@@ -162,10 +162,10 @@  discard block
 block discarded – undo
162 162
 	 */
163 163
 	protected function moveSystemKeys($oldRoot, $newRoot) {
164 164
 		if (
165
-			$this->rootView->is_dir($oldRoot . '/files_encryption') &&
166
-			$this->targetExists($newRoot . '/files_encryption') === false
165
+			$this->rootView->is_dir($oldRoot.'/files_encryption') &&
166
+			$this->targetExists($newRoot.'/files_encryption') === false
167 167
 		) {
168
-			$this->rootView->rename($oldRoot . '/files_encryption', $newRoot . '/files_encryption');
168
+			$this->rootView->rename($oldRoot.'/files_encryption', $newRoot.'/files_encryption');
169 169
 		}
170 170
 	}
171 171
 
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
 		$progress->start();
195 195
 
196 196
 
197
-		foreach($this->userManager->getBackends() as $backend) {
197
+		foreach ($this->userManager->getBackends() as $backend) {
198 198
 			$limit = 500;
199 199
 			$offset = 0;
200 200
 			do {
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
 					$this->moveUserEncryptionFolder($user, $oldRoot, $newRoot);
206 206
 				}
207 207
 				$offset += $limit;
208
-			} while(count($users) >= $limit);
208
+			} while (count($users) >= $limit);
209 209
 		}
210 210
 		$progress->finish();
211 211
 	}
@@ -222,13 +222,13 @@  discard block
 block discarded – undo
222 222
 
223 223
 		if ($this->userManager->userExists($user)) {
224 224
 
225
-			$source = $oldRoot . '/' . $user . '/files_encryption';
226
-			$target = $newRoot . '/' . $user . '/files_encryption';
225
+			$source = $oldRoot.'/'.$user.'/files_encryption';
226
+			$target = $newRoot.'/'.$user.'/files_encryption';
227 227
 			if (
228 228
 				$this->rootView->is_dir($source) &&
229 229
 				$this->targetExists($target) === false
230 230
 			) {
231
-				$this->prepareParentFolder($newRoot . '/' . $user);
231
+				$this->prepareParentFolder($newRoot.'/'.$user);
232 232
 				$this->rootView->rename($source, $target);
233 233
 			}
234 234
 		}
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
 			$sub_dirs = explode('/', ltrim($path, '/'));
247 247
 			$dir = '';
248 248
 			foreach ($sub_dirs as $sub_dir) {
249
-				$dir .= '/' . $sub_dir;
249
+				$dir .= '/'.$sub_dir;
250 250
 				if ($this->rootView->file_exists($dir) === false) {
251 251
 					$this->rootView->mkdir($dir);
252 252
 				}
Please login to merge, or discard this patch.
lib/private/SubAdmin.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -120,9 +120,9 @@  discard block
 block discarded – undo
120 120
 			->execute();
121 121
 
122 122
 		$groups = [];
123
-		while($row = $result->fetch()) {
123
+		while ($row = $result->fetch()) {
124 124
 			$group = $this->groupManager->get($row['gid']);
125
-			if(!is_null($group)) {
125
+			if (!is_null($group)) {
126 126
 				$groups[$group->getGID()] = $group;
127 127
 			}
128 128
 		}
@@ -156,9 +156,9 @@  discard block
 block discarded – undo
156 156
 			->execute();
157 157
 
158 158
 		$users = [];
159
-		while($row = $result->fetch()) {
159
+		while ($row = $result->fetch()) {
160 160
 			$user = $this->userManager->get($row['uid']);
161
-			if(!is_null($user)) {
161
+			if (!is_null($user)) {
162 162
 				$users[] = $user;
163 163
 			}
164 164
 		}
@@ -179,10 +179,10 @@  discard block
 block discarded – undo
179 179
 			->execute();
180 180
 
181 181
 		$subadmins = [];
182
-		while($row = $result->fetch()) {
182
+		while ($row = $result->fetch()) {
183 183
 			$user = $this->userManager->get($row['uid']);
184 184
 			$group = $this->groupManager->get($row['gid']);
185
-			if(!is_null($user) && !is_null($group)) {
185
+			if (!is_null($user) && !is_null($group)) {
186 186
 				$subadmins[] = [
187 187
 					'user'  => $user,
188 188
 					'group' => $group
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
 			->andWhere($qb->expr()->eq('uid', $qb->createNamedParameter($user->getUID())))
213 213
 			->execute();
214 214
 
215
-		$fetch =  $result->fetch();
215
+		$fetch = $result->fetch();
216 216
 		$result->closeCursor();
217 217
 		$result = !empty($fetch) ? true : false;
218 218
 
@@ -251,15 +251,15 @@  discard block
 block discarded – undo
251 251
 	 * @return bool
252 252
 	 */
253 253
 	public function isUserAccessible($subadmin, $user) {
254
-		if(!$this->isSubAdmin($subadmin)) {
254
+		if (!$this->isSubAdmin($subadmin)) {
255 255
 			return false;
256 256
 		}
257
-		if($this->groupManager->isAdmin($user->getUID())) {
257
+		if ($this->groupManager->isAdmin($user->getUID())) {
258 258
 			return false;
259 259
 		}
260 260
 		$accessibleGroups = $this->getSubAdminsGroups($subadmin);
261
-		foreach($accessibleGroups as $accessibleGroup) {
262
-			if($accessibleGroup->inGroup($user)) {
261
+		foreach ($accessibleGroups as $accessibleGroup) {
262
+			if ($accessibleGroup->inGroup($user)) {
263 263
 				return true;
264 264
 			}
265 265
 		}
Please login to merge, or discard this patch.
apps/user_ldap/lib/Proxy.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 	public function __construct(ILDAPWrapper $ldap) {
50 50
 		$this->ldap = $ldap;
51 51
 		$memcache = \OC::$server->getMemCacheFactory();
52
-		if($memcache->isAvailable()) {
52
+		if ($memcache->isAvailable()) {
53 53
 			$this->cache = $memcache->createDistributed();
54 54
 		}
55 55
 	}
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 		static $db;
68 68
 		static $coreUserManager;
69 69
 		static $coreNotificationManager;
70
-		if($fs === null) {
70
+		if ($fs === null) {
71 71
 			$ocConfig = \OC::$server->getConfig();
72 72
 			$fs       = new FilesystemHelper();
73 73
 			$log      = new LogWrapper();
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 	 * @return mixed
94 94
 	 */
95 95
 	protected function getAccess($configPrefix) {
96
-		if(!isset(self::$accesses[$configPrefix])) {
96
+		if (!isset(self::$accesses[$configPrefix])) {
97 97
 			$this->addAccess($configPrefix);
98 98
 		}
99 99
 		return self::$accesses[$configPrefix];
@@ -147,8 +147,8 @@  discard block
 block discarded – undo
147 147
 	 * @return mixed, the result of the specified method
148 148
 	 */
149 149
 	protected function handleRequest($id, $method, $parameters, $passOnWhen = false) {
150
-		$result = $this->callOnLastSeenOn($id,  $method, $parameters, $passOnWhen);
151
-		if($result === $passOnWhen) {
150
+		$result = $this->callOnLastSeenOn($id, $method, $parameters, $passOnWhen);
151
+		if ($result === $passOnWhen) {
152 152
 			$result = $this->walkBackends($id, $method, $parameters);
153 153
 		}
154 154
 		return $result;
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 	 */
161 161
 	private function getCacheKey($key) {
162 162
 		$prefix = 'LDAP-Proxy-';
163
-		if($key === null) {
163
+		if ($key === null) {
164 164
 			return $prefix;
165 165
 		}
166 166
 		return $prefix.hash('sha256', $key);
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
 	 * @return mixed|null
172 172
 	 */
173 173
 	public function getFromCache($key) {
174
-		if($this->cache === null) {
174
+		if ($this->cache === null) {
175 175
 			return null;
176 176
 		}
177 177
 
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
 	 * @param mixed $value
190 190
 	 */
191 191
 	public function writeToCache($key, $value) {
192
-		if($this->cache === null) {
192
+		if ($this->cache === null) {
193 193
 			return;
194 194
 		}
195 195
 		$key   = $this->getCacheKey($key);
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
 	}
199 199
 
200 200
 	public function clearCache() {
201
-		if($this->cache === null) {
201
+		if ($this->cache === null) {
202 202
 			return;
203 203
 		}
204 204
 		$this->cache->clear($this->getCacheKey(null));
Please login to merge, or discard this patch.
apps/dav/lib/Upload/ChunkingPlugin.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -100,7 +100,7 @@
 block discarded – undo
100 100
 
101 101
 		// casted to string because cast to float cause equality for non equal numbers
102 102
 		// and integer has the problem of limited size on 32 bit systems
103
-		if ((string)$expectedSize !== (string)$actualSize) {
103
+		if ((string) $expectedSize !== (string) $actualSize) {
104 104
 			throw new BadRequest("Chunks on server do not sum up to $expectedSize but to $actualSize bytes");
105 105
 		}
106 106
 	}
Please login to merge, or discard this patch.
lib/private/Files/ObjectStore/ObjectStoreStorage.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -55,9 +55,9 @@  discard block
 block discarded – undo
55 55
 			throw new \Exception('missing IObjectStore instance');
56 56
 		}
57 57
 		if (isset($params['storageid'])) {
58
-			$this->id = 'object::store:' . $params['storageid'];
58
+			$this->id = 'object::store:'.$params['storageid'];
59 59
 		} else {
60
-			$this->id = 'object::store:' . $this->objectStore->getStorageId();
60
+			$this->id = 'object::store:'.$this->objectStore->getStorageId();
61 61
 		}
62 62
 		if (isset($params['objectPrefix'])) {
63 63
 			$this->objectPrefix = $params['objectPrefix'];
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
 				if ($ex->getCode() !== 404) {
192 192
 					$this->logger->logException($ex, [
193 193
 						'app' => 'objectstore',
194
-						'message' => 'Could not delete object ' . $this->getURN($stat['fileid']) . ' for ' . $path,
194
+						'message' => 'Could not delete object '.$this->getURN($stat['fileid']).' for '.$path,
195 195
 					]);
196 196
 					return false;
197 197
 				}
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
 	 */
224 224
 	protected function getURN($fileId) {
225 225
 		if (is_numeric($fileId)) {
226
-			return $this->objectPrefix . $fileId;
226
+			return $this->objectPrefix.$fileId;
227 227
 		}
228 228
 		return null;
229 229
 	}
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
 					} catch (\Exception $ex) {
278 278
 						$this->logger->logException($ex, [
279 279
 							'app' => 'objectstore',
280
-							'message' => 'Count not get object ' . $this->getURN($stat['fileid']) . ' for file ' . $path,
280
+							'message' => 'Count not get object '.$this->getURN($stat['fileid']).' for file '.$path,
281 281
 						]);
282 282
 						return false;
283 283
 					}
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
 			case 'wb+':
291 291
 				$tmpFile = \OC::$server->getTempManager()->getTemporaryFile($ext);
292 292
 				$handle = fopen($tmpFile, $mode);
293
-				return CallbackWrapper::wrap($handle, null, null, function () use ($path, $tmpFile) {
293
+				return CallbackWrapper::wrap($handle, null, null, function() use ($path, $tmpFile) {
294 294
 					$this->writeBack($tmpFile, $path);
295 295
 				});
296 296
 			case 'a':
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
 					file_put_contents($tmpFile, $source);
308 308
 				}
309 309
 				$handle = fopen($tmpFile, $mode);
310
-				return CallbackWrapper::wrap($handle, null, null, function () use ($path, $tmpFile) {
310
+				return CallbackWrapper::wrap($handle, null, null, function() use ($path, $tmpFile) {
311 311
 					$this->writeBack($tmpFile, $path);
312 312
 				});
313 313
 		}
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
 
317 317
 	public function file_exists($path) {
318 318
 		$path = $this->normalizePath($path);
319
-		return (bool)$this->stat($path);
319
+		return (bool) $this->stat($path);
320 320
 	}
321 321
 
322 322
 	public function rename($source, $target) {
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
 			} catch (\Exception $ex) {
374 374
 				$this->logger->logException($ex, [
375 375
 					'app' => 'objectstore',
376
-					'message' => 'Could not create object for ' . $path,
376
+					'message' => 'Could not create object for '.$path,
377 377
 				]);
378 378
 				throw $ex;
379 379
 			}
@@ -413,7 +413,7 @@  discard block
 block discarded – undo
413 413
 			$this->getCache()->remove($path);
414 414
 			$this->logger->logException($ex, [
415 415
 				'app' => 'objectstore',
416
-				'message' => 'Could not create object ' . $this->getURN($fileId) . ' for ' . $path,
416
+				'message' => 'Could not create object '.$this->getURN($fileId).' for '.$path,
417 417
 			]);
418 418
 			throw $ex; // make this bubble up
419 419
 		}
Please login to merge, or discard this patch.
lib/private/Template/JSCombiner.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 		$this->appData = $appData;
70 70
 		$this->urlGenerator = $urlGenerator;
71 71
 		$this->cacheFactory = $cacheFactory;
72
-		$this->depsCache = $this->cacheFactory->createDistributed('JS-' . md5($this->urlGenerator->getBaseUrl()));
72
+		$this->depsCache = $this->cacheFactory->createDistributed('JS-'.md5($this->urlGenerator->getBaseUrl()));
73 73
 		$this->config = $config;
74 74
 		$this->logger = $logger;
75 75
 	}
@@ -85,19 +85,19 @@  discard block
 block discarded – undo
85 85
 			return false;
86 86
 		}
87 87
 
88
-		$path = explode('/', $root . '/' . $file);
88
+		$path = explode('/', $root.'/'.$file);
89 89
 
90 90
 		$fileName = array_pop($path);
91 91
 		$path = implode('/', $path);
92 92
 
93 93
 		try {
94 94
 			$folder = $this->appData->getFolder($app);
95
-		} catch(NotFoundException $e) {
95
+		} catch (NotFoundException $e) {
96 96
 			// creating css appdata folder
97 97
 			$folder = $this->appData->newFolder($app);
98 98
 		}
99 99
 
100
-		if($this->isCached($fileName, $folder)) {
100
+		if ($this->isCached($fileName, $folder)) {
101 101
 			return true;
102 102
 		}
103 103
 		return $this->cache($path, $fileName, $folder);
@@ -115,9 +115,9 @@  discard block
 block discarded – undo
115 115
 			return false;
116 116
 		}
117 117
 
118
-		$fileName = $fileName . '.deps';
118
+		$fileName = $fileName.'.deps';
119 119
 		try {
120
-			$deps = $this->depsCache->get($folder->getName() . '-' . $fileName);
120
+			$deps = $this->depsCache->get($folder->getName().'-'.$fileName);
121 121
 			if ($deps === null || $deps === '') {
122 122
 				$depFile = $folder->getFile($fileName);
123 123
 				$deps = $depFile->getContent();
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 
126 126
 			// check again
127 127
 			if ($deps === null || $deps === '') {
128
-				$this->logger->info('JSCombiner: deps file empty: ' . $fileName);
128
+				$this->logger->info('JSCombiner: deps file empty: '.$fileName);
129 129
 				return false;
130 130
 			}
131 131
 
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 			}
143 143
 
144 144
 			return true;
145
-		} catch(NotFoundException $e) {
145
+		} catch (NotFoundException $e) {
146 146
 			return false;
147 147
 		}
148 148
 	}
@@ -155,17 +155,17 @@  discard block
 block discarded – undo
155 155
 	 */
156 156
 	protected function cache($path, $fileName, ISimpleFolder $folder) {
157 157
 		$deps = [];
158
-		$fullPath = $path . '/' . $fileName;
158
+		$fullPath = $path.'/'.$fileName;
159 159
 		$data = json_decode(file_get_contents($fullPath));
160 160
 		$deps[$fullPath] = filemtime($fullPath);
161 161
 
162 162
 		$res = '';
163 163
 		foreach ($data as $file) {
164
-			$filePath = $path . '/' . $file;
164
+			$filePath = $path.'/'.$file;
165 165
 
166 166
 			if (is_file($filePath)) {
167 167
 				$res .= file_get_contents($filePath);
168
-				$res .= PHP_EOL . PHP_EOL;
168
+				$res .= PHP_EOL.PHP_EOL;
169 169
 				$deps[$filePath] = filemtime($filePath);
170 170
 			}
171 171
 		}
@@ -173,11 +173,11 @@  discard block
 block discarded – undo
173 173
 		$fileName = str_replace('.json', '.js', $fileName);
174 174
 		try {
175 175
 			$cachedfile = $folder->getFile($fileName);
176
-		} catch(NotFoundException $e) {
176
+		} catch (NotFoundException $e) {
177 177
 			$cachedfile = $folder->newFile($fileName);
178 178
 		}
179 179
 
180
-		$depFileName = $fileName . '.deps';
180
+		$depFileName = $fileName.'.deps';
181 181
 		try {
182 182
 			$depFile = $folder->getFile($depFileName);
183 183
 		} catch (NotFoundException $e) {
@@ -185,21 +185,21 @@  discard block
 block discarded – undo
185 185
 		}
186 186
 
187 187
 		try {
188
-			$gzipFile = $folder->getFile($fileName . '.gzip'); # Safari doesn't like .gz
188
+			$gzipFile = $folder->getFile($fileName.'.gzip'); # Safari doesn't like .gz
189 189
 		} catch (NotFoundException $e) {
190
-			$gzipFile = $folder->newFile($fileName . '.gzip'); # Safari doesn't like .gz
190
+			$gzipFile = $folder->newFile($fileName.'.gzip'); # Safari doesn't like .gz
191 191
 		}
192 192
 
193 193
 		try {
194 194
 			$cachedfile->putContent($res);
195 195
 			$deps = json_encode($deps);
196 196
 			$depFile->putContent($deps);
197
-			$this->depsCache->set($folder->getName() . '-' . $depFileName, $deps);
197
+			$this->depsCache->set($folder->getName().'-'.$depFileName, $deps);
198 198
 			$gzipFile->putContent(gzencode($res, 9));
199
-			$this->logger->debug('JSCombiner: successfully cached: ' . $fileName);
199
+			$this->logger->debug('JSCombiner: successfully cached: '.$fileName);
200 200
 			return true;
201 201
 		} catch (NotPermittedException $e) {
202
-			$this->logger->error('JSCombiner: unable to cache: ' . $fileName);
202
+			$this->logger->error('JSCombiner: unable to cache: '.$fileName);
203 203
 			return false;
204 204
 		}
205 205
 	}
@@ -224,8 +224,8 @@  discard block
 block discarded – undo
224 224
 	 */
225 225
 	public function getContent($root, $file) {
226 226
 		/** @var array $data */
227
-		$data = json_decode(file_get_contents($root . '/' . $file));
228
-		if(!is_array($data)) {
227
+		$data = json_decode(file_get_contents($root.'/'.$file));
228
+		if (!is_array($data)) {
229 229
 			return [];
230 230
 		}
231 231
 
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
 
236 236
 		$result = [];
237 237
 		foreach ($data as $f) {
238
-			$result[] = $path . '/' . $f;
238
+			$result[] = $path.'/'.$f;
239 239
 		}
240 240
 
241 241
 		return $result;
Please login to merge, or discard this patch.
apps/user_ldap/lib/Helper.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 		$keys = $this->getServersConfig($referenceConfigkey);
100 100
 
101 101
 		$result = array();
102
-		foreach($keys as $key) {
102
+		foreach ($keys as $key) {
103 103
 			$len = strlen($key) - strlen($referenceConfigkey);
104 104
 			$prefix = substr($key, 0, $len);
105 105
 			$result[$prefix] = $this->config->getAppValue('user_ldap', $key);
@@ -116,18 +116,18 @@  discard block
 block discarded – undo
116 116
 	public function getNextServerConfigurationPrefix() {
117 117
 		$serverConnections = $this->getServerConfigurationPrefixes();
118 118
 
119
-		if(count($serverConnections) === 0) {
119
+		if (count($serverConnections) === 0) {
120 120
 			return 's01';
121 121
 		}
122 122
 
123 123
 		sort($serverConnections);
124 124
 		$lastKey = array_pop($serverConnections);
125
-		$lastNumber = (int)str_replace('s', '', $lastKey);
126
-		return 's' . str_pad($lastNumber + 1, 2, '0', STR_PAD_LEFT);
125
+		$lastNumber = (int) str_replace('s', '', $lastKey);
126
+		return 's'.str_pad($lastNumber + 1, 2, '0', STR_PAD_LEFT);
127 127
 	}
128 128
 
129 129
 	private function getServersConfig($value) {
130
-		$regex = '/' . $value . '$/S';
130
+		$regex = '/'.$value.'$/S';
131 131
 
132 132
 		$keys = $this->config->getAppKeys('user_ldap');
133 133
 		$result = [];
@@ -146,12 +146,12 @@  discard block
 block discarded – undo
146 146
 	 * @return bool true on success, false otherwise
147 147
 	 */
148 148
 	public function deleteServerConfiguration($prefix) {
149
-		if(!in_array($prefix, self::getServerConfigurationPrefixes())) {
149
+		if (!in_array($prefix, self::getServerConfigurationPrefixes())) {
150 150
 			return false;
151 151
 		}
152 152
 
153 153
 		$saveOtherConfigurations = '';
154
-		if(empty($prefix)) {
154
+		if (empty($prefix)) {
155 155
 			$saveOtherConfigurations = 'AND `configkey` NOT LIKE \'s%\'';
156 156
 		}
157 157
 
@@ -165,11 +165,11 @@  discard block
 block discarded – undo
165 165
 		');
166 166
 		$delRows = $query->execute(array($prefix.'%'));
167 167
 
168
-		if($delRows === null) {
168
+		if ($delRows === null) {
169 169
 			return false;
170 170
 		}
171 171
 
172
-		if($delRows === 0) {
172
+		if ($delRows === 0) {
173 173
 			return false;
174 174
 		}
175 175
 
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 		$all = $this->getServerConfigurationPrefixes(false);
186 186
 		$active = $this->getServerConfigurationPrefixes(true);
187 187
 
188
-		if(!is_array($all) || !is_array($active)) {
188
+		if (!is_array($all) || !is_array($active)) {
189 189
 			throw new \Exception('Unexpected Return Value');
190 190
 		}
191 191
 
@@ -199,14 +199,14 @@  discard block
 block discarded – undo
199 199
 	 */
200 200
 	public function getDomainFromURL($url) {
201 201
 		$uinfo = parse_url($url);
202
-		if(!is_array($uinfo)) {
202
+		if (!is_array($uinfo)) {
203 203
 			return false;
204 204
 		}
205 205
 
206 206
 		$domain = false;
207
-		if(isset($uinfo['host'])) {
207
+		if (isset($uinfo['host'])) {
208 208
 			$domain = $uinfo['host'];
209
-		} else if(isset($uinfo['path'])) {
209
+		} else if (isset($uinfo['path'])) {
210 210
 			$domain = $uinfo['path'];
211 211
 		}
212 212
 
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
 	 */
221 221
 	public function setLDAPProvider() {
222 222
 		$current = \OC::$server->getConfig()->getSystemValue('ldapProviderFactory', null);
223
-		if(is_null($current)) {
223
+		if (is_null($current)) {
224 224
 			\OC::$server->getConfig()->setSystemValue('ldapProviderFactory', LDAPProviderFactory::class);
225 225
 		}
226 226
 	}
@@ -232,9 +232,9 @@  discard block
 block discarded – undo
232 232
 	 */
233 233
 	public function sanitizeDN($dn) {
234 234
 		//treating multiple base DNs
235
-		if(is_array($dn)) {
235
+		if (is_array($dn)) {
236 236
 			$result = array();
237
-			foreach($dn as $singleDN) {
237
+			foreach ($dn as $singleDN) {
238 238
 				$result[] = $this->sanitizeDN($singleDN);
239 239
 			}
240 240
 			return $result;
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
 	 * @throws \Exception
286 286
 	 */
287 287
 	public static function loginName2UserName($param) {
288
-		if(!isset($param['uid'])) {
288
+		if (!isset($param['uid'])) {
289 289
 			throw new \Exception('key uid is expected to be set in $param');
290 290
 		}
291 291
 
@@ -300,11 +300,11 @@  discard block
 block discarded – undo
300 300
 		$userSession = \OC::$server->getUserSession();
301 301
 		$userPluginManager = \OC::$server->query('LDAPUserPluginManager');
302 302
 
303
-		$userBackend  = new User_Proxy(
303
+		$userBackend = new User_Proxy(
304 304
 			$configPrefixes, $ldapWrapper, $ocConfig, $notificationManager, $userSession, $userPluginManager
305 305
 		);
306
-		$uid = $userBackend->loginName2UserName($param['uid'] );
307
-		if($uid !== false) {
306
+		$uid = $userBackend->loginName2UserName($param['uid']);
307
+		if ($uid !== false) {
308 308
 			$param['uid'] = $uid;
309 309
 		}
310 310
 	}
Please login to merge, or discard this patch.
lib/private/legacy/eventsource.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 		header('X-Accel-Buffering: no');
61 61
 		$this->fallback = isset($_GET['fallback']) and $_GET['fallback'] == 'true';
62 62
 		if ($this->fallback) {
63
-			$this->fallBackId = (int)$_GET['fallback_id'];
63
+			$this->fallBackId = (int) $_GET['fallback_id'];
64 64
 			/**
65 65
 			 * FIXME: The default content-security-policy of ownCloud forbids inline
66 66
 			 * JavaScript for security reasons. IE starting on Windows 10 will
@@ -73,11 +73,11 @@  discard block
 block discarded – undo
73 73
 			 */
74 74
 			header("Content-Security-Policy: default-src 'none'; script-src 'unsafe-inline'");
75 75
 			header("Content-Type: text/html");
76
-			echo str_repeat('<span></span>' . PHP_EOL, 10); //dummy data to keep IE happy
76
+			echo str_repeat('<span></span>'.PHP_EOL, 10); //dummy data to keep IE happy
77 77
 		} else {
78 78
 			header("Content-Type: text/event-stream");
79 79
 		}
80
-		if(!\OC::$server->getRequest()->passesStrictCookieCheck()) {
80
+		if (!\OC::$server->getRequest()->passesStrictCookieCheck()) {
81 81
 			header('Location: '.\OC::$WEBROOT);
82 82
 			exit();
83 83
 		}
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 	 */
102 102
 	public function send($type, $data = null) {
103 103
 		if ($data and !preg_match('/^[A-Za-z0-9_]+$/', $type)) {
104
-			throw new BadMethodCallException('Type needs to be alphanumeric ('. $type .')');
104
+			throw new BadMethodCallException('Type needs to be alphanumeric ('.$type.')');
105 105
 		}
106 106
 		$this->init();
107 107
 		if (is_null($data)) {
@@ -110,13 +110,13 @@  discard block
 block discarded – undo
110 110
 		}
111 111
 		if ($this->fallback) {
112 112
 			$response = '<script type="text/javascript">window.parent.OC.EventSource.fallBackCallBack('
113
-				. $this->fallBackId . ',"' . $type . '",' . OC_JSON::encode($data) . ')</script>' . PHP_EOL;
113
+				. $this->fallBackId.',"'.$type.'",'.OC_JSON::encode($data).')</script>'.PHP_EOL;
114 114
 			echo $response;
115 115
 		} else {
116 116
 			if ($type) {
117
-				echo 'event: ' . $type . PHP_EOL;
117
+				echo 'event: '.$type.PHP_EOL;
118 118
 			}
119
-			echo 'data: ' . OC_JSON::encode($data) . PHP_EOL;
119
+			echo 'data: '.OC_JSON::encode($data).PHP_EOL;
120 120
 		}
121 121
 		echo PHP_EOL;
122 122
 		flush();
Please login to merge, or discard this patch.