Completed
Pull Request — master (#5623)
by Thomas
33:42
created
apps/provisioning_api/lib/Controller/UsersController.php 1 patch
Spacing   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 		// Admin? Or SubAdmin?
124 124
 		$uid = $user->getUID();
125 125
 		$subAdminManager = $this->groupManager->getSubAdmin();
126
-		if($this->groupManager->isAdmin($uid)){
126
+		if ($this->groupManager->isAdmin($uid)) {
127 127
 			$users = $this->userManager->search($search, $limit, $offset);
128 128
 		} else if ($subAdminManager->isSubAdmin($user)) {
129 129
 			$subAdminOfGroups = $subAdminManager->getSubAdminsGroups($user);
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 				$subAdminOfGroups[$key] = $group->getGID();
132 132
 			}
133 133
 
134
-			if($offset === null) {
134
+			if ($offset === null) {
135 135
 				$offset = 0;
136 136
 			}
137 137
 
@@ -165,22 +165,22 @@  discard block
 block discarded – undo
165 165
 		$isAdmin = $this->groupManager->isAdmin($user->getUID());
166 166
 		$subAdminManager = $this->groupManager->getSubAdmin();
167 167
 
168
-		if($this->userManager->userExists($userid)) {
168
+		if ($this->userManager->userExists($userid)) {
169 169
 			$this->logger->error('Failed addUser attempt: User already exists.', ['app' => 'ocs_api']);
170 170
 			throw new OCSException('User already exists', 102);
171 171
 		}
172 172
 
173
-		if(is_array($groups)) {
173
+		if (is_array($groups)) {
174 174
 			foreach ($groups as $group) {
175
-				if(!$this->groupManager->groupExists($group)) {
175
+				if (!$this->groupManager->groupExists($group)) {
176 176
 					throw new OCSException('group '.$group.' does not exist', 104);
177 177
 				}
178
-				if(!$isAdmin && !$subAdminManager->isSubAdminofGroup($user, $this->groupManager->get($group))) {
179
-					throw new OCSException('insufficient privileges for group '. $group, 105);
178
+				if (!$isAdmin && !$subAdminManager->isSubAdminofGroup($user, $this->groupManager->get($group))) {
179
+					throw new OCSException('insufficient privileges for group '.$group, 105);
180 180
 				}
181 181
 			}
182 182
 		} else {
183
-			if(!$isAdmin) {
183
+			if (!$isAdmin) {
184 184
 				throw new OCSException('no group specified (required for subadmins)', 106);
185 185
 			}
186 186
 		}
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
 	public function getCurrentUser() {
230 230
 		$user = $this->userSession->getUser();
231 231
 		if ($user) {
232
-			$data =  $this->getUserData($user->getUID());
232
+			$data = $this->getUserData($user->getUID());
233 233
 			// rename "displayname" to "display-name" only for this call to keep
234 234
 			// the API stable.
235 235
 			$data['display-name'] = $data['displayname'];
@@ -255,17 +255,17 @@  discard block
 block discarded – undo
255 255
 
256 256
 		// Check if the target user exists
257 257
 		$targetUserObject = $this->userManager->get($userId);
258
-		if($targetUserObject === null) {
258
+		if ($targetUserObject === null) {
259 259
 			throw new OCSException('The requested user could not be found', \OCP\API::RESPOND_NOT_FOUND);
260 260
 		}
261 261
 
262 262
 		// Admin? Or SubAdmin?
263
-		if($this->groupManager->isAdmin($currentLoggedInUser->getUID())
263
+		if ($this->groupManager->isAdmin($currentLoggedInUser->getUID())
264 264
 			|| $this->groupManager->getSubAdmin()->isUserAccessible($currentLoggedInUser, $targetUserObject)) {
265 265
 			$data['enabled'] = $this->config->getUserValue($targetUserObject->getUID(), 'core', 'enabled', 'true');
266 266
 		} else {
267 267
 			// Check they are looking up themselves
268
-			if($currentLoggedInUser->getUID() !== $targetUserObject->getUID()) {
268
+			if ($currentLoggedInUser->getUID() !== $targetUserObject->getUID()) {
269 269
 				throw new OCSException('', \OCP\API::RESPOND_UNAUTHORISED);
270 270
 			}
271 271
 		}
@@ -311,12 +311,12 @@  discard block
 block discarded – undo
311 311
 		$currentLoggedInUser = $this->userSession->getUser();
312 312
 
313 313
 		$targetUser = $this->userManager->get($userId);
314
-		if($targetUser === null) {
314
+		if ($targetUser === null) {
315 315
 			throw new OCSException('', \OCP\API::RESPOND_UNAUTHORISED);
316 316
 		}
317 317
 
318 318
 		$permittedFields = [];
319
-		if($targetUser->getUID() === $currentLoggedInUser->getUID()) {
319
+		if ($targetUser->getUID() === $currentLoggedInUser->getUID()) {
320 320
 			// Editing self (display, email)
321 321
 			if ($this->config->getSystemValue('allow_user_to_change_display_name', true) !== false) {
322 322
 				$permittedFields[] = 'display';
@@ -343,13 +343,13 @@  discard block
 block discarded – undo
343 343
 			}
344 344
 
345 345
 			// If admin they can edit their own quota
346
-			if($this->groupManager->isAdmin($currentLoggedInUser->getUID())) {
346
+			if ($this->groupManager->isAdmin($currentLoggedInUser->getUID())) {
347 347
 				$permittedFields[] = 'quota';
348 348
 			}
349 349
 		} else {
350 350
 			// Check if admin / subadmin
351 351
 			$subAdminManager = $this->groupManager->getSubAdmin();
352
-			if($subAdminManager->isUserAccessible($currentLoggedInUser, $targetUser)
352
+			if ($subAdminManager->isUserAccessible($currentLoggedInUser, $targetUser)
353 353
 			|| $this->groupManager->isAdmin($currentLoggedInUser->getUID())) {
354 354
 				// They have permissions over the user
355 355
 				$permittedFields[] = 'display';
@@ -369,18 +369,18 @@  discard block
 block discarded – undo
369 369
 			}
370 370
 		}
371 371
 		// Check if permitted to edit this field
372
-		if(!in_array($key, $permittedFields)) {
372
+		if (!in_array($key, $permittedFields)) {
373 373
 			throw new OCSException('', \OCP\API::RESPOND_UNAUTHORISED);
374 374
 		}
375 375
 		// Process the edit
376
-		switch($key) {
376
+		switch ($key) {
377 377
 			case 'display':
378 378
 			case AccountManager::PROPERTY_DISPLAYNAME:
379 379
 				$targetUser->setDisplayName($value);
380 380
 				break;
381 381
 			case 'quota':
382 382
 				$quota = $value;
383
-				if($quota !== 'none' && $quota !== 'default') {
383
+				if ($quota !== 'none' && $quota !== 'default') {
384 384
 					if (is_numeric($quota)) {
385 385
 						$quota = (float) $quota;
386 386
 					} else {
@@ -389,9 +389,9 @@  discard block
 block discarded – undo
389 389
 					if ($quota === false) {
390 390
 						throw new OCSException('Invalid quota value '.$value, 103);
391 391
 					}
392
-					if($quota === 0) {
392
+					if ($quota === 0) {
393 393
 						$quota = 'default';
394
-					}else if($quota === -1) {
394
+					} else if ($quota === -1) {
395 395
 						$quota = 'none';
396 396
 					} else {
397 397
 						$quota = \OCP\Util::humanFileSize($quota);
@@ -414,7 +414,7 @@  discard block
 block discarded – undo
414 414
 				$this->config->setUserValue($targetUser->getUID(), 'core', 'locale', $value);
415 415
 				break;
416 416
 			case AccountManager::PROPERTY_EMAIL:
417
-				if(filter_var($value, FILTER_VALIDATE_EMAIL)) {
417
+				if (filter_var($value, FILTER_VALIDATE_EMAIL)) {
418 418
 					$targetUser->setEMailAddress($value);
419 419
 				} else {
420 420
 					throw new OCSException('', 102);
@@ -450,18 +450,18 @@  discard block
 block discarded – undo
450 450
 
451 451
 		$targetUser = $this->userManager->get($userId);
452 452
 
453
-		if($targetUser === null || $targetUser->getUID() === $currentLoggedInUser->getUID()) {
453
+		if ($targetUser === null || $targetUser->getUID() === $currentLoggedInUser->getUID()) {
454 454
 			throw new OCSException('', 101);
455 455
 		}
456 456
 
457 457
 		// If not permitted
458 458
 		$subAdminManager = $this->groupManager->getSubAdmin();
459
-		if(!$this->groupManager->isAdmin($currentLoggedInUser->getUID()) && !$subAdminManager->isUserAccessible($currentLoggedInUser, $targetUser)) {
459
+		if (!$this->groupManager->isAdmin($currentLoggedInUser->getUID()) && !$subAdminManager->isUserAccessible($currentLoggedInUser, $targetUser)) {
460 460
 			throw new OCSException('', \OCP\API::RESPOND_UNAUTHORISED);
461 461
 		}
462 462
 
463 463
 		// Go ahead with the delete
464
-		if($targetUser->delete()) {
464
+		if ($targetUser->delete()) {
465 465
 			return new DataResponse();
466 466
 		} else {
467 467
 			throw new OCSException('', 101);
@@ -505,13 +505,13 @@  discard block
 block discarded – undo
505 505
 		$currentLoggedInUser = $this->userSession->getUser();
506 506
 
507 507
 		$targetUser = $this->userManager->get($userId);
508
-		if($targetUser === null || $targetUser->getUID() === $currentLoggedInUser->getUID()) {
508
+		if ($targetUser === null || $targetUser->getUID() === $currentLoggedInUser->getUID()) {
509 509
 			throw new OCSException('', 101);
510 510
 		}
511 511
 
512 512
 		// If not permitted
513 513
 		$subAdminManager = $this->groupManager->getSubAdmin();
514
-		if(!$this->groupManager->isAdmin($currentLoggedInUser->getUID()) && !$subAdminManager->isUserAccessible($currentLoggedInUser, $targetUser)) {
514
+		if (!$this->groupManager->isAdmin($currentLoggedInUser->getUID()) && !$subAdminManager->isUserAccessible($currentLoggedInUser, $targetUser)) {
515 515
 			throw new OCSException('', \OCP\API::RESPOND_UNAUTHORISED);
516 516
 		}
517 517
 
@@ -532,11 +532,11 @@  discard block
 block discarded – undo
532 532
 		$loggedInUser = $this->userSession->getUser();
533 533
 
534 534
 		$targetUser = $this->userManager->get($userId);
535
-		if($targetUser === null) {
535
+		if ($targetUser === null) {
536 536
 			throw new OCSException('', \OCP\API::RESPOND_NOT_FOUND);
537 537
 		}
538 538
 
539
-		if($targetUser->getUID() === $loggedInUser->getUID() || $this->groupManager->isAdmin($loggedInUser->getUID())) {
539
+		if ($targetUser->getUID() === $loggedInUser->getUID() || $this->groupManager->isAdmin($loggedInUser->getUID())) {
540 540
 			// Self lookup or admin lookup
541 541
 			return new DataResponse([
542 542
 				'groups' => $this->groupManager->getUserGroupIds($targetUser)
@@ -545,7 +545,7 @@  discard block
 block discarded – undo
545 545
 			$subAdminManager = $this->groupManager->getSubAdmin();
546 546
 
547 547
 			// Looking up someone else
548
-			if($subAdminManager->isUserAccessible($loggedInUser, $targetUser)) {
548
+			if ($subAdminManager->isUserAccessible($loggedInUser, $targetUser)) {
549 549
 				// Return the group that the method caller is subadmin of for the user in question
550 550
 				/** @var IGroup[] $getSubAdminsGroups */
551 551
 				$getSubAdminsGroups = $subAdminManager->getSubAdminsGroups($loggedInUser);
@@ -575,16 +575,16 @@  discard block
 block discarded – undo
575 575
 	 * @throws OCSException
576 576
 	 */
577 577
 	public function addToGroup($userId, $groupid = '') {
578
-		if($groupid === '') {
578
+		if ($groupid === '') {
579 579
 			throw new OCSException('', 101);
580 580
 		}
581 581
 
582 582
 		$group = $this->groupManager->get($groupid);
583 583
 		$targetUser = $this->userManager->get($userId);
584
-		if($group === null) {
584
+		if ($group === null) {
585 585
 			throw new OCSException('', 102);
586 586
 		}
587
-		if($targetUser === null) {
587
+		if ($targetUser === null) {
588 588
 			throw new OCSException('', 103);
589 589
 		}
590 590
 
@@ -612,17 +612,17 @@  discard block
 block discarded – undo
612 612
 	public function removeFromGroup($userId, $groupid) {
613 613
 		$loggedInUser = $this->userSession->getUser();
614 614
 
615
-		if($groupid === null) {
615
+		if ($groupid === null) {
616 616
 			throw new OCSException('', 101);
617 617
 		}
618 618
 
619 619
 		$group = $this->groupManager->get($groupid);
620
-		if($group === null) {
620
+		if ($group === null) {
621 621
 			throw new OCSException('', 102);
622 622
 		}
623 623
 
624 624
 		$targetUser = $this->userManager->get($userId);
625
-		if($targetUser === null) {
625
+		if ($targetUser === null) {
626 626
 			throw new OCSException('', 103);
627 627
 		}
628 628
 
@@ -646,7 +646,7 @@  discard block
 block discarded – undo
646 646
 		} else if (!$this->groupManager->isAdmin($loggedInUser->getUID())) {
647 647
 			/** @var IGroup[] $subAdminGroups */
648 648
 			$subAdminGroups = $subAdminManager->getSubAdminsGroups($loggedInUser);
649
-			$subAdminGroups = array_map(function (IGroup $subAdminGroup) {
649
+			$subAdminGroups = array_map(function(IGroup $subAdminGroup) {
650 650
 				return $subAdminGroup->getGID();
651 651
 			}, $subAdminGroups);
652 652
 			$userGroups = $this->groupManager->getUserGroupIds($targetUser);
@@ -678,15 +678,15 @@  discard block
 block discarded – undo
678 678
 		$user = $this->userManager->get($userId);
679 679
 
680 680
 		// Check if the user exists
681
-		if($user === null) {
681
+		if ($user === null) {
682 682
 			throw new OCSException('User does not exist', 101);
683 683
 		}
684 684
 		// Check if group exists
685
-		if($group === null) {
686
-			throw new OCSException('Group does not exist',  102);
685
+		if ($group === null) {
686
+			throw new OCSException('Group does not exist', 102);
687 687
 		}
688 688
 		// Check if trying to make subadmin of admin group
689
-		if($group->getGID() === 'admin') {
689
+		if ($group->getGID() === 'admin') {
690 690
 			throw new OCSException('Cannot create subadmins for admin group', 103);
691 691
 		}
692 692
 
@@ -697,7 +697,7 @@  discard block
 block discarded – undo
697 697
 			return new DataResponse();
698 698
 		}
699 699
 		// Go
700
-		if($subAdminManager->createSubAdmin($user, $group)) {
700
+		if ($subAdminManager->createSubAdmin($user, $group)) {
701 701
 			return new DataResponse();
702 702
 		} else {
703 703
 			throw new OCSException('Unknown error occurred', 103);
@@ -720,20 +720,20 @@  discard block
 block discarded – undo
720 720
 		$subAdminManager = $this->groupManager->getSubAdmin();
721 721
 
722 722
 		// Check if the user exists
723
-		if($user === null) {
723
+		if ($user === null) {
724 724
 			throw new OCSException('User does not exist', 101);
725 725
 		}
726 726
 		// Check if the group exists
727
-		if($group === null) {
727
+		if ($group === null) {
728 728
 			throw new OCSException('Group does not exist', 101);
729 729
 		}
730 730
 		// Check if they are a subadmin of this said group
731
-		if(!$subAdminManager->isSubAdminOfGroup($user, $group)) {
731
+		if (!$subAdminManager->isSubAdminOfGroup($user, $group)) {
732 732
 			throw new OCSException('User is not a subadmin of this group', 102);
733 733
 		}
734 734
 
735 735
 		// Go
736
-		if($subAdminManager->deleteSubAdmin($user, $group)) {
736
+		if ($subAdminManager->deleteSubAdmin($user, $group)) {
737 737
 			return new DataResponse();
738 738
 		} else {
739 739
 			throw new OCSException('Unknown error occurred', 103);
@@ -750,7 +750,7 @@  discard block
 block discarded – undo
750 750
 	public function getUserSubAdminGroups($userId) {
751 751
 		$user = $this->userManager->get($userId);
752 752
 		// Check if the user exists
753
-		if($user === null) {
753
+		if ($user === null) {
754 754
 			throw new OCSException('User does not exist', 101);
755 755
 		}
756 756
 
@@ -760,7 +760,7 @@  discard block
 block discarded – undo
760 760
 			$groups[$key] = $group->getGID();
761 761
 		}
762 762
 
763
-		if(!$groups) {
763
+		if (!$groups) {
764 764
 			throw new OCSException('Unknown error occurred', 102);
765 765
 		} else {
766 766
 			return new DataResponse($groups);
@@ -804,13 +804,13 @@  discard block
 block discarded – undo
804 804
 		$currentLoggedInUser = $this->userSession->getUser();
805 805
 
806 806
 		$targetUser = $this->userManager->get($userId);
807
-		if($targetUser === null) {
807
+		if ($targetUser === null) {
808 808
 			throw new OCSException('', \OCP\API::RESPOND_NOT_FOUND);
809 809
 		}
810 810
 
811 811
 		// Check if admin / subadmin
812 812
 		$subAdminManager = $this->groupManager->getSubAdmin();
813
-		if(!$subAdminManager->isUserAccessible($currentLoggedInUser, $targetUser)
813
+		if (!$subAdminManager->isUserAccessible($currentLoggedInUser, $targetUser)
814 814
 			&& !$this->groupManager->isAdmin($currentLoggedInUser->getUID())) {
815 815
 			// No rights
816 816
 			throw new OCSException('', \OCP\API::RESPOND_UNAUTHORISED);
@@ -832,8 +832,8 @@  discard block
 block discarded – undo
832 832
 			$this->newUserMailHelper->setL10N($l10n);
833 833
 			$emailTemplate = $this->newUserMailHelper->generateTemplate($targetUser, false);
834 834
 			$this->newUserMailHelper->sendMail($targetUser, $emailTemplate);
835
-		} catch(\Exception $e) {
836
-			$this->logger->error("Can't send new user mail to $email: " . $e->getMessage(), array('app' => 'settings'));
835
+		} catch (\Exception $e) {
836
+			$this->logger->error("Can't send new user mail to $email: ".$e->getMessage(), array('app' => 'settings'));
837 837
 			throw new OCSException('Sending email failed', 102);
838 838
 		}
839 839
 
Please login to merge, or discard this patch.
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
@@ -142,9 +142,9 @@  discard block
 block discarded – undo
142 142
 		 *
143 143
 		 * @link https://github.com/owncloud/core/issues/21955
144 144
 		 */
145
-		if($this->config->getSystemValue('installed', false)) {
146
-			$userId = !is_null($this->userSession->getUser()) ? $this->userSession->getUser()->getUID() :  null;
147
-			if(!is_null($userId)) {
145
+		if ($this->config->getSystemValue('installed', false)) {
146
+			$userId = !is_null($this->userSession->getUser()) ? $this->userSession->getUser()->getUID() : null;
147
+			if (!is_null($userId)) {
148 148
 				$userLang = $this->config->getUserValue($userId, 'core', 'lang', null);
149 149
 			} else {
150 150
 				$userLang = null;
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 	public function findLocale($app = null, $lang = null)
184 184
 	{
185 185
 		if ($this->config->getSystemValue('installed', false)) {
186
-			$userId = null !== $this->userSession->getUser() ? $this->userSession->getUser()->getUID() :  null;
186
+			$userId = null !== $this->userSession->getUser() ? $this->userSession->getUser()->getUID() : null;
187 187
 			$userLocale = null;
188 188
 			if (null !== $userId) {
189 189
 				$userLocale = $this->config->getUserValue($userId, 'core', 'locale', null);
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
 		// merge with translations from theme
246 246
 		$theme = $this->config->getSystemValue('theme');
247 247
 		if (!empty($theme)) {
248
-			$themeDir = $this->serverRoot . '/themes/' . $theme . substr($dir, strlen($this->serverRoot));
248
+			$themeDir = $this->serverRoot.'/themes/'.$theme.substr($dir, strlen($this->serverRoot));
249 249
 
250 250
 			if (is_dir($themeDir)) {
251 251
 				$files = scandir($themeDir);
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
 
266 266
 	public function findAvailableLocales()
267 267
 	{
268
-		$localeData = file_get_contents(__DIR__ . '/locales.json');
268
+		$localeData = file_get_contents(__DIR__.'/locales.json');
269 269
 		return json_decode($localeData, true);
270 270
 	}
271 271
 
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
 	 */
347 347
 	private function isSubDirectory($sub, $parent) {
348 348
 		// Check whether $sub contains no ".."
349
-		if(strpos($sub, '..') !== false) {
349
+		if (strpos($sub, '..') !== false) {
350 350
 			return false;
351 351
 		}
352 352
 
@@ -371,12 +371,12 @@  discard block
 block discarded – undo
371 371
 		$languageFiles = [];
372 372
 
373 373
 		$i18nDir = $this->findL10nDir($app);
374
-		$transFile = strip_tags($i18nDir) . strip_tags($lang) . '.json';
374
+		$transFile = strip_tags($i18nDir).strip_tags($lang).'.json';
375 375
 
376
-		if (($this->isSubDirectory($transFile, $this->serverRoot . '/core/l10n/')
377
-				|| $this->isSubDirectory($transFile, $this->serverRoot . '/lib/l10n/')
378
-				|| $this->isSubDirectory($transFile, $this->serverRoot . '/settings/l10n/')
379
-				|| $this->isSubDirectory($transFile, \OC_App::getAppPath($app) . '/l10n/')
376
+		if (($this->isSubDirectory($transFile, $this->serverRoot.'/core/l10n/')
377
+				|| $this->isSubDirectory($transFile, $this->serverRoot.'/lib/l10n/')
378
+				|| $this->isSubDirectory($transFile, $this->serverRoot.'/settings/l10n/')
379
+				|| $this->isSubDirectory($transFile, \OC_App::getAppPath($app).'/l10n/')
380 380
 			)
381 381
 			&& file_exists($transFile)) {
382 382
 			// load the translations file
@@ -386,7 +386,7 @@  discard block
 block discarded – undo
386 386
 		// merge with translations from theme
387 387
 		$theme = $this->config->getSystemValue('theme');
388 388
 		if (!empty($theme)) {
389
-			$transFile = $this->serverRoot . '/themes/' . $theme . substr($transFile, strlen($this->serverRoot));
389
+			$transFile = $this->serverRoot.'/themes/'.$theme.substr($transFile, strlen($this->serverRoot));
390 390
 			if (file_exists($transFile)) {
391 391
 				$languageFiles[] = $transFile;
392 392
 			}
@@ -403,14 +403,14 @@  discard block
 block discarded – undo
403 403
 	 */
404 404
 	protected function findL10nDir($app = null) {
405 405
 		if (in_array($app, ['core', 'lib', 'settings'])) {
406
-			if (file_exists($this->serverRoot . '/' . $app . '/l10n/')) {
407
-				return $this->serverRoot . '/' . $app . '/l10n/';
406
+			if (file_exists($this->serverRoot.'/'.$app.'/l10n/')) {
407
+				return $this->serverRoot.'/'.$app.'/l10n/';
408 408
 			}
409 409
 		} else if ($app && \OC_App::getAppPath($app) !== false) {
410 410
 			// Check if the app is in the app folder
411
-			return \OC_App::getAppPath($app) . '/l10n/';
411
+			return \OC_App::getAppPath($app).'/l10n/';
412 412
 		}
413
-		return $this->serverRoot . '/core/l10n/';
413
+		return $this->serverRoot.'/core/l10n/';
414 414
 	}
415 415
 
416 416
 
@@ -427,15 +427,15 @@  discard block
 block discarded – undo
427 427
 			return $this->pluralFunctions[$string];
428 428
 		}
429 429
 
430
-		if (preg_match( '/^\s*nplurals\s*=\s*(\d+)\s*;\s*plural=(.*)$/u', $string, $matches)) {
430
+		if (preg_match('/^\s*nplurals\s*=\s*(\d+)\s*;\s*plural=(.*)$/u', $string, $matches)) {
431 431
 			// sanitize
432
-			$nplurals = preg_replace( '/[^0-9]/', '', $matches[1] );
433
-			$plural = preg_replace( '#[^n0-9:\(\)\?\|\&=!<>+*/\%-]#', '', $matches[2] );
432
+			$nplurals = preg_replace('/[^0-9]/', '', $matches[1]);
433
+			$plural = preg_replace('#[^n0-9:\(\)\?\|\&=!<>+*/\%-]#', '', $matches[2]);
434 434
 
435 435
 			$body = str_replace(
436
-				array( 'plural', 'n', '$n$plurals', ),
437
-				array( '$plural', '$n', '$nplurals', ),
438
-				'nplurals='. $nplurals . '; plural=' . $plural
436
+				array('plural', 'n', '$n$plurals',),
437
+				array('$plural', '$n', '$nplurals',),
438
+				'nplurals='.$nplurals.'; plural='.$plural
439 439
 			);
440 440
 
441 441
 			// add parents
@@ -443,9 +443,9 @@  discard block
 block discarded – undo
443 443
 			$body .= ';';
444 444
 			$res = '';
445 445
 			$p = 0;
446
-			for($i = 0; $i < strlen($body); $i++) {
446
+			for ($i = 0; $i < strlen($body); $i++) {
447 447
 				$ch = $body[$i];
448
-				switch ( $ch ) {
448
+				switch ($ch) {
449 449
 					case '?':
450 450
 						$res .= ' ? (';
451 451
 						$p++;
@@ -454,7 +454,7 @@  discard block
 block discarded – undo
454 454
 						$res .= ') : (';
455 455
 						break;
456 456
 					case ';':
457
-						$res .= str_repeat( ')', $p ) . ';';
457
+						$res .= str_repeat(')', $p).';';
458 458
 						$p = 0;
459 459
 						break;
460 460
 					default:
@@ -462,7 +462,7 @@  discard block
 block discarded – undo
462 462
 				}
463 463
 			}
464 464
 
465
-			$body = $res . 'return ($plural>=$nplurals?$nplurals-1:$plural);';
465
+			$body = $res.'return ($plural>=$nplurals?$nplurals-1:$plural);';
466 466
 			$function = create_function('$n', $body);
467 467
 			$this->pluralFunctions[$string] = $function;
468 468
 			return $function;
Please login to merge, or discard this patch.
settings/templates/settings/personal/personal.info.php 1 patch
Spacing   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -39,15 +39,15 @@  discard block
 block discarded – undo
39 39
 ?>
40 40
 
41 41
 <div id="quota" class="section">
42
-	<div style="width:<?php p($_['usage_relative']);?>%"
43
-		<?php if($_['usage_relative'] > 80): ?> class="quota-warning" <?php endif; ?>>
42
+	<div style="width:<?php p($_['usage_relative']); ?>%"
43
+		<?php if ($_['usage_relative'] > 80): ?> class="quota-warning" <?php endif; ?>>
44 44
 		<p id="quotatext">
45 45
 			<?php if ($_['quota'] === \OCP\Files\FileInfo::SPACE_UNLIMITED): ?>
46 46
 				<?php print_unescaped($l->t('You are using <strong>%s</strong> of <strong>%s</strong>',
47
-					[$_['usage'], $_['total_space']]));?>
47
+					[$_['usage'], $_['total_space']])); ?>
48 48
 			<?php else: ?>
49 49
 				<?php print_unescaped($l->t('You are using <strong>%s</strong> of <strong>%s</strong> (<strong>%s %%</strong>)',
50
-					[$_['usage'], $_['total_space'],  $_['usage_relative']]));?>
50
+					[$_['usage'], $_['total_space'], $_['usage_relative']])); ?>
51 51
 			<?php endif ?>
52 52
 		</p>
53 53
 	</div>
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 				</div>
82 82
 			</div>
83 83
 			<span class="icon-checkmark hidden"/>
84
-			<?php if($_['lookupServerUploadEnabled']) { ?>
84
+			<?php if ($_['lookupServerUploadEnabled']) { ?>
85 85
 				<input type="hidden" id="avatarscope" value="<?php p($_['avatarScope']) ?>">
86 86
 			<?php } ?>
87 87
 		</form>
@@ -95,14 +95,14 @@  discard block
 block discarded – undo
95 95
 					<span class="icon-password"/>
96 96
 				</h2>
97 97
 				<input type="text" id="displayname" name="displayname"
98
-					<?php if(!$_['displayNameChangeSupported']) { print_unescaped('class="hidden"'); } ?>
98
+					<?php if (!$_['displayNameChangeSupported']) { print_unescaped('class="hidden"'); } ?>
99 99
 					   value="<?php p($_['displayName']) ?>"
100 100
 					   autocomplete="on" autocapitalize="none" autocorrect="off" />
101
-				<?php if(!$_['displayNameChangeSupported']) { ?>
102
-					<span><?php if(isset($_['displayName']) && !empty($_['displayName'])) { p($_['displayName']); } else { p($l->t('No display name set')); } ?></span>
101
+				<?php if (!$_['displayNameChangeSupported']) { ?>
102
+					<span><?php if (isset($_['displayName']) && !empty($_['displayName'])) { p($_['displayName']); } else { p($l->t('No display name set')); } ?></span>
103 103
 				<?php } ?>
104 104
 				<span class="icon-checkmark hidden"/>
105
-				<?php if($_['lookupServerUploadEnabled']) { ?>
105
+				<?php if ($_['lookupServerUploadEnabled']) { ?>
106 106
 					<input type="hidden" id="displaynamescope" value="<?php p($_['displayNameScope']) ?>">
107 107
 				<?php } ?>
108 108
 			</form>
@@ -113,10 +113,10 @@  discard block
 block discarded – undo
113 113
 					<label for="email"><?php p($l->t('Email')); ?></label>
114 114
 					<span class="icon-password"/>
115 115
 				</h2>
116
-				<div class="verify <?php if ($_['email'] === ''  || $_['emailScope'] !== 'public') p('hidden'); ?>">
116
+				<div class="verify <?php if ($_['email'] === '' || $_['emailScope'] !== 'public') p('hidden'); ?>">
117 117
 					<img id="verify-email" title="<?php p($_['emailMessage']); ?>" data-status="<?php p($_['emailVerification']) ?>" src="
118 118
 				<?php
119
-					switch($_['emailVerification']) {
119
+					switch ($_['emailVerification']) {
120 120
 						case \OC\Accounts\AccountManager::VERIFICATION_IN_PROGRESS:
121 121
 							p(image_path('core', 'actions/verifying.svg'));
122 122
 							break;
@@ -129,23 +129,23 @@  discard block
 block discarded – undo
129 129
 					?>">
130 130
 				</div>
131 131
 				<input type="email" name="email" id="email" value="<?php p($_['email']); ?>"
132
-					<?php if(!$_['displayNameChangeSupported']) { print_unescaped('class="hidden"'); } ?>
132
+					<?php if (!$_['displayNameChangeSupported']) { print_unescaped('class="hidden"'); } ?>
133 133
 					   placeholder="<?php p($l->t('Your email address')); ?>"
134 134
 					   autocomplete="on" autocapitalize="none" autocorrect="off" />
135
-				<?php if(!$_['displayNameChangeSupported']) { ?>
136
-					<span><?php if(isset($_['email']) && !empty($_['email'])) { p($_['email']); } else { p($l->t('No email address set')); }?></span>
135
+				<?php if (!$_['displayNameChangeSupported']) { ?>
136
+					<span><?php if (isset($_['email']) && !empty($_['email'])) { p($_['email']); } else { p($l->t('No email address set')); }?></span>
137 137
 				<?php } ?>
138
-				<?php if($_['displayNameChangeSupported']) { ?>
138
+				<?php if ($_['displayNameChangeSupported']) { ?>
139 139
 					<br />
140 140
 					<em><?php p($l->t('For password reset and notifications')); ?></em>
141 141
 				<?php } ?>
142 142
 				<span class="icon-checkmark hidden"/>
143
-				<?php if($_['lookupServerUploadEnabled']) { ?>
143
+				<?php if ($_['lookupServerUploadEnabled']) { ?>
144 144
 					<input type="hidden" id="emailscope" value="<?php p($_['emailScope']) ?>">
145 145
 				<?php } ?>
146 146
 			</form>
147 147
 		</div>
148
-		<?php if($_['lookupServerUploadEnabled']) { ?>
148
+		<?php if ($_['lookupServerUploadEnabled']) { ?>
149 149
 			<div class="personal-settings-setting-box">
150 150
 				<form id="phoneform" class="section">
151 151
 					<h2>
@@ -180,10 +180,10 @@  discard block
 block discarded – undo
180 180
 						<label for="website"><?php p($l->t('Website')); ?></label>
181 181
 						<span class="icon-password"/>
182 182
 					</h2>
183
-					<div class="verify <?php if ($_['website'] === ''  || $_['websiteScope'] !== 'public') p('hidden'); ?>">
183
+					<div class="verify <?php if ($_['website'] === '' || $_['websiteScope'] !== 'public') p('hidden'); ?>">
184 184
 						<img id="verify-website" title="<?php p($_['websiteMessage']); ?>" data-status="<?php p($_['websiteVerification']) ?>" src="
185 185
 				<?php
186
-						switch($_['websiteVerification']) {
186
+						switch ($_['websiteVerification']) {
187 187
 							case \OC\Accounts\AccountManager::VERIFICATION_IN_PROGRESS:
188 188
 								p(image_path('core', 'actions/verifying.svg'));
189 189
 								break;
@@ -194,13 +194,13 @@  discard block
 block discarded – undo
194 194
 								p(image_path('core', 'actions/verify.svg'));
195 195
 						}
196 196
 						?>"
197
-							<?php if($_['websiteVerification'] === \OC\Accounts\AccountManager::VERIFICATION_IN_PROGRESS || $_['websiteVerification'] === \OC\Accounts\AccountManager::NOT_VERIFIED) print_unescaped(' class="verify-action"') ?>
197
+							<?php if ($_['websiteVerification'] === \OC\Accounts\AccountManager::VERIFICATION_IN_PROGRESS || $_['websiteVerification'] === \OC\Accounts\AccountManager::NOT_VERIFIED) print_unescaped(' class="verify-action"') ?>
198 198
 						>
199 199
 						<div class="verification-dialog popovermenu bubble menu">
200 200
 							<div class="verification-dialog-content">
201 201
 								<p class="explainVerification"></p>
202 202
 								<p class="verificationCode"></p>
203
-								<p><?php p($l->t('It can take up to 24 hours before the account is displayed as verified.'));?></p>
203
+								<p><?php p($l->t('It can take up to 24 hours before the account is displayed as verified.')); ?></p>
204 204
 							</div>
205 205
 						</div>
206 206
 					</div>
@@ -217,10 +217,10 @@  discard block
 block discarded – undo
217 217
 						<label for="twitter"><?php p($l->t('Twitter')); ?></label>
218 218
 						<span class="icon-password"/>
219 219
 					</h2>
220
-					<div class="verify <?php if ($_['twitter'] === ''  || $_['twitterScope'] !== 'public') p('hidden'); ?>">
220
+					<div class="verify <?php if ($_['twitter'] === '' || $_['twitterScope'] !== 'public') p('hidden'); ?>">
221 221
 						<img id="verify-twitter" title="<?php p($_['twitterMessage']); ?>" data-status="<?php p($_['twitterVerification']) ?>" src="
222 222
 				<?php
223
-						switch($_['twitterVerification']) {
223
+						switch ($_['twitterVerification']) {
224 224
 							case \OC\Accounts\AccountManager::VERIFICATION_IN_PROGRESS:
225 225
 								p(image_path('core', 'actions/verifying.svg'));
226 226
 								break;
@@ -231,13 +231,13 @@  discard block
 block discarded – undo
231 231
 								p(image_path('core', 'actions/verify.svg'));
232 232
 						}
233 233
 						?>"
234
-							<?php if($_['twitterVerification'] === \OC\Accounts\AccountManager::VERIFICATION_IN_PROGRESS || $_['twitterVerification'] === \OC\Accounts\AccountManager::NOT_VERIFIED) print_unescaped(' class="verify-action"') ?>
234
+							<?php if ($_['twitterVerification'] === \OC\Accounts\AccountManager::VERIFICATION_IN_PROGRESS || $_['twitterVerification'] === \OC\Accounts\AccountManager::NOT_VERIFIED) print_unescaped(' class="verify-action"') ?>
235 235
 						>
236 236
 						<div class="verification-dialog popovermenu bubble menu">
237 237
 							<div class="verification-dialog-content">
238 238
 								<p class="explainVerification"></p>
239 239
 								<p class="verificationCode"></p>
240
-								<p><?php p($l->t('It can take up to 24 hours before the account is displayed as verified.'));?></p>
240
+								<p><?php p($l->t('It can take up to 24 hours before the account is displayed as verified.')); ?></p>
241 241
 							</div>
242 242
 						</div>
243 243
 					</div>
@@ -262,19 +262,19 @@  discard block
 block discarded – undo
262 262
 </div>
263 263
 
264 264
 <?php
265
-if($_['passwordChangeSupported']) {
265
+if ($_['passwordChangeSupported']) {
266 266
 	script('jquery-showpassword');
267 267
 	?>
268 268
 	<form id="passwordform" class="section">
269
-		<h2 class="inlineblock"><?php p($l->t('Password'));?></h2>
269
+		<h2 class="inlineblock"><?php p($l->t('Password')); ?></h2>
270 270
 		<div id="password-error-msg" class="msg success inlineblock" style="display: none;">Saved</div>
271 271
 		<br>
272 272
 		<label for="pass1" class="hidden-visually"><?php p($l->t('Current password')); ?>: </label>
273 273
 		<input type="password" id="pass1" name="oldpassword"
274
-			   placeholder="<?php p($l->t('Current password'));?>"
274
+			   placeholder="<?php p($l->t('Current password')); ?>"
275 275
 			   autocomplete="off" autocapitalize="none" autocorrect="off" />
276 276
 		<div class="personal-show-container">
277
-			<label for="pass2" class="hidden-visually"><?php p($l->t('New password'));?>: </label>
277
+			<label for="pass2" class="hidden-visually"><?php p($l->t('New password')); ?>: </label>
278 278
 			<input type="password" id="pass2" name="newpassword"
279 279
 				   placeholder="<?php p($l->t('New password')); ?>"
280 280
 				   data-typetoggle="#personal-show"
@@ -291,27 +291,27 @@  discard block
 block discarded – undo
291 291
 <?php if (isset($_['activelanguage'])) { ?>
292 292
 <form id="language" class="section">
293 293
 	<h2>
294
-		<label for="languageinput"><?php p($l->t('Language'));?></label>
294
+		<label for="languageinput"><?php p($l->t('Language')); ?></label>
295 295
 	</h2>
296
-	<select id="languageinput" name="lang" data-placeholder="<?php p($l->t('Language'));?>">
297
-		<option value="<?php p($_['activelanguage']['code']);?>">
298
-			<?php p($_['activelanguage']['name']);?>
296
+	<select id="languageinput" name="lang" data-placeholder="<?php p($l->t('Language')); ?>">
297
+		<option value="<?php p($_['activelanguage']['code']); ?>">
298
+			<?php p($_['activelanguage']['name']); ?>
299 299
 		</option>
300
-		<?php foreach($_['commonlanguages'] as $language):?>
301
-			<option value="<?php p($language['code']);?>">
302
-				<?php p($language['name']);?>
300
+		<?php foreach ($_['commonlanguages'] as $language):?>
301
+			<option value="<?php p($language['code']); ?>">
302
+				<?php p($language['name']); ?>
303 303
 			</option>
304
-		<?php endforeach;?>
304
+		<?php endforeach; ?>
305 305
 		<optgroup label="––––––––––"></optgroup>
306
-		<?php foreach($_['languages'] as $language):?>
307
-			<option value="<?php p($language['code']);?>">
308
-				<?php p($language['name']);?>
306
+		<?php foreach ($_['languages'] as $language):?>
307
+			<option value="<?php p($language['code']); ?>">
308
+				<?php p($language['name']); ?>
309 309
 			</option>
310
-		<?php endforeach;?>
310
+		<?php endforeach; ?>
311 311
 	</select>
312 312
 	<a href="https://www.transifex.com/nextcloud/nextcloud/"
313 313
 	   target="_blank" rel="noreferrer">
314
-		<em><?php p($l->t('Help translate'));?></em>
314
+		<em><?php p($l->t('Help translate')); ?></em>
315 315
 	</a>
316 316
 </form>
317 317
 <?php } ?>
@@ -319,27 +319,27 @@  discard block
 block discarded – undo
319 319
 <?php if (isset($_['activelocale'])) { ?>
320 320
 <form id="locale" class="section">
321 321
 	<h2>
322
-		<label for="localeinput"><?php p($l->t('Locale'));?></label>
322
+		<label for="localeinput"><?php p($l->t('Locale')); ?></label>
323 323
 	</h2>
324
-	<select id="localeinput" name="lang" data-placeholder="<?php p($l->t('Locale'));?>">
325
-		<option value="<?php p($_['activelocale']['code']);?>">
326
-			<?php p($_['activelocale']['name']);?>
324
+	<select id="localeinput" name="lang" data-placeholder="<?php p($l->t('Locale')); ?>">
325
+		<option value="<?php p($_['activelocale']['code']); ?>">
326
+			<?php p($_['activelocale']['name']); ?>
327 327
 		</option>
328 328
 		<optgroup label="––––––––––"></optgroup>
329
-		<?php foreach($_['localesforlanguage'] as $locale):?>
330
-			<option value="<?php p($locale['code']);?>">
331
-				<?php p($locale['name']);?>
329
+		<?php foreach ($_['localesforlanguage'] as $locale):?>
330
+			<option value="<?php p($locale['code']); ?>">
331
+				<?php p($locale['name']); ?>
332 332
 			</option>
333
-		<?php endforeach;?>
333
+		<?php endforeach; ?>
334 334
 		<optgroup label="––––––––––"></optgroup>
335
-		<option value="<?php p($_['activelocale']['code']);?>">
336
-			<?php p($_['activelocale']['name']);?>
335
+		<option value="<?php p($_['activelocale']['code']); ?>">
336
+			<?php p($_['activelocale']['name']); ?>
337 337
 		</option>
338
-		<?php foreach($_['locales'] as $locale):?>
339
-			<option value="<?php p($locale['code']);?>">
340
-				<?php p($locale['name']);?>
338
+		<?php foreach ($_['locales'] as $locale):?>
339
+			<option value="<?php p($locale['code']); ?>">
340
+				<?php p($locale['name']); ?>
341 341
 			</option>
342
-		<?php endforeach;?>
342
+		<?php endforeach; ?>
343 343
 	</select>
344 344
 </form>
345 345
 <?php } ?>
Please login to merge, or discard this patch.