Completed
Pull Request — master (#5623)
by Georg
12:58
created
lib/private/Settings/Personal/PersonalInfo.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 	public function getForm() {
95 95
 		$federatedFileSharingEnabled = $this->appManager->isEnabledForUser('federatedfilesharing');
96 96
 		$lookupServerUploadEnabled = false;
97
-		if($federatedFileSharingEnabled) {
97
+		if ($federatedFileSharingEnabled) {
98 98
 			$federatedFileSharing = new Application();
99 99
 			$shareProvider = $federatedFileSharing->getFederatedShareProvider();
100 100
 			$lookupServerUploadEnabled = $shareProvider->isLookupServerUploadEnabled();
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
 	 */
195 195
 	private function getLanguages(IUser $user) {
196 196
 		$forceLanguage = $this->config->getSystemValue('force_language', false);
197
-		if($forceLanguage !== false) {
197
+		if ($forceLanguage !== false) {
198 198
 			return [];
199 199
 		}
200 200
 
@@ -206,16 +206,16 @@  discard block
 block discarded – undo
206 206
 		$commonLanguages = [];
207 207
 		$languages = [];
208 208
 
209
-		foreach($languageCodes as $lang) {
209
+		foreach ($languageCodes as $lang) {
210 210
 			$l = \OC::$server->getL10N('settings', $lang);
211 211
 			// TRANSLATORS this is the language name for the language switcher in the personal settings and should be the localized version
212 212
 			$potentialName = (string) $l->t('__language_name__');
213
-			if($l->getLanguageCode() === $lang && substr($potentialName, 0, 1) !== '_') {//first check if the language name is in the translation file
213
+			if ($l->getLanguageCode() === $lang && substr($potentialName, 0, 1) !== '_') {//first check if the language name is in the translation file
214 214
 				$ln = array('code' => $lang, 'name' => $potentialName);
215 215
 			} elseif ($lang === 'en') {
216 216
 				$ln = ['code' => $lang, 'name' => 'English (US)'];
217
-			}else{//fallback to language code
218
-				$ln=array('code'=>$lang, 'name'=>$lang);
217
+			} else {//fallback to language code
218
+				$ln = array('code'=>$lang, 'name'=>$lang);
219 219
 			}
220 220
 
221 221
 			// put appropriate languages into appropriate arrays, to print them sorted
@@ -223,9 +223,9 @@  discard block
 block discarded – undo
223 223
 			if ($lang === $userLang) {
224 224
 				$userLang = $ln;
225 225
 			} elseif (in_array($lang, self::COMMON_LANGUAGE_CODES)) {
226
-				$commonLanguages[array_search($lang, self::COMMON_LANGUAGE_CODES)]=$ln;
226
+				$commonLanguages[array_search($lang, self::COMMON_LANGUAGE_CODES)] = $ln;
227 227
 			} else {
228
-				$languages[]=$ln;
228
+				$languages[] = $ln;
229 229
 			}
230 230
 		}
231 231
 
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 		ksort($commonLanguages);
241 241
 
242 242
 		// sort now by displayed language not the iso-code
243
-		usort( $languages, function ($a, $b) {
243
+		usort($languages, function($a, $b) {
244 244
 			if ($a['code'] === $a['name'] && $b['code'] !== $b['name']) {
245 245
 				// If a doesn't have a name, but b does, list b before a
246 246
 				return 1;
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
 
263 263
 	private function getLocales(IUser $user) {
264 264
 		$forceLanguage = $this->config->getSystemValue('force_locale', false);
265
-		if($forceLanguage !== false) {
265
+		if ($forceLanguage !== false) {
266 266
 			return [];
267 267
 		}
268 268
 
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
 				default:
314 314
 					$message = $this->l->t('Verify');
315 315
 			}
316
-			$messageParameters[$property . 'Message'] = $message;
316
+			$messageParameters[$property.'Message'] = $message;
317 317
 		}
318 318
 		return $messageParameters;
319 319
 	}
Please login to merge, or discard this patch.
lib/private/L10N/Factory.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -147,9 +147,9 @@  discard block
 block discarded – undo
147 147
 		 *
148 148
 		 * @link https://github.com/owncloud/core/issues/21955
149 149
 		 */
150
-		if($this->config->getSystemValue('installed', false)) {
151
-			$userId = !is_null($this->userSession->getUser()) ? $this->userSession->getUser()->getUID() :  null;
152
-			if(!is_null($userId)) {
150
+		if ($this->config->getSystemValue('installed', false)) {
151
+			$userId = !is_null($this->userSession->getUser()) ? $this->userSession->getUser()->getUID() : null;
152
+			if (!is_null($userId)) {
153 153
 				$userLang = $this->config->getUserValue($userId, 'core', 'lang', null);
154 154
 			} else {
155 155
 				$userLang = null;
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 	public function findLocale($lang = null)
189 189
 	{
190 190
 		if ($this->config->getSystemValue('installed', false)) {
191
-			$userId = null !== $this->userSession->getUser() ? $this->userSession->getUser()->getUID() :  null;
191
+			$userId = null !== $this->userSession->getUser() ? $this->userSession->getUser()->getUID() : null;
192 192
 			$userLocale = null;
193 193
 			if (null !== $userId) {
194 194
 				$userLocale = $this->config->getUserValue($userId, 'core', 'locale', null);
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
 		// merge with translations from theme
251 251
 		$theme = $this->config->getSystemValue('theme');
252 252
 		if (!empty($theme)) {
253
-			$themeDir = $this->serverRoot . '/themes/' . $theme . substr($dir, strlen($this->serverRoot));
253
+			$themeDir = $this->serverRoot.'/themes/'.$theme.substr($dir, strlen($this->serverRoot));
254 254
 
255 255
 			if (is_dir($themeDir)) {
256 256
 				$files = scandir($themeDir);
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
 
271 271
 	public function findAvailableLocales()
272 272
 	{
273
-		$localeData = file_get_contents(__DIR__ . '/locales.json');
273
+		$localeData = file_get_contents(__DIR__.'/locales.json');
274 274
 		return json_decode($localeData, true);
275 275
 	}
276 276
 
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
 	 */
352 352
 	private function isSubDirectory($sub, $parent) {
353 353
 		// Check whether $sub contains no ".."
354
-		if(strpos($sub, '..') !== false) {
354
+		if (strpos($sub, '..') !== false) {
355 355
 			return false;
356 356
 		}
357 357
 
@@ -376,12 +376,12 @@  discard block
 block discarded – undo
376 376
 		$languageFiles = [];
377 377
 
378 378
 		$i18nDir = $this->findL10nDir($app);
379
-		$transFile = strip_tags($i18nDir) . strip_tags($lang) . '.json';
379
+		$transFile = strip_tags($i18nDir).strip_tags($lang).'.json';
380 380
 
381
-		if (($this->isSubDirectory($transFile, $this->serverRoot . '/core/l10n/')
382
-				|| $this->isSubDirectory($transFile, $this->serverRoot . '/lib/l10n/')
383
-				|| $this->isSubDirectory($transFile, $this->serverRoot . '/settings/l10n/')
384
-				|| $this->isSubDirectory($transFile, \OC_App::getAppPath($app) . '/l10n/')
381
+		if (($this->isSubDirectory($transFile, $this->serverRoot.'/core/l10n/')
382
+				|| $this->isSubDirectory($transFile, $this->serverRoot.'/lib/l10n/')
383
+				|| $this->isSubDirectory($transFile, $this->serverRoot.'/settings/l10n/')
384
+				|| $this->isSubDirectory($transFile, \OC_App::getAppPath($app).'/l10n/')
385 385
 			)
386 386
 			&& file_exists($transFile)) {
387 387
 			// load the translations file
@@ -391,7 +391,7 @@  discard block
 block discarded – undo
391 391
 		// merge with translations from theme
392 392
 		$theme = $this->config->getSystemValue('theme');
393 393
 		if (!empty($theme)) {
394
-			$transFile = $this->serverRoot . '/themes/' . $theme . substr($transFile, strlen($this->serverRoot));
394
+			$transFile = $this->serverRoot.'/themes/'.$theme.substr($transFile, strlen($this->serverRoot));
395 395
 			if (file_exists($transFile)) {
396 396
 				$languageFiles[] = $transFile;
397 397
 			}
@@ -408,14 +408,14 @@  discard block
 block discarded – undo
408 408
 	 */
409 409
 	protected function findL10nDir($app = null) {
410 410
 		if (in_array($app, ['core', 'lib', 'settings'])) {
411
-			if (file_exists($this->serverRoot . '/' . $app . '/l10n/')) {
412
-				return $this->serverRoot . '/' . $app . '/l10n/';
411
+			if (file_exists($this->serverRoot.'/'.$app.'/l10n/')) {
412
+				return $this->serverRoot.'/'.$app.'/l10n/';
413 413
 			}
414 414
 		} else if ($app && \OC_App::getAppPath($app) !== false) {
415 415
 			// Check if the app is in the app folder
416
-			return \OC_App::getAppPath($app) . '/l10n/';
416
+			return \OC_App::getAppPath($app).'/l10n/';
417 417
 		}
418
-		return $this->serverRoot . '/core/l10n/';
418
+		return $this->serverRoot.'/core/l10n/';
419 419
 	}
420 420
 
421 421
 
@@ -432,15 +432,15 @@  discard block
 block discarded – undo
432 432
 			return $this->pluralFunctions[$string];
433 433
 		}
434 434
 
435
-		if (preg_match( '/^\s*nplurals\s*=\s*(\d+)\s*;\s*plural=(.*)$/u', $string, $matches)) {
435
+		if (preg_match('/^\s*nplurals\s*=\s*(\d+)\s*;\s*plural=(.*)$/u', $string, $matches)) {
436 436
 			// sanitize
437
-			$nplurals = preg_replace( '/[^0-9]/', '', $matches[1] );
438
-			$plural = preg_replace( '#[^n0-9:\(\)\?\|\&=!<>+*/\%-]#', '', $matches[2] );
437
+			$nplurals = preg_replace('/[^0-9]/', '', $matches[1]);
438
+			$plural = preg_replace('#[^n0-9:\(\)\?\|\&=!<>+*/\%-]#', '', $matches[2]);
439 439
 
440 440
 			$body = str_replace(
441
-				array( 'plural', 'n', '$n$plurals', ),
442
-				array( '$plural', '$n', '$nplurals', ),
443
-				'nplurals='. $nplurals . '; plural=' . $plural
441
+				array('plural', 'n', '$n$plurals',),
442
+				array('$plural', '$n', '$nplurals',),
443
+				'nplurals='.$nplurals.'; plural='.$plural
444 444
 			);
445 445
 
446 446
 			// add parents
@@ -448,9 +448,9 @@  discard block
 block discarded – undo
448 448
 			$body .= ';';
449 449
 			$res = '';
450 450
 			$p = 0;
451
-			for($i = 0; $i < strlen($body); $i++) {
451
+			for ($i = 0; $i < strlen($body); $i++) {
452 452
 				$ch = $body[$i];
453
-				switch ( $ch ) {
453
+				switch ($ch) {
454 454
 					case '?':
455 455
 						$res .= ' ? (';
456 456
 						$p++;
@@ -459,7 +459,7 @@  discard block
 block discarded – undo
459 459
 						$res .= ') : (';
460 460
 						break;
461 461
 					case ';':
462
-						$res .= str_repeat( ')', $p ) . ';';
462
+						$res .= str_repeat(')', $p).';';
463 463
 						$p = 0;
464 464
 						break;
465 465
 					default:
@@ -467,7 +467,7 @@  discard block
 block discarded – undo
467 467
 				}
468 468
 			}
469 469
 
470
-			$body = $res . 'return ($plural>=$nplurals?$nplurals-1:$plural);';
470
+			$body = $res.'return ($plural>=$nplurals?$nplurals-1:$plural);';
471 471
 			$function = create_function('$n', $body);
472 472
 			$this->pluralFunctions[$string] = $function;
473 473
 			return $function;
Please login to merge, or discard this patch.
lib/private/TemplateLayout.php 1 patch
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -53,44 +53,44 @@  discard block
 block discarded – undo
53 53
 	 * @param string $renderAs
54 54
 	 * @param string $appId application id
55 55
 	 */
56
-	public function __construct( $renderAs, $appId = '' ) {
56
+	public function __construct($renderAs, $appId = '') {
57 57
 
58 58
 		// yes - should be injected ....
59 59
 		$this->config = \OC::$server->getConfig();
60 60
 
61 61
 
62 62
 		// Decide which page we show
63
-		if($renderAs == 'user') {
64
-			parent::__construct( 'core', 'layout.user' );
65
-			if(in_array(\OC_App::getCurrentApp(), ['settings','admin', 'help']) !== false) {
63
+		if ($renderAs == 'user') {
64
+			parent::__construct('core', 'layout.user');
65
+			if (in_array(\OC_App::getCurrentApp(), ['settings', 'admin', 'help']) !== false) {
66 66
 				$this->assign('bodyid', 'body-settings');
67
-			}else{
67
+			} else {
68 68
 				$this->assign('bodyid', 'body-user');
69 69
 			}
70 70
 
71 71
 			// Code integrity notification
72 72
 			$integrityChecker = \OC::$server->getIntegrityCodeChecker();
73
-			if(\OC_User::isAdminUser(\OC_User::getUser()) && $integrityChecker->isCodeCheckEnforced() && !$integrityChecker->hasPassedCheck()) {
73
+			if (\OC_User::isAdminUser(\OC_User::getUser()) && $integrityChecker->isCodeCheckEnforced() && !$integrityChecker->hasPassedCheck()) {
74 74
 				\OCP\Util::addScript('core', 'integritycheck-failed-notification');
75 75
 			}
76 76
 
77 77
 			// Add navigation entry
78
-			$this->assign( 'application', '');
79
-			$this->assign( 'appid', $appId );
78
+			$this->assign('application', '');
79
+			$this->assign('appid', $appId);
80 80
 			$navigation = \OC_App::getNavigation();
81
-			$this->assign( 'navigation', $navigation);
81
+			$this->assign('navigation', $navigation);
82 82
 			$settingsNavigation = \OC_App::getSettingsNavigation();
83
-			$this->assign( 'settingsnavigation', $settingsNavigation);
84
-			foreach($navigation as $entry) {
83
+			$this->assign('settingsnavigation', $settingsNavigation);
84
+			foreach ($navigation as $entry) {
85 85
 				if ($entry['active']) {
86
-					$this->assign( 'application', $entry['name'] );
86
+					$this->assign('application', $entry['name']);
87 87
 					break;
88 88
 				}
89 89
 			}
90 90
 			
91
-			foreach($settingsNavigation as $entry) {
91
+			foreach ($settingsNavigation as $entry) {
92 92
 				if ($entry['active']) {
93
-					$this->assign( 'application', $entry['name'] );
93
+					$this->assign('application', $entry['name']);
94 94
 					break;
95 95
 				}
96 96
 			}
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 		$this->assign('language', \OC::$server->getL10NFactory()->findLanguage());
120 120
 		$this->assign('locale', \OC::$server->getL10NFactory()->findLocale());
121 121
 
122
-		if(\OC::$server->getSystemConfig()->getValue('installed', false)) {
122
+		if (\OC::$server->getSystemConfig()->getValue('installed', false)) {
123 123
 			if (empty(self::$versionHash)) {
124 124
 				$v = \OC_App::getAppVersions();
125 125
 				$v['core'] = implode('.', \OCP\Util::getVersion());
@@ -150,10 +150,10 @@  discard block
 block discarded – undo
150 150
 				$this->append('jsfiles', \OC::$server->getURLGenerator()->linkToRoute('core.OCJS.getConfig', ['v' => self::$versionHash]));
151 151
 			}
152 152
 		}
153
-		foreach($jsFiles as $info) {
153
+		foreach ($jsFiles as $info) {
154 154
 			$web = $info[1];
155 155
 			$file = $info[2];
156
-			$this->append( 'jsfiles', $web.'/'.$file . $this->getVersionHashSuffix() );
156
+			$this->append('jsfiles', $web.'/'.$file.$this->getVersionHashSuffix());
157 157
 		}
158 158
 
159 159
 		try {
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
 
165 165
 		// Do not initialise scss appdata until we have a fully installed instance
166 166
 		// Do not load scss for update, errors, installation or login page
167
-		if(\OC::$server->getSystemConfig()->getValue('installed', false)
167
+		if (\OC::$server->getSystemConfig()->getValue('installed', false)
168 168
 			&& !\OCP\Util::needUpgrade()
169 169
 			&& $pathInfo !== ''
170 170
 			&& !preg_match('/^\/login/', $pathInfo)) {
@@ -179,27 +179,27 @@  discard block
 block discarded – undo
179 179
 		$this->assign('cssfiles', array());
180 180
 		$this->assign('printcssfiles', []);
181 181
 		$this->assign('versionHash', self::$versionHash);
182
-		foreach($cssFiles as $info) {
182
+		foreach ($cssFiles as $info) {
183 183
 			$web = $info[1];
184 184
 			$file = $info[2];
185 185
 
186 186
 			if (substr($file, -strlen('print.css')) === 'print.css') {
187
-				$this->append( 'printcssfiles', $web.'/'.$file . $this->getVersionHashSuffix() );
187
+				$this->append('printcssfiles', $web.'/'.$file.$this->getVersionHashSuffix());
188 188
 			} else {
189
-				$this->append( 'cssfiles', $web.'/'.$file . $this->getVersionHashSuffix()  );
189
+				$this->append('cssfiles', $web.'/'.$file.$this->getVersionHashSuffix());
190 190
 			}
191 191
 		}
192 192
 	}
193 193
 
194 194
 	protected function getVersionHashSuffix() {
195
-		if(\OC::$server->getConfig()->getSystemValue('debug', false)) {
195
+		if (\OC::$server->getConfig()->getSystemValue('debug', false)) {
196 196
 			// allows chrome workspace mapping in debug mode
197 197
 			return "";
198 198
 		}
199 199
 		if ($this->config->getSystemValue('installed', false) && \OC::$server->getAppManager()->isInstalled('theming')) {
200
-			return '?v=' . self::$versionHash . '-' . $this->config->getAppValue('theming', 'cachebuster', '0');
200
+			return '?v='.self::$versionHash.'-'.$this->config->getAppValue('theming', 'cachebuster', '0');
201 201
 		}
202
-		return '?v=' . self::$versionHash;
202
+		return '?v='.self::$versionHash;
203 203
 	}
204 204
 
205 205
 	/**
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
 		// Read the selected theme from the config file
211 211
 		$theme = \OC_Util::getTheme();
212 212
 
213
-		if($compileScss) {
213
+		if ($compileScss) {
214 214
 			$SCSSCacher = \OC::$server->query(SCSSCacher::class);
215 215
 		} else {
216 216
 			$SCSSCacher = null;
@@ -219,8 +219,8 @@  discard block
 block discarded – undo
219 219
 		$locator = new \OC\Template\CSSResourceLocator(
220 220
 			\OC::$server->getLogger(),
221 221
 			$theme,
222
-			array( \OC::$SERVERROOT => \OC::$WEBROOT ),
223
-			array( \OC::$SERVERROOT => \OC::$WEBROOT ),
222
+			array(\OC::$SERVERROOT => \OC::$WEBROOT),
223
+			array(\OC::$SERVERROOT => \OC::$WEBROOT),
224 224
 			$SCSSCacher
225 225
 		);
226 226
 		$locator->find($styles);
@@ -238,8 +238,8 @@  discard block
 block discarded – undo
238 238
 		$locator = new \OC\Template\JSResourceLocator(
239 239
 			\OC::$server->getLogger(),
240 240
 			$theme,
241
-			array( \OC::$SERVERROOT => \OC::$WEBROOT ),
242
-			array( \OC::$SERVERROOT => \OC::$WEBROOT ),
241
+			array(\OC::$SERVERROOT => \OC::$WEBROOT),
242
+			array(\OC::$SERVERROOT => \OC::$WEBROOT),
243 243
 			new JSCombiner(
244 244
 				\OC::$server->getAppDataDir('js'),
245 245
 				\OC::$server->getURLGenerator(),
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
 	 */
260 260
 	public static function convertToRelativePath($filePath) {
261 261
 		$relativePath = explode(\OC::$SERVERROOT, $filePath);
262
-		if(count($relativePath) !== 2) {
262
+		if (count($relativePath) !== 2) {
263 263
 			throw new \Exception('$filePath is not under the \OC::$SERVERROOT');
264 264
 		}
265 265
 
Please login to merge, or discard this patch.
settings/templates/settings/personal/personal.info.php 1 patch
Spacing   +67 added lines, -67 removed lines patch added patch discarded remove patch
@@ -40,16 +40,16 @@  discard block
 block discarded – undo
40 40
 
41 41
 <div id="quota" class="section">
42 42
 	<progress value="<?php p($_['usage_relative']); ?>" max="100"
43
-	<?php if($_['usage_relative'] > 80): ?> class="warn" <?php endif; ?>></progress>
43
+	<?php if ($_['usage_relative'] > 80): ?> class="warn" <?php endif; ?>></progress>
44 44
 
45
-	<div style="width:<?php p($_['usage_relative']);?>%" class="quotatext-fg">
45
+	<div style="width:<?php p($_['usage_relative']); ?>%" class="quotatext-fg">
46 46
 		<p class="quotatext">
47 47
 			<?php if ($_['quota'] === \OCP\Files\FileInfo::SPACE_UNLIMITED): ?>
48 48
 				<?php print_unescaped($l->t('You are using <strong>%s</strong> of <strong>%s</strong>',
49
-					[$_['usage'], $_['total_space']]));?>
49
+					[$_['usage'], $_['total_space']])); ?>
50 50
 			<?php else: ?>
51 51
 				<?php print_unescaped($l->t('You are using <strong>%s</strong> of <strong>%s</strong> (<strong>%s %%</strong>)',
52
-					[$_['usage'], $_['total_space'],  $_['usage_relative']]));?>
52
+					[$_['usage'], $_['total_space'], $_['usage_relative']])); ?>
53 53
 			<?php endif ?>
54 54
 		</p>
55 55
 	</div>
@@ -57,10 +57,10 @@  discard block
 block discarded – undo
57 57
 		<p class="quotatext">
58 58
 			<?php if ($_['quota'] === \OCP\Files\FileInfo::SPACE_UNLIMITED): ?>
59 59
 				<?php print_unescaped($l->t('You are using <strong>%s</strong> of <strong>%s</strong>',
60
-					[$_['usage'], $_['total_space']]));?>
60
+					[$_['usage'], $_['total_space']])); ?>
61 61
 			<?php else: ?>
62 62
 				<?php print_unescaped($l->t('You are using <strong>%s</strong> of <strong>%s</strong> (<strong>%s %%</strong>)',
63
-					[$_['usage'], $_['total_space'],  $_['usage_relative']]));?>
63
+					[$_['usage'], $_['total_space'], $_['usage_relative']])); ?>
64 64
 			<?php endif ?>
65 65
 		</p>
66 66
 	</div>
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 					</div>
97 97
 				</div>
98 98
 				<span class="icon-checkmark hidden"></span>
99
-				<?php if($_['lookupServerUploadEnabled']) { ?>
99
+				<?php if ($_['lookupServerUploadEnabled']) { ?>
100 100
 				<input type="hidden" id="avatarscope" value="<?php p($_['avatarScope']) ?>">
101 101
 				<?php } ?>
102 102
 			</form>
@@ -113,15 +113,15 @@  discard block
 block discarded – undo
113 113
 					</span>
114 114
 				</h2>
115 115
 				<input type="text" id="displayname" name="displayname"
116
-					<?php if(!$_['displayNameChangeSupported']) { print_unescaped('class="hidden"'); } ?>
116
+					<?php if (!$_['displayNameChangeSupported']) { print_unescaped('class="hidden"'); } ?>
117 117
 					   value="<?php p($_['displayName']) ?>"
118 118
 					   autocomplete="on" autocapitalize="none" autocorrect="off" />
119
-				<?php if(!$_['displayNameChangeSupported']) { ?>
120
-					<span><?php if(isset($_['displayName']) && !empty($_['displayName'])) { p($_['displayName']); } else { p($l->t('No display name set')); } ?></span>
119
+				<?php if (!$_['displayNameChangeSupported']) { ?>
120
+					<span><?php if (isset($_['displayName']) && !empty($_['displayName'])) { p($_['displayName']); } else { p($l->t('No display name set')); } ?></span>
121 121
 				<?php } ?>
122 122
 				<span class="icon-checkmark hidden"></span>
123 123
 				<span class="icon-error hidden" ></span>
124
-				<?php if($_['lookupServerUploadEnabled']) { ?>
124
+				<?php if ($_['lookupServerUploadEnabled']) { ?>
125 125
 					<input type="hidden" id="displaynamescope" value="<?php p($_['displayNameScope']) ?>">
126 126
 				<?php } ?>
127 127
 			</form>
@@ -134,10 +134,10 @@  discard block
 block discarded – undo
134 134
 						<span class="icon-triangle-s"></span>
135 135
 					</span>
136 136
 				</h2>
137
-				<div class="verify <?php if ($_['email'] === ''  || $_['emailScope'] !== 'public') p('hidden'); ?>">
137
+				<div class="verify <?php if ($_['email'] === '' || $_['emailScope'] !== 'public') p('hidden'); ?>">
138 138
 					<img id="verify-email" title="<?php p($_['emailMessage']); ?>" data-status="<?php p($_['emailVerification']) ?>" src="
139 139
 				<?php
140
-					switch($_['emailVerification']) {
140
+					switch ($_['emailVerification']) {
141 141
 						case \OC\Accounts\AccountManager::VERIFICATION_IN_PROGRESS:
142 142
 							p(image_path('core', 'actions/verifying.svg'));
143 143
 							break;
@@ -150,18 +150,18 @@  discard block
 block discarded – undo
150 150
 					?>">
151 151
 				</div>
152 152
 				<input type="email" name="email" id="email" value="<?php p($_['email']); ?>"
153
-					<?php if(!$_['displayNameChangeSupported']) { print_unescaped('class="hidden"'); } ?>
153
+					<?php if (!$_['displayNameChangeSupported']) { print_unescaped('class="hidden"'); } ?>
154 154
 					   placeholder="<?php p($l->t('Your email address')); ?>"
155 155
 					   autocomplete="on" autocapitalize="none" autocorrect="off" />
156 156
 			   	<span class="icon-checkmark hidden"></span>
157 157
 				<span class="icon-error hidden" ></span>
158
-				<?php if(!$_['displayNameChangeSupported']) { ?>
159
-					<span><?php if(isset($_['email']) && !empty($_['email'])) { p($_['email']); } else { p($l->t('No email address set')); }?></span>
158
+				<?php if (!$_['displayNameChangeSupported']) { ?>
159
+					<span><?php if (isset($_['email']) && !empty($_['email'])) { p($_['email']); } else { p($l->t('No email address set')); }?></span>
160 160
 				<?php } ?>
161
-				<?php if($_['displayNameChangeSupported']) { ?>
161
+				<?php if ($_['displayNameChangeSupported']) { ?>
162 162
 					<em><?php p($l->t('For password reset and notifications')); ?></em>
163 163
 				<?php } ?>
164
-				<?php if($_['lookupServerUploadEnabled']) { ?>
164
+				<?php if ($_['lookupServerUploadEnabled']) { ?>
165 165
 					<input type="hidden" id="emailscope" value="<?php p($_['emailScope']) ?>">
166 166
 				<?php } ?>
167 167
 			</form>
@@ -175,12 +175,12 @@  discard block
 block discarded – undo
175 175
 						<span class="icon-triangle-s"></span>
176 176
 					</span>
177 177
 				</h2>
178
-				<input type="tel" id="phone" name="phone" <?php if(!$_['lookupServerUploadEnabled']) print_unescaped('disabled="1"'); ?>
178
+				<input type="tel" id="phone" name="phone" <?php if (!$_['lookupServerUploadEnabled']) print_unescaped('disabled="1"'); ?>
179 179
 					   value="<?php p($_['phone']) ?>"
180 180
 					   placeholder="<?php p($l->t('Your phone number')); ?>"
181 181
 				       autocomplete="on" autocapitalize="none" autocorrect="off" />
182 182
 				<span class="icon-checkmark hidden"></span>
183
-				<?php if($_['lookupServerUploadEnabled']) { ?>
183
+				<?php if ($_['lookupServerUploadEnabled']) { ?>
184 184
 				<input type="hidden" id="phonescope" value="<?php p($_['phoneScope']) ?>">
185 185
 				<?php } ?>
186 186
 			</form>
@@ -195,12 +195,12 @@  discard block
 block discarded – undo
195 195
 						<span class="icon-triangle-s"></span>
196 196
 					</span>
197 197
 				</h2>
198
-				<input type="text" id="address" name="address" <?php if(!$_['lookupServerUploadEnabled']) print_unescaped('disabled="1"');  ?>
198
+				<input type="text" id="address" name="address" <?php if (!$_['lookupServerUploadEnabled']) print_unescaped('disabled="1"'); ?>
199 199
 					   placeholder="<?php p($l->t('Your postal address')); ?>"
200 200
 					   value="<?php p($_['address']) ?>"
201 201
 					   autocomplete="on" autocapitalize="none" autocorrect="off" />
202 202
 				<span class="icon-checkmark hidden"></span>
203
-				<?php if($_['lookupServerUploadEnabled']) { ?>
203
+				<?php if ($_['lookupServerUploadEnabled']) { ?>
204 204
 				<input type="hidden" id="addressscope" value="<?php p($_['addressScope']) ?>">
205 205
 				<?php } ?>
206 206
 			</form>
@@ -215,11 +215,11 @@  discard block
 block discarded – undo
215 215
 						<span class="icon-triangle-s"></span>
216 216
 					</span>
217 217
 				</h2>
218
-				<?php if($_['lookupServerUploadEnabled']) { ?>
219
-				<div class="verify <?php if ($_['website'] === ''  || $_['websiteScope'] !== 'public') p('hidden'); ?>">
218
+				<?php if ($_['lookupServerUploadEnabled']) { ?>
219
+				<div class="verify <?php if ($_['website'] === '' || $_['websiteScope'] !== 'public') p('hidden'); ?>">
220 220
 					<img id="verify-website" title="<?php p($_['websiteMessage']); ?>" data-status="<?php p($_['websiteVerification']) ?>" src="
221 221
 					<?php
222
-					switch($_['websiteVerification']) {
222
+					switch ($_['websiteVerification']) {
223 223
 						case \OC\Accounts\AccountManager::VERIFICATION_IN_PROGRESS:
224 224
 							p(image_path('core', 'actions/verifying.svg'));
225 225
 							break;
@@ -230,13 +230,13 @@  discard block
 block discarded – undo
230 230
 							p(image_path('core', 'actions/verify.svg'));
231 231
 					}
232 232
 					?>"
233
-					<?php if($_['websiteVerification'] === \OC\Accounts\AccountManager::VERIFICATION_IN_PROGRESS || $_['websiteVerification'] === \OC\Accounts\AccountManager::NOT_VERIFIED) print_unescaped(' class="verify-action"') ?>
233
+					<?php if ($_['websiteVerification'] === \OC\Accounts\AccountManager::VERIFICATION_IN_PROGRESS || $_['websiteVerification'] === \OC\Accounts\AccountManager::NOT_VERIFIED) print_unescaped(' class="verify-action"') ?>
234 234
 					>
235 235
 					<div class="verification-dialog popovermenu bubble menu">
236 236
 						<div class="verification-dialog-content">
237 237
 							<p class="explainVerification"></p>
238 238
 							<p class="verificationCode"></p>
239
-							<p><?php p($l->t('It can take up to 24 hours before the account is displayed as verified.'));?></p>
239
+							<p><?php p($l->t('It can take up to 24 hours before the account is displayed as verified.')); ?></p>
240 240
 						</div>
241 241
 					</div>
242 242
 				</div>
@@ -244,10 +244,10 @@  discard block
 block discarded – undo
244 244
 				<input type="text" name="website" id="website" value="<?php p($_['website']); ?>"
245 245
 				       placeholder="<?php p($l->t('Link https://…')); ?>"
246 246
 				       autocomplete="on" autocapitalize="none" autocorrect="off"
247
-					   <?php if(!$_['lookupServerUploadEnabled']) print_unescaped('disabled="1"');  ?>
247
+					   <?php if (!$_['lookupServerUploadEnabled']) print_unescaped('disabled="1"'); ?>
248 248
 				/>
249 249
 				<span class="icon-checkmark hidden"></span>
250
-				<?php if($_['lookupServerUploadEnabled']) { ?>
250
+				<?php if ($_['lookupServerUploadEnabled']) { ?>
251 251
 				<input type="hidden" id="websitescope" value="<?php p($_['websiteScope']) ?>">
252 252
 				<?php } ?>
253 253
 			</form>
@@ -262,11 +262,11 @@  discard block
 block discarded – undo
262 262
 						<span class="icon-triangle-s"></span>
263 263
 					</span>
264 264
 				</h2>
265
-				<?php if($_['lookupServerUploadEnabled']) { ?>
266
-				<div class="verify <?php if ($_['twitter'] === ''  || $_['twitterScope'] !== 'public') p('hidden'); ?>">
265
+				<?php if ($_['lookupServerUploadEnabled']) { ?>
266
+				<div class="verify <?php if ($_['twitter'] === '' || $_['twitterScope'] !== 'public') p('hidden'); ?>">
267 267
 					<img id="verify-twitter" title="<?php p($_['twitterMessage']); ?>" data-status="<?php p($_['twitterVerification']) ?>" src="
268 268
 					<?php
269
-					switch($_['twitterVerification']) {
269
+					switch ($_['twitterVerification']) {
270 270
 						case \OC\Accounts\AccountManager::VERIFICATION_IN_PROGRESS:
271 271
 							p(image_path('core', 'actions/verifying.svg'));
272 272
 							break;
@@ -277,13 +277,13 @@  discard block
 block discarded – undo
277 277
 							p(image_path('core', 'actions/verify.svg'));
278 278
 					}
279 279
 					?>"
280
-					<?php if($_['twitterVerification'] === \OC\Accounts\AccountManager::VERIFICATION_IN_PROGRESS || $_['twitterVerification'] === \OC\Accounts\AccountManager::NOT_VERIFIED) print_unescaped(' class="verify-action"') ?>
280
+					<?php if ($_['twitterVerification'] === \OC\Accounts\AccountManager::VERIFICATION_IN_PROGRESS || $_['twitterVerification'] === \OC\Accounts\AccountManager::NOT_VERIFIED) print_unescaped(' class="verify-action"') ?>
281 281
 					>
282 282
 					<div class="verification-dialog popovermenu bubble menu">
283 283
 						<div class="verification-dialog-content">
284 284
 							<p class="explainVerification"></p>
285 285
 							<p class="verificationCode"></p>
286
-							<p><?php p($l->t('It can take up to 24 hours before the account is displayed as verified.'));?></p>
286
+							<p><?php p($l->t('It can take up to 24 hours before the account is displayed as verified.')); ?></p>
287 287
 						</div>
288 288
 					</div>
289 289
 				</div>
@@ -291,10 +291,10 @@  discard block
 block discarded – undo
291 291
 				<input type="text" name="twitter" id="twitter" value="<?php p($_['twitter']); ?>"
292 292
 					   placeholder="<?php p($l->t('Twitter handle @…')); ?>"
293 293
 					   autocomplete="on" autocapitalize="none" autocorrect="off"
294
-					   <?php if(!$_['lookupServerUploadEnabled']) print_unescaped('disabled="1"');  ?>
294
+					   <?php if (!$_['lookupServerUploadEnabled']) print_unescaped('disabled="1"'); ?>
295 295
 				/>
296 296
 				<span class="icon-checkmark hidden"></span>
297
-				<?php if($_['lookupServerUploadEnabled']) { ?>
297
+				<?php if ($_['lookupServerUploadEnabled']) { ?>
298 298
 				<input type="hidden" id="twitterscope" value="<?php p($_['twitterScope']) ?>">
299 299
 				<?php } ?>
300 300
 			</form>
@@ -321,47 +321,47 @@  discard block
 block discarded – undo
321 321
 			<?php if (isset($_['activelanguage'])) { ?>
322 322
 			<form id="language" class="section">
323 323
 				<h2>
324
-					<label for="languageinput"><?php p($l->t('Language'));?></label>
324
+					<label for="languageinput"><?php p($l->t('Language')); ?></label>
325 325
 				</h2>
326
-				<select id="languageinput" name="lang" data-placeholder="<?php p($l->t('Language'));?>">
327
-					<option value="<?php p($_['activelanguage']['code']);?>">
328
-						<?php p($_['activelanguage']['name']);?>
326
+				<select id="languageinput" name="lang" data-placeholder="<?php p($l->t('Language')); ?>">
327
+					<option value="<?php p($_['activelanguage']['code']); ?>">
328
+						<?php p($_['activelanguage']['name']); ?>
329 329
 					</option>
330
-					<?php foreach($_['commonlanguages'] as $language):?>
331
-						<option value="<?php p($language['code']);?>">
332
-							<?php p($language['name']);?>
330
+					<?php foreach ($_['commonlanguages'] as $language):?>
331
+						<option value="<?php p($language['code']); ?>">
332
+							<?php p($language['name']); ?>
333 333
 						</option>
334
-					<?php endforeach;?>
334
+					<?php endforeach; ?>
335 335
 					<optgroup label="––––––––––"></optgroup>
336
-					<?php foreach($_['languages'] as $language):?>
337
-						<option value="<?php p($language['code']);?>">
338
-							<?php p($language['name']);?>
336
+					<?php foreach ($_['languages'] as $language):?>
337
+						<option value="<?php p($language['code']); ?>">
338
+							<?php p($language['name']); ?>
339 339
 						</option>
340
-					<?php endforeach;?>
340
+					<?php endforeach; ?>
341 341
 				</select>
342 342
 				<a href="https://www.transifex.com/nextcloud/nextcloud/"
343 343
 					target="_blank" rel="noreferrer noopener">
344
-					<em><?php p($l->t('Help translate'));?></em>
344
+					<em><?php p($l->t('Help translate')); ?></em>
345 345
 				</a>
346 346
 			</form>
347 347
 			<?php } ?>
348 348
 		</div>
349 349
 		<div class="personal-settings-setting-box personal-settings-password-box">
350 350
 			<?php
351
-			if($_['passwordChangeSupported']) {
351
+			if ($_['passwordChangeSupported']) {
352 352
 				script('jquery-showpassword');
353 353
 			?>
354 354
 			<form id="passwordform" class="section">
355
-				<h2 class="inlineblock"><?php p($l->t('Password'));?></h2>
355
+				<h2 class="inlineblock"><?php p($l->t('Password')); ?></h2>
356 356
 				<div id="password-error-msg" class="msg success inlineblock" style="display: none;">Saved</div>
357 357
 
358 358
 				<label for="pass1" class="hidden-visually"><?php p($l->t('Current password')); ?>: </label>
359 359
 				<input type="password" id="pass1" name="oldpassword"
360
-					placeholder="<?php p($l->t('Current password'));?>"
360
+					placeholder="<?php p($l->t('Current password')); ?>"
361 361
 					autocomplete="off" autocapitalize="none" autocorrect="off" />
362 362
 
363 363
 				<div class="personal-show-container">
364
-					<label for="pass2" class="hidden-visually"><?php p($l->t('New password'));?>: </label>
364
+					<label for="pass2" class="hidden-visually"><?php p($l->t('New password')); ?>: </label>
365 365
 					<input type="password" id="pass2" name="newpassword"
366 366
 						placeholder="<?php p($l->t('New password')); ?>"
367 367
 						data-typetoggle="#personal-show"
@@ -385,27 +385,27 @@  discard block
 block discarded – undo
385 385
 <?php if (isset($_['activelocale'])) { ?>
386 386
 <form id="locale" class="section">
387 387
 	<h2>
388
-		<label for="localeinput"><?php p($l->t('Locale'));?></label>
388
+		<label for="localeinput"><?php p($l->t('Locale')); ?></label>
389 389
 	</h2>
390
-	<select id="localeinput" name="lang" data-placeholder="<?php p($l->t('Locale'));?>">
391
-		<option value="<?php p($_['activelocale']['code']);?>">
392
-			<?php p($_['activelocale']['name']);?>
390
+	<select id="localeinput" name="lang" data-placeholder="<?php p($l->t('Locale')); ?>">
391
+		<option value="<?php p($_['activelocale']['code']); ?>">
392
+			<?php p($_['activelocale']['name']); ?>
393 393
 		</option>
394 394
 		<optgroup label="––––––––––"></optgroup>
395
-		<?php foreach($_['localesforlanguage'] as $locale):?>
396
-			<option value="<?php p($locale['code']);?>">
397
-				<?php p($locale['name']);?>
395
+		<?php foreach ($_['localesforlanguage'] as $locale):?>
396
+			<option value="<?php p($locale['code']); ?>">
397
+				<?php p($locale['name']); ?>
398 398
 			</option>
399
-		<?php endforeach;?>
399
+		<?php endforeach; ?>
400 400
 		<optgroup label="––––––––––"></optgroup>
401
-		<option value="<?php p($_['activelocale']['code']);?>">
402
-			<?php p($_['activelocale']['name']);?>
401
+		<option value="<?php p($_['activelocale']['code']); ?>">
402
+			<?php p($_['activelocale']['name']); ?>
403 403
 		</option>
404
-		<?php foreach($_['locales'] as $locale):?>
405
-			<option value="<?php p($locale['code']);?>">
406
-				<?php p($locale['name']);?>
404
+		<?php foreach ($_['locales'] as $locale):?>
405
+			<option value="<?php p($locale['code']); ?>">
406
+				<?php p($locale['name']); ?>
407 407
 			</option>
408
-		<?php endforeach;?>
408
+		<?php endforeach; ?>
409 409
 	</select>
410 410
 </form>
411 411
 <?php } ?>
Please login to merge, or discard this patch.
apps/provisioning_api/lib/Controller/UsersController.php 1 patch
Spacing   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 		// Admin? Or SubAdmin?
125 125
 		$uid = $user->getUID();
126 126
 		$subAdminManager = $this->groupManager->getSubAdmin();
127
-		if($this->groupManager->isAdmin($uid)){
127
+		if ($this->groupManager->isAdmin($uid)) {
128 128
 			$users = $this->userManager->search($search, $limit, $offset);
129 129
 		} else if ($subAdminManager->isSubAdmin($user)) {
130 130
 			$subAdminOfGroups = $subAdminManager->getSubAdminsGroups($user);
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 				$subAdminOfGroups[$key] = $group->getGID();
133 133
 			}
134 134
 
135
-			if($offset === null) {
135
+			if ($offset === null) {
136 136
 				$offset = 0;
137 137
 			}
138 138
 
@@ -166,22 +166,22 @@  discard block
 block discarded – undo
166 166
 		$isAdmin = $this->groupManager->isAdmin($user->getUID());
167 167
 		$subAdminManager = $this->groupManager->getSubAdmin();
168 168
 
169
-		if($this->userManager->userExists($userid)) {
169
+		if ($this->userManager->userExists($userid)) {
170 170
 			$this->logger->error('Failed addUser attempt: User already exists.', ['app' => 'ocs_api']);
171 171
 			throw new OCSException('User already exists', 102);
172 172
 		}
173 173
 
174
-		if(is_array($groups)) {
174
+		if (is_array($groups)) {
175 175
 			foreach ($groups as $group) {
176
-				if(!$this->groupManager->groupExists($group)) {
176
+				if (!$this->groupManager->groupExists($group)) {
177 177
 					throw new OCSException('group '.$group.' does not exist', 104);
178 178
 				}
179
-				if(!$isAdmin && !$subAdminManager->isSubAdminofGroup($user, $this->groupManager->get($group))) {
180
-					throw new OCSException('insufficient privileges for group '. $group, 105);
179
+				if (!$isAdmin && !$subAdminManager->isSubAdminofGroup($user, $this->groupManager->get($group))) {
180
+					throw new OCSException('insufficient privileges for group '.$group, 105);
181 181
 				}
182 182
 			}
183 183
 		} else {
184
-			if(!$isAdmin) {
184
+			if (!$isAdmin) {
185 185
 				throw new OCSException('no group specified (required for subadmins)', 106);
186 186
 			}
187 187
 		}
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
 	public function getCurrentUser() {
231 231
 		$user = $this->userSession->getUser();
232 232
 		if ($user) {
233
-			$data =  $this->getUserData($user->getUID());
233
+			$data = $this->getUserData($user->getUID());
234 234
 			// rename "displayname" to "display-name" only for this call to keep
235 235
 			// the API stable.
236 236
 			$data['display-name'] = $data['displayname'];
@@ -256,17 +256,17 @@  discard block
 block discarded – undo
256 256
 
257 257
 		// Check if the target user exists
258 258
 		$targetUserObject = $this->userManager->get($userId);
259
-		if($targetUserObject === null) {
259
+		if ($targetUserObject === null) {
260 260
 			throw new OCSException('The requested user could not be found', \OCP\API::RESPOND_NOT_FOUND);
261 261
 		}
262 262
 
263 263
 		// Admin? Or SubAdmin?
264
-		if($this->groupManager->isAdmin($currentLoggedInUser->getUID())
264
+		if ($this->groupManager->isAdmin($currentLoggedInUser->getUID())
265 265
 			|| $this->groupManager->getSubAdmin()->isUserAccessible($currentLoggedInUser, $targetUserObject)) {
266 266
 			$data['enabled'] = $this->config->getUserValue($targetUserObject->getUID(), 'core', 'enabled', 'true');
267 267
 		} else {
268 268
 			// Check they are looking up themselves
269
-			if($currentLoggedInUser->getUID() !== $targetUserObject->getUID()) {
269
+			if ($currentLoggedInUser->getUID() !== $targetUserObject->getUID()) {
270 270
 				throw new OCSException('', \OCP\API::RESPOND_UNAUTHORISED);
271 271
 			}
272 272
 		}
@@ -312,12 +312,12 @@  discard block
 block discarded – undo
312 312
 		$currentLoggedInUser = $this->userSession->getUser();
313 313
 
314 314
 		$targetUser = $this->userManager->get($userId);
315
-		if($targetUser === null) {
315
+		if ($targetUser === null) {
316 316
 			throw new OCSException('', \OCP\API::RESPOND_UNAUTHORISED);
317 317
 		}
318 318
 
319 319
 		$permittedFields = [];
320
-		if($targetUser->getUID() === $currentLoggedInUser->getUID()) {
320
+		if ($targetUser->getUID() === $currentLoggedInUser->getUID()) {
321 321
 			// Editing self (display, email)
322 322
 			if ($this->config->getSystemValue('allow_user_to_change_display_name', true) !== false) {
323 323
 				$permittedFields[] = 'display';
@@ -348,13 +348,13 @@  discard block
 block discarded – undo
348 348
 			}
349 349
 
350 350
 			// If admin they can edit their own quota
351
-			if($this->groupManager->isAdmin($currentLoggedInUser->getUID())) {
351
+			if ($this->groupManager->isAdmin($currentLoggedInUser->getUID())) {
352 352
 				$permittedFields[] = 'quota';
353 353
 			}
354 354
 		} else {
355 355
 			// Check if admin / subadmin
356 356
 			$subAdminManager = $this->groupManager->getSubAdmin();
357
-			if($subAdminManager->isUserAccessible($currentLoggedInUser, $targetUser)
357
+			if ($subAdminManager->isUserAccessible($currentLoggedInUser, $targetUser)
358 358
 			|| $this->groupManager->isAdmin($currentLoggedInUser->getUID())) {
359 359
 				// They have permissions over the user
360 360
 				$permittedFields[] = 'display';
@@ -374,18 +374,18 @@  discard block
 block discarded – undo
374 374
 			}
375 375
 		}
376 376
 		// Check if permitted to edit this field
377
-		if(!in_array($key, $permittedFields)) {
377
+		if (!in_array($key, $permittedFields)) {
378 378
 			throw new OCSException('', \OCP\API::RESPOND_UNAUTHORISED);
379 379
 		}
380 380
 		// Process the edit
381
-		switch($key) {
381
+		switch ($key) {
382 382
 			case 'display':
383 383
 			case AccountManager::PROPERTY_DISPLAYNAME:
384 384
 				$targetUser->setDisplayName($value);
385 385
 				break;
386 386
 			case 'quota':
387 387
 				$quota = $value;
388
-				if($quota !== 'none' && $quota !== 'default') {
388
+				if ($quota !== 'none' && $quota !== 'default') {
389 389
 					if (is_numeric($quota)) {
390 390
 						$quota = (float) $quota;
391 391
 					} else {
@@ -394,9 +394,9 @@  discard block
 block discarded – undo
394 394
 					if ($quota === false) {
395 395
 						throw new OCSException('Invalid quota value '.$value, 103);
396 396
 					}
397
-					if($quota === 0) {
397
+					if ($quota === 0) {
398 398
 						$quota = 'default';
399
-					}else if($quota === -1) {
399
+					} else if ($quota === -1) {
400 400
 						$quota = 'none';
401 401
 					} else {
402 402
 						$quota = \OCP\Util::humanFileSize($quota);
@@ -421,7 +421,7 @@  discard block
 block discarded – undo
421 421
 				$this->config->setUserValue($targetUser->getUID(), 'core', 'locale', $value);
422 422
 				break;
423 423
 			case AccountManager::PROPERTY_EMAIL:
424
-				if(filter_var($value, FILTER_VALIDATE_EMAIL)) {
424
+				if (filter_var($value, FILTER_VALIDATE_EMAIL)) {
425 425
 					$targetUser->setEMailAddress($value);
426 426
 				} else {
427 427
 					throw new OCSException('', 102);
@@ -457,18 +457,18 @@  discard block
 block discarded – undo
457 457
 
458 458
 		$targetUser = $this->userManager->get($userId);
459 459
 
460
-		if($targetUser === null || $targetUser->getUID() === $currentLoggedInUser->getUID()) {
460
+		if ($targetUser === null || $targetUser->getUID() === $currentLoggedInUser->getUID()) {
461 461
 			throw new OCSException('', 101);
462 462
 		}
463 463
 
464 464
 		// If not permitted
465 465
 		$subAdminManager = $this->groupManager->getSubAdmin();
466
-		if(!$this->groupManager->isAdmin($currentLoggedInUser->getUID()) && !$subAdminManager->isUserAccessible($currentLoggedInUser, $targetUser)) {
466
+		if (!$this->groupManager->isAdmin($currentLoggedInUser->getUID()) && !$subAdminManager->isUserAccessible($currentLoggedInUser, $targetUser)) {
467 467
 			throw new OCSException('', \OCP\API::RESPOND_UNAUTHORISED);
468 468
 		}
469 469
 
470 470
 		// Go ahead with the delete
471
-		if($targetUser->delete()) {
471
+		if ($targetUser->delete()) {
472 472
 			return new DataResponse();
473 473
 		} else {
474 474
 			throw new OCSException('', 101);
@@ -512,13 +512,13 @@  discard block
 block discarded – undo
512 512
 		$currentLoggedInUser = $this->userSession->getUser();
513 513
 
514 514
 		$targetUser = $this->userManager->get($userId);
515
-		if($targetUser === null || $targetUser->getUID() === $currentLoggedInUser->getUID()) {
515
+		if ($targetUser === null || $targetUser->getUID() === $currentLoggedInUser->getUID()) {
516 516
 			throw new OCSException('', 101);
517 517
 		}
518 518
 
519 519
 		// If not permitted
520 520
 		$subAdminManager = $this->groupManager->getSubAdmin();
521
-		if(!$this->groupManager->isAdmin($currentLoggedInUser->getUID()) && !$subAdminManager->isUserAccessible($currentLoggedInUser, $targetUser)) {
521
+		if (!$this->groupManager->isAdmin($currentLoggedInUser->getUID()) && !$subAdminManager->isUserAccessible($currentLoggedInUser, $targetUser)) {
522 522
 			throw new OCSException('', \OCP\API::RESPOND_UNAUTHORISED);
523 523
 		}
524 524
 
@@ -539,11 +539,11 @@  discard block
 block discarded – undo
539 539
 		$loggedInUser = $this->userSession->getUser();
540 540
 
541 541
 		$targetUser = $this->userManager->get($userId);
542
-		if($targetUser === null) {
542
+		if ($targetUser === null) {
543 543
 			throw new OCSException('', \OCP\API::RESPOND_NOT_FOUND);
544 544
 		}
545 545
 
546
-		if($targetUser->getUID() === $loggedInUser->getUID() || $this->groupManager->isAdmin($loggedInUser->getUID())) {
546
+		if ($targetUser->getUID() === $loggedInUser->getUID() || $this->groupManager->isAdmin($loggedInUser->getUID())) {
547 547
 			// Self lookup or admin lookup
548 548
 			return new DataResponse([
549 549
 				'groups' => $this->groupManager->getUserGroupIds($targetUser)
@@ -552,7 +552,7 @@  discard block
 block discarded – undo
552 552
 			$subAdminManager = $this->groupManager->getSubAdmin();
553 553
 
554 554
 			// Looking up someone else
555
-			if($subAdminManager->isUserAccessible($loggedInUser, $targetUser)) {
555
+			if ($subAdminManager->isUserAccessible($loggedInUser, $targetUser)) {
556 556
 				// Return the group that the method caller is subadmin of for the user in question
557 557
 				/** @var IGroup[] $getSubAdminsGroups */
558 558
 				$getSubAdminsGroups = $subAdminManager->getSubAdminsGroups($loggedInUser);
@@ -582,16 +582,16 @@  discard block
 block discarded – undo
582 582
 	 * @throws OCSException
583 583
 	 */
584 584
 	public function addToGroup($userId, $groupid = '') {
585
-		if($groupid === '') {
585
+		if ($groupid === '') {
586 586
 			throw new OCSException('', 101);
587 587
 		}
588 588
 
589 589
 		$group = $this->groupManager->get($groupid);
590 590
 		$targetUser = $this->userManager->get($userId);
591
-		if($group === null) {
591
+		if ($group === null) {
592 592
 			throw new OCSException('', 102);
593 593
 		}
594
-		if($targetUser === null) {
594
+		if ($targetUser === null) {
595 595
 			throw new OCSException('', 103);
596 596
 		}
597 597
 
@@ -619,17 +619,17 @@  discard block
 block discarded – undo
619 619
 	public function removeFromGroup($userId, $groupid) {
620 620
 		$loggedInUser = $this->userSession->getUser();
621 621
 
622
-		if($groupid === null || trim($groupid) === '') {
622
+		if ($groupid === null || trim($groupid) === '') {
623 623
 			throw new OCSException('', 101);
624 624
 		}
625 625
 
626 626
 		$group = $this->groupManager->get($groupid);
627
-		if($group === null) {
627
+		if ($group === null) {
628 628
 			throw new OCSException('', 102);
629 629
 		}
630 630
 
631 631
 		$targetUser = $this->userManager->get($userId);
632
-		if($targetUser === null) {
632
+		if ($targetUser === null) {
633 633
 			throw new OCSException('', 103);
634 634
 		}
635 635
 
@@ -653,7 +653,7 @@  discard block
 block discarded – undo
653 653
 		} else if (!$this->groupManager->isAdmin($loggedInUser->getUID())) {
654 654
 			/** @var IGroup[] $subAdminGroups */
655 655
 			$subAdminGroups = $subAdminManager->getSubAdminsGroups($loggedInUser);
656
-			$subAdminGroups = array_map(function (IGroup $subAdminGroup) {
656
+			$subAdminGroups = array_map(function(IGroup $subAdminGroup) {
657 657
 				return $subAdminGroup->getGID();
658 658
 			}, $subAdminGroups);
659 659
 			$userGroups = $this->groupManager->getUserGroupIds($targetUser);
@@ -685,15 +685,15 @@  discard block
 block discarded – undo
685 685
 		$user = $this->userManager->get($userId);
686 686
 
687 687
 		// Check if the user exists
688
-		if($user === null) {
688
+		if ($user === null) {
689 689
 			throw new OCSException('User does not exist', 101);
690 690
 		}
691 691
 		// Check if group exists
692
-		if($group === null) {
693
-			throw new OCSException('Group does not exist',  102);
692
+		if ($group === null) {
693
+			throw new OCSException('Group does not exist', 102);
694 694
 		}
695 695
 		// Check if trying to make subadmin of admin group
696
-		if($group->getGID() === 'admin') {
696
+		if ($group->getGID() === 'admin') {
697 697
 			throw new OCSException('Cannot create subadmins for admin group', 103);
698 698
 		}
699 699
 
@@ -704,7 +704,7 @@  discard block
 block discarded – undo
704 704
 			return new DataResponse();
705 705
 		}
706 706
 		// Go
707
-		if($subAdminManager->createSubAdmin($user, $group)) {
707
+		if ($subAdminManager->createSubAdmin($user, $group)) {
708 708
 			return new DataResponse();
709 709
 		} else {
710 710
 			throw new OCSException('Unknown error occurred', 103);
@@ -727,20 +727,20 @@  discard block
 block discarded – undo
727 727
 		$subAdminManager = $this->groupManager->getSubAdmin();
728 728
 
729 729
 		// Check if the user exists
730
-		if($user === null) {
730
+		if ($user === null) {
731 731
 			throw new OCSException('User does not exist', 101);
732 732
 		}
733 733
 		// Check if the group exists
734
-		if($group === null) {
734
+		if ($group === null) {
735 735
 			throw new OCSException('Group does not exist', 101);
736 736
 		}
737 737
 		// Check if they are a subadmin of this said group
738
-		if(!$subAdminManager->isSubAdminOfGroup($user, $group)) {
738
+		if (!$subAdminManager->isSubAdminOfGroup($user, $group)) {
739 739
 			throw new OCSException('User is not a subadmin of this group', 102);
740 740
 		}
741 741
 
742 742
 		// Go
743
-		if($subAdminManager->deleteSubAdmin($user, $group)) {
743
+		if ($subAdminManager->deleteSubAdmin($user, $group)) {
744 744
 			return new DataResponse();
745 745
 		} else {
746 746
 			throw new OCSException('Unknown error occurred', 103);
@@ -757,7 +757,7 @@  discard block
 block discarded – undo
757 757
 	public function getUserSubAdminGroups($userId) {
758 758
 		$user = $this->userManager->get($userId);
759 759
 		// Check if the user exists
760
-		if($user === null) {
760
+		if ($user === null) {
761 761
 			throw new OCSException('User does not exist', 101);
762 762
 		}
763 763
 
@@ -767,7 +767,7 @@  discard block
 block discarded – undo
767 767
 			$groups[$key] = $group->getGID();
768 768
 		}
769 769
 
770
-		if(!$groups) {
770
+		if (!$groups) {
771 771
 			throw new OCSException('Unknown error occurred', 102);
772 772
 		} else {
773 773
 			return new DataResponse($groups);
@@ -811,13 +811,13 @@  discard block
 block discarded – undo
811 811
 		$currentLoggedInUser = $this->userSession->getUser();
812 812
 
813 813
 		$targetUser = $this->userManager->get($userId);
814
-		if($targetUser === null) {
814
+		if ($targetUser === null) {
815 815
 			throw new OCSException('', \OCP\API::RESPOND_NOT_FOUND);
816 816
 		}
817 817
 
818 818
 		// Check if admin / subadmin
819 819
 		$subAdminManager = $this->groupManager->getSubAdmin();
820
-		if(!$subAdminManager->isUserAccessible($currentLoggedInUser, $targetUser)
820
+		if (!$subAdminManager->isUserAccessible($currentLoggedInUser, $targetUser)
821 821
 			&& !$this->groupManager->isAdmin($currentLoggedInUser->getUID())) {
822 822
 			// No rights
823 823
 			throw new OCSException('', \OCP\API::RESPOND_UNAUTHORISED);
@@ -839,8 +839,8 @@  discard block
 block discarded – undo
839 839
 			$this->newUserMailHelper->setL10N($l10n);
840 840
 			$emailTemplate = $this->newUserMailHelper->generateTemplate($targetUser, false);
841 841
 			$this->newUserMailHelper->sendMail($targetUser, $emailTemplate);
842
-		} catch(\Exception $e) {
843
-			$this->logger->error("Can't send new user mail to $email: " . $e->getMessage(), array('app' => 'settings'));
842
+		} catch (\Exception $e) {
843
+			$this->logger->error("Can't send new user mail to $email: ".$e->getMessage(), array('app' => 'settings'));
844 844
 			throw new OCSException('Sending email failed', 102);
845 845
 		}
846 846
 
Please login to merge, or discard this patch.