diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2020-04-10 14:19:56 +0200 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2020-04-10 14:19:56 +0200 |
commit | caff1023ea72bb2ea94130e18a2a6e2ccf819e5f (patch) | |
tree | 186d494c2aea5dea7255d3584ef5d595fc6e6194 /apps/settings | |
parent | edf8ce32cffdb920e8171207b342abbd7f1fbe73 (diff) | |
download | nextcloud-server-caff1023ea72bb2ea94130e18a2a6e2ccf819e5f.tar.gz nextcloud-server-caff1023ea72bb2ea94130e18a2a6e2ccf819e5f.zip |
Format control structures, classes, methods and function
To continue this formatting madness, here's a tiny patch that adds
unified formatting for control structures like if and loops as well as
classes, their methods and anonymous functions. This basically forces
the constructs to start on the same line. This is not exactly what PSR2
wants, but I think we can have a few exceptions with "our" style. The
starting of braces on the same line is pracrically standard for our
code.
This also removes and empty lines from method/function bodies at the
beginning and end.
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'apps/settings')
50 files changed, 319 insertions, 254 deletions
diff --git a/apps/settings/lib/Activity/GroupProvider.php b/apps/settings/lib/Activity/GroupProvider.php index 65ca2627775..ab34e907ca3 100644 --- a/apps/settings/lib/Activity/GroupProvider.php +++ b/apps/settings/lib/Activity/GroupProvider.php @@ -36,7 +36,6 @@ use OCP\IUserManager; use OCP\L10N\IFactory as L10nFactory; class GroupProvider implements IProvider { - public const ADDED_TO_GROUP = 'group_added'; public const REMOVED_FROM_GROUP = 'group_removed'; diff --git a/apps/settings/lib/Activity/Provider.php b/apps/settings/lib/Activity/Provider.php index ecf653eb0e4..5023b4af199 100644 --- a/apps/settings/lib/Activity/Provider.php +++ b/apps/settings/lib/Activity/Provider.php @@ -38,7 +38,6 @@ use OCP\IUserManager; use OCP\L10N\IFactory; class Provider implements IProvider { - public const PASSWORD_CHANGED_BY = 'password_changed_by'; public const PASSWORD_CHANGED_SELF = 'password_changed_self'; public const PASSWORD_RESET = 'password_changed'; @@ -106,14 +105,12 @@ class Provider implements IProvider { $subject = $this->l->t('You changed your password'); } elseif ($event->getSubject() === self::PASSWORD_RESET) { $subject = $this->l->t('Your password was reset by an administrator'); - } elseif ($event->getSubject() === self::EMAIL_CHANGED_BY) { $subject = $this->l->t('{actor} changed your email address'); } elseif ($event->getSubject() === self::EMAIL_CHANGED_SELF) { $subject = $this->l->t('You changed your email address'); } elseif ($event->getSubject() === self::EMAIL_CHANGED) { $subject = $this->l->t('Your email address was changed by an administrator'); - } elseif ($event->getSubject() === self::APP_TOKEN_CREATED) { $subject = $this->l->t('You created app password "{token}"'); } elseif ($event->getSubject() === self::APP_TOKEN_DELETED) { @@ -124,7 +121,6 @@ class Provider implements IProvider { $subject = $this->l->t('You granted filesystem access to app password "{token}"'); } elseif ($event->getSubject() === self::APP_TOKEN_FILESYSTEM_REVOKED) { $subject = $this->l->t('You revoked filesystem access from app password "{token}"'); - } else { throw new \InvalidArgumentException('Unknown subject'); } diff --git a/apps/settings/lib/Activity/SecurityFilter.php b/apps/settings/lib/Activity/SecurityFilter.php index dd0312232fe..d814571897c 100644 --- a/apps/settings/lib/Activity/SecurityFilter.php +++ b/apps/settings/lib/Activity/SecurityFilter.php @@ -63,5 +63,4 @@ class SecurityFilter implements IFilter { public function getPriority() { return 30; } - } diff --git a/apps/settings/lib/Activity/SecurityProvider.php b/apps/settings/lib/Activity/SecurityProvider.php index 568006d03cc..20156bbc407 100644 --- a/apps/settings/lib/Activity/SecurityProvider.php +++ b/apps/settings/lib/Activity/SecurityProvider.php @@ -109,5 +109,4 @@ class SecurityProvider implements IProvider { } return $event; } - } diff --git a/apps/settings/lib/Activity/SecuritySetting.php b/apps/settings/lib/Activity/SecuritySetting.php index d276285d484..c9ed42b2e2a 100644 --- a/apps/settings/lib/Activity/SecuritySetting.php +++ b/apps/settings/lib/Activity/SecuritySetting.php @@ -62,5 +62,4 @@ class SecuritySetting implements ISetting { public function isDefaultEnabledStream() { return true; } - } diff --git a/apps/settings/lib/AppInfo/Application.php b/apps/settings/lib/AppInfo/Application.php index f53a5ddcf51..809fe6cf844 100644 --- a/apps/settings/lib/AppInfo/Application.php +++ b/apps/settings/lib/AppInfo/Application.php @@ -54,7 +54,6 @@ use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\EventDispatcher\GenericEvent; class Application extends App { - const APP_ID = 'settings'; /** @@ -80,7 +79,7 @@ class Application extends App { $container->registerService('isSubAdmin', function (IContainer $c) { $userObject = \OC::$server->getUserSession()->getUser(); $isSubAdmin = false; - if($userObject !== null) { + if ($userObject !== null) { $isSubAdmin = \OC::$server->getGroupManager()->getSubAdmin()->isSubAdmin($userObject); } return $isSubAdmin; @@ -158,7 +157,6 @@ class Application extends App { /** @var Hooks $hooks */ $hooks = $this->getContainer()->query(Hooks::class); $hooks->addUserToGroup($group, $user); - } public function removeUserFromGroup(IGroup $group, IUser $user): void { diff --git a/apps/settings/lib/BackgroundJobs/VerifyUserData.php b/apps/settings/lib/BackgroundJobs/VerifyUserData.php index a5c46c603bf..e77d95ff4d9 100644 --- a/apps/settings/lib/BackgroundJobs/VerifyUserData.php +++ b/apps/settings/lib/BackgroundJobs/VerifyUserData.php @@ -100,7 +100,6 @@ class VerifyUserData extends Job { * @param ILogger|null $logger */ public function execute($jobList, ILogger $logger = null) { - if ($this->shouldRun($this->argument)) { parent::execute($jobList, $logger); $jobList->remove($this, $this->argument); @@ -110,14 +109,12 @@ class VerifyUserData extends Job { $this->resetVerificationState(); } } - } protected function run($argument) { - $try = (int)$argument['try'] + 1; - switch($argument['type']) { + switch ($argument['type']) { case AccountManager::PROPERTY_WEBSITE: $result = $this->verifyWebsite($argument); break; @@ -143,7 +140,6 @@ class VerifyUserData extends Job { * @return bool true if we could check the verification code, otherwise false */ protected function verifyWebsite(array $argument) { - $result = false; $url = rtrim($argument['data'], '/') . '/.well-known/' . 'CloudIdVerificationCode.txt'; @@ -188,7 +184,7 @@ class VerifyUserData extends Job { * @return bool true if we could check the verification code, otherwise false */ protected function verifyViaLookupServer(array $argument, $dataType) { - if(empty($this->lookupServerUrl) || + if (empty($this->lookupServerUrl) || $this->config->getAppValue('files_sharing', 'lookupServerUploadEnabled', 'yes') !== 'yes' || $this->config->getSystemValue('has_internet_connection', true) === false) { return false; @@ -249,7 +245,6 @@ class VerifyUserData extends Job { if (is_array($body) && isset($body['federationId']) && $body['federationId'] === $cloudId) { return $body; } - } catch (\Exception $e) { // do nothing, we will just re-try later } @@ -299,5 +294,4 @@ class VerifyUserData extends Job { $this->accountManager->updateUser($user, $accountData); } } - } diff --git a/apps/settings/lib/Controller/AdminSettingsController.php b/apps/settings/lib/Controller/AdminSettingsController.php index e7b1a27a637..c50ffc6f1e7 100644 --- a/apps/settings/lib/Controller/AdminSettingsController.php +++ b/apps/settings/lib/Controller/AdminSettingsController.php @@ -82,7 +82,7 @@ class AdminSettingsController extends Controller { ); $formatted = $this->formatSettings($settings); // Do not show legacy forms for sub admins - if($section === 'additional' && !$isSubAdmin) { + if ($section === 'additional' && !$isSubAdmin) { $formatted['content'] .= $this->getLegacyForms(); } return $formatted; @@ -117,6 +117,4 @@ class AdminSettingsController extends Controller { return $out->fetchPage(); } - - } diff --git a/apps/settings/lib/Controller/AppSettingsController.php b/apps/settings/lib/Controller/AppSettingsController.php index f40a8024b6d..7dbbaca1a45 100644 --- a/apps/settings/lib/Controller/AppSettingsController.php +++ b/apps/settings/lib/Controller/AppSettingsController.php @@ -149,9 +149,9 @@ class AppSettingsController extends Controller { private function getAppsWithUpdates() { $appClass = new \OC_App(); $apps = $appClass->listAllApps(); - foreach($apps as $key => $app) { + foreach ($apps as $key => $app) { $newVersion = $this->installer->isUpdateAvailable($app['id']); - if($newVersion === false) { + if ($newVersion === false) { unset($apps[$key]); } } @@ -169,7 +169,6 @@ class AppSettingsController extends Controller { ]; } return $result; - } /** @@ -186,7 +185,7 @@ class AppSettingsController extends Controller { $formattedCategories = []; $categories = $this->categoryFetcher->get(); - foreach($categories as $category) { + foreach ($categories as $category) { $formattedCategories[] = [ 'id' => $category['id'], 'ident' => $category['id'], @@ -217,10 +216,10 @@ class AppSettingsController extends Controller { // add bundle information $bundles = $this->bundleFetcher->getBundles(); - foreach($bundles as $bundle) { - foreach($bundle->getAppIdentifiers() as $identifier) { - foreach($this->allApps as &$app) { - if($app['id'] === $identifier) { + foreach ($bundles as $bundle) { + foreach ($bundle->getAppIdentifiers() as $identifier) { + foreach ($this->allApps as &$app) { + if ($app['id'] === $identifier) { $app['bundleIds'][] = $bundle->getIdentifier(); continue; } @@ -240,7 +239,6 @@ class AppSettingsController extends Controller { * @throws \Exception */ public function listApps(): JSONResponse { - $this->fetchApps(); $apps = $this->getAllApps(); @@ -255,7 +253,7 @@ class AppSettingsController extends Controller { } $newVersion = $this->installer->isUpdateAvailable($appData['id']); - if($newVersion) { + if ($newVersion) { $appData['update'] = $newVersion; } @@ -307,16 +305,16 @@ class AppSettingsController extends Controller { $versionParser = new VersionParser(); $formattedApps = []; $apps = $this->appFetcher->get(); - foreach($apps as $app) { + foreach ($apps as $app) { // Skip all apps not in the requested category if ($requestedCategory !== '') { $isInCategory = false; - foreach($app['categories'] as $category) { - if($category === $requestedCategory) { + foreach ($app['categories'] as $category) { + if ($category === $requestedCategory) { $isInCategory = true; } } - if(!$isInCategory) { + if (!$isInCategory) { continue; } } @@ -326,28 +324,28 @@ class AppSettingsController extends Controller { } $nextCloudVersion = $versionParser->getVersion($app['releases'][0]['rawPlatformVersionSpec']); $nextCloudVersionDependencies = []; - if($nextCloudVersion->getMinimumVersion() !== '') { + if ($nextCloudVersion->getMinimumVersion() !== '') { $nextCloudVersionDependencies['nextcloud']['@attributes']['min-version'] = $nextCloudVersion->getMinimumVersion(); } - if($nextCloudVersion->getMaximumVersion() !== '') { + if ($nextCloudVersion->getMaximumVersion() !== '') { $nextCloudVersionDependencies['nextcloud']['@attributes']['max-version'] = $nextCloudVersion->getMaximumVersion(); } $phpVersion = $versionParser->getVersion($app['releases'][0]['rawPhpVersionSpec']); $existsLocally = \OC_App::getAppPath($app['id']) !== false; $phpDependencies = []; - if($phpVersion->getMinimumVersion() !== '') { + if ($phpVersion->getMinimumVersion() !== '') { $phpDependencies['php']['@attributes']['min-version'] = $phpVersion->getMinimumVersion(); } - if($phpVersion->getMaximumVersion() !== '') { + if ($phpVersion->getMaximumVersion() !== '') { $phpDependencies['php']['@attributes']['max-version'] = $phpVersion->getMaximumVersion(); } - if(isset($app['releases'][0]['minIntSize'])) { + if (isset($app['releases'][0]['minIntSize'])) { $phpDependencies['php']['@attributes']['min-int-size'] = $app['releases'][0]['minIntSize']; } $authors = ''; - foreach($app['authors'] as $key => $author) { + foreach ($app['authors'] as $key => $author) { $authors .= $author['name']; - if($key !== count($app['authors']) - 1) { + if ($key !== count($app['authors']) - 1) { $authors .= ', '; } } @@ -355,12 +353,12 @@ class AppSettingsController extends Controller { $currentLanguage = substr(\OC::$server->getL10NFactory()->findLanguage(), 0, 2); $enabledValue = $this->config->getAppValue($app['id'], 'enabled', 'no'); $groups = null; - if($enabledValue !== 'no' && $enabledValue !== 'yes') { + if ($enabledValue !== 'no' && $enabledValue !== 'yes') { $groups = $enabledValue; } $currentVersion = ''; - if($this->appManager->isInstalled($app['id'])) { + if ($this->appManager->isInstalled($app['id'])) { $currentVersion = $this->appManager->getAppVersion($app['id']); } else { $currentLanguage = $app['releases'][0]['version']; @@ -442,7 +440,7 @@ class AppSettingsController extends Controller { $installer = \OC::$server->query(Installer::class); $isDownloaded = $installer->isDownloaded($appId); - if(!$isDownloaded) { + if (!$isDownloaded) { $installer->downloadApp($appId); } @@ -458,7 +456,6 @@ class AppSettingsController extends Controller { } } return new JSONResponse(['data' => ['update_required' => $updateRequired]]); - } catch (\Exception $e) { $this->logger->logException($e); return new JSONResponse(['data' => ['message' => $e->getMessage()]], Http::STATUS_INTERNAL_SERVER_ERROR); @@ -515,7 +512,7 @@ class AppSettingsController extends Controller { public function uninstallApp(string $appId): JSONResponse { $appId = OC_App::cleanAppId($appId); $result = $this->installer->removeApp($appId); - if($result !== false) { + if ($result !== false) { $this->appManager->clearAppsCache(); return new JSONResponse(['data' => ['appid' => $appId]]); } @@ -558,5 +555,4 @@ class AppSettingsController extends Controller { $this->appManager->ignoreNextcloudRequirementForApp($appId); return new JSONResponse(); } - } diff --git a/apps/settings/lib/Controller/AuthSettingsController.php b/apps/settings/lib/Controller/AuthSettingsController.php index 405044746a3..0296a1ac5cb 100644 --- a/apps/settings/lib/Controller/AuthSettingsController.php +++ b/apps/settings/lib/Controller/AuthSettingsController.php @@ -126,8 +126,7 @@ class AuthSettingsController extends Controller { } catch (SessionNotAvailableException $ex) { return $this->getServiceNotAvailableResponse(); } - if ($this->userSession->getImpersonatingUserID() !== null) - { + if ($this->userSession->getImpersonatingUserID() !== null) { return $this->getServiceNotAvailableResponse(); } diff --git a/apps/settings/lib/Controller/CertificateController.php b/apps/settings/lib/Controller/CertificateController.php index d23821bdf9c..b7ce1749660 100644 --- a/apps/settings/lib/Controller/CertificateController.php +++ b/apps/settings/lib/Controller/CertificateController.php @@ -126,7 +126,6 @@ class CertificateController extends Controller { * @return DataResponse */ public function removePersonalRootCertificate($certificateIdentifier) { - if ($this->isCertificateImportAllowed() === false) { return new DataResponse(['Individual certificate management disabled'], Http::STATUS_FORBIDDEN); } @@ -168,7 +167,6 @@ class CertificateController extends Controller { * @return DataResponse */ public function removeSystemRootCertificate($certificateIdentifier) { - if ($this->isCertificateImportAllowed() === false) { return new DataResponse(['Individual certificate management disabled'], Http::STATUS_FORBIDDEN); } diff --git a/apps/settings/lib/Controller/ChangePasswordController.php b/apps/settings/lib/Controller/ChangePasswordController.php index 20b8357a6a9..439731b22eb 100644 --- a/apps/settings/lib/Controller/ChangePasswordController.php +++ b/apps/settings/lib/Controller/ChangePasswordController.php @@ -108,8 +108,8 @@ class ChangePasswordController extends Controller { 'status' => 'error' ]); } - // password policy app throws exception - } catch(HintException $e) { + // password policy app throws exception + } catch (HintException $e) { return new JSONResponse([ 'status' => 'error', 'data' => [ @@ -221,8 +221,8 @@ class ChangePasswordController extends Controller { } else { // now we know that everything is fine regarding the recovery password, let's try to change the password try { $result = $targetUser->setPassword($password, $recoveryPassword); - // password policy app throws exception - } catch(HintException $e) { + // password policy app throws exception + } catch (HintException $e) { return new JSONResponse([ 'status' => 'error', 'data' => [ @@ -256,8 +256,8 @@ class ChangePasswordController extends Controller { ], ]); } - // password policy app throws exception - } catch(HintException $e) { + // password policy app throws exception + } catch (HintException $e) { return new JSONResponse([ 'status' => 'error', 'data' => [ diff --git a/apps/settings/lib/Controller/CheckSetupController.php b/apps/settings/lib/Controller/CheckSetupController.php index e386f29a94e..a0d374e5b44 100644 --- a/apps/settings/lib/Controller/CheckSetupController.php +++ b/apps/settings/lib/Controller/CheckSetupController.php @@ -137,7 +137,7 @@ class CheckSetupController extends Controller { 'www.nextcloud.com', 'www.startpage.com', 'www.eff.org', 'www.edri.org' ]); - foreach($siteArray as $site) { + foreach ($siteArray as $site) { if ($this->isSiteReachable($site)) { return false; } @@ -208,40 +208,40 @@ class CheckSetupController extends Controller { // Don't run check when: // 1. Server has `has_internet_connection` set to false // 2. AppStore AND S2S is disabled - if(!$this->config->getSystemValue('has_internet_connection', true)) { + if (!$this->config->getSystemValue('has_internet_connection', true)) { return ''; } - if(!$this->config->getSystemValue('appstoreenabled', true) + if (!$this->config->getSystemValue('appstoreenabled', true) && $this->config->getAppValue('files_sharing', 'outgoing_server2server_share_enabled', 'yes') === 'no' && $this->config->getAppValue('files_sharing', 'incoming_server2server_share_enabled', 'yes') === 'no') { return ''; } $versionString = $this->getCurlVersion(); - if(isset($versionString['ssl_version'])) { + if (isset($versionString['ssl_version'])) { $versionString = $versionString['ssl_version']; } else { return ''; } $features = (string)$this->l10n->t('installing and updating apps via the app store or Federated Cloud Sharing'); - if(!$this->config->getSystemValue('appstoreenabled', true)) { + if (!$this->config->getSystemValue('appstoreenabled', true)) { $features = (string)$this->l10n->t('Federated Cloud Sharing'); } // Check if at least OpenSSL after 1.01d or 1.0.2b - if(strpos($versionString, 'OpenSSL/') === 0) { + if (strpos($versionString, 'OpenSSL/') === 0) { $majorVersion = substr($versionString, 8, 5); $patchRelease = substr($versionString, 13, 6); - if(($majorVersion === '1.0.1' && ord($patchRelease) < ord('d')) || + if (($majorVersion === '1.0.1' && ord($patchRelease) < ord('d')) || ($majorVersion === '1.0.2' && ord($patchRelease) < ord('b'))) { return $this->l10n->t('cURL is using an outdated %1$s version (%2$s). Please update your operating system or features such as %3$s will not work reliably.', ['OpenSSL', $versionString, $features]); } } // Check if NSS and perform heuristic check - if(strpos($versionString, 'NSS/') === 0) { + if (strpos($versionString, 'NSS/') === 0) { try { $firstClient = $this->clientService->newClient(); $firstClient->get('https://nextcloud.com/'); @@ -249,7 +249,7 @@ class CheckSetupController extends Controller { $secondClient = $this->clientService->newClient(); $secondClient->get('https://nextcloud.com/'); } catch (ClientException $e) { - if($e->getResponse()->getStatusCode() === 400) { + if ($e->getResponse()->getStatusCode() === 400) { return $this->l10n->t('cURL is using an outdated %1$s version (%2$s). Please update your operating system or features such as %3$s will not work reliably.', ['NSS', $versionString, $features]); } } @@ -344,13 +344,13 @@ class CheckSetupController extends Controller { * @return DataResponse */ public function getFailedIntegrityCheckFiles() { - if(!$this->checker->isCodeCheckEnforced()) { + if (!$this->checker->isCodeCheckEnforced()) { return new DataDisplayResponse('Integrity checker has been disabled. Integrity cannot be verified.'); } $completeResults = $this->checker->getResults(); - if(!empty($completeResults)) { + if (!empty($completeResults)) { $formattedTextResponse = 'Technical information ===================== The following list covers which files have failed the integrity check. Please read @@ -360,12 +360,12 @@ them. Results ======= '; - foreach($completeResults as $context => $contextResult) { + foreach ($completeResults as $context => $contextResult) { $formattedTextResponse .= "- $context\n"; - foreach($contextResult as $category => $result) { + foreach ($contextResult as $category => $result) { $formattedTextResponse .= "\t- $category\n"; - if($category !== 'EXCEPTION') { + if ($category !== 'EXCEPTION') { foreach ($result as $key => $results) { $formattedTextResponse .= "\t\t- $key\n"; } @@ -374,7 +374,6 @@ Results $formattedTextResponse .= "\t\t- $results\n"; } } - } } @@ -406,23 +405,23 @@ Raw output protected function isOpcacheProperlySetup() { $iniWrapper = new IniGetWrapper(); - if(!$iniWrapper->getBool('opcache.enable')) { + if (!$iniWrapper->getBool('opcache.enable')) { return false; } - if(!$iniWrapper->getBool('opcache.save_comments')) { + if (!$iniWrapper->getBool('opcache.save_comments')) { return false; } - if($iniWrapper->getNumeric('opcache.max_accelerated_files') < 10000) { + if ($iniWrapper->getNumeric('opcache.max_accelerated_files') < 10000) { return false; } - if($iniWrapper->getNumeric('opcache.memory_consumption') < 128) { + if ($iniWrapper->getNumeric('opcache.memory_consumption') < 128) { return false; } - if($iniWrapper->getNumeric('opcache.interned_strings_buffer') < 8) { + if ($iniWrapper->getNumeric('opcache.interned_strings_buffer') < 8) { return false; } diff --git a/apps/settings/lib/Controller/CommonSettingsTrait.php b/apps/settings/lib/Controller/CommonSettingsTrait.php index 7aa202429eb..f5c8bb465fd 100644 --- a/apps/settings/lib/Controller/CommonSettingsTrait.php +++ b/apps/settings/lib/Controller/CommonSettingsTrait.php @@ -38,7 +38,7 @@ use OCP\Settings\IIconSection; use OCP\Settings\IManager as ISettingsManager; use OCP\Settings\ISettings; -trait CommonSettingsTrait { +trait CommonSettingsTrait { /** @var ISettingsManager */ private $settingsManager; @@ -85,11 +85,11 @@ trait CommonSettingsTrait { protected function formatSections($sections, $currentSection, $type, $currentType, bool $subAdminOnly = false) { $templateParameters = []; /** @var \OCP\Settings\ISection[] $prioritizedSections */ - foreach($sections as $prioritizedSections) { + foreach ($sections as $prioritizedSections) { foreach ($prioritizedSections as $section) { - if($type === 'admin') { + if ($type === 'admin') { $settings = $this->settingsManager->getAdminSettings($section->getID(), $subAdminOnly); - } elseif($type === 'personal') { + } elseif ($type === 'personal') { $settings = $this->settingsManager->getPersonalSettings($section->getID()); } if (empty($settings) && !($section->getID() === 'additional' && count(\OC_App::getForms('admin')) > 0)) { diff --git a/apps/settings/lib/Controller/HelpController.php b/apps/settings/lib/Controller/HelpController.php index cf470d6af4b..58fb18ea2c5 100644 --- a/apps/settings/lib/Controller/HelpController.php +++ b/apps/settings/lib/Controller/HelpController.php @@ -71,7 +71,7 @@ class HelpController extends Controller { public function help(string $mode = 'user'): TemplateResponse { $this->navigationManager->setActiveEntry('help'); - if(!isset($mode) || $mode !== 'admin') { + if (!isset($mode) || $mode !== 'admin') { $mode = 'user'; } @@ -93,7 +93,5 @@ class HelpController extends Controller { $policy->addAllowedFrameDomain('\'self\''); $response->setContentSecurityPolicy($policy); return $response; - } - } diff --git a/apps/settings/lib/Controller/LogSettingsController.php b/apps/settings/lib/Controller/LogSettingsController.php index 648b0ff1c3b..31abc144371 100644 --- a/apps/settings/lib/Controller/LogSettingsController.php +++ b/apps/settings/lib/Controller/LogSettingsController.php @@ -51,7 +51,7 @@ class LogSettingsController extends Controller { * @return StreamResponse */ public function download() { - if(!$this->log instanceof Log) { + if (!$this->log instanceof Log) { throw new \UnexpectedValueException('Log file not available'); } $resp = new StreamResponse($this->log->getLogPath()); diff --git a/apps/settings/lib/Controller/MailSettingsController.php b/apps/settings/lib/Controller/MailSettingsController.php index 5dc0ff9d890..94f9d72cafd 100644 --- a/apps/settings/lib/Controller/MailSettingsController.php +++ b/apps/settings/lib/Controller/MailSettingsController.php @@ -93,10 +93,9 @@ class MailSettingsController extends Controller { $mail_smtpauth, $mail_smtpport, $mail_sendmailmode) { - $params = get_defined_vars(); $configs = []; - foreach($params as $key => $value) { + foreach ($params as $key => $value) { $configs[$key] = empty($value) ? null : $value; } @@ -168,5 +167,4 @@ class MailSettingsController extends Controller { return new DataResponse($this->l10n->t('You need to set your user email before being able to send test emails.'), Http::STATUS_BAD_REQUEST); } - } diff --git a/apps/settings/lib/Controller/PersonalSettingsController.php b/apps/settings/lib/Controller/PersonalSettingsController.php index 12d8af3af17..0aff8bee649 100644 --- a/apps/settings/lib/Controller/PersonalSettingsController.php +++ b/apps/settings/lib/Controller/PersonalSettingsController.php @@ -65,7 +65,6 @@ class PersonalSettingsController extends Controller { */ public function index($section) { return $this->getIndexResponse('personal', $section); - } /** @@ -75,7 +74,7 @@ class PersonalSettingsController extends Controller { protected function getSettings($section) { $settings = $this->settingsManager->getPersonalSettings($section); $formatted = $this->formatSettings($settings); - if($section === 'additional') { + if ($section === 'additional') { $formatted['content'] .= $this->getLegacyForms(); } return $formatted; diff --git a/apps/settings/lib/Controller/TwoFactorSettingsController.php b/apps/settings/lib/Controller/TwoFactorSettingsController.php index 77d8e882354..36b554c8181 100644 --- a/apps/settings/lib/Controller/TwoFactorSettingsController.php +++ b/apps/settings/lib/Controller/TwoFactorSettingsController.php @@ -56,5 +56,4 @@ class TwoFactorSettingsController extends Controller { return new JSONResponse($this->mandatoryTwoFactor->getState()); } - } diff --git a/apps/settings/lib/Controller/UsersController.php b/apps/settings/lib/Controller/UsersController.php index 5a4ebd122f8..abc4715df6c 100644 --- a/apps/settings/lib/Controller/UsersController.php +++ b/apps/settings/lib/Controller/UsersController.php @@ -172,7 +172,7 @@ class UsersController extends Controller { $groupsInfo->setSorting($sortGroupsBy); list($adminGroup, $groups) = $groupsInfo->get(); - if(!$isLDAPUsed && $this->appManager->isEnabledForUser('user_ldap')) { + if (!$isLDAPUsed && $this->appManager->isEnabledForUser('user_ldap')) { $isLDAPUsed = (bool)array_reduce($this->userManager->getBackends(), function ($ldapFound, $backend) { return $ldapFound || $backend instanceof User_Proxy; }); @@ -181,7 +181,7 @@ class UsersController extends Controller { $disabledUsers = -1; $userCount = 0; - if(!$isLDAPUsed) { + if (!$isLDAPUsed) { if ($this->isAdmin) { $disabledUsers = $this->userManager->countDisabledUsers(); $userCount = array_reduce($this->userManager->countUsers(), function ($v, $w) { @@ -193,7 +193,7 @@ class UsersController extends Controller { $userGroups = $this->groupManager->getUserGroups($user); $groupsNames = []; - foreach($groups as $key => $group) { + foreach ($groups as $key => $group) { // $userCount += (int)$group['usercount']; array_push($groupsNames, $group['name']); // we prevent subadmins from looking up themselves @@ -447,7 +447,6 @@ class UsersController extends Controller { * @return DataResponse */ public function getVerificationCode(string $account, bool $onlyVerificationCode): DataResponse { - $user = $this->userSession->getUser(); if ($user === null) { diff --git a/apps/settings/lib/Controller/WebAuthnController.php b/apps/settings/lib/Controller/WebAuthnController.php index cbc396b675f..c1ce7a6cf98 100644 --- a/apps/settings/lib/Controller/WebAuthnController.php +++ b/apps/settings/lib/Controller/WebAuthnController.php @@ -37,7 +37,6 @@ use OCP\IUserSession; use Webauthn\PublicKeyCredentialCreationOptions; class WebAuthnController extends Controller { - private const WEBAUTHN_REGISTRATION = 'webauthn_registration'; /** @var Manager */ diff --git a/apps/settings/lib/Hooks.php b/apps/settings/lib/Hooks.php index baa8941bd32..851f2f143dc 100644 --- a/apps/settings/lib/Hooks.php +++ b/apps/settings/lib/Hooks.php @@ -157,7 +157,6 @@ class Hooks { * @throws \BadMethodCallException */ public function onChangeEmail(IUser $user, $oldMailAddress) { - if ($oldMailAddress === $user->getEMailAddress() || $user->getLastLogin() === 0) { // Email didn't really change or user didn't login, diff --git a/apps/settings/lib/Mailer/NewUserMailHelper.php b/apps/settings/lib/Mailer/NewUserMailHelper.php index ca6a5947527..75b1593c6b1 100644 --- a/apps/settings/lib/Mailer/NewUserMailHelper.php +++ b/apps/settings/lib/Mailer/NewUserMailHelper.php @@ -139,7 +139,7 @@ class NewUserMailHelper { $emailTemplate->addHeading($l10n->t('Welcome aboard %s', [$displayName])); } $emailTemplate->addBodyText($l10n->t('Welcome to your %s account, you can add, protect, and share your data.', [$this->themingDefaults->getName()])); - if($user->getBackendClassName() !== 'LDAP') { + if ($user->getBackendClassName() !== 'LDAP') { $emailTemplate->addBodyText($l10n->t('Your username is: %s', [$userId])); } if ($generatePasswordResetToken) { diff --git a/apps/settings/lib/Middleware/SubadminMiddleware.php b/apps/settings/lib/Middleware/SubadminMiddleware.php index ffc507e50e0..7fa30c8e26c 100644 --- a/apps/settings/lib/Middleware/SubadminMiddleware.php +++ b/apps/settings/lib/Middleware/SubadminMiddleware.php @@ -65,8 +65,8 @@ class SubadminMiddleware extends Middleware { * @throws \Exception */ public function beforeController($controller, $methodName) { - if(!$this->reflector->hasAnnotation('NoSubadminRequired')) { - if(!$this->isSubAdmin) { + if (!$this->reflector->hasAnnotation('NoSubadminRequired')) { + if (!$this->isSubAdmin) { throw new NotAdminException($this->l10n->t('Logged in user must be a subadmin')); } } @@ -81,7 +81,7 @@ class SubadminMiddleware extends Middleware { * @throws \Exception */ public function afterException($controller, $methodName, \Exception $exception) { - if($exception instanceof NotAdminException) { + if ($exception instanceof NotAdminException) { $response = new TemplateResponse('core', '403', [], 'guest'); $response->setStatus(Http::STATUS_FORBIDDEN); return $response; @@ -89,5 +89,4 @@ class SubadminMiddleware extends Middleware { throw $exception; } - } diff --git a/apps/settings/lib/Settings/Personal/PersonalInfo.php b/apps/settings/lib/Settings/Personal/PersonalInfo.php index e6bc4388359..152259b743f 100644 --- a/apps/settings/lib/Settings/Personal/PersonalInfo.php +++ b/apps/settings/lib/Settings/Personal/PersonalInfo.php @@ -95,7 +95,7 @@ class PersonalInfo implements ISettings { public function getForm() { $federatedFileSharingEnabled = $this->appManager->isEnabledForUser('federatedfilesharing'); $lookupServerUploadEnabled = false; - if($federatedFileSharingEnabled) { + if ($federatedFileSharingEnabled) { $federatedFileSharing = \OC::$server->query(Application::class); $shareProvider = $federatedFileSharing->getFederatedShareProvider(); $lookupServerUploadEnabled = $shareProvider->isLookupServerUploadEnabled(); @@ -194,7 +194,7 @@ class PersonalInfo implements ISettings { */ private function getLanguages(IUser $user) { $forceLanguage = $this->config->getSystemValue('force_language', false); - if($forceLanguage !== false) { + if ($forceLanguage !== false) { return []; } @@ -227,7 +227,7 @@ class PersonalInfo implements ISettings { private function getLocales(IUser $user) { $forceLanguage = $this->config->getSystemValue('force_locale', false); - if($forceLanguage !== false) { + if ($forceLanguage !== false) { return []; } @@ -243,8 +243,7 @@ class PersonalInfo implements ISettings { return $userLocaleString === $value['code']; }); - if (!empty($userLocale)) - { + if (!empty($userLocale)) { $userLocale = reset($userLocale); } @@ -289,5 +288,4 @@ class PersonalInfo implements ISettings { } return $messageParameters; } - } diff --git a/apps/settings/lib/Settings/Personal/Security/Authtokens.php b/apps/settings/lib/Settings/Personal/Security/Authtokens.php index 3e33723a62b..22aca1660d9 100644 --- a/apps/settings/lib/Settings/Personal/Security/Authtokens.php +++ b/apps/settings/lib/Settings/Personal/Security/Authtokens.php @@ -117,5 +117,4 @@ class Authtokens implements ISettings { return $data; }, $tokens); } - } diff --git a/apps/settings/lib/Settings/Personal/Security/TwoFactor.php b/apps/settings/lib/Settings/Personal/Security/TwoFactor.php index 4db8f6f8ab2..ca20274b33d 100644 --- a/apps/settings/lib/Settings/Personal/Security/TwoFactor.php +++ b/apps/settings/lib/Settings/Personal/Security/TwoFactor.php @@ -66,7 +66,6 @@ class TwoFactor implements ISettings { 'twoFactorProviderData' => $this->getTwoFactorProviderData(), 'themedark' => $this->config->getUserValue($this->uid, 'accessibility', 'theme', false) ]); - } public function getSection(): string { diff --git a/apps/settings/templates/help.php b/apps/settings/templates/help.php index 0eccf78cc90..045f45d5d8a 100644 --- a/apps/settings/templates/help.php +++ b/apps/settings/templates/help.php @@ -4,14 +4,18 @@ <div id="app-navigation"> <ul> <li> - <a class="icon-user <?php if ($_['mode'] === 'user') { p('active'); } ?>" + <a class="icon-user <?php if ($_['mode'] === 'user') { + p('active'); +} ?>" href="<?php print_unescaped($_['urlUserDocs']); ?>"> <?php p($l->t('User documentation')); ?> </a> </li> - <?php if($_['admin']) { ?> + <?php if ($_['admin']) { ?> <li> - <a class="icon-user-admin <?php if ($_['mode'] === 'admin') { p('active'); } ?>" + <a class="icon-user-admin <?php if ($_['mode'] === 'admin') { + p('active'); +} ?>" href="<?php print_unescaped($_['urlAdminDocs']); ?>"> <?php p($l->t('Administrator documentation')); ?> </a> diff --git a/apps/settings/templates/settings-vue.php b/apps/settings/templates/settings-vue.php index f04d577fdae..8db9dc6286b 100644 --- a/apps/settings/templates/settings-vue.php +++ b/apps/settings/templates/settings-vue.php @@ -25,7 +25,8 @@ script('settings', 'vue-settings-apps-users-management'); style('settings', 'settings'); // Do we have some data to inject ? -if(is_array($_['serverData'])) { -?> -<span id="serverData" data-server="<?php p(json_encode($_['serverData']));?>"></span> -<?php } ?> +if (is_array($_['serverData'])) { + ?> +<span id="serverData" data-server="<?php p(json_encode($_['serverData'])); ?>"></span> +<?php +} ?> diff --git a/apps/settings/templates/settings/additional.php b/apps/settings/templates/settings/additional.php index 3af78adde71..ac6b91e8d76 100644 --- a/apps/settings/templates/settings/additional.php +++ b/apps/settings/templates/settings/additional.php @@ -26,7 +26,7 @@ ?> -<?php foreach($_['forms'] as $form) { +<?php foreach ($_['forms'] as $form) { if (isset($form['form'])) {?> <div id="<?php isset($form['anchor']) ? p($form['anchor']) : p('');?>"><?php print_unescaped($form['form']);?></div> <?php } diff --git a/apps/settings/templates/settings/admin/additional-mail.php b/apps/settings/templates/settings/admin/additional-mail.php index 609aa3222d5..06a45332855 100644 --- a/apps/settings/templates/settings/admin/additional-mail.php +++ b/apps/settings/templates/settings/admin/additional-mail.php @@ -76,11 +76,15 @@ $mail_sendmailmode = [ </select> <label id="mail_smtpsecure_label" for="mail_smtpsecure" - <?php if ($_['mail_smtpmode'] !== 'smtp') print_unescaped(' class="hidden"'); ?>> + <?php if ($_['mail_smtpmode'] !== 'smtp') { + print_unescaped(' class="hidden"'); + } ?>> <?php p($l->t('Encryption')); ?> </label> <select name="mail_smtpsecure" id="mail_smtpsecure" - <?php if ($_['mail_smtpmode'] !== 'smtp') print_unescaped(' class="hidden"'); ?>> + <?php if ($_['mail_smtpmode'] !== 'smtp') { + print_unescaped(' class="hidden"'); + } ?>> <?php foreach ($mail_smtpsecure as $secure => $name): $selected = ''; if ($secure == $_['mail_smtpsecure']): @@ -108,7 +112,9 @@ $mail_sendmailmode = [ value="<?php p($_['mail_domain']) ?>" /> </p> - <p id="setting_smtpauth" <?php if ($_['mail_smtpmode'] !== 'smtp') print_unescaped(' class="hidden"'); ?>> + <p id="setting_smtpauth" <?php if ($_['mail_smtpmode'] !== 'smtp') { + print_unescaped(' class="hidden"'); + } ?>> <label for="mail_smtpauthtype"><?php p($l->t('Authentication method')); ?></label> <select name="mail_smtpauthtype" id="mail_smtpauthtype"> <?php foreach ($mail_smtpauthtype as $authtype => $name): @@ -121,11 +127,15 @@ $mail_sendmailmode = [ </select> <input type="checkbox" name="mail_smtpauth" id="mail_smtpauth" class="checkbox" value="1" - <?php if ($_['mail_smtpauth']) print_unescaped('checked="checked"'); ?> /> + <?php if ($_['mail_smtpauth']) { + print_unescaped('checked="checked"'); + } ?> /> <label for="mail_smtpauth"><?php p($l->t('Authentication required')); ?></label> </p> - <p id="setting_smtphost" <?php if ($_['mail_smtpmode'] !== 'smtp') print_unescaped(' class="hidden"'); ?>> + <p id="setting_smtphost" <?php if ($_['mail_smtpmode'] !== 'smtp') { + print_unescaped(' class="hidden"'); + } ?>> <label for="mail_smtphost"><?php p($l->t('Server address')); ?></label> <input type="text" name="mail_smtphost" id="mail_smtphost" placeholder="smtp.example.com" value="<?php p($_['mail_smtphost']) ?>" /> @@ -135,7 +145,9 @@ $mail_sendmailmode = [ </p> </form> <form class="mail_settings" id="mail_credentials_settings"> - <p id="mail_credentials" <?php if (!$_['mail_smtpauth'] || $_['mail_smtpmode'] !== 'smtp') print_unescaped(' class="hidden"'); ?>> + <p id="mail_credentials" <?php if (!$_['mail_smtpauth'] || $_['mail_smtpmode'] !== 'smtp') { + print_unescaped(' class="hidden"'); + } ?>> <label for="mail_smtpname"><?php p($l->t('Credentials')); ?></label> <input type="text" name="mail_smtpname" id="mail_smtpname" placeholder="<?php p($l->t('SMTP Username'))?>" value="<?php p($_['mail_smtpname']) ?>" /> diff --git a/apps/settings/templates/settings/admin/overview.php b/apps/settings/templates/settings/admin/overview.php index 9eb6fc1c1f5..a9f5ad0d77f 100644 --- a/apps/settings/templates/settings/admin/overview.php +++ b/apps/settings/templates/settings/admin/overview.php @@ -45,7 +45,11 @@ <span class="icon loading"></span><span class="message"><?php p($l->t('Checking for system and security issues.'));?></span> </div> - <div id="postsetupchecks" data-check-wellknown="<?php if($_['checkForWorkingWellKnownSetup']) { p('true'); } else { p('false'); } ?>"> + <div id="postsetupchecks" data-check-wellknown="<?php if ($_['checkForWorkingWellKnownSetup']) { + p('true'); +} else { + p('false'); +} ?>"> <ul class="errors hidden"></ul> <ul class="warnings hidden"></ul> <ul class="info hidden"></ul> diff --git a/apps/settings/templates/settings/admin/security.php b/apps/settings/templates/settings/admin/security.php index 0e32399f325..f0689b948af 100644 --- a/apps/settings/templates/settings/admin/security.php +++ b/apps/settings/templates/settings/admin/security.php @@ -43,7 +43,9 @@ script('settings', 'vue-settings-admin-security'); <p id="enable"> <input type="checkbox" id="enableEncryption" class="checkbox" - value="1" <?php if ($_['encryptionEnabled']) print_unescaped('checked="checked" disabled="disabled"'); ?> /> + value="1" <?php if ($_['encryptionEnabled']) { + print_unescaped('checked="checked" disabled="disabled"'); +} ?> /> <label for="enableEncryption"><?php p($l->t('Enable server-side encryption')); ?> <span id="startmigration_msg" class="msg"></span> </label><br/> </p> @@ -62,8 +64,12 @@ script('settings', 'vue-settings-admin-security'); value="<?php p($l->t("Enable encryption")); ?>" /></p> </div> - <div id="EncryptionSettingsArea" class="<?php if (!$_['encryptionEnabled']) p('hidden'); ?>"> - <div id='selectEncryptionModules' class="<?php if (!$_['encryptionReady']) p('hidden'); ?>"> + <div id="EncryptionSettingsArea" class="<?php if (!$_['encryptionEnabled']) { + p('hidden'); +} ?>"> + <div id='selectEncryptionModules' class="<?php if (!$_['encryptionReady']) { + p('hidden'); +} ?>"> <?php if (empty($_['encryptionModules'])) { p($l->t('No encryption module loaded, please enable an encryption module in the app menu.')); @@ -75,8 +81,8 @@ script('settings', 'vue-settings-admin-security'); name="default_encryption_module" value="<?php p($id) ?>" <?php if ($module['default']) { - p('checked'); - } ?>> + p('checked'); + } ?>> <label for="<?php p($id) ?>"><?php p($module['displayName']) ?></label> <br/> @@ -84,7 +90,9 @@ script('settings', 'vue-settings-admin-security'); </fieldset> <?php } ?> </div> - <div id="migrationWarning" class="<?php if ($_['encryptionReady']) p('hidden'); ?>"> + <div id="migrationWarning" class="<?php if ($_['encryptionReady']) { + p('hidden'); + } ?>"> <?php if ($_['encryptionReady'] === false && $_['externalBackendsEnabled'] === true) { p($l->t('You need to migrate your encryption keys from the old encryption (ownCloud <= 8.0) to the new one. Please enable the "Default encryption module" and run \'occ encryption:migrate\'')); @@ -92,7 +100,8 @@ script('settings', 'vue-settings-admin-security'); p($l->t('You need to migrate your encryption keys from the old encryption (ownCloud <= 8.0) to the new one.')); ?> <input type="submit" name="startmigration" id="startmigration" value="<?php p($l->t('Start migration')); ?>"/> - <?php } ?> + <?php + } ?> </div> </div> </div> diff --git a/apps/settings/templates/settings/admin/server.php b/apps/settings/templates/settings/admin/server.php index bde4423f67f..c848ef5c494 100644 --- a/apps/settings/templates/settings/admin/server.php +++ b/apps/settings/templates/settings/admin/server.php @@ -30,19 +30,19 @@ <h2 class="inlineblock"><?php p($l->t('Background jobs'));?></h2> <p class="cronlog inlineblock"> <?php if ($_['lastcron'] !== false) { - $relative_time = relative_modified_date($_['lastcron']); - $maxAgeRelativeTime = relative_modified_date($_['cronMaxAge']); + $relative_time = relative_modified_date($_['lastcron']); + $maxAgeRelativeTime = relative_modified_date($_['cronMaxAge']); - $formatter = \OC::$server->getDateTimeFormatter(); - $absolute_time = $formatter->formatDateTime($_['lastcron'], 'long', 'long'); - $maxAgeAbsoluteTime = $formatter->formatDateTime($_['cronMaxAge'], 'long', 'long'); - if (time() - $_['lastcron'] > 600) { ?> + $formatter = \OC::$server->getDateTimeFormatter(); + $absolute_time = $formatter->formatDateTime($_['lastcron'], 'long', 'long'); + $maxAgeAbsoluteTime = $formatter->formatDateTime($_['cronMaxAge'], 'long', 'long'); + if (time() - $_['lastcron'] > 600) { ?> <span class="status error"></span> <span class="crondate" title="<?php p($absolute_time);?>"> <?php p($l->t("Last job execution ran %s. Something seems wrong.", [$relative_time]));?> </span> <?php } elseif (time() - $_['cronMaxAge'] > 12*3600) { - if ($_['backgroundjobs_mode'] === 'cron') { ?> + if ($_['backgroundjobs_mode'] === 'cron') { ?> <span class="status warning"></span> <span class="crondate" title="<?php p($maxAgeAbsoluteTime);?>"> <?php p($l->t("Some jobs haven’t been executed since %s. Please consider increasing the execution frequency.", [$maxAgeRelativeTime]));?> @@ -53,13 +53,13 @@ <?php p($l->t("Some jobs didn’t execute since %s. Please consider switching to system cron.", [$maxAgeRelativeTime]));?> </span> <?php } - } else { ?> + } else { ?> <span class="status success"></span> <span class="crondate" title="<?php p($absolute_time);?>"> <?php p($l->t("Last job ran %s.", [$relative_time]));?> </span> <?php } - } else { ?> +} else { ?> <span class="status error"></span> <?php p($l->t("Background job didn’t run yet!")); } ?> @@ -75,33 +75,33 @@ <p> <input type="radio" name="mode" value="ajax" class="radio" id="backgroundjobs_ajax" <?php if ($_['backgroundjobs_mode'] === "ajax") { - print_unescaped('checked="checked"'); - } ?>> + print_unescaped('checked="checked"'); + } ?>> <label for="backgroundjobs_ajax">AJAX</label><br/> <em><?php p($l->t("Execute one task with each page loaded")); ?></em> </p> <p> <input type="radio" name="mode" value="webcron" class="radio" id="backgroundjobs_webcron" <?php if ($_['backgroundjobs_mode'] === "webcron") { - print_unescaped('checked="checked"'); - } ?>> + print_unescaped('checked="checked"'); + } ?>> <label for="backgroundjobs_webcron">Webcron</label><br/> <em><?php p($l->t("cron.php is registered at a webcron service to call cron.php every 5 minutes over HTTP.")); ?></em> </p> <p> <input type="radio" name="mode" value="cron" class="radio" id="backgroundjobs_cron" <?php if ($_['backgroundjobs_mode'] === "cron") { - print_unescaped('checked="checked"'); - } + print_unescaped('checked="checked"'); + } if (!$_['cli_based_cron_possible']) { print_unescaped('disabled'); }?>> <label for="backgroundjobs_cron">Cron</label><br/> <em><?php p($l->t("Use system cron service to call the cron.php file every 5 minutes.")); ?> - <?php if($_['cli_based_cron_possible']) { - p($l->t('The cron.php needs to be executed by the system user "%s".', [$_['cli_based_cron_user']])); - } else { - print_unescaped(str_replace( + <?php if ($_['cli_based_cron_possible']) { + p($l->t('The cron.php needs to be executed by the system user "%s".', [$_['cli_based_cron_user']])); + } else { + print_unescaped(str_replace( ['{linkstart}', '{linkend}'], ['<a href="http://php.net/manual/en/book.posix.php">', ' ↗</a>'], $l->t('To run this you need the PHP POSIX extension. See {linkstart}PHP documentation{linkend} for more details.') diff --git a/apps/settings/templates/settings/admin/sharing.php b/apps/settings/templates/settings/admin/sharing.php index 0cfbb3e8492..bd75b04eedb 100644 --- a/apps/settings/templates/settings/admin/sharing.php +++ b/apps/settings/templates/settings/admin/sharing.php @@ -34,110 +34,172 @@ <p class="settings-hint"><?php p($l->t('As admin you can fine-tune the sharing behavior. Please see the documentation for more information.'));?></p> <p id="enable"> <input type="checkbox" name="shareapi_enabled" id="shareAPIEnabled" class="checkbox" - value="1" <?php if ($_['shareAPIEnabled'] === 'yes') print_unescaped('checked="checked"'); ?> /> + value="1" <?php if ($_['shareAPIEnabled'] === 'yes') { + print_unescaped('checked="checked"'); +} ?> /> <label for="shareAPIEnabled"><?php p($l->t('Allow apps to use the Share API'));?></label><br/> </p> - <p id="internalShareSettings" class="indent <?php if ($_['shareAPIEnabled'] === 'no') p('hidden'); ?>"> + <p id="internalShareSettings" class="indent <?php if ($_['shareAPIEnabled'] === 'no') { + p('hidden'); +} ?>"> <input type="checkbox" name="shareapi_default_internal_expire_date" id="shareapiDefaultInternalExpireDate" class="checkbox" - value="1" <?php if ($_['shareDefaultInternalExpireDateSet'] === 'yes') print_unescaped('checked="checked"'); ?> /> + value="1" <?php if ($_['shareDefaultInternalExpireDateSet'] === 'yes') { + print_unescaped('checked="checked"'); +} ?> /> <label for="shareapiDefaultInternalExpireDate"><?php p($l->t('Set default expiration date for shares'));?></label><br/> </p> - <p id="setDefaultInternalExpireDate" class="double-indent <?php if ($_['shareDefaultInternalExpireDateSet'] === 'no' || $_['shareAPIEnabled'] === 'no') p('hidden');?>"> + <p id="setDefaultInternalExpireDate" class="double-indent <?php if ($_['shareDefaultInternalExpireDateSet'] === 'no' || $_['shareAPIEnabled'] === 'no') { + p('hidden'); +}?>"> <?php p($l->t('Expire after ')); ?> <input type="text" name='shareapi_internal_expire_after_n_days' id="shareapiInternalExpireAfterNDays" placeholder="<?php p('7')?>" value='<?php p($_['shareInternalExpireAfterNDays']) ?>' /> <?php p($l->t('days')); ?> <input type="checkbox" name="shareapi_internal_enforce_expire_date" id="shareapiInternalEnforceExpireDate" class="checkbox" - value="1" <?php if ($_['shareInternalEnforceExpireDate'] === 'yes') print_unescaped('checked="checked"'); ?> /> + value="1" <?php if ($_['shareInternalEnforceExpireDate'] === 'yes') { + print_unescaped('checked="checked"'); +} ?> /> <label for="shareapiInternalEnforceExpireDate"><?php p($l->t('Enforce expiration date'));?></label><br/> </p> - <p class="<?php if ($_['shareAPIEnabled'] === 'no') p('hidden');?>"> + <p class="<?php if ($_['shareAPIEnabled'] === 'no') { + p('hidden'); +}?>"> <input type="checkbox" name="shareapi_allow_links" id="allowLinks" class="checkbox" - value="1" <?php if ($_['allowLinks'] === 'yes') print_unescaped('checked="checked"'); ?> /> + value="1" <?php if ($_['allowLinks'] === 'yes') { + print_unescaped('checked="checked"'); +} ?> /> <label for="allowLinks"><?php p($l->t('Allow users to share via link'));?></label><br/> </p> - <p id="publicLinkSettings" class="indent <?php if ($_['allowLinks'] !== 'yes' || $_['shareAPIEnabled'] === 'no') p('hidden'); ?>"> + <p id="publicLinkSettings" class="indent <?php if ($_['allowLinks'] !== 'yes' || $_['shareAPIEnabled'] === 'no') { + p('hidden'); +} ?>"> <input type="checkbox" name="shareapi_allow_public_upload" id="allowPublicUpload" class="checkbox" - value="1" <?php if ($_['allowPublicUpload'] == 'yes') print_unescaped('checked="checked"'); ?> /> + value="1" <?php if ($_['allowPublicUpload'] == 'yes') { + print_unescaped('checked="checked"'); +} ?> /> <label for="allowPublicUpload"><?php p($l->t('Allow public uploads'));?></label><br/> <input type="checkbox" name="shareapi_enable_link_password_by_default" id="enableLinkPasswordByDefault" class="checkbox" - value="1" <?php if ($_['enableLinkPasswordByDefault'] === 'yes') print_unescaped('checked="checked"'); ?> /> + value="1" <?php if ($_['enableLinkPasswordByDefault'] === 'yes') { + print_unescaped('checked="checked"'); +} ?> /> <label for="enableLinkPasswordByDefault"><?php p($l->t('Always ask for a password'));?></label><br/> <input type="checkbox" name="shareapi_enforce_links_password" id="enforceLinkPassword" class="checkbox" - value="1" <?php if ($_['enforceLinkPassword']) print_unescaped('checked="checked"'); ?> /> + value="1" <?php if ($_['enforceLinkPassword']) { + print_unescaped('checked="checked"'); +} ?> /> <label for="enforceLinkPassword"><?php p($l->t('Enforce password protection'));?></label><br/> <input type="checkbox" name="shareapi_default_expire_date" id="shareapiDefaultExpireDate" class="checkbox" - value="1" <?php if ($_['shareDefaultExpireDateSet'] === 'yes') print_unescaped('checked="checked"'); ?> /> + value="1" <?php if ($_['shareDefaultExpireDateSet'] === 'yes') { + print_unescaped('checked="checked"'); +} ?> /> <label for="shareapiDefaultExpireDate"><?php p($l->t('Set default expiration date for link shares'));?></label><br/> </p> - <p id="setDefaultExpireDate" class="double-indent <?php if ($_['allowLinks'] !== 'yes' || $_['shareDefaultExpireDateSet'] === 'no' || $_['shareAPIEnabled'] === 'no') p('hidden');?>"> + <p id="setDefaultExpireDate" class="double-indent <?php if ($_['allowLinks'] !== 'yes' || $_['shareDefaultExpireDateSet'] === 'no' || $_['shareAPIEnabled'] === 'no') { + p('hidden'); +}?>"> <?php p($l->t('Expire after ')); ?> <input type="text" name='shareapi_expire_after_n_days' id="shareapiExpireAfterNDays" placeholder="<?php p('7')?>" value='<?php p($_['shareExpireAfterNDays']) ?>' /> <?php p($l->t('days')); ?> <input type="checkbox" name="shareapi_enforce_expire_date" id="shareapiEnforceExpireDate" class="checkbox" - value="1" <?php if ($_['shareEnforceExpireDate'] === 'yes') print_unescaped('checked="checked"'); ?> /> + value="1" <?php if ($_['shareEnforceExpireDate'] === 'yes') { + print_unescaped('checked="checked"'); +} ?> /> <label for="shareapiEnforceExpireDate"><?php p($l->t('Enforce expiration date'));?></label><br/> </p> - <p class="<?php if ($_['shareAPIEnabled'] === 'no') p('hidden');?>"> + <p class="<?php if ($_['shareAPIEnabled'] === 'no') { + p('hidden'); +}?>"> <input type="checkbox" name="shareapi_allow_resharing" id="allowResharing" class="checkbox" - value="1" <?php if ($_['allowResharing'] === 'yes') print_unescaped('checked="checked"'); ?> /> + value="1" <?php if ($_['allowResharing'] === 'yes') { + print_unescaped('checked="checked"'); +} ?> /> <label for="allowResharing"><?php p($l->t('Allow resharing'));?></label><br/> </p> - <p class="<?php if ($_['shareAPIEnabled'] === 'no') p('hidden');?>"> + <p class="<?php if ($_['shareAPIEnabled'] === 'no') { + p('hidden'); +}?>"> <input type="checkbox" name="shareapi_allow_group_sharing" id="allowGroupSharing" class="checkbox" - value="1" <?php if ($_['allowGroupSharing'] === 'yes') print_unescaped('checked="checked"'); ?> /> + value="1" <?php if ($_['allowGroupSharing'] === 'yes') { + print_unescaped('checked="checked"'); +} ?> /> <label for="allowGroupSharing"><?php p($l->t('Allow sharing with groups'));?></label><br /> </p> - <p class="<?php if ($_['shareAPIEnabled'] === 'no') p('hidden');?>"> + <p class="<?php if ($_['shareAPIEnabled'] === 'no') { + p('hidden'); +}?>"> <input type="checkbox" name="shareapi_only_share_with_group_members" id="onlyShareWithGroupMembers" class="checkbox" - value="1" <?php if ($_['onlyShareWithGroupMembers']) print_unescaped('checked="checked"'); ?> /> + value="1" <?php if ($_['onlyShareWithGroupMembers']) { + print_unescaped('checked="checked"'); +} ?> /> <label for="onlyShareWithGroupMembers"><?php p($l->t('Restrict users to only share with users in their groups'));?></label><br/> </p> - <p class="<?php if ($_['shareAPIEnabled'] === 'no') p('hidden');?>"> + <p class="<?php if ($_['shareAPIEnabled'] === 'no') { + p('hidden'); +}?>"> <input type="checkbox" name="shareapi_exclude_groups" id="shareapiExcludeGroups" class="checkbox" - value="1" <?php if ($_['shareExcludeGroups']) print_unescaped('checked="checked"'); ?> /> + value="1" <?php if ($_['shareExcludeGroups']) { + print_unescaped('checked="checked"'); +} ?> /> <label for="shareapiExcludeGroups"><?php p($l->t('Exclude groups from sharing'));?></label><br/> </p> - <p id="selectExcludedGroups" class="indent <?php if (!$_['shareExcludeGroups'] || $_['shareAPIEnabled'] === 'no') p('hidden'); ?>"> + <p id="selectExcludedGroups" class="indent <?php if (!$_['shareExcludeGroups'] || $_['shareAPIEnabled'] === 'no') { + p('hidden'); +} ?>"> <input name="shareapi_exclude_groups_list" type="hidden" id="excludedGroups" value="<?php p($_['shareExcludedGroupsList']) ?>" style="width: 400px" class="noJSAutoUpdate"/> <br /> <em><?php p($l->t('These groups will still be able to receive shares, but not to initiate them.')); ?></em> </p> - <p class="<?php if ($_['shareAPIEnabled'] === 'no') p('hidden');?>"> + <p class="<?php if ($_['shareAPIEnabled'] === 'no') { + p('hidden'); +}?>"> <input type="checkbox" name="shareapi_allow_share_dialog_user_enumeration" value="1" id="shareapi_allow_share_dialog_user_enumeration" class="checkbox" - <?php if ($_['allowShareDialogUserEnumeration'] === 'yes') print_unescaped('checked="checked"'); ?> /> + <?php if ($_['allowShareDialogUserEnumeration'] === 'yes') { + print_unescaped('checked="checked"'); +} ?> /> <label for="shareapi_allow_share_dialog_user_enumeration"><?php p($l->t('Allow username autocompletion in share dialog. If this is disabled the full username or email address needs to be entered.'));?></label><br /> </p> - <p id="shareapi_restrict_user_enumeration_to_group_setting" class="indent <?php if ($_['shareAPIEnabled'] === 'no' || $_['allowShareDialogUserEnumeration'] === 'no') p('hidden');?>"> + <p id="shareapi_restrict_user_enumeration_to_group_setting" class="indent <?php if ($_['shareAPIEnabled'] === 'no' || $_['allowShareDialogUserEnumeration'] === 'no') { + p('hidden'); +}?>"> <input type="checkbox" name="shareapi_restrict_user_enumeration_to_group" value="1" id="shareapi_restrict_user_enumeration_to_group" class="checkbox" - <?php if ($_['restrictUserEnumerationToGroup'] === 'yes') print_unescaped('checked="checked"'); ?> /> + <?php if ($_['restrictUserEnumerationToGroup'] === 'yes') { + print_unescaped('checked="checked"'); +} ?> /> <label for="shareapi_restrict_user_enumeration_to_group"><?php p($l->t('Restrict username autocompletion to users within the same groups'));?></label><br /> </p> <p> <input type="checkbox" id="publicShareDisclaimer" class="checkbox noJSAutoUpdate" - <?php if ($_['publicShareDisclaimerText'] !== null) print_unescaped('checked="checked"'); ?> /> + <?php if ($_['publicShareDisclaimerText'] !== null) { + print_unescaped('checked="checked"'); +} ?> /> <label for="publicShareDisclaimer"><?php p($l->t('Show disclaimer text on the public link upload page. (Only shown when the file list is hidden.)'));?></label> <span id="publicShareDisclaimerStatus" class="msg" style="display:none"></span> <br/> - <textarea placeholder="<?php p($l->t('This text will be shown on the public link upload page when the file list is hidden.')) ?>" id="publicShareDisclaimerText" <?php if ($_['publicShareDisclaimerText'] === null) { print_unescaped('class="hidden"'); } ?>><?php p($_['publicShareDisclaimerText']) ?></textarea> + <textarea placeholder="<?php p($l->t('This text will be shown on the public link upload page when the file list is hidden.')) ?>" id="publicShareDisclaimerText" <?php if ($_['publicShareDisclaimerText'] === null) { + print_unescaped('class="hidden"'); +} ?>><?php p($_['publicShareDisclaimerText']) ?></textarea> </p> <h3><?php p($l->t('Default share permissions'));?></h3> <input type="hidden" name="shareapi_default_permissions" id="shareApiDefaultPermissions" class="checkbox" value="<?php p($_['shareApiDefaultPermissions']) ?>" /> - <p id="shareApiDefaultPermissionsSection" class="indent <?php if ($_['shareAPIEnabled'] === 'no') p('hidden'); ?>"> + <p id="shareApiDefaultPermissionsSection" class="indent <?php if ($_['shareAPIEnabled'] === 'no') { + p('hidden'); +} ?>"> <?php foreach ($_['shareApiDefaultPermissionsCheckboxes'] as $perm): ?> <input type="checkbox" name="shareapi_default_permission_<?php p($perm['id']) ?>" id="shareapi_default_permission_<?php p($perm['id']) ?>" - class="noautosave checkbox" value="<?php p($perm['value']) ?>" <?php if (($_['shareApiDefaultPermissions'] & $perm['value']) !== 0) print_unescaped('checked="checked"'); ?> /> + class="noautosave checkbox" value="<?php p($perm['value']) ?>" <?php if (($_['shareApiDefaultPermissions'] & $perm['value']) !== 0) { + print_unescaped('checked="checked"'); +} ?> /> <label for="shareapi_default_permission_<?php p($perm['id']) ?>"><?php p($perm['label']);?></label> <?php endforeach ?> </p> diff --git a/apps/settings/templates/settings/frame.php b/apps/settings/templates/settings/frame.php index d6658e9c631..5f7186559ab 100644 --- a/apps/settings/templates/settings/frame.php +++ b/apps/settings/templates/settings/frame.php @@ -30,17 +30,16 @@ script('files', 'jquery.fileupload'); <div id="app-navigation"> <ul> - <?php if(!empty($_['forms']['admin'])) { ?> + <?php if (!empty($_['forms']['admin'])) { ?> <li class="app-navigation-caption"><?php p($l->t('Personal')); ?></li> <?php } - foreach($_['forms']['personal'] as $form) { + foreach ($_['forms']['personal'] as $form) { if (isset($form['anchor'])) { $anchor = \OC::$server->getURLGenerator()->linkToRoute('settings.PersonalSettings.index', ['section' => $form['anchor']]); $class = 'nav-icon-' . $form['anchor']; $sectionName = $form['section-name']; - $active = $form['active'] ? ' class="active"' : ''; - ?> + $active = $form['active'] ? ' class="active"' : ''; ?> <li <?php print_unescaped($form['active'] ? ' class="active"' : ''); ?>> <a href="<?php p($anchor); ?>"> <?php if (!empty($form['icon'])) { ?> @@ -57,19 +56,17 @@ script('files', 'jquery.fileupload'); ?> <?php - if(!empty($_['forms']['admin'])) { + if (!empty($_['forms']['admin'])) { ?> <li class="app-navigation-caption"><?php p($l->t('Administration')); ?></li> <?php } - foreach($_['forms']['admin'] as $form) { + foreach ($_['forms']['admin'] as $form) { if (isset($form['anchor'])) { - $anchor = \OC::$server->getURLGenerator()->linkToRoute('settings.AdminSettings.index', ['section' => $form['anchor']]); $class = 'nav-icon-' . $form['anchor']; $sectionName = $form['section-name']; - $active = $form['active'] ? ' class="active"' : ''; - ?> + $active = $form['active'] ? ' class="active"' : ''; ?> <li <?php print_unescaped($form['active'] ? ' class="active"' : ''); ?>> <a href="<?php p($anchor); ?>"> <?php if (!empty($form['icon'])) { ?> diff --git a/apps/settings/templates/settings/personal/personal.info.php b/apps/settings/templates/settings/personal/personal.info.php index ad5f8ac547f..ac95b9eddbf 100644 --- a/apps/settings/templates/settings/personal/personal.info.php +++ b/apps/settings/templates/settings/personal/personal.info.php @@ -67,7 +67,7 @@ script('settings', [ </div> </div> <span class="icon-checkmark hidden"></span> - <?php if($_['lookupServerUploadEnabled']) { ?> + <?php if ($_['lookupServerUploadEnabled']) { ?> <input type="hidden" id="avatarscope" value="<?php p($_['avatarScope']) ?>"> <?php } ?> </form> @@ -92,7 +92,7 @@ script('settings', [ <?php endif ?> </p> </div> - <progress value="<?php p($_['usage_relative']); ?>" max="100"<?php if($_['usage_relative'] > 80): ?> class="warn" <?php endif; ?>></progress> + <progress value="<?php p($_['usage_relative']); ?>" max="100"<?php if ($_['usage_relative'] > 80): ?> class="warn" <?php endif; ?>></progress> </div> </div> </div> @@ -109,15 +109,21 @@ script('settings', [ </div> </h3> <input type="text" id="displayname" name="displayname" - <?php if(!$_['displayNameChangeSupported']) { print_unescaped('class="hidden"'); } ?> + <?php if (!$_['displayNameChangeSupported']) { + print_unescaped('class="hidden"'); + } ?> value="<?php p($_['displayName']) ?>" autocomplete="on" autocapitalize="none" autocorrect="off" /> - <?php if(!$_['displayNameChangeSupported']) { ?> - <span><?php if(isset($_['displayName']) && !empty($_['displayName'])) { p($_['displayName']); } else { p($l->t('No display name set')); } ?></span> + <?php if (!$_['displayNameChangeSupported']) { ?> + <span><?php if (isset($_['displayName']) && !empty($_['displayName'])) { + p($_['displayName']); + } else { + p($l->t('No display name set')); + } ?></span> <?php } ?> <span class="icon-checkmark hidden"></span> <span class="icon-error hidden" ></span> - <?php if($_['lookupServerUploadEnabled']) { ?> + <?php if ($_['lookupServerUploadEnabled']) { ?> <input type="hidden" id="displaynamescope" value="<?php p($_['displayNameScope']) ?>"> <?php } ?> </form> @@ -132,10 +138,12 @@ script('settings', [ </span> </div> </h3> - <div class="verify <?php if ($_['email'] === '' || $_['emailScope'] !== 'public') p('hidden'); ?>"> + <div class="verify <?php if ($_['email'] === '' || $_['emailScope'] !== 'public') { + p('hidden'); + } ?>"> <img id="verify-email" title="<?php p($_['emailMessage']); ?>" data-status="<?php p($_['emailVerification']) ?>" src=" <?php - switch($_['emailVerification']) { + switch ($_['emailVerification']) { case \OC\Accounts\AccountManager::VERIFICATION_IN_PROGRESS: p(image_path('core', 'actions/verifying.svg')); break; @@ -148,18 +156,24 @@ script('settings', [ ?>"> </div> <input type="email" name="email" id="email" value="<?php p($_['email']); ?>" - <?php if(!$_['displayNameChangeSupported']) { print_unescaped('class="hidden"'); } ?> + <?php if (!$_['displayNameChangeSupported']) { + print_unescaped('class="hidden"'); + } ?> placeholder="<?php p($l->t('Your email address')); ?>" autocomplete="on" autocapitalize="none" autocorrect="off" /> <span class="icon-checkmark hidden"></span> <span class="icon-error hidden" ></span> - <?php if(!$_['displayNameChangeSupported']) { ?> - <span><?php if(isset($_['email']) && !empty($_['email'])) { p($_['email']); } else { p($l->t('No email address set')); }?></span> + <?php if (!$_['displayNameChangeSupported']) { ?> + <span><?php if (isset($_['email']) && !empty($_['email'])) { + p($_['email']); + } else { + p($l->t('No email address set')); + }?></span> <?php } ?> - <?php if($_['displayNameChangeSupported']) { ?> + <?php if ($_['displayNameChangeSupported']) { ?> <em><?php p($l->t('For password reset and notifications')); ?></em> <?php } ?> - <?php if($_['lookupServerUploadEnabled']) { ?> + <?php if ($_['lookupServerUploadEnabled']) { ?> <input type="hidden" id="emailscope" value="<?php p($_['emailScope']) ?>"> <?php } ?> </form> @@ -175,12 +189,14 @@ script('settings', [ </span> </div> </h3> - <input type="tel" id="phone" name="phone" <?php if(!$_['lookupServerUploadEnabled']) print_unescaped('disabled="1"'); ?> + <input type="tel" id="phone" name="phone" <?php if (!$_['lookupServerUploadEnabled']) { + print_unescaped('disabled="1"'); + } ?> value="<?php p($_['phone']) ?>" placeholder="<?php p($l->t('Your phone number')); ?>" autocomplete="on" autocapitalize="none" autocorrect="off" /> <span class="icon-checkmark hidden"></span> - <?php if($_['lookupServerUploadEnabled']) { ?> + <?php if ($_['lookupServerUploadEnabled']) { ?> <input type="hidden" id="phonescope" value="<?php p($_['phoneScope']) ?>"> <?php } ?> </form> @@ -197,12 +213,14 @@ script('settings', [ </span> </div> </h3> - <input type="text" id="address" name="address" <?php if(!$_['lookupServerUploadEnabled']) print_unescaped('disabled="1"'); ?> + <input type="text" id="address" name="address" <?php if (!$_['lookupServerUploadEnabled']) { + print_unescaped('disabled="1"'); + } ?> placeholder="<?php p($l->t('Your postal address')); ?>" value="<?php p($_['address']) ?>" autocomplete="on" autocapitalize="none" autocorrect="off" /> <span class="icon-checkmark hidden"></span> - <?php if($_['lookupServerUploadEnabled']) { ?> + <?php if ($_['lookupServerUploadEnabled']) { ?> <input type="hidden" id="addressscope" value="<?php p($_['addressScope']) ?>"> <?php } ?> </form> @@ -219,11 +237,13 @@ script('settings', [ </span> </div> </h3> - <?php if($_['lookupServerUploadEnabled']) { ?> - <div class="verify <?php if ($_['website'] === '' || $_['websiteScope'] !== 'public') p('hidden'); ?>"> + <?php if ($_['lookupServerUploadEnabled']) { ?> + <div class="verify <?php if ($_['website'] === '' || $_['websiteScope'] !== 'public') { + p('hidden'); + } ?>"> <img id="verify-website" title="<?php p($_['websiteMessage']); ?>" data-status="<?php p($_['websiteVerification']) ?>" src=" <?php - switch($_['websiteVerification']) { + switch ($_['websiteVerification']) { case \OC\Accounts\AccountManager::VERIFICATION_IN_PROGRESS: p(image_path('core', 'actions/verifying.svg')); break; @@ -234,7 +254,9 @@ script('settings', [ p(image_path('core', 'actions/verify.svg')); } ?>" - <?php if($_['websiteVerification'] === \OC\Accounts\AccountManager::VERIFICATION_IN_PROGRESS || $_['websiteVerification'] === \OC\Accounts\AccountManager::NOT_VERIFIED) print_unescaped(' class="verify-action"') ?> + <?php if ($_['websiteVerification'] === \OC\Accounts\AccountManager::VERIFICATION_IN_PROGRESS || $_['websiteVerification'] === \OC\Accounts\AccountManager::NOT_VERIFIED) { + print_unescaped(' class="verify-action"'); + } ?> > <div class="verification-dialog popovermenu bubble menu"> <div class="verification-dialog-content"> @@ -248,10 +270,12 @@ script('settings', [ <input type="url" name="website" id="website" value="<?php p($_['website']); ?>" placeholder="<?php p($l->t('Link https://…')); ?>" autocomplete="on" autocapitalize="none" autocorrect="off" - <?php if(!$_['lookupServerUploadEnabled']) print_unescaped('disabled="1"'); ?> + <?php if (!$_['lookupServerUploadEnabled']) { + print_unescaped('disabled="1"'); + } ?> /> <span class="icon-checkmark hidden"></span> - <?php if($_['lookupServerUploadEnabled']) { ?> + <?php if ($_['lookupServerUploadEnabled']) { ?> <input type="hidden" id="websitescope" value="<?php p($_['websiteScope']) ?>"> <?php } ?> </form> @@ -268,11 +292,13 @@ script('settings', [ </span> </div> </h3> - <?php if($_['lookupServerUploadEnabled']) { ?> - <div class="verify <?php if ($_['twitter'] === '' || $_['twitterScope'] !== 'public') p('hidden'); ?>"> + <?php if ($_['lookupServerUploadEnabled']) { ?> + <div class="verify <?php if ($_['twitter'] === '' || $_['twitterScope'] !== 'public') { + p('hidden'); + } ?>"> <img id="verify-twitter" title="<?php p($_['twitterMessage']); ?>" data-status="<?php p($_['twitterVerification']) ?>" src=" <?php - switch($_['twitterVerification']) { + switch ($_['twitterVerification']) { case \OC\Accounts\AccountManager::VERIFICATION_IN_PROGRESS: p(image_path('core', 'actions/verifying.svg')); break; @@ -283,7 +309,9 @@ script('settings', [ p(image_path('core', 'actions/verify.svg')); } ?>" - <?php if($_['twitterVerification'] === \OC\Accounts\AccountManager::VERIFICATION_IN_PROGRESS || $_['twitterVerification'] === \OC\Accounts\AccountManager::NOT_VERIFIED) print_unescaped(' class="verify-action"') ?> + <?php if ($_['twitterVerification'] === \OC\Accounts\AccountManager::VERIFICATION_IN_PROGRESS || $_['twitterVerification'] === \OC\Accounts\AccountManager::NOT_VERIFIED) { + print_unescaped(' class="verify-action"'); + } ?> > <div class="verification-dialog popovermenu bubble menu"> <div class="verification-dialog-content"> @@ -297,10 +325,12 @@ script('settings', [ <input type="text" name="twitter" id="twitter" value="<?php p($_['twitter']); ?>" placeholder="<?php p($l->t('Twitter handle @…')); ?>" autocomplete="on" autocapitalize="none" autocorrect="off" - <?php if(!$_['lookupServerUploadEnabled']) print_unescaped('disabled="1"'); ?> + <?php if (!$_['lookupServerUploadEnabled']) { + print_unescaped('disabled="1"'); + } ?> /> <span class="icon-checkmark hidden"></span> - <?php if($_['lookupServerUploadEnabled']) { ?> + <?php if ($_['lookupServerUploadEnabled']) { ?> <input type="hidden" id="twitterscope" value="<?php p($_['twitterScope']) ?>"> <?php } ?> </form> @@ -319,13 +349,13 @@ script('settings', [ <option value="<?php p($_['activelanguage']['code']);?>"> <?php p($_['activelanguage']['name']);?> </option> - <?php foreach($_['commonlanguages'] as $language):?> + <?php foreach ($_['commonlanguages'] as $language):?> <option value="<?php p($language['code']);?>"> <?php p($language['name']);?> </option> <?php endforeach;?> <optgroup label="––––––––––"></optgroup> - <?php foreach($_['languages'] as $language):?> + <?php foreach ($_['languages'] as $language):?> <option value="<?php p($language['code']);?>"> <?php p($language['name']);?> </option> @@ -349,7 +379,7 @@ script('settings', [ <?php p($l->t($_['activelocale']['name']));?> </option> <optgroup label="––––––––––"></optgroup> - <?php foreach($_['localesForLanguage'] as $locale):?> + <?php foreach ($_['localesForLanguage'] as $locale):?> <option value="<?php p($locale['code']);?>"> <?php p($l->t($locale['name']));?> </option> @@ -358,7 +388,7 @@ script('settings', [ <option value="<?php p($_['activelocale']['code']);?>"> <?php p($l->t($_['activelocale']['name']));?> </option> - <?php foreach($_['locales'] as $locale):?> + <?php foreach ($_['locales'] as $locale):?> <option value="<?php p($locale['code']);?>"> <?php p($l->t($locale['name']));?> </option> diff --git a/apps/settings/templates/settings/personal/security/password.php b/apps/settings/templates/settings/personal/security/password.php index 23959f7d9c2..7edd9e20126 100644 --- a/apps/settings/templates/settings/personal/security/password.php +++ b/apps/settings/templates/settings/personal/security/password.php @@ -27,12 +27,12 @@ script('settings', [ 'vue-settings-personal-security', ]); -if($_['passwordChangeSupported']) { +if ($_['passwordChangeSupported']) { script('settings', 'security_password'); } ?> -<?php if($_['passwordChangeSupported']) { ?> +<?php if ($_['passwordChangeSupported']) { ?> <div id="security-password" class="section"> <h2 class="inlineblock"><?php p($l->t('Password'));?></h2> <span id="password-error-msg" class="msg success hidden">Saved</span> diff --git a/apps/settings/templates/settings/personal/security/twofactor.php b/apps/settings/templates/settings/personal/security/twofactor.php index f5e5b7025c2..127833b4bbc 100644 --- a/apps/settings/templates/settings/personal/security/twofactor.php +++ b/apps/settings/templates/settings/personal/security/twofactor.php @@ -41,19 +41,16 @@ declare(strict_types=1); if ($provider instanceof \OCP\Authentication\TwoFactorAuth\IProvidesIcons) { if ($_['themedark']) { $icon = $provider->getLightIcon(); - } - else { + } else { $icon = $provider->getDarkIcon(); } //fallback icon if the 2factor provider doesn't provide an icon. } else { if ($_['themedark']) { $icon = image_path('core', 'actions/password-white.svg'); - } - else { + } else { $icon = image_path('core', 'actions/password.svg'); } - } /** @var \OCP\Authentication\TwoFactorAuth\IPersonalProviderSettings $settings */ $settings = $data['settings']; diff --git a/apps/settings/tests/Activity/SecurityFilterTest.php b/apps/settings/tests/Activity/SecurityFilterTest.php index 750e242c889..4f9d9a87ef1 100644 --- a/apps/settings/tests/Activity/SecurityFilterTest.php +++ b/apps/settings/tests/Activity/SecurityFilterTest.php @@ -85,5 +85,4 @@ class SecurityFilterTest extends TestCase { public function testGetPriority() { $this->assertEquals(30, $this->filter->getPriority()); } - } diff --git a/apps/settings/tests/Activity/SecurityProviderTest.php b/apps/settings/tests/Activity/SecurityProviderTest.php index 7deac1f7ddb..174f6049b34 100644 --- a/apps/settings/tests/Activity/SecurityProviderTest.php +++ b/apps/settings/tests/Activity/SecurityProviderTest.php @@ -135,5 +135,4 @@ class SecurityProviderTest extends TestCase { $this->expectException(InvalidArgumentException::class); $this->provider->parse($lang, $event); } - } diff --git a/apps/settings/tests/Activity/SecuritySettingTest.php b/apps/settings/tests/Activity/SecuritySettingTest.php index da53f8b38e9..e66d3e0dc10 100644 --- a/apps/settings/tests/Activity/SecuritySettingTest.php +++ b/apps/settings/tests/Activity/SecuritySettingTest.php @@ -29,7 +29,6 @@ use OCP\IL10N; use Test\TestCase; class SecuritySettingTest extends TestCase { - private $l10n; /** @var SecuritySetting */ @@ -71,5 +70,4 @@ class SecuritySettingTest extends TestCase { $this->assertTrue($this->setting->isDefaultEnabledMail()); $this->assertTrue($this->setting->isDefaultEnabledStream()); } - } diff --git a/apps/settings/tests/Controller/AuthSettingsControllerTest.php b/apps/settings/tests/Controller/AuthSettingsControllerTest.php index 1d24a90794f..b642b1c06c5 100644 --- a/apps/settings/tests/Controller/AuthSettingsControllerTest.php +++ b/apps/settings/tests/Controller/AuthSettingsControllerTest.php @@ -479,5 +479,4 @@ class AuthSettingsControllerTest extends TestCase { $expected = new JSONResponse([]); $this->assertEquals($expected, $response); } - } diff --git a/apps/settings/tests/Controller/CertificateControllerTest.php b/apps/settings/tests/Controller/CertificateControllerTest.php index a04906a6811..0259868321d 100644 --- a/apps/settings/tests/Controller/CertificateControllerTest.php +++ b/apps/settings/tests/Controller/CertificateControllerTest.php @@ -193,5 +193,4 @@ class CertificateControllerTest extends \Test\TestCase { $this->assertEquals(new DataResponse(), $this->certificateController->removePersonalRootCertificate('CertificateToRemove')); } - } diff --git a/apps/settings/tests/Controller/CheckSetupControllerTest.php b/apps/settings/tests/Controller/CheckSetupControllerTest.php index 86acf8acced..ebbe9fd95b7 100644 --- a/apps/settings/tests/Controller/CheckSetupControllerTest.php +++ b/apps/settings/tests/Controller/CheckSetupControllerTest.php @@ -719,7 +719,7 @@ class CheckSetupControllerTest extends TestCase { ->expects($this->once()) ->method('getCurlVersion') ->willReturn(['ssl_version' => 'OpenSSL/1.0.1d']); - $this->assertSame('', $this->invokePrivate($this->checkSetupController, 'isUsedTlsLibOutdated')); + $this->assertSame('', $this->invokePrivate($this->checkSetupController, 'isUsedTlsLibOutdated')); } public function testIsUsedTlsLibOutdatedWithMatchingOpenSslVersion1() { diff --git a/apps/settings/tests/Controller/MailSettingsControllerTest.php b/apps/settings/tests/Controller/MailSettingsControllerTest.php index 7d17ac80407..7611d6bcf68 100644 --- a/apps/settings/tests/Controller/MailSettingsControllerTest.php +++ b/apps/settings/tests/Controller/MailSettingsControllerTest.php @@ -133,7 +133,6 @@ class MailSettingsControllerTest extends \Test\TestCase { null ); $this->assertSame(Http::STATUS_OK, $response->getStatus()); - } public function testStoreCredentials() { @@ -189,5 +188,4 @@ class MailSettingsControllerTest extends \Test\TestCase { $response = $this->mailController->sendTestMail(); $this->assertSame(Http::STATUS_OK, $response->getStatus()); } - } diff --git a/apps/settings/tests/Controller/TwoFactorSettingsControllerTest.php b/apps/settings/tests/Controller/TwoFactorSettingsControllerTest.php index d7da886c991..1d7c7db8924 100644 --- a/apps/settings/tests/Controller/TwoFactorSettingsControllerTest.php +++ b/apps/settings/tests/Controller/TwoFactorSettingsControllerTest.php @@ -82,5 +82,4 @@ class TwoFactorSettingsControllerTest extends TestCase { $this->assertEquals($expected, $resp); } - } diff --git a/apps/settings/tests/Controller/UsersControllerTest.php b/apps/settings/tests/Controller/UsersControllerTest.php index 65258252016..9029b1af396 100644 --- a/apps/settings/tests/Controller/UsersControllerTest.php +++ b/apps/settings/tests/Controller/UsersControllerTest.php @@ -113,8 +113,9 @@ class UsersControllerTest extends \Test\TestCase { $this->encryptionModule = $this->createMock(IEncryptionModule::class); $this->encryptionManager->expects($this->any())->method('getEncryptionModules') - ->willReturn(['encryptionModule' => ['callback' => function () { return $this->encryptionModule;}]]); - + ->willReturn(['encryptionModule' => ['callback' => function () { + return $this->encryptionModule; + }]]); } /** @@ -444,12 +445,11 @@ class UsersControllerTest extends \Test\TestCase { * @dataProvider dataTestGetVerificationCode */ public function testGetVerificationCode($account, $type, $dataBefore, $expectedData, $onlyVerificationCode) { - $message = 'Use my Federated Cloud ID to share with me: user@nextcloud.com'; $signature = 'theSignature'; $code = $message . ' ' . $signature; - if($type === AccountManager::PROPERTY_TWITTER) { + if ($type === AccountManager::PROPERTY_TWITTER) { $code = $message . ' ' . md5($signature); } @@ -485,7 +485,6 @@ class UsersControllerTest extends \Test\TestCase { } public function dataTestGetVerificationCode() { - $accountDataBefore = [ AccountManager::PROPERTY_WEBSITE => ['value' => 'https://nextcloud.com', 'verified' => AccountManager::NOT_VERIFIED], AccountManager::PROPERTY_TWITTER => ['value' => '@nextclouders', 'verified' => AccountManager::NOT_VERIFIED, 'signature' => 'theSignature'], @@ -513,7 +512,6 @@ class UsersControllerTest extends \Test\TestCase { * test get verification code in case no valid user was given */ public function testGetVerificationCodeInvalidUser() { - $controller = $this->getController(); $this->userSession->expects($this->once())->method('getUser')->willReturn(null); $result = $controller->getVerificationCode('account', false); @@ -541,8 +539,11 @@ class UsersControllerTest extends \Test\TestCase { $this->encryptionManager->expects($this->any()) ->method('getEncryptionModule') ->willReturnCallback(function () use ($encryptionModuleLoaded) { - if ($encryptionModuleLoaded) return $this->encryptionModule; - else throw new ModuleDoesNotExistsException(); + if ($encryptionModuleLoaded) { + return $this->encryptionModule; + } else { + throw new ModuleDoesNotExistsException(); + } }); $this->encryptionModule->expects($this->any()) ->method('needDetailedAccessList') @@ -565,5 +566,4 @@ class UsersControllerTest extends \Test\TestCase { [false, false, false, true], ]; } - } diff --git a/apps/settings/tests/Settings/Personal/Security/AuthtokensTest.php b/apps/settings/tests/Settings/Personal/Security/AuthtokensTest.php index ad0b7108423..e03e05c149a 100644 --- a/apps/settings/tests/Settings/Personal/Security/AuthtokensTest.php +++ b/apps/settings/tests/Settings/Personal/Security/AuthtokensTest.php @@ -130,5 +130,4 @@ class AuthtokensTest extends TestCase { $expected = new TemplateResponse('settings', 'settings/personal/security/authtokens'); $this->assertEquals($expected, $form); } - } diff --git a/apps/settings/tests/Settings/Personal/Security/PasswordTest.php b/apps/settings/tests/Settings/Personal/Security/PasswordTest.php index 7785338d86d..db766747fe7 100644 --- a/apps/settings/tests/Settings/Personal/Security/PasswordTest.php +++ b/apps/settings/tests/Settings/Personal/Security/PasswordTest.php @@ -74,5 +74,4 @@ class PasswordTest extends TestCase { ]); $this->assertEquals($expected, $form); } - } |