@@ -123,7 +123,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | |
@@ -94,7 +94,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | } |
@@ -39,15 +39,15 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 } ?> |
@@ -147,9 +147,9 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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; |
@@ -53,44 +53,44 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | |