Passed
Push — master ( f0dd71...c56a27 )
by Christoph
11:49 queued 12s
created
lib/private/L10N/L10N.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 			$data = strtotime($data);
183 183
 			$value->setTimestamp($data);
184 184
 		} else if ($data !== null) {
185
-			$data = (int)$data;
185
+			$data = (int) $data;
186 186
 			$value->setTimestamp($data);
187 187
 		}
188 188
 
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
 	public function getPluralFormFunction(): \Closure {
222 222
 		if (\is_null($this->pluralFormFunction)) {
223 223
 			$lang = $this->getLanguageCode();
224
-			$this->pluralFormFunction = function ($n) use ($lang) {
224
+			$this->pluralFormFunction = function($n) use ($lang) {
225 225
 				return PluralizationRules::get($n, $lang);
226 226
 			};
227 227
 		}
Please login to merge, or discard this patch.
lib/private/L10N/Factory.php 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -114,11 +114,11 @@  discard block
 block discarded – undo
114 114
 	 * @return \OCP\IL10N
115 115
 	 */
116 116
 	public function get($app, $lang = null, $locale = null) {
117
-		return new LazyL10N(function () use ($app, $lang, $locale) {
117
+		return new LazyL10N(function() use ($app, $lang, $locale) {
118 118
 
119 119
 			$app = \OC_App::cleanAppId($app);
120 120
 			if ($lang !== null) {
121
-				$lang = str_replace(['\0', '/', '\\', '..'], '', (string)$lang);
121
+				$lang = str_replace(['\0', '/', '\\', '..'], '', (string) $lang);
122 122
 			}
123 123
 
124 124
 			$forceLang = $this->config->getSystemValue('force_language', false);
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 		 * @link https://github.com/owncloud/core/issues/21955
175 175
 		 */
176 176
 		if ($this->config->getSystemValue('installed', false)) {
177
-			$userId = !is_null($this->userSession->getUser()) ? $this->userSession->getUser()->getUID() :  null;
177
+			$userId = !is_null($this->userSession->getUser()) ? $this->userSession->getUser()->getUID() : null;
178 178
 			if (!is_null($userId)) {
179 179
 				$userLang = $this->config->getUserValue($userId, 'core', 'lang', null);
180 180
 			} else {
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
 		}
225 225
 
226 226
 		if ($this->config->getSystemValue('installed', false)) {
227
-			$userId = null !== $this->userSession->getUser() ? $this->userSession->getUser()->getUID() :  null;
227
+			$userId = null !== $this->userSession->getUser() ? $this->userSession->getUser()->getUID() : null;
228 228
 			$userLocale = null;
229 229
 			if (null !== $userId) {
230 230
 				$userLocale = $this->config->getUserValue($userId, 'core', 'locale', null);
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
 		// merge with translations from theme
306 306
 		$theme = $this->config->getSystemValue('theme');
307 307
 		if (!empty($theme)) {
308
-			$themeDir = $this->serverRoot . '/themes/' . $theme . substr($dir, strlen($this->serverRoot));
308
+			$themeDir = $this->serverRoot.'/themes/'.$theme.substr($dir, strlen($this->serverRoot));
309 309
 
310 310
 			if (is_dir($themeDir)) {
311 311
 				$files = scandir($themeDir);
@@ -331,7 +331,7 @@  discard block
 block discarded – undo
331 331
 			return $this->availableLocales;
332 332
 		}
333 333
 
334
-		$localeData = file_get_contents(\OC::$SERVERROOT . '/resources/locales.json');
334
+		$localeData = file_get_contents(\OC::$SERVERROOT.'/resources/locales.json');
335 335
 		$this->availableLocales = \json_decode($localeData, true);
336 336
 
337 337
 		return $this->availableLocales;
@@ -353,7 +353,7 @@  discard block
 block discarded – undo
353 353
 
354 354
 	public function getLanguageIterator(IUser $user = null): ILanguageIterator {
355 355
 		$user = $user ?? $this->userSession->getUser();
356
-		if($user === null) {
356
+		if ($user === null) {
357 357
 			throw new \RuntimeException('Failed to get an IUser instance');
358 358
 		}
359 359
 		return new LanguageIterator($user, $this->config);
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
 		}
370 370
 
371 371
 		$locales = $this->findAvailableLocales();
372
-		$userLocale = array_filter($locales, function ($value) use ($locale) {
372
+		$userLocale = array_filter($locales, function($value) use ($locale) {
373 373
 			return $locale === $value['code'];
374 374
 		});
375 375
 
@@ -471,11 +471,11 @@  discard block
 block discarded – undo
471 471
 		$languageFiles = [];
472 472
 
473 473
 		$i18nDir = $this->findL10nDir($app);
474
-		$transFile = strip_tags($i18nDir) . strip_tags($lang) . '.json';
474
+		$transFile = strip_tags($i18nDir).strip_tags($lang).'.json';
475 475
 
476
-		if (($this->isSubDirectory($transFile, $this->serverRoot . '/core/l10n/')
477
-				|| $this->isSubDirectory($transFile, $this->serverRoot . '/lib/l10n/')
478
-				|| $this->isSubDirectory($transFile, \OC_App::getAppPath($app) . '/l10n/')
476
+		if (($this->isSubDirectory($transFile, $this->serverRoot.'/core/l10n/')
477
+				|| $this->isSubDirectory($transFile, $this->serverRoot.'/lib/l10n/')
478
+				|| $this->isSubDirectory($transFile, \OC_App::getAppPath($app).'/l10n/')
479 479
 			)
480 480
 			&& file_exists($transFile)) {
481 481
 			// load the translations file
@@ -485,7 +485,7 @@  discard block
 block discarded – undo
485 485
 		// merge with translations from theme
486 486
 		$theme = $this->config->getSystemValue('theme');
487 487
 		if (!empty($theme)) {
488
-			$transFile = $this->serverRoot . '/themes/' . $theme . substr($transFile, strlen($this->serverRoot));
488
+			$transFile = $this->serverRoot.'/themes/'.$theme.substr($transFile, strlen($this->serverRoot));
489 489
 			if (file_exists($transFile)) {
490 490
 				$languageFiles[] = $transFile;
491 491
 			}
@@ -502,14 +502,14 @@  discard block
 block discarded – undo
502 502
 	 */
503 503
 	protected function findL10nDir($app = null) {
504 504
 		if (in_array($app, ['core', 'lib'])) {
505
-			if (file_exists($this->serverRoot . '/' . $app . '/l10n/')) {
506
-				return $this->serverRoot . '/' . $app . '/l10n/';
505
+			if (file_exists($this->serverRoot.'/'.$app.'/l10n/')) {
506
+				return $this->serverRoot.'/'.$app.'/l10n/';
507 507
 			}
508 508
 		} else if ($app && \OC_App::getAppPath($app) !== false) {
509 509
 			// Check if the app is in the app folder
510
-			return \OC_App::getAppPath($app) . '/l10n/';
510
+			return \OC_App::getAppPath($app).'/l10n/';
511 511
 		}
512
-		return $this->serverRoot . '/core/l10n/';
512
+		return $this->serverRoot.'/core/l10n/';
513 513
 	}
514 514
 
515 515
 
@@ -526,15 +526,15 @@  discard block
 block discarded – undo
526 526
 			return $this->pluralFunctions[$string];
527 527
 		}
528 528
 
529
-		if (preg_match( '/^\s*nplurals\s*=\s*(\d+)\s*;\s*plural=(.*)$/u', $string, $matches)) {
529
+		if (preg_match('/^\s*nplurals\s*=\s*(\d+)\s*;\s*plural=(.*)$/u', $string, $matches)) {
530 530
 			// sanitize
531
-			$nplurals = preg_replace( '/[^0-9]/', '', $matches[1] );
532
-			$plural = preg_replace( '#[^n0-9:\(\)\?\|\&=!<>+*/\%-]#', '', $matches[2] );
531
+			$nplurals = preg_replace('/[^0-9]/', '', $matches[1]);
532
+			$plural = preg_replace('#[^n0-9:\(\)\?\|\&=!<>+*/\%-]#', '', $matches[2]);
533 533
 
534 534
 			$body = str_replace(
535
-				[ 'plural', 'n', '$n$plurals', ],
536
-				[ '$plural', '$n', '$nplurals', ],
537
-				'nplurals='. $nplurals . '; plural=' . $plural
535
+				['plural', 'n', '$n$plurals', ],
536
+				['$plural', '$n', '$nplurals', ],
537
+				'nplurals='.$nplurals.'; plural='.$plural
538 538
 			);
539 539
 
540 540
 			// add parents
@@ -543,9 +543,9 @@  discard block
 block discarded – undo
543 543
 			$res = '';
544 544
 			$p = 0;
545 545
 			$length = strlen($body);
546
-			for($i = 0; $i < $length; $i++) {
546
+			for ($i = 0; $i < $length; $i++) {
547 547
 				$ch = $body[$i];
548
-				switch ( $ch ) {
548
+				switch ($ch) {
549 549
 					case '?':
550 550
 						$res .= ' ? (';
551 551
 						$p++;
@@ -554,7 +554,7 @@  discard block
 block discarded – undo
554 554
 						$res .= ') : (';
555 555
 						break;
556 556
 					case ';':
557
-						$res .= str_repeat( ')', $p ) . ';';
557
+						$res .= str_repeat(')', $p).';';
558 558
 						$p = 0;
559 559
 						break;
560 560
 					default:
@@ -562,7 +562,7 @@  discard block
 block discarded – undo
562 562
 				}
563 563
 			}
564 564
 
565
-			$body = $res . 'return ($plural>=$nplurals?$nplurals-1:$plural);';
565
+			$body = $res.'return ($plural>=$nplurals?$nplurals-1:$plural);';
566 566
 			$function = create_function('$n', $body);
567 567
 			$this->pluralFunctions[$string] = $function;
568 568
 			return $function;
@@ -594,7 +594,7 @@  discard block
 block discarded – undo
594 594
 		$commonLanguages = [];
595 595
 		$languages = [];
596 596
 
597
-		foreach($languageCodes as $lang) {
597
+		foreach ($languageCodes as $lang) {
598 598
 			$l = $this->get('lib', $lang);
599 599
 			// TRANSLATORS this is the language name for the language switcher in the personal settings and should be the localized version
600 600
 			$potentialName = (string) $l->t('__language_name__');
@@ -627,7 +627,7 @@  discard block
 block discarded – undo
627 627
 		ksort($commonLanguages);
628 628
 
629 629
 		// sort now by displayed language not the iso-code
630
-		usort( $languages, function ($a, $b) {
630
+		usort($languages, function($a, $b) {
631 631
 			if ($a['code'] === $a['name'] && $b['code'] !== $b['name']) {
632 632
 				// If a doesn't have a name, but b does, list b before a
633 633
 				return 1;
Please login to merge, or discard this patch.
lib/private/App/CodeChecker/CodeChecker.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -42,10 +42,10 @@  discard block
 block discarded – undo
42 42
 	const CLASS_IMPLEMENTS_NOT_ALLOWED = 1001;
43 43
 	const STATIC_CALL_NOT_ALLOWED = 1002;
44 44
 	const CLASS_CONST_FETCH_NOT_ALLOWED = 1003;
45
-	const CLASS_NEW_NOT_ALLOWED =  1004;
46
-	const OP_OPERATOR_USAGE_DISCOURAGED =  1005;
47
-	const CLASS_USE_NOT_ALLOWED =  1006;
48
-	const CLASS_METHOD_CALL_NOT_ALLOWED =  1007;
45
+	const CLASS_NEW_NOT_ALLOWED = 1004;
46
+	const OP_OPERATOR_USAGE_DISCOURAGED = 1005;
47
+	const CLASS_USE_NOT_ALLOWED = 1006;
48
+	const CLASS_METHOD_CALL_NOT_ALLOWED = 1007;
49 49
 
50 50
 	/** @var Parser */
51 51
 	private $parser;
@@ -89,14 +89,14 @@  discard block
 block discarded – undo
89 89
 			$excludedDirectories[] = 'lists';
90 90
 		}
91 91
 
92
-		$excludes = array_map(function ($item) use ($folder) {
93
-			return $folder . '/' . $item;
92
+		$excludes = array_map(function($item) use ($folder) {
93
+			return $folder.'/'.$item;
94 94
 		}, $excludedDirectories);
95 95
 
96 96
 		$iterator = new RecursiveDirectoryIterator($folder, RecursiveDirectoryIterator::SKIP_DOTS);
97
-		$iterator = new RecursiveCallbackFilterIterator($iterator, function ($item) use ($excludes) {
97
+		$iterator = new RecursiveCallbackFilterIterator($iterator, function($item) use ($excludes) {
98 98
 			/** @var SplFileInfo $item */
99
-			foreach($excludes as $exclude) {
99
+			foreach ($excludes as $exclude) {
100 100
 				if (substr($item->getPath(), 0, strlen($exclude)) === $exclude) {
101 101
 					return false;
102 102
 				}
Please login to merge, or discard this patch.
lib/private/Encryption/Util.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 		$this->config = $config;
101 101
 
102 102
 		$this->excludedPaths[] = 'files_encryption';
103
-		$this->excludedPaths[] = 'appdata_' . $config->getSystemValue('instanceid', null);
103
+		$this->excludedPaths[] = 'appdata_'.$config->getSystemValue('instanceid', null);
104 104
 		$this->excludedPaths[] = 'files_external';
105 105
 	}
106 106
 
@@ -140,12 +140,12 @@  discard block
 block discarded – undo
140 140
 	 * @throws EncryptionHeaderKeyExistsException if header key is already in use
141 141
 	 */
142 142
 	public function createHeader(array $headerData, IEncryptionModule $encryptionModule) {
143
-		$header = self::HEADER_START . ':' . self::HEADER_ENCRYPTION_MODULE_KEY . ':' . $encryptionModule->getId() . ':';
143
+		$header = self::HEADER_START.':'.self::HEADER_ENCRYPTION_MODULE_KEY.':'.$encryptionModule->getId().':';
144 144
 		foreach ($headerData as $key => $value) {
145 145
 			if (in_array($key, $this->ocHeaderKeys)) {
146 146
 				throw new EncryptionHeaderKeyExistsException($key);
147 147
 			}
148
-			$header .= $key . ':' . $value . ':';
148
+			$header .= $key.':'.$value.':';
149 149
 		}
150 150
 		$header .= self::HEADER_END;
151 151
 
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 				if ($c->getType() === 'dir') {
177 177
 					$dirList[] = $c->getPath();
178 178
 				} else {
179
-					$result[] =  $c->getPath();
179
+					$result[] = $c->getPath();
180 180
 				}
181 181
 			}
182 182
 
@@ -253,15 +253,15 @@  discard block
 block discarded – undo
253 253
 	public function stripPartialFileExtension($path) {
254 254
 		$extension = pathinfo($path, PATHINFO_EXTENSION);
255 255
 
256
-		if ( $extension === 'part') {
256
+		if ($extension === 'part') {
257 257
 
258 258
 			$newLength = strlen($path) - 5; // 5 = strlen(".part")
259 259
 			$fPath = substr($path, 0, $newLength);
260 260
 
261 261
 			// if path also contains a transaction id, we remove it too
262 262
 			$extension = pathinfo($fPath, PATHINFO_EXTENSION);
263
-			if(substr($extension, 0, 12) === 'ocTransferId') { // 12 = strlen("ocTransferId")
264
-				$newLength = strlen($fPath) - strlen($extension) -1;
263
+			if (substr($extension, 0, 12) === 'ocTransferId') { // 12 = strlen("ocTransferId")
264
+				$newLength = strlen($fPath) - strlen($extension) - 1;
265 265
 				$fPath = substr($fPath, 0, $newLength);
266 266
 			}
267 267
 			return $fPath;
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
 		$result = [];
276 276
 		if (in_array('all', $users)) {
277 277
 			$users = $this->userManager->search('', null, null);
278
-			$result = array_map(function (IUser $user) {
278
+			$result = array_map(function(IUser $user) {
279 279
 				return $user->getUID();
280 280
 			}, $users);
281 281
 		} else {
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
 		if (\OCP\App::isEnabled("files_external")) {
309 309
 			$mounts = \OC_Mount_Config::getSystemMountPoints();
310 310
 			foreach ($mounts as $mount) {
311
-				if (strpos($path, '/files/' . $mount['mountpoint']) === 0) {
311
+				if (strpos($path, '/files/'.$mount['mountpoint']) === 0) {
312 312
 					if ($this->isMountPointApplicableToUser($mount, $uid)) {
313 313
 						return true;
314 314
 					}
Please login to merge, or discard this patch.
lib/private/legacy/OC_DB_StatementWrapper.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -56,8 +56,8 @@  discard block
 block discarded – undo
56 56
 	/**
57 57
 	 * pass all other function directly to the \Doctrine\DBAL\Driver\Statement
58 58
 	 */
59
-	public function __call($name,$arguments) {
60
-		return call_user_func_array([$this->statement,$name], $arguments);
59
+	public function __call($name, $arguments) {
60
+		return call_user_func_array([$this->statement, $name], $arguments);
61 61
 	}
62 62
 
63 63
 	/**
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 	 * @param array $input
67 67
 	 * @return \OC_DB_StatementWrapper|int|bool
68 68
 	 */
69
-	public function execute($input= []) {
69
+	public function execute($input = []) {
70 70
 		$this->lastArguments = $input;
71 71
 		if (count($input) > 0) {
72 72
 			$result = $this->statement->execute($input);
Please login to merge, or discard this patch.
lib/private/legacy/OC_Util.php 1 patch
Spacing   +65 added lines, -65 removed lines patch added patch discarded remove patch
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 
85 85
 	private static function initLocalStorageRootFS() {
86 86
 		// mount local file backend as root
87
-		$configDataDirectory = \OC::$server->getSystemConfig()->getValue("datadirectory", OC::$SERVERROOT . "/data");
87
+		$configDataDirectory = \OC::$server->getSystemConfig()->getValue("datadirectory", OC::$SERVERROOT."/data");
88 88
 		//first set up the local "root" storage
89 89
 		\OC\Files\Filesystem::initMountManager();
90 90
 		if (!self::$rootMounted) {
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 		\OC\Files\Filesystem::initMountManager();
207 207
 
208 208
 		$prevLogging = \OC\Files\Filesystem::logWarningWhenAddingStorageWrapper(false);
209
-		\OC\Files\Filesystem::addStorageWrapper('mount_options', function ($mountPoint, \OCP\Files\Storage $storage, \OCP\Files\Mount\IMountPoint $mount) {
209
+		\OC\Files\Filesystem::addStorageWrapper('mount_options', function($mountPoint, \OCP\Files\Storage $storage, \OCP\Files\Mount\IMountPoint $mount) {
210 210
 			if ($storage->instanceOfStorage('\OC\Files\Storage\Common')) {
211 211
 				/** @var \OC\Files\Storage\Common $storage */
212 212
 				$storage->setMountOptions($mount->getOptions());
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 			return $storage;
215 215
 		});
216 216
 
217
-		\OC\Files\Filesystem::addStorageWrapper('enable_sharing', function ($mountPoint, \OCP\Files\Storage\IStorage $storage, \OCP\Files\Mount\IMountPoint $mount) {
217
+		\OC\Files\Filesystem::addStorageWrapper('enable_sharing', function($mountPoint, \OCP\Files\Storage\IStorage $storage, \OCP\Files\Mount\IMountPoint $mount) {
218 218
 			if (!$mount->getOption('enable_sharing', true)) {
219 219
 				return new \OC\Files\Storage\Wrapper\PermissionsMask([
220 220
 					'storage' => $storage,
@@ -225,21 +225,21 @@  discard block
 block discarded – undo
225 225
 		});
226 226
 
227 227
 		// install storage availability wrapper, before most other wrappers
228
-		\OC\Files\Filesystem::addStorageWrapper('oc_availability', function ($mountPoint, \OCP\Files\Storage\IStorage $storage) {
228
+		\OC\Files\Filesystem::addStorageWrapper('oc_availability', function($mountPoint, \OCP\Files\Storage\IStorage $storage) {
229 229
 			if (!$storage->instanceOfStorage('\OCA\Files_Sharing\SharedStorage') && !$storage->isLocal()) {
230 230
 				return new \OC\Files\Storage\Wrapper\Availability(['storage' => $storage]);
231 231
 			}
232 232
 			return $storage;
233 233
 		});
234 234
 
235
-		\OC\Files\Filesystem::addStorageWrapper('oc_encoding', function ($mountPoint, \OCP\Files\Storage $storage, \OCP\Files\Mount\IMountPoint $mount) {
235
+		\OC\Files\Filesystem::addStorageWrapper('oc_encoding', function($mountPoint, \OCP\Files\Storage $storage, \OCP\Files\Mount\IMountPoint $mount) {
236 236
 			if ($mount->getOption('encoding_compatibility', false) && !$storage->instanceOfStorage('\OCA\Files_Sharing\SharedStorage') && !$storage->isLocal()) {
237 237
 				return new \OC\Files\Storage\Wrapper\Encoding(['storage' => $storage]);
238 238
 			}
239 239
 			return $storage;
240 240
 		});
241 241
 
242
-		\OC\Files\Filesystem::addStorageWrapper('oc_quota', function ($mountPoint, $storage) {
242
+		\OC\Files\Filesystem::addStorageWrapper('oc_quota', function($mountPoint, $storage) {
243 243
 			// set up quota for home storages, even for other users
244 244
 			// which can happen when using sharing
245 245
 
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
 			return $storage;
262 262
 		});
263 263
 
264
-		\OC\Files\Filesystem::addStorageWrapper('readonly', function ($mountPoint, \OCP\Files\Storage\IStorage $storage, \OCP\Files\Mount\IMountPoint $mount) {
264
+		\OC\Files\Filesystem::addStorageWrapper('readonly', function($mountPoint, \OCP\Files\Storage\IStorage $storage, \OCP\Files\Mount\IMountPoint $mount) {
265 265
 			/*
266 266
 			 * Do not allow any operations that modify the storage
267 267
 			 */
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
 		//if we aren't logged in, there is no use to set up the filesystem
304 304
 		if ($user != "") {
305 305
 
306
-			$userDir = '/' . $user . '/files';
306
+			$userDir = '/'.$user.'/files';
307 307
 
308 308
 			//jail the user into his "home" directory
309 309
 			\OC\Files\Filesystem::init($user, $userDir);
@@ -382,7 +382,7 @@  discard block
 block discarded – undo
382 382
 			return \OCP\Files\FileInfo::SPACE_UNLIMITED;
383 383
 		}
384 384
 		$userQuota = $user->getQuota();
385
-		if($userQuota === 'none') {
385
+		if ($userQuota === 'none') {
386 386
 			return \OCP\Files\FileInfo::SPACE_UNLIMITED;
387 387
 		}
388 388
 		return OC_Helper::computerFileSize($userQuota);
@@ -399,7 +399,7 @@  discard block
 block discarded – undo
399 399
 	 */
400 400
 	public static function copySkeleton($userId, \OCP\Files\Folder $userDirectory) {
401 401
 
402
-		$plainSkeletonDirectory = \OC::$server->getConfig()->getSystemValue('skeletondirectory', \OC::$SERVERROOT . '/core/skeleton');
402
+		$plainSkeletonDirectory = \OC::$server->getConfig()->getSystemValue('skeletondirectory', \OC::$SERVERROOT.'/core/skeleton');
403 403
 		$userLang = \OC::$server->getL10NFactory()->findLanguage();
404 404
 		$skeletonDirectory = str_replace('{lang}', $userLang, $plainSkeletonDirectory);
405 405
 
@@ -421,9 +421,9 @@  discard block
 block discarded – undo
421 421
 		if ($instanceId === null) {
422 422
 			throw new \RuntimeException('no instance id!');
423 423
 		}
424
-		$appdata = 'appdata_' . $instanceId;
424
+		$appdata = 'appdata_'.$instanceId;
425 425
 		if ($userId === $appdata) {
426
-			throw new \RuntimeException('username is reserved name: ' . $appdata);
426
+			throw new \RuntimeException('username is reserved name: '.$appdata);
427 427
 		}
428 428
 
429 429
 		if (!empty($skeletonDirectory)) {
@@ -450,7 +450,7 @@  discard block
 block discarded – undo
450 450
 
451 451
 		// Verify if folder exists
452 452
 		$dir = opendir($source);
453
-		if($dir === false) {
453
+		if ($dir === false) {
454 454
 			$logger->error(sprintf('Could not opendir "%s"', $source), ['app' => 'core']);
455 455
 			return;
456 456
 		}
@@ -458,14 +458,14 @@  discard block
 block discarded – undo
458 458
 		// Copy the files
459 459
 		while (false !== ($file = readdir($dir))) {
460 460
 			if (!\OC\Files\Filesystem::isIgnoredDir($file)) {
461
-				if (is_dir($source . '/' . $file)) {
461
+				if (is_dir($source.'/'.$file)) {
462 462
 					$child = $target->newFolder($file);
463
-					self::copyr($source . '/' . $file, $child);
463
+					self::copyr($source.'/'.$file, $child);
464 464
 				} else {
465 465
 					$child = $target->newFile($file);
466
-					$sourceStream = fopen($source . '/' . $file, 'r');
467
-					if($sourceStream === false) {
468
-						$logger->error(sprintf('Could not fopen "%s"', $source . '/' . $file), ['app' => 'core']);
466
+					$sourceStream = fopen($source.'/'.$file, 'r');
467
+					if ($sourceStream === false) {
468
+						$logger->error(sprintf('Could not fopen "%s"', $source.'/'.$file), ['app' => 'core']);
469 469
 						closedir($dir);
470 470
 						return;
471 471
 					}
@@ -542,8 +542,8 @@  discard block
 block discarded – undo
542 542
 			return;
543 543
 		}
544 544
 
545
-		$timestamp = filemtime(OC::$SERVERROOT . '/version.php');
546
-		require OC::$SERVERROOT . '/version.php';
545
+		$timestamp = filemtime(OC::$SERVERROOT.'/version.php');
546
+		require OC::$SERVERROOT.'/version.php';
547 547
 		/** @var $timestamp int */
548 548
 		self::$versionCache['OC_Version_Timestamp'] = $timestamp;
549 549
 		/** @var $OC_Version string */
@@ -590,7 +590,7 @@  discard block
 block discarded – undo
590 590
 
591 591
 		// core js files need separate handling
592 592
 		if ($application !== 'core' && $file !== null) {
593
-			self::addTranslations ( $application );
593
+			self::addTranslations($application);
594 594
 		}
595 595
 		self::addExternalResource($application, $prepend, $path, "script");
596 596
 	}
@@ -667,7 +667,7 @@  discard block
 block discarded – undo
667 667
 		if ($type === "style") {
668 668
 			if (!in_array($path, self::$styles)) {
669 669
 				if ($prepend === true) {
670
-					array_unshift ( self::$styles, $path );
670
+					array_unshift(self::$styles, $path);
671 671
 				} else {
672 672
 					self::$styles[] = $path;
673 673
 				}
@@ -675,7 +675,7 @@  discard block
 block discarded – undo
675 675
 		} elseif ($type === "script") {
676 676
 			if (!in_array($path, self::$scripts)) {
677 677
 				if ($prepend === true) {
678
-					array_unshift ( self::$scripts, $path );
678
+					array_unshift(self::$scripts, $path);
679 679
 				} else {
680 680
 					self::$scripts [] = $path;
681 681
 				}
@@ -699,7 +699,7 @@  discard block
 block discarded – undo
699 699
 			'text' => $text
700 700
 		];
701 701
 		if ($prepend === true) {
702
-			array_unshift (self::$headers, $header);
702
+			array_unshift(self::$headers, $header);
703 703
 
704 704
 		} else {
705 705
 			self::$headers[] = $header;
@@ -715,7 +715,7 @@  discard block
 block discarded – undo
715 715
 	public static function checkServer(\OC\SystemConfig $config) {
716 716
 		$l = \OC::$server->getL10N('lib');
717 717
 		$errors = [];
718
-		$CONFIG_DATADIRECTORY = $config->getValue('datadirectory', OC::$SERVERROOT . '/data');
718
+		$CONFIG_DATADIRECTORY = $config->getValue('datadirectory', OC::$SERVERROOT.'/data');
719 719
 
720 720
 		if (!self::needUpgrade($config) && $config->getValue('installed', false)) {
721 721
 			// this check needs to be done every time
@@ -750,14 +750,14 @@  discard block
 block discarded – undo
750 750
 		}
751 751
 
752 752
 		// Check if config folder is writable.
753
-		if(!OC_Helper::isReadOnlyConfigEnabled()) {
753
+		if (!OC_Helper::isReadOnlyConfigEnabled()) {
754 754
 			if (!is_writable(OC::$configDir) or !is_readable(OC::$configDir)) {
755 755
 				$errors[] = [
756 756
 					'error' => $l->t('Cannot write into "config" directory'),
757 757
 					'hint' => $l->t('This can usually be fixed by giving the webserver write access to the config directory. See %s',
758
-						[ $urlGenerator->linkToDocs('admin-dir_permissions') ]) . '. '
758
+						[$urlGenerator->linkToDocs('admin-dir_permissions')]).'. '
759 759
 						. $l->t('Or, if you prefer to keep config.php file read only, set the option "config_is_read_only" to true in it. See %s',
760
-						[ $urlGenerator->linkToDocs('admin-config') ] )
760
+						[$urlGenerator->linkToDocs('admin-config')])
761 761
 				];
762 762
 			}
763 763
 		}
@@ -890,15 +890,15 @@  discard block
 block discarded – undo
890 890
 			}
891 891
 		}
892 892
 
893
-		foreach($missingDependencies as $missingDependency) {
893
+		foreach ($missingDependencies as $missingDependency) {
894 894
 			$errors[] = [
895 895
 				'error' => $l->t('PHP module %s not installed.', [$missingDependency]),
896 896
 				'hint' => $moduleHint
897 897
 			];
898 898
 			$webServerRestart = true;
899 899
 		}
900
-		foreach($invalidIniSettings as $setting) {
901
-			if(is_bool($setting[1])) {
900
+		foreach ($invalidIniSettings as $setting) {
901
+			if (is_bool($setting[1])) {
902 902
 				$setting[1] = $setting[1] ? 'on' : 'off';
903 903
 			}
904 904
 			$errors[] = [
@@ -916,7 +916,7 @@  discard block
 block discarded – undo
916 916
 		 * TODO: Should probably be implemented in the above generic dependency
917 917
 		 *       check somehow in the long-term.
918 918
 		 */
919
-		if($iniWrapper->getBool('mbstring.func_overload') !== null &&
919
+		if ($iniWrapper->getBool('mbstring.func_overload') !== null &&
920 920
 			$iniWrapper->getBool('mbstring.func_overload') === true) {
921 921
 			$errors[] = [
922 922
 				'error' => $l->t('mbstring.func_overload is set to "%s" instead of the expected value "0"', [$iniWrapper->getString('mbstring.func_overload')]),
@@ -924,16 +924,16 @@  discard block
 block discarded – undo
924 924
 			];
925 925
 		}
926 926
 
927
-		if(function_exists('xml_parser_create') &&
928
-			LIBXML_LOADED_VERSION < 20700 ) {
927
+		if (function_exists('xml_parser_create') &&
928
+			LIBXML_LOADED_VERSION < 20700) {
929 929
 			$version = LIBXML_LOADED_VERSION;
930
-			$major = floor($version/10000);
930
+			$major = floor($version / 10000);
931 931
 			$version -= ($major * 10000);
932
-			$minor = floor($version/100);
932
+			$minor = floor($version / 100);
933 933
 			$version -= ($minor * 100);
934 934
 			$patch = $version;
935 935
 			$errors[] = [
936
-				'error' => $l->t('libxml2 2.7.0 is at least required. Currently %s is installed.', [$major . '.' . $minor . '.' . $patch]),
936
+				'error' => $l->t('libxml2 2.7.0 is at least required. Currently %s is installed.', [$major.'.'.$minor.'.'.$patch]),
937 937
 				'hint' => $l->t('To fix this issue update your libxml2 version and restart your web server.')
938 938
 			];
939 939
 		}
@@ -999,7 +999,7 @@  discard block
 block discarded – undo
999 999
 	 * @return array arrays with error messages and hints
1000 1000
 	 */
1001 1001
 	public static function checkDataDirectoryPermissions($dataDirectory) {
1002
-		if(\OC::$server->getConfig()->getSystemValue('check_data_directory_permissions', true) === false) {
1002
+		if (\OC::$server->getConfig()->getSystemValue('check_data_directory_permissions', true) === false) {
1003 1003
 			return  [];
1004 1004
 		}
1005 1005
 		$l = \OC::$server->getL10N('lib');
@@ -1037,10 +1037,10 @@  discard block
 block discarded – undo
1037 1037
 				'hint' => $l->t('Check the value of "datadirectory" in your configuration')
1038 1038
 			];
1039 1039
 		}
1040
-		if (!file_exists($dataDirectory . '/.ocdata')) {
1040
+		if (!file_exists($dataDirectory.'/.ocdata')) {
1041 1041
 			$errors[] = [
1042 1042
 				'error' => $l->t('Your data directory is invalid'),
1043
-				'hint' => $l->t('Ensure there is a file called ".ocdata"' .
1043
+				'hint' => $l->t('Ensure there is a file called ".ocdata"'.
1044 1044
 					' in the root of the data directory.')
1045 1045
 			];
1046 1046
 		}
@@ -1056,7 +1056,7 @@  discard block
 block discarded – undo
1056 1056
 	public static function checkLoggedIn() {
1057 1057
 		// Check if we are a user
1058 1058
 		if (!\OC::$server->getUserSession()->isLoggedIn()) {
1059
-			header('Location: ' . \OC::$server->getURLGenerator()->linkToRoute(
1059
+			header('Location: '.\OC::$server->getURLGenerator()->linkToRoute(
1060 1060
 						'core.login.showLoginForm',
1061 1061
 						[
1062 1062
 							'redirect_url' => \OC::$server->getRequest()->getRequestUri(),
@@ -1067,7 +1067,7 @@  discard block
 block discarded – undo
1067 1067
 		}
1068 1068
 		// Redirect to 2FA challenge selection if 2FA challenge was not solved yet
1069 1069
 		if (\OC::$server->getTwoFactorAuthManager()->needsSecondFactor(\OC::$server->getUserSession()->getUser())) {
1070
-			header('Location: ' . \OC::$server->getURLGenerator()->linkToRoute('core.TwoFactorChallenge.selectChallenge'));
1070
+			header('Location: '.\OC::$server->getURLGenerator()->linkToRoute('core.TwoFactorChallenge.selectChallenge'));
1071 1071
 			exit();
1072 1072
 		}
1073 1073
 	}
@@ -1080,7 +1080,7 @@  discard block
 block discarded – undo
1080 1080
 	public static function checkAdminUser() {
1081 1081
 		OC_Util::checkLoggedIn();
1082 1082
 		if (!OC_User::isAdminUser(OC_User::getUser())) {
1083
-			header('Location: ' . \OCP\Util::linkToAbsolute('', 'index.php'));
1083
+			header('Location: '.\OCP\Util::linkToAbsolute('', 'index.php'));
1084 1084
 			exit();
1085 1085
 		}
1086 1086
 	}
@@ -1116,10 +1116,10 @@  discard block
 block discarded – undo
1116 1116
 					}
1117 1117
 				}
1118 1118
 
1119
-				if($config->getSystemValue('htaccess.IgnoreFrontController', false) === true || getenv('front_controller_active') === 'true') {
1120
-					$location = $urlGenerator->getAbsoluteURL('/apps/' . $appId . '/');
1119
+				if ($config->getSystemValue('htaccess.IgnoreFrontController', false) === true || getenv('front_controller_active') === 'true') {
1120
+					$location = $urlGenerator->getAbsoluteURL('/apps/'.$appId.'/');
1121 1121
 				} else {
1122
-					$location = $urlGenerator->getAbsoluteURL('/index.php/apps/' . $appId . '/');
1122
+					$location = $urlGenerator->getAbsoluteURL('/index.php/apps/'.$appId.'/');
1123 1123
 				}
1124 1124
 			}
1125 1125
 		}
@@ -1133,7 +1133,7 @@  discard block
 block discarded – undo
1133 1133
 	 */
1134 1134
 	public static function redirectToDefaultPage() {
1135 1135
 		$location = self::getDefaultPageUrl();
1136
-		header('Location: ' . $location);
1136
+		header('Location: '.$location);
1137 1137
 		exit();
1138 1138
 	}
1139 1139
 
@@ -1146,7 +1146,7 @@  discard block
 block discarded – undo
1146 1146
 		$id = \OC::$server->getSystemConfig()->getValue('instanceid', null);
1147 1147
 		if (is_null($id)) {
1148 1148
 			// We need to guarantee at least one letter in instanceid so it can be used as the session_name
1149
-			$id = 'oc' . \OC::$server->getSecureRandom()->generate(10, \OCP\Security\ISecureRandom::CHAR_LOWER.\OCP\Security\ISecureRandom::CHAR_DIGITS);
1149
+			$id = 'oc'.\OC::$server->getSecureRandom()->generate(10, \OCP\Security\ISecureRandom::CHAR_LOWER.\OCP\Security\ISecureRandom::CHAR_DIGITS);
1150 1150
 			\OC::$server->getSystemConfig()->setValue('instanceid', $id);
1151 1151
 		}
1152 1152
 		return $id;
@@ -1163,12 +1163,12 @@  discard block
 block discarded – undo
1163 1163
 	 */
1164 1164
 	public static function sanitizeHTML($value) {
1165 1165
 		if (is_array($value)) {
1166
-			$value = array_map(function ($value) {
1166
+			$value = array_map(function($value) {
1167 1167
 				return self::sanitizeHTML($value);
1168 1168
 			}, $value);
1169 1169
 		} else {
1170 1170
 			// Specify encoding for PHP<5.4
1171
-			$value = htmlspecialchars((string)$value, ENT_QUOTES, 'UTF-8');
1171
+			$value = htmlspecialchars((string) $value, ENT_QUOTES, 'UTF-8');
1172 1172
 		}
1173 1173
 		return $value;
1174 1174
 	}
@@ -1201,7 +1201,7 @@  discard block
 block discarded – undo
1201 1201
 		$testContent = 'This is used for testing whether htaccess is properly enabled to disallow access from the outside. This file can be safely removed.';
1202 1202
 
1203 1203
 		// creating a test file
1204
-		$testFile = $config->getSystemValue('datadirectory', OC::$SERVERROOT . '/data') . '/' . $fileName;
1204
+		$testFile = $config->getSystemValue('datadirectory', OC::$SERVERROOT.'/data').'/'.$fileName;
1205 1205
 
1206 1206
 		if (file_exists($testFile)) {// already running this test, possible recursive call
1207 1207
 			return false;
@@ -1210,7 +1210,7 @@  discard block
 block discarded – undo
1210 1210
 		$fp = @fopen($testFile, 'w');
1211 1211
 		if (!$fp) {
1212 1212
 			throw new OC\HintException('Can\'t create test file to check for working .htaccess file.',
1213
-				'Make sure it is possible for the webserver to write to ' . $testFile);
1213
+				'Make sure it is possible for the webserver to write to '.$testFile);
1214 1214
 		}
1215 1215
 		fwrite($fp, $testContent);
1216 1216
 		fclose($fp);
@@ -1237,10 +1237,10 @@  discard block
 block discarded – undo
1237 1237
 		}
1238 1238
 
1239 1239
 		$fileName = '/htaccesstest.txt';
1240
-		$testFile = $config->getSystemValue('datadirectory', OC::$SERVERROOT . '/data') . '/' . $fileName;
1240
+		$testFile = $config->getSystemValue('datadirectory', OC::$SERVERROOT.'/data').'/'.$fileName;
1241 1241
 
1242 1242
 		// accessing the file via http
1243
-		$url = \OC::$server->getURLGenerator()->getAbsoluteURL(OC::$WEBROOT . '/data' . $fileName);
1243
+		$url = \OC::$server->getURLGenerator()->getAbsoluteURL(OC::$WEBROOT.'/data'.$fileName);
1244 1244
 		try {
1245 1245
 			$content = \OC::$server->getHTTPClientService()->newClient()->get($url)->getBody();
1246 1246
 		} catch (\Exception $e) {
@@ -1248,9 +1248,9 @@  discard block
 block discarded – undo
1248 1248
 		}
1249 1249
 
1250 1250
 		if (strpos($url, 'https:') === 0) {
1251
-			$url = 'http:' . substr($url, 6);
1251
+			$url = 'http:'.substr($url, 6);
1252 1252
 		} else {
1253
-			$url = 'https:' . substr($url, 5);
1253
+			$url = 'https:'.substr($url, 5);
1254 1254
 		}
1255 1255
 
1256 1256
 		try {
@@ -1334,7 +1334,7 @@  discard block
 block discarded – undo
1334 1334
 		$theme = \OC::$server->getSystemConfig()->getValue("theme", '');
1335 1335
 
1336 1336
 		if ($theme === '') {
1337
-			if (is_dir(OC::$SERVERROOT . '/themes/default')) {
1337
+			if (is_dir(OC::$SERVERROOT.'/themes/default')) {
1338 1338
 				$theme = 'default';
1339 1339
 			}
1340 1340
 		}
@@ -1349,13 +1349,13 @@  discard block
 block discarded – undo
1349 1349
 	 * @return bool|string
1350 1350
 	 */
1351 1351
 	public static function normalizeUnicode($value) {
1352
-		if(Normalizer::isNormalized($value)) {
1352
+		if (Normalizer::isNormalized($value)) {
1353 1353
 			return $value;
1354 1354
 		}
1355 1355
 
1356 1356
 		$normalizedValue = Normalizer::normalize($value);
1357 1357
 		if ($normalizedValue === null || $normalizedValue === false) {
1358
-			\OC::$server->getLogger()->warning('normalizing failed for "' . $value . '"', ['app' => 'core']);
1358
+			\OC::$server->getLogger()->warning('normalizing failed for "'.$value.'"', ['app' => 'core']);
1359 1359
 			return $value;
1360 1360
 		}
1361 1361
 
@@ -1371,7 +1371,7 @@  discard block
 block discarded – undo
1371 1371
 		$version = OC_Util::getVersionString();
1372 1372
 		$build = OC_Util::getBuild();
1373 1373
 		if (!empty($build) and OC_Util::getChannel() === 'daily') {
1374
-			$version .= ' Build:' . $build;
1374
+			$version .= ' Build:'.$build;
1375 1375
 		}
1376 1376
 		return $version;
1377 1377
 	}
@@ -1393,7 +1393,7 @@  discard block
 block discarded – undo
1393 1393
 		}
1394 1394
 
1395 1395
 		// detect part files
1396
-		if (preg_match('/' . \OCP\Files\FileInfo::BLACKLIST_FILES_REGEX . '/', $trimmed) !== 0) {
1396
+		if (preg_match('/'.\OCP\Files\FileInfo::BLACKLIST_FILES_REGEX.'/', $trimmed) !== 0) {
1397 1397
 			return false;
1398 1398
 		}
1399 1399
 
@@ -1424,19 +1424,19 @@  discard block
 block discarded – undo
1424 1424
 			} else if ($config->getValue('debug', false) && $versionDiff < 0) {
1425 1425
 				// downgrade with debug
1426 1426
 				$installedMajor = explode('.', $installedVersion);
1427
-				$installedMajor = $installedMajor[0] . '.' . $installedMajor[1];
1427
+				$installedMajor = $installedMajor[0].'.'.$installedMajor[1];
1428 1428
 				$currentMajor = explode('.', $currentVersion);
1429
-				$currentMajor = $currentMajor[0] . '.' . $currentMajor[1];
1429
+				$currentMajor = $currentMajor[0].'.'.$currentMajor[1];
1430 1430
 				if ($installedMajor === $currentMajor) {
1431 1431
 					// Same major, allow downgrade for developers
1432 1432
 					return true;
1433 1433
 				} else {
1434 1434
 					// downgrade attempt, throw exception
1435
-					throw new \OC\HintException('Downgrading is not supported and is likely to cause unpredictable issues (from ' . $installedVersion . ' to ' . $currentVersion . ')');
1435
+					throw new \OC\HintException('Downgrading is not supported and is likely to cause unpredictable issues (from '.$installedVersion.' to '.$currentVersion.')');
1436 1436
 				}
1437 1437
 			} else if ($versionDiff < 0) {
1438 1438
 				// downgrade attempt, throw exception
1439
-				throw new \OC\HintException('Downgrading is not supported and is likely to cause unpredictable issues (from ' . $installedVersion . ' to ' . $currentVersion . ')');
1439
+				throw new \OC\HintException('Downgrading is not supported and is likely to cause unpredictable issues (from '.$installedVersion.' to '.$currentVersion.')');
1440 1440
 			}
1441 1441
 
1442 1442
 			// also check for upgrades for apps (independently from the user)
Please login to merge, or discard this patch.
lib/private/legacy/OC_Template.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -99,21 +99,21 @@  discard block
 block discarded – undo
99 99
 	 * @param string $renderAs
100 100
 	 */
101 101
 	public static function initTemplateEngine($renderAs) {
102
-		if (self::$initTemplateEngineFirstRun){
102
+		if (self::$initTemplateEngineFirstRun) {
103 103
 
104 104
 			//apps that started before the template initialization can load their own scripts/styles
105 105
 			//so to make sure this scripts/styles here are loaded first we use OC_Util::addScript() with $prepend=true
106 106
 			//meaning the last script/style in this list will be loaded first
107
-			if (\OC::$server->getSystemConfig()->getValue ('installed', false) && $renderAs !== 'error' && !\OCP\Util::needUpgrade()) {
108
-				if (\OC::$server->getConfig ()->getAppValue ( 'core', 'backgroundjobs_mode', 'ajax' ) == 'ajax') {
109
-					OC_Util::addScript ( 'backgroundjobs', null, true );
107
+			if (\OC::$server->getSystemConfig()->getValue('installed', false) && $renderAs !== 'error' && !\OCP\Util::needUpgrade()) {
108
+				if (\OC::$server->getConfig()->getAppValue('core', 'backgroundjobs_mode', 'ajax') == 'ajax') {
109
+					OC_Util::addScript('backgroundjobs', null, true);
110 110
 				}
111 111
 			}
112 112
 			OC_Util::addStyle('css-variables', null, true);
113 113
 			OC_Util::addStyle('server', null, true);
114 114
 			OC_Util::addTranslations('core', null, true);
115 115
 
116
-			if (\OC::$server->getSystemConfig()->getValue ('installed', false)) {
116
+			if (\OC::$server->getSystemConfig()->getValue('installed', false)) {
117 117
 				OC_Util::addStyle('search', 'results');
118 118
 				OC_Util::addScript('search', 'search', true);
119 119
 				OC_Util::addScript('search', 'searchprovider');
@@ -146,12 +146,12 @@  discard block
 block discarded – undo
146 146
 	 */
147 147
 	protected function findTemplate($theme, $app, $name) {
148 148
 		// Check if it is a app template or not.
149
-		if( $app !== '' ) {
149
+		if ($app !== '') {
150 150
 			$dirs = $this->getAppTemplateDirs($theme, $app, OC::$SERVERROOT, OC_App::getAppPath($app));
151 151
 		} else {
152 152
 			$dirs = $this->getCoreTemplateDirs($theme, OC::$SERVERROOT);
153 153
 		}
154
-		$locator = new \OC\Template\TemplateFileLocator( $dirs );
154
+		$locator = new \OC\Template\TemplateFileLocator($dirs);
155 155
 		$template = $locator->find($name);
156 156
 		$path = $locator->getPath();
157 157
 		return [$path, $template];
@@ -164,8 +164,8 @@  discard block
 block discarded – undo
164 164
 	 * @param string $text the text content for the element. If $text is null then the
165 165
 	 * element will be written as empty element. So use "" to get a closing tag.
166 166
 	 */
167
-	public function addHeader($tag, $attributes, $text=null) {
168
-		$this->headers[]= [
167
+	public function addHeader($tag, $attributes, $text = null) {
168
+		$this->headers[] = [
169 169
 			'tag' => $tag,
170 170
 			'attributes' => $attributes,
171 171
 			'text' => $text
@@ -182,10 +182,10 @@  discard block
 block discarded – undo
182 182
 	public function fetchPage($additionalParams = null) {
183 183
 		$data = parent::fetchPage($additionalParams);
184 184
 
185
-		if( $this->renderAs ) {
185
+		if ($this->renderAs) {
186 186
 			$page = new TemplateLayout($this->renderAs, $this->app);
187 187
 
188
-			if(is_array($additionalParams)) {
188
+			if (is_array($additionalParams)) {
189 189
 				foreach ($additionalParams as $key => $value) {
190 190
 					$page->assign($key, $value);
191 191
 				}
@@ -193,12 +193,12 @@  discard block
 block discarded – undo
193 193
 
194 194
 			// Add custom headers
195 195
 			$headers = '';
196
-			foreach(OC_Util::$headers as $header) {
196
+			foreach (OC_Util::$headers as $header) {
197 197
 				$headers .= '<'.\OCP\Util::sanitizeHTML($header['tag']);
198
-				if ( strcasecmp($header['tag'], 'script') === 0 && in_array('src', array_map('strtolower', array_keys($header['attributes']))) ) {
198
+				if (strcasecmp($header['tag'], 'script') === 0 && in_array('src', array_map('strtolower', array_keys($header['attributes'])))) {
199 199
 					$headers .= ' defer';
200 200
 				}
201
-				foreach($header['attributes'] as $name=>$value) {
201
+				foreach ($header['attributes'] as $name=>$value) {
202 202
 					$headers .= ' '.\OCP\Util::sanitizeHTML($name).'="'.\OCP\Util::sanitizeHTML($value).'"';
203 203
 				}
204 204
 				if ($header['text'] !== null) {
@@ -239,9 +239,9 @@  discard block
 block discarded – undo
239 239
 	 * @return boolean|null
240 240
 	 */
241 241
 	public static function printUserPage($application, $name, $parameters = []) {
242
-		$content = new OC_Template( $application, $name, "user" );
243
-		foreach( $parameters as $key => $value ) {
244
-			$content->assign( $key, $value );
242
+		$content = new OC_Template($application, $name, "user");
243
+		foreach ($parameters as $key => $value) {
244
+			$content->assign($key, $value);
245 245
 		}
246 246
 		print $content->printPage();
247 247
 	}
@@ -254,9 +254,9 @@  discard block
 block discarded – undo
254 254
 	 * @return bool
255 255
 	 */
256 256
 	public static function printAdminPage($application, $name, $parameters = []) {
257
-		$content = new OC_Template( $application, $name, "admin" );
258
-		foreach( $parameters as $key => $value ) {
259
-			$content->assign( $key, $value );
257
+		$content = new OC_Template($application, $name, "admin");
258
+		foreach ($parameters as $key => $value) {
259
+			$content->assign($key, $value);
260 260
 		}
261 261
 		return $content->printPage();
262 262
 	}
@@ -270,8 +270,8 @@  discard block
 block discarded – undo
270 270
 	 */
271 271
 	public static function printGuestPage($application, $name, $parameters = []) {
272 272
 		$content = new OC_Template($application, $name, $name === 'error' ? $name : 'guest');
273
-		foreach( $parameters as $key => $value ) {
274
-			$content->assign( $key, $value );
273
+		foreach ($parameters as $key => $value) {
274
+			$content->assign($key, $value);
275 275
 		}
276 276
 		return $content->printPage();
277 277
 	}
@@ -296,9 +296,9 @@  discard block
 block discarded – undo
296 296
 
297 297
 		http_response_code($statusCode);
298 298
 		try {
299
-			$content = new \OC_Template( '', 'error', 'error', false );
299
+			$content = new \OC_Template('', 'error', 'error', false);
300 300
 			$errors = [['error' => $error_msg, 'hint' => $hint]];
301
-			$content->assign( 'errors', $errors );
301
+			$content->assign('errors', $errors);
302 302
 			$content->printPage();
303 303
 		} catch (\Exception $e) {
304 304
 			$logger = \OC::$server->getLogger();
Please login to merge, or discard this patch.
lib/private/legacy/OC_Response.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -40,10 +40,10 @@  discard block
 block discarded – undo
40 40
 				\OC\AppFramework\Http\Request::USER_AGENT_ANDROID_MOBILE_CHROME,
41 41
 				\OC\AppFramework\Http\Request::USER_AGENT_FREEBOX,
42 42
 			])) {
43
-			header( 'Content-Disposition: ' . rawurlencode($type) . '; filename="' . rawurlencode( $filename ) . '"' );
43
+			header('Content-Disposition: '.rawurlencode($type).'; filename="'.rawurlencode($filename).'"');
44 44
 		} else {
45
-			header( 'Content-Disposition: ' . rawurlencode($type) . '; filename*=UTF-8\'\'' . rawurlencode( $filename )
46
-												 . '; filename="' . rawurlencode( $filename ) . '"' );
45
+			header('Content-Disposition: '.rawurlencode($type).'; filename*=UTF-8\'\''.rawurlencode($filename)
46
+												 . '; filename="'.rawurlencode($filename).'"');
47 47
 		}
48 48
 	}
49 49
 
@@ -90,11 +90,11 @@  discard block
 block discarded – undo
90 90
 			. 'connect-src *; '
91 91
 			. 'object-src \'none\'; '
92 92
 			. 'base-uri \'self\'; ';
93
-		header('Content-Security-Policy:' . $policy);
93
+		header('Content-Security-Policy:'.$policy);
94 94
 
95 95
 		// Send fallback headers for installations that don't have the possibility to send
96 96
 		// custom headers on the webserver side
97
-		if(getenv('modHeadersAvailable') !== 'true') {
97
+		if (getenv('modHeadersAvailable') !== 'true') {
98 98
 			header('Referrer-Policy: no-referrer'); // https://www.w3.org/TR/referrer-policy/
99 99
 			header('X-Content-Type-Options: nosniff'); // Disable sniffing the content type for IE
100 100
 			header('X-Download-Options: noopen'); // https://msdn.microsoft.com/en-us/library/jj542450(v=vs.85).aspx
Please login to merge, or discard this patch.
lib/private/legacy/OC_Files.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 	private static function sendHeaders($filename, $name, array $rangeArray) {
78 78
 		OC_Response::setContentDispositionHeader($name, 'attachment');
79 79
 		header('Content-Transfer-Encoding: binary', true);
80
-		header('Pragma: public');// enable caching in IE
80
+		header('Pragma: public'); // enable caching in IE
81 81
 		header('Expires: 0');
82 82
 		header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
83 83
 		$fileSize = \OC\Files\Filesystem::filesize($filename);
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 			}
122 122
 
123 123
 			if (!is_array($files)) {
124
-				$filename = $dir . '/' . $files;
124
+				$filename = $dir.'/'.$files;
125 125
 				if (!$view->is_dir($filename)) {
126 126
 					self::getSingleFile($view, $dir, $files, is_null($params) ? [] : $params);
127 127
 					return;
@@ -136,9 +136,9 @@  discard block
 block discarded – undo
136 136
 					$name = $basename;
137 137
 				}
138 138
 
139
-				$filename = $dir . '/' . $name;
139
+				$filename = $dir.'/'.$name;
140 140
 			} else {
141
-				$filename = $dir . '/' . $files;
141
+				$filename = $dir.'/'.$files;
142 142
 				$getType = self::ZIP_DIR;
143 143
 				// downloading root ?
144 144
 				if ($files !== '') {
@@ -153,13 +153,13 @@  discard block
 block discarded – undo
153 153
 				$fileInfos = [];
154 154
 				$fileSize = 0;
155 155
 				foreach ($files as $file) {
156
-					$fileInfo = \OC\Files\Filesystem::getFileInfo($dir . '/' . $file);
156
+					$fileInfo = \OC\Files\Filesystem::getFileInfo($dir.'/'.$file);
157 157
 					$fileSize += $fileInfo->getSize();
158 158
 					$fileInfos[] = $fileInfo;
159 159
 				}
160 160
 				$numberOfFiles = self::getNumberOfFiles($fileInfos);
161 161
 			} elseif ($getType === self::ZIP_DIR) {
162
-				$fileInfo = \OC\Files\Filesystem::getFileInfo($dir . '/' . $files);
162
+				$fileInfo = \OC\Files\Filesystem::getFileInfo($dir.'/'.$files);
163 163
 				$fileSize = $fileInfo->getSize();
164 164
 				$numberOfFiles = self::getNumberOfFiles([$fileInfo]);
165 165
 			}
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 			OC_Util::obEnd();
169 169
 
170 170
 			$streamer->sendHeaders($name);
171
-			$executionTime = (int)OC::$server->getIniWrapper()->getNumeric('max_execution_time');
171
+			$executionTime = (int) OC::$server->getIniWrapper()->getNumeric('max_execution_time');
172 172
 			if (strpos(@ini_get('disable_functions'), 'set_time_limit') === false) {
173 173
 				@set_time_limit(0);
174 174
 			}
@@ -176,11 +176,11 @@  discard block
 block discarded – undo
176 176
 
177 177
 			if ($getType === self::ZIP_FILES) {
178 178
 				foreach ($files as $file) {
179
-					$file = $dir . '/' . $file;
179
+					$file = $dir.'/'.$file;
180 180
 					if (\OC\Files\Filesystem::is_file($file)) {
181 181
 						$userFolder = \OC::$server->getRootFolder()->get(\OC\Files\Filesystem::getRoot());
182 182
 						$file = $userFolder->get($file);
183
-						if($file instanceof \OC\Files\Node\File) {
183
+						if ($file instanceof \OC\Files\Node\File) {
184 184
 							try {
185 185
 								$fh = $file->fopen('r');
186 186
 							} catch (\OCP\Files\NotPermittedException $e) {
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
 							// File is not a file? …
193 193
 							\OC::$server->getLogger()->debug(
194 194
 								'File given, but no Node available. Name {file}',
195
-								[ 'app' => 'files', 'file' => $file ]
195
+								['app' => 'files', 'file' => $file]
196 196
 							);
197 197
 							continue;
198 198
 						}
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
 					}
204 204
 				}
205 205
 			} elseif ($getType === self::ZIP_DIR) {
206
-				$file = $dir . '/' . $files;
206
+				$file = $dir.'/'.$files;
207 207
 				$streamer->addDirRecursive($file);
208 208
 			}
209 209
 			$streamer->finalize();
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
 	 * @return array $rangeArray ('from'=>int,'to'=>int), ...
236 236
 	 */
237 237
 	private static function parseHttpRangeHeader($rangeHeaderPos, $fileSize) {
238
-		$rArray=explode(',', $rangeHeaderPos);
238
+		$rArray = explode(',', $rangeHeaderPos);
239 239
 		$minOffset = 0;
240 240
 		$ind = 0;
241 241
 
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
 				if ($ranges[0] < $minOffset) { // case: bytes=500-700,601-999
248 248
 					$ranges[0] = $minOffset;
249 249
 				}
250
-				if ($ind > 0 && $rangeArray[$ind-1]['to']+1 == $ranges[0]) { // case: bytes=500-600,601-999
250
+				if ($ind > 0 && $rangeArray[$ind - 1]['to'] + 1 == $ranges[0]) { // case: bytes=500-600,601-999
251 251
 					$ind--;
252 252
 					$ranges[0] = $rangeArray[$ind]['from'];
253 253
 				}
@@ -256,9 +256,9 @@  discard block
 block discarded – undo
256 256
 			if (is_numeric($ranges[0]) && is_numeric($ranges[1]) && $ranges[0] < $fileSize && $ranges[0] <= $ranges[1]) {
257 257
 				// case: x-x
258 258
 				if ($ranges[1] >= $fileSize) {
259
-					$ranges[1] = $fileSize-1;
259
+					$ranges[1] = $fileSize - 1;
260 260
 				}
261
-				$rangeArray[$ind++] = [ 'from' => $ranges[0], 'to' => $ranges[1], 'size' => $fileSize ];
261
+				$rangeArray[$ind++] = ['from' => $ranges[0], 'to' => $ranges[1], 'size' => $fileSize];
262 262
 				$minOffset = $ranges[1] + 1;
263 263
 				if ($minOffset >= $fileSize) {
264 264
 					break;
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
 			}
267 267
 			elseif (is_numeric($ranges[0]) && $ranges[0] < $fileSize) {
268 268
 				// case: x-
269
-				$rangeArray[$ind++] = [ 'from' => $ranges[0], 'to' => $fileSize-1, 'size' => $fileSize ];
269
+				$rangeArray[$ind++] = ['from' => $ranges[0], 'to' => $fileSize - 1, 'size' => $fileSize];
270 270
 				break;
271 271
 			}
272 272
 			elseif (is_numeric($ranges[1])) {
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
 				if ($ranges[1] > $fileSize) {
275 275
 					$ranges[1] = $fileSize;
276 276
 				}
277
-				$rangeArray[$ind++] = [ 'from' => $fileSize-$ranges[1], 'to' => $fileSize-1, 'size' => $fileSize ];
277
+				$rangeArray[$ind++] = ['from' => $fileSize - $ranges[1], 'to' => $fileSize - 1, 'size' => $fileSize];
278 278
 				break;
279 279
 			}
280 280
 		}
@@ -288,13 +288,13 @@  discard block
 block discarded – undo
288 288
 	 * @param array $params ; 'head' boolean to only send header of the request ; 'range' http range header
289 289
 	 */
290 290
 	private static function getSingleFile($view, $dir, $name, $params) {
291
-		$filename = $dir . '/' . $name;
291
+		$filename = $dir.'/'.$name;
292 292
 		$file = null;
293 293
 
294 294
 		try {
295 295
 			$userFolder = \OC::$server->getRootFolder()->get(\OC\Files\Filesystem::getRoot());
296 296
 			$file = $userFolder->get($filename);
297
-			if(!$file instanceof \OC\Files\Node\File || !$file->isReadable()) {
297
+			if (!$file instanceof \OC\Files\Node\File || !$file->isReadable()) {
298 298
 				http_response_code(403);
299 299
 				die('403 Forbidden');
300 300
 			}
@@ -391,17 +391,17 @@  discard block
 block discarded – undo
391 391
 	 */
392 392
 	public static function lockFiles($view, $dir, $files) {
393 393
 		if (!is_array($files)) {
394
-			$file = $dir . '/' . $files;
394
+			$file = $dir.'/'.$files;
395 395
 			$files = [$file];
396 396
 		}
397 397
 		foreach ($files as $file) {
398
-			$file = $dir . '/' . $file;
398
+			$file = $dir.'/'.$file;
399 399
 			$view->lockFile($file, ILockingProvider::LOCK_SHARED);
400 400
 			if ($view->is_dir($file)) {
401 401
 				$contents = $view->getDirectoryContent($file);
402
-				$contents = array_map(function ($fileInfo) use ($file) {
402
+				$contents = array_map(function($fileInfo) use ($file) {
403 403
 					/** @var \OCP\Files\FileInfo $fileInfo */
404
-					return $file . '/' . $fileInfo->getName();
404
+					return $file.'/'.$fileInfo->getName();
405 405
 				}, $contents);
406 406
 				self::lockFiles($view, $dir, $contents);
407 407
 			}
@@ -421,12 +421,12 @@  discard block
 block discarded – undo
421 421
 		}
422 422
 		if ($getType === self::ZIP_FILES) {
423 423
 			foreach ($files as $file) {
424
-				$file = $dir . '/' . $file;
424
+				$file = $dir.'/'.$file;
425 425
 				$view->unlockFile($file, ILockingProvider::LOCK_SHARED);
426 426
 			}
427 427
 		}
428 428
 		if ($getType === self::ZIP_DIR) {
429
-			$file = $dir . '/' . $files;
429
+			$file = $dir.'/'.$files;
430 430
 			$view->unlockFile($file, ILockingProvider::LOCK_SHARED);
431 431
 		}
432 432
 	}
Please login to merge, or discard this patch.