diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2020-04-10 15:19:56 +0300 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2020-04-10 15:19:56 +0300 |
commit | caff1023ea72bb2ea94130e18a2a6e2ccf819e5f (patch) | |
tree | 186d494c2aea5dea7255d3584ef5d595fc6e6194 /core | |
parent | edf8ce32cffdb920e8171207b342abbd7f1fbe73 (diff) |
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 'core')
97 files changed, 154 insertions, 214 deletions
diff --git a/core/Application.php b/core/Application.php index 15246c9c76c..55f3b68c26e 100644 --- a/core/Application.php +++ b/core/Application.php @@ -55,7 +55,6 @@ use Symfony\Component\EventDispatcher\GenericEvent; * @package OC\Core */ class Application extends App { - public function __construct() { parent::__construct('core'); @@ -193,5 +192,4 @@ class Application extends App { $eventDispatcher->addServiceListener(RemoteWipeFinished::class, RemoteWipeEmailListener::class); $eventDispatcher->addServiceListener(UserDeletedEvent::class, UserDeletedStoreCleanupListener::class); } - } diff --git a/core/BackgroundJobs/BackgroundCleanupUpdaterBackupsJob.php b/core/BackgroundJobs/BackgroundCleanupUpdaterBackupsJob.php index 4489afe1f02..c24c8aa05a3 100644 --- a/core/BackgroundJobs/BackgroundCleanupUpdaterBackupsJob.php +++ b/core/BackgroundJobs/BackgroundCleanupUpdaterBackupsJob.php @@ -48,18 +48,18 @@ class BackgroundCleanupUpdaterBackupsJob extends QueuedJob { $dataDir = $this->config->getSystemValue('datadirectory', \OC::$SERVERROOT . '/data'); $instanceId = $this->config->getSystemValue('instanceid', null); - if(!is_string($instanceId) || empty($instanceId)) { + if (!is_string($instanceId) || empty($instanceId)) { return; } $updaterFolderPath = $dataDir . '/updater-' . $instanceId; $backupFolderPath = $updaterFolderPath . '/backups'; - if(file_exists($backupFolderPath)) { + if (file_exists($backupFolderPath)) { $this->log->info("$backupFolderPath exists - start to clean it up"); $dirList = []; $dirs = new \DirectoryIterator($backupFolderPath); - foreach($dirs as $dir) { + foreach ($dirs as $dir) { // skip files and dot dirs if ($dir->isFile() || $dir->isDot()) { continue; @@ -80,7 +80,7 @@ class BackgroundCleanupUpdaterBackupsJob extends QueuedJob { $dirList = array_slice($dirList, 0, -3); $this->log->info("List of all directories that will be deleted: " . json_encode($dirList)); - foreach($dirList as $dir) { + foreach ($dirList as $dir) { $this->log->info("Removing $dir ..."); \OC_Helper::rmdirr($dir); } diff --git a/core/Command/App/CheckCode.php b/core/Command/App/CheckCode.php index d37211d3add..185ec0e64a3 100644 --- a/core/Command/App/CheckCode.php +++ b/core/Command/App/CheckCode.php @@ -42,8 +42,7 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; -class CheckCode extends Command implements CompletionAwareInterface { - +class CheckCode extends Command implements CompletionAwareInterface { protected $checkers = [ 'private' => PrivateCheck::class, 'deprecation' => DeprecationCheck::class, @@ -95,7 +94,7 @@ class CheckCode extends Command implements CompletionAwareInterface { $codeChecker = new CodeChecker($checkList, !$input->getOption('skip-validate-info')); $codeChecker->listen('CodeChecker', 'analyseFileBegin', function ($params) use ($output) { - if(OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) { + if (OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) { $output->writeln("<info>Analysing {$params}</info>"); } }); @@ -103,29 +102,29 @@ class CheckCode extends Command implements CompletionAwareInterface { $count = count($errors); // show filename if the verbosity is low, but there are errors in a file - if($count > 0 && OutputInterface::VERBOSITY_VERBOSE > $output->getVerbosity()) { + if ($count > 0 && OutputInterface::VERBOSITY_VERBOSE > $output->getVerbosity()) { $output->writeln("<info>Analysing {$filename}</info>"); } // show error count if there are errors present or the verbosity is high - if($count > 0 || OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) { + if ($count > 0 || OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) { $output->writeln(" {$count} errors"); } usort($errors, function ($a, $b) { return $a['line'] >$b['line']; }); - foreach($errors as $p) { + foreach ($errors as $p) { $line = sprintf("%' 4d", $p['line']); $output->writeln(" <error>line $line: {$p['disallowedToken']} - {$p['reason']}</error>"); } }); $errors = []; - if(!$input->getOption('skip-checkers')) { + if (!$input->getOption('skip-checkers')) { $errors = $codeChecker->analyse($appId); } - if(!$input->getOption('skip-validate-info')) { + if (!$input->getOption('skip-validate-info')) { $infoChecker = new InfoChecker(); $infoChecker->listen('InfoChecker', 'parseError', function ($error) use ($output) { $output->writeln("<error>Invalid appinfo.xml file found: $error</error>"); diff --git a/core/Command/App/Install.php b/core/Command/App/Install.php index 7248ec1e425..49f4f0b804e 100644 --- a/core/Command/App/Install.php +++ b/core/Command/App/Install.php @@ -32,7 +32,6 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; class Install extends Command { - protected function configure() { $this ->setName('app:install') @@ -64,12 +63,12 @@ class Install extends Command { $installer = \OC::$server->query(Installer::class); $installer->downloadApp($appId); $result = $installer->installApp($appId); - } catch(\Exception $e) { + } catch (\Exception $e) { $output->writeln('Error: ' . $e->getMessage()); return 1; } - if($result === false) { + if ($result === false) { $output->writeln($appId . ' couldn\'t be installed'); return 1; } diff --git a/core/Command/App/ListApps.php b/core/Command/App/ListApps.php index 84fdf7f8f41..0765ab39a24 100644 --- a/core/Command/App/ListApps.php +++ b/core/Command/App/ListApps.php @@ -62,7 +62,7 @@ class ListApps extends Base { } protected function execute(InputInterface $input, OutputInterface $output) { - if ($input->getOption('shipped') === 'true' || $input->getOption('shipped') === 'false'){ + if ($input->getOption('shipped') === 'true' || $input->getOption('shipped') === 'false') { $shippedFilter = $input->getOption('shipped') === 'true'; } else { $shippedFilter = null; @@ -74,7 +74,7 @@ class ListApps extends Base { //sort enabled apps above disabled apps foreach ($apps as $app) { - if ($shippedFilter !== null && $this->manager->isShipped($app) !== $shippedFilter){ + if ($shippedFilter !== null && $this->manager->isShipped($app) !== $shippedFilter) { continue; } if ($this->manager->isInstalled($app)) { diff --git a/core/Command/App/Remove.php b/core/Command/App/Remove.php index bb264e77e5f..d3e91332d77 100644 --- a/core/Command/App/Remove.php +++ b/core/Command/App/Remove.php @@ -96,7 +96,7 @@ class Remove extends Command implements CompletionAwareInterface { try { $this->manager->disableApp($appId); $output->writeln($appId . ' disabled'); - } catch(Throwable $e) { + } catch (Throwable $e) { $output->writeln('<error>Error: ' . $e->getMessage() . '</error>'); $this->logger->logException($e, [ 'app' => 'CLI', @@ -109,7 +109,7 @@ class Remove extends Command implements CompletionAwareInterface { // Let's try to remove the app... try { $result = $this->installer->removeApp($appId); - } catch(Throwable $e) { + } catch (Throwable $e) { $output->writeln('<error>Error: ' . $e->getMessage() . '</error>'); $this->logger->logException($e, [ 'app' => 'CLI', @@ -118,7 +118,7 @@ class Remove extends Command implements CompletionAwareInterface { return 1; } - if($result === false) { + if ($result === false) { $output->writeln($appId . ' could not be removed'); return 1; } diff --git a/core/Command/App/Update.php b/core/Command/App/Update.php index 4be2f4639ef..417d1915d05 100644 --- a/core/Command/App/Update.php +++ b/core/Command/App/Update.php @@ -91,7 +91,6 @@ class Update extends Command { $output->writeln($singleAppId . ' not installed'); return 1; } - } elseif ($input->getOption('all') || $input->getOption('showonly')) { $apps = \OC_App::getAllApps(); } else { @@ -108,7 +107,7 @@ class Update extends Command { if (!$input->getOption('showonly')) { try { $result = $this->installer->updateAppstoreApp($appId); - } catch(\Exception $e) { + } catch (\Exception $e) { $this->logger->logException($e, ['message' => 'Failure during update of app "' . $appId . '"','app' => 'app:update']); $output->writeln('Error: ' . $e->getMessage()); $return = 1; @@ -117,7 +116,7 @@ class Update extends Command { if ($result === false) { $output->writeln($appId . ' couldn\'t be updated'); $return = 1; - } elseif($result === true) { + } elseif ($result === true) { $output->writeln($appId . ' updated'); } } diff --git a/core/Command/Background/Ajax.php b/core/Command/Background/Ajax.php index 3eb00655ead..5dc94d939d7 100644 --- a/core/Command/Background/Ajax.php +++ b/core/Command/Background/Ajax.php @@ -26,7 +26,6 @@ namespace OC\Core\Command\Background; class Ajax extends Base { - protected function getMode() { return 'ajax'; } diff --git a/core/Command/Background/Base.php b/core/Command/Background/Base.php index a00a8fe4c51..41466660000 100644 --- a/core/Command/Background/Base.php +++ b/core/Command/Background/Base.php @@ -37,8 +37,6 @@ use Symfony\Component\Console\Output\OutputInterface; * Subclasses will override the getMode() function to specify the mode to configure. */ abstract class Base extends Command { - - abstract protected function getMode(); /** diff --git a/core/Command/Background/Cron.php b/core/Command/Background/Cron.php index 27253a355b2..9dbb4f855e5 100644 --- a/core/Command/Background/Cron.php +++ b/core/Command/Background/Cron.php @@ -26,7 +26,6 @@ namespace OC\Core\Command\Background; class Cron extends Base { - protected function getMode() { return 'cron'; } diff --git a/core/Command/Background/WebCron.php b/core/Command/Background/WebCron.php index 76bcf83a304..7da379b6a53 100644 --- a/core/Command/Background/WebCron.php +++ b/core/Command/Background/WebCron.php @@ -26,7 +26,6 @@ namespace OC\Core\Command\Background; class WebCron extends Base { - protected function getMode() { return 'webcron'; } diff --git a/core/Command/Broadcast/Test.php b/core/Command/Broadcast/Test.php index 08fcd1f0d92..93734369ace 100644 --- a/core/Command/Broadcast/Test.php +++ b/core/Command/Broadcast/Test.php @@ -98,5 +98,4 @@ class Test extends Command { return 0; } - } diff --git a/core/Command/Config/Import.php b/core/Command/Config/Import.php index a6e57e92052..7918ef620ab 100644 --- a/core/Command/Config/Import.php +++ b/core/Command/Config/Import.php @@ -33,7 +33,7 @@ use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -class Import extends Command implements CompletionAwareInterface { +class Import extends Command implements CompletionAwareInterface { protected $validRootKeys = ['system', 'apps']; /** @var IConfig */ diff --git a/core/Command/Config/System/DeleteConfig.php b/core/Command/Config/System/DeleteConfig.php index 85531c4c4bf..9ddad641e38 100644 --- a/core/Command/Config/System/DeleteConfig.php +++ b/core/Command/Config/System/DeleteConfig.php @@ -75,8 +75,7 @@ class DeleteConfig extends Base { try { $value = $this->removeSubValue(array_slice($configNames, 1), $value, $input->hasParameterOption('--error-if-not-exists')); - } - catch (\UnexpectedValueException $e) { + } catch (\UnexpectedValueException $e) { $output->writeln('<error>System config ' . implode(' => ', $configNames) . ' could not be deleted because it did not exist</error>'); return 1; } diff --git a/core/Command/Db/AddMissingColumns.php b/core/Command/Db/AddMissingColumns.php index 4672770c6af..5794b95b76f 100644 --- a/core/Command/Db/AddMissingColumns.php +++ b/core/Command/Db/AddMissingColumns.php @@ -78,7 +78,6 @@ class AddMissingColumns extends Command { * @throws \Doctrine\DBAL\Schema\SchemaException */ private function addCoreColumns(OutputInterface $output) { - $output->writeln('<info>Check columns of the comments table.</info>'); $schema = new SchemaWrapper($this->connection); diff --git a/core/Command/Db/AddMissingIndices.php b/core/Command/Db/AddMissingIndices.php index 924c2af05c0..506fef94a63 100644 --- a/core/Command/Db/AddMissingIndices.php +++ b/core/Command/Db/AddMissingIndices.php @@ -83,7 +83,6 @@ class AddMissingIndices extends Command { * @throws \Doctrine\DBAL\Schema\SchemaException */ private function addCoreIndexes(OutputInterface $output) { - $output->writeln('<info>Check indices of the share table.</info>'); $schema = new SchemaWrapper($this->connection); diff --git a/core/Command/Db/ConvertFilecacheBigInt.php b/core/Command/Db/ConvertFilecacheBigInt.php index 16971e20b6c..4a833fbbede 100644 --- a/core/Command/Db/ConvertFilecacheBigInt.php +++ b/core/Command/Db/ConvertFilecacheBigInt.php @@ -72,7 +72,6 @@ class ConvertFilecacheBigInt extends Command { } protected function execute(InputInterface $input, OutputInterface $output) { - $schema = new SchemaWrapper($this->connection); $isSqlite = $this->connection->getDatabasePlatform() instanceof SqlitePlatform; $updates = []; diff --git a/core/Command/Db/ConvertType.php b/core/Command/Db/ConvertType.php index c79ece79915..2929fea3764 100644 --- a/core/Command/Db/ConvertType.php +++ b/core/Command/Db/ConvertType.php @@ -239,7 +239,7 @@ class ConvertType extends Command implements CompletionAwareInterface { $schemaManager = new \OC\DB\MDB2SchemaManager($toDB); $apps = $input->getOption('all-apps') ? \OC_App::getAllApps() : \OC_App::getEnabledApps(); - foreach($apps as $app) { + foreach ($apps as $app) { if (file_exists(\OC_App::getAppPath($app).'/appinfo/database.xml')) { $schemaManager->createDbFromStructure(\OC_App::getAppPath($app).'/appinfo/database.xml'); } else { @@ -275,7 +275,7 @@ class ConvertType extends Command implements CompletionAwareInterface { if (!empty($toTables)) { $output->writeln('<info>Clearing schema in new database</info>'); } - foreach($toTables as $table) { + foreach ($toTables as $table) { $db->getSchemaManager()->dropTable($table); } } @@ -403,7 +403,7 @@ class ConvertType extends Command implements CompletionAwareInterface { try { // copy table rows - foreach($tables as $table) { + foreach ($tables as $table) { $output->writeln($table); $this->copyTable($fromDB, $toDB, $schema->getTable($table), $input, $output); } @@ -413,7 +413,7 @@ class ConvertType extends Command implements CompletionAwareInterface { } // save new database config $this->saveDBInfo($input); - } catch(\Exception $e) { + } catch (\Exception $e) { $this->config->setSystemValue('maintenance', false); throw $e; } diff --git a/core/Command/Db/Migrations/ExecuteCommand.php b/core/Command/Db/Migrations/ExecuteCommand.php index 0f2709646ba..149ca8904b7 100644 --- a/core/Command/Db/Migrations/ExecuteCommand.php +++ b/core/Command/Db/Migrations/ExecuteCommand.php @@ -127,5 +127,4 @@ class ExecuteCommand extends Command implements CompletionAwareInterface { return []; } - } diff --git a/core/Command/Db/Migrations/GenerateCommand.php b/core/Command/Db/Migrations/GenerateCommand.php index a40cd800dff..6d554a57858 100644 --- a/core/Command/Db/Migrations/GenerateCommand.php +++ b/core/Command/Db/Migrations/GenerateCommand.php @@ -38,7 +38,6 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; class GenerateCommand extends Command implements CompletionAwareInterface { - protected static $_templateSimple = '<?php diff --git a/core/Command/Db/Migrations/MigrateCommand.php b/core/Command/Db/Migrations/MigrateCommand.php index c9ba604ae7e..2b0fe268369 100644 --- a/core/Command/Db/Migrations/MigrateCommand.php +++ b/core/Command/Db/Migrations/MigrateCommand.php @@ -95,5 +95,4 @@ class MigrateCommand extends Command implements CompletionAwareInterface { return []; } - } diff --git a/core/Command/Db/Migrations/StatusCommand.php b/core/Command/Db/Migrations/StatusCommand.php index 6f19ef03bd6..b9aa918ebbf 100644 --- a/core/Command/Db/Migrations/StatusCommand.php +++ b/core/Command/Db/Migrations/StatusCommand.php @@ -97,7 +97,6 @@ class StatusCommand extends Command implements CompletionAwareInterface { * @return array associative array of human readable info name as key and the actual information as value */ public function getMigrationsInfos(MigrationService $ms) { - $executedMigrations = $ms->getMigratedVersions(); $availableMigrations = $ms->getAvailableVersions(); $executedUnavailableMigrations = array_diff($executedMigrations, array_keys($availableMigrations)); @@ -145,6 +144,4 @@ class StatusCommand extends Command implements CompletionAwareInterface { return $migration; } - - } diff --git a/core/Command/Encryption/ChangeKeyStorageRoot.php b/core/Command/Encryption/ChangeKeyStorageRoot.php index 05626715781..bdc2857dd18 100644 --- a/core/Command/Encryption/ChangeKeyStorageRoot.php +++ b/core/Command/Encryption/ChangeKeyStorageRoot.php @@ -116,7 +116,6 @@ class ChangeKeyStorageRoot extends Command { * @throws \Exception */ protected function moveAllKeys($oldRoot, $newRoot, OutputInterface $output) { - $output->writeln("Start to move keys:"); if ($this->rootView->is_dir($oldRoot) === false) { @@ -150,7 +149,6 @@ class ChangeKeyStorageRoot extends Command { if (!$result) { throw new \Exception("Can't access the new root folder. Please check the permissions and make sure that the folder is in your data folder"); } - } @@ -189,12 +187,11 @@ class ChangeKeyStorageRoot extends Command { * @param OutputInterface $output */ protected function moveUserKeys($oldRoot, $newRoot, OutputInterface $output) { - $progress = new ProgressBar($output); $progress->start(); - foreach($this->userManager->getBackends() as $backend) { + foreach ($this->userManager->getBackends() as $backend) { $limit = 500; $offset = 0; do { @@ -205,7 +202,7 @@ class ChangeKeyStorageRoot extends Command { $this->moveUserEncryptionFolder($user, $oldRoot, $newRoot); } $offset += $limit; - } while(count($users) >= $limit); + } while (count($users) >= $limit); } $progress->finish(); } @@ -219,9 +216,7 @@ class ChangeKeyStorageRoot extends Command { * @throws \Exception */ protected function moveUserEncryptionFolder($user, $oldRoot, $newRoot) { - if ($this->userManager->userExists($user)) { - $source = $oldRoot . '/' . $user . '/files_encryption'; $target = $newRoot . '/' . $user . '/files_encryption'; if ( @@ -268,5 +263,4 @@ class ChangeKeyStorageRoot extends Command { return false; } - } diff --git a/core/Command/Encryption/DecryptAll.php b/core/Command/Encryption/DecryptAll.php index af1aa4c792c..e631f97cdaa 100644 --- a/core/Command/Encryption/DecryptAll.php +++ b/core/Command/Encryption/DecryptAll.php @@ -192,6 +192,5 @@ class DecryptAll extends Command { $this->resetMaintenanceAndTrashbin(); throw $e; } - } } diff --git a/core/Command/Encryption/EncryptAll.php b/core/Command/Encryption/EncryptAll.php index 77c2cb31204..7c6cad41a37 100644 --- a/core/Command/Encryption/EncryptAll.php +++ b/core/Command/Encryption/EncryptAll.php @@ -142,5 +142,4 @@ class EncryptAll extends Command { $output->writeln('aborted'); } } - } diff --git a/core/Command/Encryption/ShowKeyStorageRoot.php b/core/Command/Encryption/ShowKeyStorageRoot.php index a1ab9c2915c..c877d1fcdd3 100644 --- a/core/Command/Encryption/ShowKeyStorageRoot.php +++ b/core/Command/Encryption/ShowKeyStorageRoot.php @@ -27,7 +27,7 @@ use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -class ShowKeyStorageRoot extends Command{ +class ShowKeyStorageRoot extends Command { /** @var Util */ protected $util; @@ -54,5 +54,4 @@ class ShowKeyStorageRoot extends Command{ $output->writeln("Current key storage root: <info>$rootDescription</info>"); } - } diff --git a/core/Command/Integrity/CheckApp.php b/core/Command/Integrity/CheckApp.php index d62c13deffb..affe137c67d 100644 --- a/core/Command/Integrity/CheckApp.php +++ b/core/Command/Integrity/CheckApp.php @@ -70,9 +70,8 @@ class CheckApp extends Base { $path = (string)$input->getOption('path'); $result = $this->checker->verifyAppSignature($appid, $path); $this->writeArrayInOutputFormat($input, $output, $result); - if (count($result)>0){ + if (count($result)>0) { return 1; } } - } diff --git a/core/Command/Integrity/CheckCore.php b/core/Command/Integrity/CheckCore.php index bebfbea560e..665e0079b44 100644 --- a/core/Command/Integrity/CheckCore.php +++ b/core/Command/Integrity/CheckCore.php @@ -61,7 +61,7 @@ class CheckCore extends Base { protected function execute(InputInterface $input, OutputInterface $output) { $result = $this->checker->verifyCoreSignature(); $this->writeArrayInOutputFormat($input, $output, $result); - if (count($result)>0){ + if (count($result)>0) { return 1; } } diff --git a/core/Command/Integrity/SignApp.php b/core/Command/Integrity/SignApp.php index 6e750d4af10..7657c2975af 100644 --- a/core/Command/Integrity/SignApp.php +++ b/core/Command/Integrity/SignApp.php @@ -76,7 +76,7 @@ class SignApp extends Command { $path = $input->getOption('path'); $privateKeyPath = $input->getOption('privateKey'); $keyBundlePath = $input->getOption('certificate'); - if(is_null($path) || is_null($privateKeyPath) || is_null($keyBundlePath)) { + if (is_null($path) || is_null($privateKeyPath) || is_null($keyBundlePath)) { $documentationUrl = $this->urlGenerator->linkToDocs('developer-code-integrity'); $output->writeln('This command requires the --path, --privateKey and --certificate.'); $output->writeln('Example: ./occ integrity:sign-app --path="/Users/lukasreschke/Programming/myapp/" --privateKey="/Users/lukasreschke/private/myapp.key" --certificate="/Users/lukasreschke/public/mycert.crt"'); @@ -87,12 +87,12 @@ class SignApp extends Command { $privateKey = $this->fileAccessHelper->file_get_contents($privateKeyPath); $keyBundle = $this->fileAccessHelper->file_get_contents($keyBundlePath); - if($privateKey === false) { + if ($privateKey === false) { $output->writeln(sprintf('Private key "%s" does not exists.', $privateKeyPath)); return null; } - if($keyBundle === false) { + if ($keyBundle === false) { $output->writeln(sprintf('Certificate "%s" does not exists.', $keyBundlePath)); return null; } @@ -105,7 +105,7 @@ class SignApp extends Command { try { $this->checker->writeAppSignature($path, $x509, $rsa); $output->writeln('Successfully signed "'.$path.'"'); - } catch (\Exception $e){ + } catch (\Exception $e) { $output->writeln('Error: ' . $e->getMessage()); return 1; } diff --git a/core/Command/Integrity/SignCore.php b/core/Command/Integrity/SignCore.php index b825a942d80..7f871b08298 100644 --- a/core/Command/Integrity/SignCore.php +++ b/core/Command/Integrity/SignCore.php @@ -70,7 +70,7 @@ class SignCore extends Command { $privateKeyPath = $input->getOption('privateKey'); $keyBundlePath = $input->getOption('certificate'); $path = $input->getOption('path'); - if(is_null($privateKeyPath) || is_null($keyBundlePath) || is_null($path)) { + if (is_null($privateKeyPath) || is_null($keyBundlePath) || is_null($path)) { $output->writeln('--privateKey, --certificate and --path are required.'); return null; } @@ -78,12 +78,12 @@ class SignCore extends Command { $privateKey = $this->fileAccessHelper->file_get_contents($privateKeyPath); $keyBundle = $this->fileAccessHelper->file_get_contents($keyBundlePath); - if($privateKey === false) { + if ($privateKey === false) { $output->writeln(sprintf('Private key "%s" does not exists.', $privateKeyPath)); return null; } - if($keyBundle === false) { + if ($keyBundle === false) { $output->writeln(sprintf('Certificate "%s" does not exists.', $keyBundlePath)); return null; } @@ -97,7 +97,7 @@ class SignCore extends Command { try { $this->checker->writeCoreSignature($x509, $rsa, $path); $output->writeln('Successfully signed "core"'); - } catch (\Exception $e){ + } catch (\Exception $e) { $output->writeln('Error: ' . $e->getMessage()); return 1; } diff --git a/core/Command/InterruptedException.php b/core/Command/InterruptedException.php index 3ca2f1572a0..509656f2dae 100644 --- a/core/Command/InterruptedException.php +++ b/core/Command/InterruptedException.php @@ -26,4 +26,5 @@ namespace OC\Core\Command; /** * Exception for when the user hit ctrl-c */ -class InterruptedException extends \Exception {} +class InterruptedException extends \Exception { +} diff --git a/core/Command/L10n/CreateJs.php b/core/Command/L10n/CreateJs.php index fd337994e86..05d58ec231d 100644 --- a/core/Command/L10n/CreateJs.php +++ b/core/Command/L10n/CreateJs.php @@ -36,7 +36,6 @@ use Symfony\Component\Console\Output\OutputInterface; use UnexpectedValueException; class CreateJs extends Command implements CompletionAwareInterface { - protected function configure() { $this ->setName('l10n:createjs') @@ -67,7 +66,7 @@ class CreateJs extends Command implements CompletionAwareInterface { $languages= $this->getAllLanguages($path); } - foreach($languages as $lang) { + foreach ($languages as $lang) { $this->writeFiles($app, $path, $lang, $output); } } @@ -75,13 +74,13 @@ class CreateJs extends Command implements CompletionAwareInterface { private function getAllLanguages($path) { $result = []; foreach (new DirectoryIterator("$path/l10n") as $fileInfo) { - if($fileInfo->isDot()) { + if ($fileInfo->isDot()) { continue; } - if($fileInfo->isDir()) { + if ($fileInfo->isDir()) { continue; } - if($fileInfo->getExtension() !== 'php') { + if ($fileInfo->getExtension() !== 'php') { continue; } $result[]= substr($fileInfo->getBasename(), 0, -4); diff --git a/core/Command/Log/Manage.php b/core/Command/Log/Manage.php index 062bc866cc9..2d7eaf9e2e6 100644 --- a/core/Command/Log/Manage.php +++ b/core/Command/Log/Manage.php @@ -36,7 +36,6 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; class Manage extends Command implements CompletionAwareInterface { - const DEFAULT_BACKEND = 'file'; const DEFAULT_LOG_LEVEL = 2; const DEFAULT_TIMEZONE = 'UTC'; diff --git a/core/Command/Maintenance/Install.php b/core/Command/Maintenance/Install.php index fa18ef721b2..b7557b55e81 100644 --- a/core/Command/Maintenance/Install.php +++ b/core/Command/Maintenance/Install.php @@ -92,7 +92,7 @@ class Install extends Command { $this->printErrors($output, $errors); // ignore the OS X setup warning - if(count($errors) !== 1 || + if (count($errors) !== 1 || (string)$errors[0]['error'] !== 'Mac OS X is not supported and Nextcloud will not work properly on this platform. Use it at your own risk! ') { return 1; } diff --git a/core/Command/Maintenance/Mimetype/GenerateMimetypeFileBuilder.php b/core/Command/Maintenance/Mimetype/GenerateMimetypeFileBuilder.php index 249b899173e..01bac261cd4 100644 --- a/core/Command/Maintenance/Mimetype/GenerateMimetypeFileBuilder.php +++ b/core/Command/Maintenance/Mimetype/GenerateMimetypeFileBuilder.php @@ -27,8 +27,7 @@ declare(strict_types=1); namespace OC\Core\Command\Maintenance\Mimetype; -class GenerateMimetypeFileBuilder -{ +class GenerateMimetypeFileBuilder { /** * Generate mime type list file * @param $aliases @@ -39,7 +38,7 @@ class GenerateMimetypeFileBuilder $keys = array_filter(array_keys($aliases), function ($k) { return $k[0] === '_'; }); - foreach($keys as $key) { + foreach ($keys as $key) { unset($aliases[$key]); } @@ -47,7 +46,7 @@ class GenerateMimetypeFileBuilder $dir = new \DirectoryIterator(\OC::$SERVERROOT.'/core/img/filetypes'); $files = []; - foreach($dir as $fileInfo) { + foreach ($dir as $fileInfo) { if ($fileInfo->isFile()) { $file = preg_replace('/.[^.]*$/', '', $fileInfo->getFilename()); $files[] = $file; @@ -61,7 +60,7 @@ class GenerateMimetypeFileBuilder // Fetch all themes! $themes = []; $dirs = new \DirectoryIterator(\OC::$SERVERROOT.'/themes/'); - foreach($dirs as $dir) { + foreach ($dirs as $dir) { //Valid theme dir if ($dir->isFile() || $dir->isDot()) { continue; @@ -105,5 +104,4 @@ OC.MimeTypeList={ }; '; } - } diff --git a/core/Command/Maintenance/Mimetype/UpdateDB.php b/core/Command/Maintenance/Mimetype/UpdateDB.php index 5bb78d9a3f3..47b0b600777 100644 --- a/core/Command/Maintenance/Mimetype/UpdateDB.php +++ b/core/Command/Maintenance/Mimetype/UpdateDB.php @@ -32,7 +32,6 @@ use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; class UpdateDB extends Command { - const DEFAULT_MIMETYPE = 'application/octet-stream'; /** @var IMimeTypeDetector */ diff --git a/core/Command/Maintenance/UpdateHtaccess.php b/core/Command/Maintenance/UpdateHtaccess.php index 6397ed7aec4..7f143536bfa 100644 --- a/core/Command/Maintenance/UpdateHtaccess.php +++ b/core/Command/Maintenance/UpdateHtaccess.php @@ -30,7 +30,6 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; class UpdateHtaccess extends Command { - protected function configure() { $this ->setName('maintenance:update:htaccess') diff --git a/core/Command/TwoFactorAuth/Cleanup.php b/core/Command/TwoFactorAuth/Cleanup.php index a8576b15384..ac9dceef343 100644 --- a/core/Command/TwoFactorAuth/Cleanup.php +++ b/core/Command/TwoFactorAuth/Cleanup.php @@ -57,5 +57,4 @@ class Cleanup extends Base { $output->writeln("<info>All user-provider associations for provider <options=bold>$providerId</> have been removed.</info>"); } - } diff --git a/core/Command/TwoFactorAuth/Disable.php b/core/Command/TwoFactorAuth/Disable.php index 1dd3a2cf64d..128699a3970 100644 --- a/core/Command/TwoFactorAuth/Disable.php +++ b/core/Command/TwoFactorAuth/Disable.php @@ -68,5 +68,4 @@ class Disable extends Base { return 2; } } - } diff --git a/core/Command/TwoFactorAuth/Enable.php b/core/Command/TwoFactorAuth/Enable.php index 0c2aef540e9..d979768f182 100644 --- a/core/Command/TwoFactorAuth/Enable.php +++ b/core/Command/TwoFactorAuth/Enable.php @@ -68,5 +68,4 @@ class Enable extends Base { return 2; } } - } diff --git a/core/Command/TwoFactorAuth/Enforce.php b/core/Command/TwoFactorAuth/Enforce.php index e99c584384c..7f3ceb9694c 100644 --- a/core/Command/TwoFactorAuth/Enforce.php +++ b/core/Command/TwoFactorAuth/Enforce.php @@ -112,5 +112,4 @@ class Enforce extends Command { protected function writeNotEnforced(OutputInterface $output) { $output->writeln('Two-factor authentication is not enforced'); } - } diff --git a/core/Command/TwoFactorAuth/State.php b/core/Command/TwoFactorAuth/State.php index 3ae1884d343..438a272223f 100644 --- a/core/Command/TwoFactorAuth/State.php +++ b/core/Command/TwoFactorAuth/State.php @@ -104,5 +104,4 @@ class State extends Base { $output->writeln("- " . $provider); } } - } diff --git a/core/Command/Upgrade.php b/core/Command/Upgrade.php index 761a6fb55c0..461884fabe4 100644 --- a/core/Command/Upgrade.php +++ b/core/Command/Upgrade.php @@ -47,7 +47,6 @@ use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\EventDispatcher\GenericEvent; class Upgrade extends Command { - const ERROR_SUCCESS = 0; const ERROR_NOT_INSTALLED = 1; const ERROR_MAINTENANCE_MODE = 2; @@ -86,8 +85,7 @@ class Upgrade extends Command { * @param OutputInterface $output output interface */ protected function execute(InputInterface $input, OutputInterface $output) { - - if(Util::needUpgrade()) { + if (Util::needUpgrade()) { if (OutputInterface::VERBOSITY_NORMAL < $output->getVerbosity()) { // Prepend each line with a little timestamp $timestampFormatter = new TimestampFormatter($this->config, $output->getFormatter()); @@ -153,12 +151,12 @@ class Upgrade extends Command { $output->writeln(''); break; case '\OC\Repair::step': - if(OutputInterface::VERBOSITY_NORMAL < $output->getVerbosity()) { + if (OutputInterface::VERBOSITY_NORMAL < $output->getVerbosity()) { $output->writeln('<info>Repair step: ' . $event->getArgument(0) . '</info>'); } break; case '\OC\Repair::info': - if(OutputInterface::VERBOSITY_NORMAL < $output->getVerbosity()) { + if (OutputInterface::VERBOSITY_NORMAL < $output->getVerbosity()) { $output->writeln('<info>Repair info: ' . $event->getArgument(0) . '</info>'); } break; @@ -259,12 +257,12 @@ class Upgrade extends Command { $this->postUpgradeCheck($input, $output); - if(!$success) { + if (!$success) { return self::ERROR_FAILURE; } return self::ERROR_SUCCESS; - } elseif($this->config->getSystemValueBool('maintenance')) { + } elseif ($this->config->getSystemValueBool('maintenance')) { //Possible scenario: Nextcloud core is updated but an app failed $output->writeln('<warning>Nextcloud is in maintenance mode</warning>'); $output->write('<comment>Maybe an upgrade is already in process. Please check the ' diff --git a/core/Command/User/Add.php b/core/Command/User/Add.php index 208fb1dceb5..2fe4de83f60 100644 --- a/core/Command/User/Add.php +++ b/core/Command/User/Add.php @@ -154,11 +154,11 @@ class Add extends Command { if (!$group) { $this->groupManager->createGroup($groupName); $group = $this->groupManager->get($groupName); - if($group instanceof IGroup) { + if ($group instanceof IGroup) { $output->writeln('Created group "' . $group->getGID() . '"'); } } - if($group instanceof IGroup) { + if ($group instanceof IGroup) { $group->addUser($user); $output->writeln('User "' . $user->getUID() . '" added to group "' . $group->getGID() . '"'); } diff --git a/core/Command/User/LastSeen.php b/core/Command/User/LastSeen.php index 37cad457015..5a1e5f3b4e5 100644 --- a/core/Command/User/LastSeen.php +++ b/core/Command/User/LastSeen.php @@ -57,13 +57,13 @@ class LastSeen extends Command { protected function execute(InputInterface $input, OutputInterface $output) { $user = $this->userManager->get($input->getArgument('uid')); - if(is_null($user)) { + if (is_null($user)) { $output->writeln('<error>User does not exist</error>'); return; } $lastLogin = $user->getLastLogin(); - if($lastLogin === 0) { + if ($lastLogin === 0) { $output->writeln('User ' . $user->getUID() . ' has never logged in, yet.'); } else { diff --git a/core/Command/User/Report.php b/core/Command/User/Report.php index 7f4562fc426..fff3924d324 100644 --- a/core/Command/User/Report.php +++ b/core/Command/User/Report.php @@ -55,10 +55,10 @@ class Report extends Command { $table = new Table($output); $table->setHeaders(['User Report', '']); $userCountArray = $this->countUsers(); - if(!empty($userCountArray)) { + if (!empty($userCountArray)) { $total = 0; $rows = []; - foreach($userCountArray as $classname => $users) { + foreach ($userCountArray as $classname => $users) { $total += $users; $rows[] = [$classname, $users]; } diff --git a/core/Command/User/Setting.php b/core/Command/User/Setting.php index e084b94cc8a..71509d4eb6e 100644 --- a/core/Command/User/Setting.php +++ b/core/Command/User/Setting.php @@ -187,7 +187,6 @@ class Setting extends Base { $this->config->setUserValue($uid, $app, $key, $input->getArgument('value')); return 0; - } elseif ($input->hasParameterOption('--delete')) { if ($input->hasParameterOption('--error-if-not-exists') && $value === null) { $output->writeln('<error>The setting does not exist for user "' . $uid . '".</error>'); @@ -204,7 +203,6 @@ class Setting extends Base { $this->config->deleteUserValue($uid, $app, $key); return 0; - } elseif ($value !== null) { $output->writeln($value); return 0; diff --git a/core/Controller/AutoCompleteController.php b/core/Controller/AutoCompleteController.php index 12414b50f30..31d0a7ab7b3 100644 --- a/core/Controller/AutoCompleteController.php +++ b/core/Controller/AutoCompleteController.php @@ -91,7 +91,7 @@ class AutoCompleteController extends Controller { unset($results['exact']); $results = array_merge_recursive($exactMatches, $results); - if($sorter !== null) { + if ($sorter !== null) { $sorters = array_reverse(explode('|', $sorter)); $this->autoCompleteManager->runSorters($sorters, $results, [ 'itemType' => $itemType, diff --git a/core/Controller/CSRFTokenController.php b/core/Controller/CSRFTokenController.php index b120acbcd5f..9ff389140bd 100644 --- a/core/Controller/CSRFTokenController.php +++ b/core/Controller/CSRFTokenController.php @@ -66,5 +66,4 @@ class CSRFTokenController extends Controller { 'token' => $requestToken->getEncryptedValue(), ]); } - } diff --git a/core/Controller/ClientFlowLoginController.php b/core/Controller/ClientFlowLoginController.php index 5df6ce5c7b6..dad43fc837a 100644 --- a/core/Controller/ClientFlowLoginController.php +++ b/core/Controller/ClientFlowLoginController.php @@ -135,7 +135,7 @@ class ClientFlowLoginController extends Controller { */ private function isValidToken($stateToken) { $currentToken = $this->session->get(self::stateName); - if(!is_string($stateToken) || !is_string($currentToken)) { + if (!is_string($stateToken) || !is_string($currentToken)) { return false; } return hash_equals($currentToken, $stateToken); @@ -169,7 +169,7 @@ class ClientFlowLoginController extends Controller { public function showAuthPickerPage($clientIdentifier = '') { $clientName = $this->getClientName(); $client = null; - if($clientIdentifier !== '') { + if ($clientIdentifier !== '') { $client = $this->clientMapper->getByIdentifier($clientIdentifier); $clientName = $client->getName(); } @@ -237,13 +237,13 @@ class ClientFlowLoginController extends Controller { */ public function grantPage($stateToken = '', $clientIdentifier = '') { - if(!$this->isValidToken($stateToken)) { + if (!$this->isValidToken($stateToken)) { return $this->stateTokenForbiddenResponse(); } $clientName = $this->getClientName(); $client = null; - if($clientIdentifier !== '') { + if ($clientIdentifier !== '') { $client = $this->clientMapper->getByIdentifier($clientIdentifier); $clientName = $client->getName(); } @@ -284,7 +284,7 @@ class ClientFlowLoginController extends Controller { */ public function generateAppPassword($stateToken, $clientIdentifier = '') { - if(!$this->isValidToken($stateToken)) { + if (!$this->isValidToken($stateToken)) { $this->session->remove(self::stateName); return $this->stateTokenForbiddenResponse(); } @@ -315,7 +315,7 @@ class ClientFlowLoginController extends Controller { $clientName = $this->getClientName(); $client = false; - if($clientIdentifier !== '') { + if ($clientIdentifier !== '') { $client = $this->clientMapper->getByIdentifier($clientIdentifier); $clientName = $client->getName(); } @@ -332,7 +332,7 @@ class ClientFlowLoginController extends Controller { IToken::DO_NOT_REMEMBER ); - if($client) { + if ($client) { $code = $this->random->generate(128, ISecureRandom::CHAR_UPPER.ISecureRandom::CHAR_LOWER.ISecureRandom::CHAR_DIGITS); $accessToken = new AccessToken(); $accessToken->setClientId($client->getId()); diff --git a/core/Controller/ClientFlowLoginV2Controller.php b/core/Controller/ClientFlowLoginV2Controller.php index b5b69972832..43e17c77dde 100644 --- a/core/Controller/ClientFlowLoginV2Controller.php +++ b/core/Controller/ClientFlowLoginV2Controller.php @@ -43,7 +43,6 @@ use OCP\IURLGenerator; use OCP\Security\ISecureRandom; class ClientFlowLoginV2Controller extends Controller { - private const tokenName = 'client.flow.v2.login.token'; private const stateName = 'client.flow.v2.state.token'; @@ -150,7 +149,7 @@ class ClientFlowLoginV2Controller extends Controller { * @NoSameSiteCookieRequired */ public function grantPage(string $stateToken): StandaloneTemplateResponse { - if(!$this->isValidStateToken($stateToken)) { + if (!$this->isValidStateToken($stateToken)) { return $this->stateTokenForbiddenResponse(); } @@ -178,7 +177,7 @@ class ClientFlowLoginV2Controller extends Controller { * @UseSession */ public function generateAppPassword(string $stateToken): Response { - if(!$this->isValidStateToken($stateToken)) { + if (!$this->isValidStateToken($stateToken)) { return $this->stateTokenForbiddenResponse(); } @@ -241,7 +240,7 @@ class ClientFlowLoginV2Controller extends Controller { private function isValidStateToken(string $stateToken): bool { $currentToken = $this->session->get(self::stateName); - if(!is_string($stateToken) || !is_string($currentToken)) { + if (!is_string($stateToken) || !is_string($currentToken)) { return false; } return hash_equals($currentToken, $stateToken); @@ -266,7 +265,7 @@ class ClientFlowLoginV2Controller extends Controller { */ private function getFlowByLoginToken(): LoginFlowV2 { $currentToken = $this->session->get(self::tokenName); - if(!is_string($currentToken)) { + if (!is_string($currentToken)) { throw new LoginFlowV2NotFoundException('Login token not set in session'); } diff --git a/core/Controller/CssController.php b/core/Controller/CssController.php index 741d4431578..f7368003d55 100644 --- a/core/Controller/CssController.php +++ b/core/Controller/CssController.php @@ -75,7 +75,7 @@ class CssController extends Controller { $folder = $this->appData->getFolder($appName); $gzip = false; $file = $this->getFile($folder, $fileName, $gzip); - } catch(NotFoundException $e) { + } catch (NotFoundException $e) { return new NotFoundResponse(); } diff --git a/core/Controller/JsController.php b/core/Controller/JsController.php index 05e7bce3368..730a1cf0cb8 100644 --- a/core/Controller/JsController.php +++ b/core/Controller/JsController.php @@ -72,7 +72,7 @@ class JsController extends Controller { $folder = $this->appData->getFolder($appName); $gzip = false; $file = $this->getFile($folder, $fileName, $gzip); - } catch(NotFoundException $e) { + } catch (NotFoundException $e) { return new NotFoundResponse(); } diff --git a/core/Controller/LoginController.php b/core/Controller/LoginController.php index b3f7bb310ba..4813f15f1c5 100644 --- a/core/Controller/LoginController.php +++ b/core/Controller/LoginController.php @@ -57,7 +57,6 @@ use OCP\IUserSession; use OCP\Util; class LoginController extends Controller { - const LOGIN_MSG_INVALIDPASSWORD = 'invalidpassword'; const LOGIN_MSG_USERDISABLED = 'userdisabled'; diff --git a/core/Controller/LostController.php b/core/Controller/LostController.php index e3d59951d4e..0a2e8d6b73d 100644 --- a/core/Controller/LostController.php +++ b/core/Controller/LostController.php @@ -195,7 +195,7 @@ class LostController extends Controller { */ protected function checkPasswordResetToken($token, $userId) { $user = $this->userManager->get($userId); - if($user === null || !$user->isEnabled()) { + if ($user === null || !$user->isEnabled()) { throw new \Exception($this->l10n->t('Couldn\'t reset password because the token is invalid')); } @@ -212,7 +212,7 @@ class LostController extends Controller { } $splittedToken = explode(':', $decryptedToken); - if(count($splittedToken) !== 2) { + if (count($splittedToken) !== 2) { throw new \Exception($this->l10n->t('Couldn\'t reset password because the token is invalid')); } @@ -318,9 +318,9 @@ class LostController extends Controller { $this->config->deleteUserValue($userId, 'core', 'lostpassword'); @\OC::$server->getUserSession()->unsetMagicInCookie(); - } catch (HintException $e){ + } catch (HintException $e) { return $this->error($e->getHint()); - } catch (\Exception $e){ + } catch (\Exception $e) { return $this->error($e->getMessage()); } diff --git a/core/Controller/OCSController.php b/core/Controller/OCSController.php index 2ae2e0ee64e..7ed43fc6003 100644 --- a/core/Controller/OCSController.php +++ b/core/Controller/OCSController.php @@ -102,7 +102,7 @@ class OCSController extends \OCP\AppFramework\OCSController { 'extendedSupport' => \OCP\Util::hasExtendedSupport() ]; - if($this->userSession->isLoggedIn()) { + if ($this->userSession->isLoggedIn()) { $result['capabilities'] = $this->capabilitiesManager->getCapabilities(); } else { $result['capabilities'] = $this->capabilitiesManager->getCapabilities(true); @@ -145,7 +145,7 @@ class OCSController extends \OCP\AppFramework\OCSController { public function getIdentityProof($cloudId) { $userObject = $this->userManager->get($cloudId); - if($userObject !== null) { + if ($userObject !== null) { $key = $this->keyManager->getKey($userObject); $data = [ 'public' => $key->getPublic(), diff --git a/core/Controller/PreviewController.php b/core/Controller/PreviewController.php index b92a82028cd..f47104bc533 100644 --- a/core/Controller/PreviewController.php +++ b/core/Controller/PreviewController.php @@ -92,7 +92,6 @@ class PreviewController extends Controller { bool $a = false, bool $forceIcon = true, string $mode = 'fill'): Http\Response { - if ($file === '' || $x === 0 || $y === 0) { return new DataResponse([], Http::STATUS_BAD_REQUEST); } @@ -127,7 +126,6 @@ class PreviewController extends Controller { bool $a = false, bool $forceIcon = true, string $mode = 'fill') { - if ($fileId === -1 || $x === 0 || $y === 0) { return new DataResponse([], Http::STATUS_BAD_REQUEST); } @@ -160,7 +158,6 @@ class PreviewController extends Controller { bool $a = false, bool $forceIcon = true, string $mode) : Http\Response { - if (!($node instanceof File) || (!$forceIcon && !$this->preview->isAvailable($node))) { return new DataResponse([], Http::STATUS_NOT_FOUND); } @@ -178,6 +175,5 @@ class PreviewController extends Controller { } catch (\InvalidArgumentException $e) { return new DataResponse([], Http::STATUS_BAD_REQUEST); } - } } diff --git a/core/Controller/RecommendedAppsController.php b/core/Controller/RecommendedAppsController.php index fe3435d9be8..6240aecf43c 100644 --- a/core/Controller/RecommendedAppsController.php +++ b/core/Controller/RecommendedAppsController.php @@ -51,5 +51,4 @@ class RecommendedAppsController extends Controller { $this->initialStateService->provideInitialState('core', 'defaultPageUrl', \OC_Util::getDefaultPageUrl()); return new StandaloneTemplateResponse($this->appName, 'recommendedapps', [], 'guest'); } - } diff --git a/core/Controller/SetupController.php b/core/Controller/SetupController.php index d77f6982f3d..b57b991884c 100644 --- a/core/Controller/SetupController.php +++ b/core/Controller/SetupController.php @@ -70,12 +70,12 @@ class SetupController { return; } - if(isset($post['install']) and $post['install']=='true') { + if (isset($post['install']) and $post['install']=='true') { // We have to launch the installation process : $e = $this->setupHelper->install($post); $errors = ['errors' => $e]; - if(count($e) > 0) { + if (count($e) > 0) { $options = array_merge($opts, $post, $errors); $this->display($options); } else { @@ -109,7 +109,7 @@ class SetupController { } private function finishSetup(bool $installRecommended) { - if(file_exists($this->autoConfigFile)) { + if (file_exists($this->autoConfigFile)) { unlink($this->autoConfigFile); } \OC::$server->getIntegrityCodeChecker()->runInstanceVerification(); @@ -130,7 +130,7 @@ class SetupController { } public function loadAutoConfig($post) { - if(file_exists($this->autoConfigFile)) { + if (file_exists($this->autoConfigFile)) { \OCP\Util::writeLog('core', 'Autoconfig file found, setting up Nextcloud…', ILogger::INFO); $AUTOCONFIG = []; include $this->autoConfigFile; diff --git a/core/Controller/TwoFactorChallengeController.php b/core/Controller/TwoFactorChallengeController.php index 4209e48e648..251ae85b3f7 100644 --- a/core/Controller/TwoFactorChallengeController.php +++ b/core/Controller/TwoFactorChallengeController.php @@ -278,5 +278,4 @@ class TwoFactorChallengeController extends Controller { ] )); } - } diff --git a/core/Controller/UserController.php b/core/Controller/UserController.php index 2b78ba1aaea..638e4e00e46 100644 --- a/core/Controller/UserController.php +++ b/core/Controller/UserController.php @@ -71,6 +71,5 @@ class UserController extends Controller { ]; return new JSONResponse($json); - } } diff --git a/core/Controller/WebAuthnController.php b/core/Controller/WebAuthnController.php index 1d667311ff7..7315053f12d 100644 --- a/core/Controller/WebAuthnController.php +++ b/core/Controller/WebAuthnController.php @@ -38,7 +38,6 @@ use OCP\Util; use Webauthn\PublicKeyCredentialRequestOptions; class WebAuthnController extends Controller { - private const WEBAUTHN_LOGIN = 'webauthn_login'; private const WEBAUTHN_LOGIN_UID = 'webauthn_login_uid'; diff --git a/core/Controller/WhatsNewController.php b/core/Controller/WhatsNewController.php index 159e88e1474..3a72486b26a 100644 --- a/core/Controller/WhatsNewController.php +++ b/core/Controller/WhatsNewController.php @@ -74,13 +74,13 @@ class WhatsNewController extends OCSController { */ public function get():DataResponse { $user = $this->userSession->getUser(); - if($user === null) { + if ($user === null) { throw new \RuntimeException("Acting user cannot be resolved"); } $lastRead = $this->config->getUserValue($user->getUID(), 'core', 'whatsNewLastRead', 0); $currentVersion = $this->whatsNewService->normalizeVersion($this->config->getSystemValue('version')); - if(version_compare($lastRead, $currentVersion, '>=')) { + if (version_compare($lastRead, $currentVersion, '>=')) { return new DataResponse([], Http::STATUS_NO_CONTENT); } @@ -94,7 +94,7 @@ class WhatsNewController extends OCSController { ]; do { $lang = $iterator->current(); - if(isset($whatsNew['whatsNew'][$lang])) { + if (isset($whatsNew['whatsNew'][$lang])) { $resultData['whatsNew'] = $whatsNew['whatsNew'][$lang]; break; } @@ -114,7 +114,7 @@ class WhatsNewController extends OCSController { */ public function dismiss(string $version):DataResponse { $user = $this->userSession->getUser(); - if($user === null) { + if ($user === null) { throw new \RuntimeException("Acting user cannot be resolved"); } $version = $this->whatsNewService->normalizeVersion($version); diff --git a/core/Controller/WipeController.php b/core/Controller/WipeController.php index 378fb112850..bc3cc7ba063 100644 --- a/core/Controller/WipeController.php +++ b/core/Controller/WipeController.php @@ -94,5 +94,4 @@ class WipeController extends Controller { return new JSONResponse([], Http::STATUS_NOT_FOUND); } } - } diff --git a/core/Data/LoginFlowV2Credentials.php b/core/Data/LoginFlowV2Credentials.php index 61f1cdd795f..4dd3cba2e9c 100644 --- a/core/Data/LoginFlowV2Credentials.php +++ b/core/Data/LoginFlowV2Credentials.php @@ -68,6 +68,4 @@ class LoginFlowV2Credentials implements \JsonSerializable { 'appPassword' => $this->appPassword, ]; } - - } diff --git a/core/Data/LoginFlowV2Tokens.php b/core/Data/LoginFlowV2Tokens.php index c7438430c3f..5d9b39069b7 100644 --- a/core/Data/LoginFlowV2Tokens.php +++ b/core/Data/LoginFlowV2Tokens.php @@ -40,7 +40,6 @@ class LoginFlowV2Tokens { public function getPollToken(): string { return $this->pollToken; - } public function getLoginToken(): string { diff --git a/core/Exception/LoginFlowV2NotFoundException.php b/core/Exception/LoginFlowV2NotFoundException.php index 6c41fd10a04..ed06801acff 100644 --- a/core/Exception/LoginFlowV2NotFoundException.php +++ b/core/Exception/LoginFlowV2NotFoundException.php @@ -27,5 +27,4 @@ declare(strict_types=1); namespace OC\Core\Exception; class LoginFlowV2NotFoundException extends \Exception { - } diff --git a/core/Exception/ResetPasswordException.php b/core/Exception/ResetPasswordException.php index 9f2028068f5..2dfd2058395 100644 --- a/core/Exception/ResetPasswordException.php +++ b/core/Exception/ResetPasswordException.php @@ -27,5 +27,4 @@ declare(strict_types=1); namespace OC\Core\Exception; class ResetPasswordException extends \Exception { - } diff --git a/core/Middleware/TwoFactorMiddleware.php b/core/Middleware/TwoFactorMiddleware.php index 392ae7ca1ca..fb856ce8938 100644 --- a/core/Middleware/TwoFactorMiddleware.php +++ b/core/Middleware/TwoFactorMiddleware.php @@ -155,5 +155,4 @@ class TwoFactorMiddleware extends Middleware { throw $exception; } - } diff --git a/core/Migrations/Version13000Date20170718121200.php b/core/Migrations/Version13000Date20170718121200.php index 4df2f4cbdab..7907313f1e3 100644 --- a/core/Migrations/Version13000Date20170718121200.php +++ b/core/Migrations/Version13000Date20170718121200.php @@ -931,5 +931,4 @@ class Version13000Date20170718121200 extends SimpleMigrationStep { } return $schema; } - } diff --git a/core/Migrations/Version13000Date20170926101637.php b/core/Migrations/Version13000Date20170926101637.php index 1dd295e383f..1e42dc9b044 100644 --- a/core/Migrations/Version13000Date20170926101637.php +++ b/core/Migrations/Version13000Date20170926101637.php @@ -59,5 +59,4 @@ class Version13000Date20170926101637 extends BigIntMigration { 'vcategory_to_object' => ['objid', 'categoryid'], ]; } - } diff --git a/core/Migrations/Version14000Date20180518120534.php b/core/Migrations/Version14000Date20180518120534.php index 1e025f88ed1..565a7fab707 100644 --- a/core/Migrations/Version14000Date20180518120534.php +++ b/core/Migrations/Version14000Date20180518120534.php @@ -31,7 +31,6 @@ use OCP\Migration\IOutput; use OCP\Migration\SimpleMigrationStep; class Version14000Date20180518120534 extends SimpleMigrationStep { - public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); diff --git a/core/Migrations/Version14000Date20180522074438.php b/core/Migrations/Version14000Date20180522074438.php index 140d220d69a..4afd98d9fbb 100644 --- a/core/Migrations/Version14000Date20180522074438.php +++ b/core/Migrations/Version14000Date20180522074438.php @@ -33,10 +33,8 @@ use OCP\Migration\IOutput; use OCP\Migration\SimpleMigrationStep; class Version14000Date20180522074438 extends SimpleMigrationStep { - public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ISchemaWrapper { - $schema = $schemaClosure(); if (!$schema->hasTable('twofactor_providers')) { @@ -62,5 +60,4 @@ class Version14000Date20180522074438 extends SimpleMigrationStep { return $schema; } - } diff --git a/core/Migrations/Version14000Date20180626223656.php b/core/Migrations/Version14000Date20180626223656.php index 70f0eaafd36..0e679a9972e 100644 --- a/core/Migrations/Version14000Date20180626223656.php +++ b/core/Migrations/Version14000Date20180626223656.php @@ -31,7 +31,7 @@ class Version14000Date20180626223656 extends SimpleMigrationStep { public function changeSchema(\OCP\Migration\IOutput $output, \Closure $schemaClosure, array $options) { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); - if(!$schema->hasTable('whats_new')) { + if (!$schema->hasTable('whats_new')) { $table = $schema->createTable('whats_new'); $table->addColumn('id', 'integer', [ 'autoincrement' => true, diff --git a/core/Migrations/Version14000Date20180710092004.php b/core/Migrations/Version14000Date20180710092004.php index 31daa4f9d47..f44dbf42401 100644 --- a/core/Migrations/Version14000Date20180710092004.php +++ b/core/Migrations/Version14000Date20180710092004.php @@ -33,7 +33,6 @@ use OCP\Migration\IOutput; use OCP\Migration\SimpleMigrationStep; class Version14000Date20180710092004 extends SimpleMigrationStep { - public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); diff --git a/core/Migrations/Version15000Date20180926101451.php b/core/Migrations/Version15000Date20180926101451.php index fff8b31c6ee..a5f37cc9125 100644 --- a/core/Migrations/Version15000Date20180926101451.php +++ b/core/Migrations/Version15000Date20180926101451.php @@ -51,5 +51,4 @@ class Version15000Date20180926101451 extends SimpleMigrationStep { return $schema; } - } diff --git a/core/Migrations/Version15000Date20181029084625.php b/core/Migrations/Version15000Date20181029084625.php index 0af1b4a6502..607ef054f3a 100644 --- a/core/Migrations/Version15000Date20181029084625.php +++ b/core/Migrations/Version15000Date20181029084625.php @@ -52,5 +52,4 @@ class Version15000Date20181029084625 extends SimpleMigrationStep { return $schema; } - } diff --git a/core/Migrations/Version16000Date20190207141427.php b/core/Migrations/Version16000Date20190207141427.php index 028bd1fcb17..1b5777a9212 100644 --- a/core/Migrations/Version16000Date20190207141427.php +++ b/core/Migrations/Version16000Date20190207141427.php @@ -112,5 +112,4 @@ class Version16000Date20190207141427 extends SimpleMigrationStep { return $schema; } - } diff --git a/core/Migrations/Version17000Date20190514105811.php b/core/Migrations/Version17000Date20190514105811.php index d5d7d63cd77..b435172d5f3 100644 --- a/core/Migrations/Version17000Date20190514105811.php +++ b/core/Migrations/Version17000Date20190514105811.php @@ -45,7 +45,7 @@ class Version17000Date20190514105811 extends SimpleMigrationStep { public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); - if(!$schema->hasTable('filecache_extended')) { + if (!$schema->hasTable('filecache_extended')) { $table = $schema->createTable('filecache_extended'); $table->addColumn('fileid', Type::BIGINT, [ 'notnull' => true, diff --git a/core/Migrations/Version18000Date20191014105105.php b/core/Migrations/Version18000Date20191014105105.php index c36972c556f..62a8e2cc37f 100644 --- a/core/Migrations/Version18000Date20191014105105.php +++ b/core/Migrations/Version18000Date20191014105105.php @@ -90,5 +90,4 @@ class Version18000Date20191014105105 extends SimpleMigrationStep { return $schema; } - } diff --git a/core/Migrations/Version18000Date20191204114856.php b/core/Migrations/Version18000Date20191204114856.php index 256b42f9597..e9bf1221dbf 100644 --- a/core/Migrations/Version18000Date20191204114856.php +++ b/core/Migrations/Version18000Date20191204114856.php @@ -61,5 +61,4 @@ class Version18000Date20191204114856 extends SimpleMigrationStep { return $schema; } - } diff --git a/core/Migrations/Version19000Date20200211083441.php b/core/Migrations/Version19000Date20200211083441.php index 72bb26b02fe..07eb04df14e 100644 --- a/core/Migrations/Version19000Date20200211083441.php +++ b/core/Migrations/Version19000Date20200211083441.php @@ -10,7 +10,6 @@ use OCP\Migration\IOutput; use OCP\Migration\SimpleMigrationStep; class Version19000Date20200211083441 extends SimpleMigrationStep { - public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); diff --git a/core/Notification/RemoveLinkSharesNotifier.php b/core/Notification/RemoveLinkSharesNotifier.php index 3976dfb91c5..d4afe7239f1 100644 --- a/core/Notification/RemoveLinkSharesNotifier.php +++ b/core/Notification/RemoveLinkSharesNotifier.php @@ -60,7 +60,7 @@ class RemoveLinkSharesNotifier implements INotifier { } public function prepare(INotification $notification, string $languageCode): INotification { - if($notification->getApp() !== 'core') { + if ($notification->getApp() !== 'core') { throw new \InvalidArgumentException(); } $l = $this->l10nFactory->get('core', $languageCode); diff --git a/core/ajax/update.php b/core/ajax/update.php index 34c65b56c58..58d64347a36 100644 --- a/core/ajax/update.php +++ b/core/ajax/update.php @@ -105,7 +105,6 @@ class FeedBackHandler { } if (\OCP\Util::needUpgrade()) { - $config = \OC::$server->getSystemConfig(); if ($config->getValue('upgrade.disable-web', false)) { $eventSource->send('failure', (string)$l->t('Please use the command line updater because automatic updating is disabled in the config.php.')); diff --git a/core/templates/403.php b/core/templates/403.php index d56a63bfe53..1ee3569ed03 100644 --- a/core/templates/403.php +++ b/core/templates/403.php @@ -1,6 +1,6 @@ <?php // @codeCoverageIgnoreStart -if(!isset($_)) {//standalone page is not supported anymore - redirect to / +if (!isset($_)) {//standalone page is not supported anymore - redirect to / require_once '../../lib/base.php'; $urlGenerator = \OC::$server->getURLGenerator(); @@ -12,6 +12,8 @@ if(!isset($_)) {//standalone page is not supported anymore - redirect to / <ul> <li class='error'> <?php p($l->t('Access forbidden')); ?><br> - <p class='hint'><?php if(isset($_['message'])) p($_['message'])?></p> + <p class='hint'><?php if (isset($_['message'])) { + p($_['message']); +}?></p> </li> </ul> diff --git a/core/templates/404.php b/core/templates/404.php index 925059d4750..85ddb4c4b17 100644 --- a/core/templates/404.php +++ b/core/templates/404.php @@ -3,7 +3,7 @@ /** @var $l \OCP\IL10N */ /** @var $theme OCP\Defaults */ // @codeCoverageIgnoreStart -if(!isset($_)) {//standalone page is not supported anymore - redirect to / +if (!isset($_)) {//standalone page is not supported anymore - redirect to / require_once '../../lib/base.php'; $urlGenerator = \OC::$server->getURLGenerator(); diff --git a/core/templates/error.php b/core/templates/error.php index 929e8dd3984..c6f7706edc1 100644 --- a/core/templates/error.php +++ b/core/templates/error.php @@ -1,10 +1,10 @@ <div class="error"> <h2><?php p($l->t('Error')) ?></h2> <ul> - <?php foreach($_["errors"] as $error):?> + <?php foreach ($_["errors"] as $error):?> <li> <p><?php p($error['error']) ?></p> - <?php if(isset($error['hint']) && $error['hint']): ?> + <?php if (isset($error['hint']) && $error['hint']): ?> <p class='hint'><?php p($error['hint']) ?></p> <?php endif;?> </li> diff --git a/core/templates/exception.php b/core/templates/exception.php index fcfa8687710..a2b019b3289 100644 --- a/core/templates/exception.php +++ b/core/templates/exception.php @@ -14,7 +14,7 @@ style('core', ['styles', 'header']); <ul> <li><?php p($l->t('Remote Address: %s', [$_['remoteAddr']])) ?></li> <li><?php p($l->t('Request ID: %s', [$_['requestID']])) ?></li> - <?php if($_['debugMode']): ?> + <?php if ($_['debugMode']): ?> <li><?php p($l->t('Type: %s', [$_['errorClass']])) ?></li> <li><?php p($l->t('Code: %s', [$_['errorCode']])) ?></li> <li><?php p($l->t('Message: %s', [$_['errorMsg']])) ?></li> @@ -23,7 +23,7 @@ style('core', ['styles', 'header']); <?php endif; ?> </ul> - <?php if($_['debugMode']): ?> + <?php if ($_['debugMode']): ?> <br /> <h3><?php p($l->t('Trace')) ?></h3> <pre><?php p($_['trace']) ?></pre> diff --git a/core/templates/installation.php b/core/templates/installation.php index d65d0adb1cb..a7808a0103c 100644 --- a/core/templates/installation.php +++ b/core/templates/installation.php @@ -9,12 +9,12 @@ script('core', [ <input type='hidden' id='hasOracle' value='<?php p($_['hasOracle']) ?>'> <form action="index.php" method="post"> <input type="hidden" name="install" value="true"> - <?php if(count($_['errors']) > 0): ?> + <?php if (count($_['errors']) > 0): ?> <fieldset class="warning"> <legend><strong><?php p($l->t('Error'));?></strong></legend> - <?php foreach($_['errors'] as $err): ?> + <?php foreach ($_['errors'] as $err): ?> <p> - <?php if(is_array($err)):?> + <?php if (is_array($err)):?> <?php p($err['error']); ?> <span class='hint'><?php p($err['hint']); ?></span> <?php else: ?> @@ -24,7 +24,7 @@ script('core', [ <?php endforeach; ?> </fieldset> <?php endif; ?> - <?php if(!$_['htaccessWorking']): ?> + <?php if (!$_['htaccessWorking']): ?> <fieldset class="warning"> <legend><strong><?php p($l->t('Security warning'));?></strong></legend> <p><?php p($l->t('Your data directory and files are probably accessible from the internet because the .htaccess file does not work.'));?><br> @@ -54,13 +54,13 @@ script('core', [ </p> </fieldset> - <?php if(!$_['directoryIsSet'] or !$_['dbIsSet'] or count($_['errors']) > 0): ?> + <?php if (!$_['directoryIsSet'] or !$_['dbIsSet'] or count($_['errors']) > 0): ?> <fieldset id="advancedHeader"> <legend><a id="showAdvanced" tabindex="0" href="#"><?php p($l->t('Storage & database')); ?><img src="<?php print_unescaped(image_path('', 'actions/caret-white.svg')); ?>" /></a></legend> </fieldset> <?php endif; ?> - <?php if(!$_['directoryIsSet'] or count($_['errors']) > 0): ?> + <?php if (!$_['directoryIsSet'] or count($_['errors']) > 0): ?> <fieldset id="datadirField"> <div id="datadirContent"> <label for="directory"><?php p($l->t('Data folder')); ?></label> @@ -72,14 +72,17 @@ script('core', [ </fieldset> <?php endif; ?> - <?php if(!$_['dbIsSet'] or count($_['errors']) > 0): ?> + <?php if (!$_['dbIsSet'] or count($_['errors']) > 0): ?> <fieldset id='databaseBackend'> - <?php if($_['hasMySQL'] or $_['hasPostgreSQL'] or $_['hasOracle']) - $hasOtherDB = true; else $hasOtherDB =false; //other than SQLite?> + <?php if ($_['hasMySQL'] or $_['hasPostgreSQL'] or $_['hasOracle']) { + $hasOtherDB = true; + } else { + $hasOtherDB =false; + } //other than SQLite?> <legend><?php p($l->t('Configure the database')); ?></legend> <div id="selectDbType"> - <?php foreach($_['databases'] as $type => $label): ?> - <?php if(count($_['databases']) === 1): ?> + <?php foreach ($_['databases'] as $type => $label): ?> + <?php if (count($_['databases']) === 1): ?> <p class="info"> <?php p($l->t('Only %s is available.', [$label])); ?> <?php p($l->t('Install and activate additional PHP modules to choose other database types.')); ?><br> @@ -96,7 +99,7 @@ script('core', [ </div> </fieldset> - <?php if($hasOtherDB): ?> + <?php if ($hasOtherDB): ?> <fieldset id='databaseField'> <div id="use_other_db"> <p class="grouptop"> @@ -123,7 +126,7 @@ script('core', [ autocomplete="off" autocapitalize="none" autocorrect="off" pattern="[0-9a-zA-Z$_-]+"> </p> - <?php if($_['hasOracle']): ?> + <?php if ($_['hasOracle']): ?> <div id="use_oracle_db"> <p class="groupmiddle"> <label for="dbtablespace" class="infield"><?php p($l->t('Database tablespace')); ?></label> @@ -149,7 +152,7 @@ script('core', [ <?php endif; ?> <?php endif; ?> - <?php if(!$_['dbIsSet'] or count($_['errors']) > 0): ?> + <?php if (!$_['dbIsSet'] or count($_['errors']) > 0): ?> <fieldset id="sqliteInformation" class="warning"> <legend><?php p($l->t('Performance warning'));?></legend> <p><?php p($l->t('You chose SQLite as database.'));?></p> diff --git a/core/templates/layout.guest.php b/core/templates/layout.guest.php index 6bb6e1c74bd..e74f2d8ebbf 100644 --- a/core/templates/layout.guest.php +++ b/core/templates/layout.guest.php @@ -37,7 +37,7 @@ <h1 class="hidden-visually"> <?php p($theme->getName()); ?> </h1> - <?php if(\OC::$server->getConfig()->getSystemValue('installed', false) + <?php if (\OC::$server->getConfig()->getSystemValue('installed', false) && \OC::$server->getConfig()->getAppValue('theming', 'logoMime', false)): ?> <img src="<?php p($theme->getLogo()); ?>"/> <?php endif; ?> diff --git a/core/templates/layout.public.php b/core/templates/layout.public.php index 996b78a922b..73e3e0f0b46 100644 --- a/core/templates/layout.public.php +++ b/core/templates/layout.public.php @@ -39,34 +39,41 @@ <span id="nextcloud"> <div class="logo logo-icon svg"></div> <h1 class="header-appname"> - <?php if (isset($template)) { p($template->getHeaderTitle()); } else { p($theme->getName());} ?> + <?php if (isset($template)) { + p($template->getHeaderTitle()); + } else { + p($theme->getName()); + } ?> </h1> <div class="header-shared-by"> - <?php if (isset($template)) { p($template->getHeaderDetails()); } ?> + <?php if (isset($template)) { + p($template->getHeaderDetails()); + } ?> </div> </span> </div> <?php /** @var \OCP\AppFramework\Http\Template\PublicTemplateResponse $template */ - if(isset($template) && $template->getActionCount() !== 0) { + if (isset($template) && $template->getActionCount() !== 0) { $primary = $template->getPrimaryAction(); - $others = $template->getOtherActions(); - ?> + $others = $template->getOtherActions(); ?> <div class="header-right"> - <span id="header-primary-action" class="<?php if($template->getActionCount() === 1) { p($primary->getIcon()); } ?>"> + <span id="header-primary-action" class="<?php if ($template->getActionCount() === 1) { + p($primary->getIcon()); + } ?>"> <a href="<?php p($primary->getLink()); ?>" class="primary button"> <span><?php p($primary->getLabel()) ?></span> </a> </span> - <?php if($template->getActionCount() > 1) { ?> + <?php if ($template->getActionCount() > 1) { ?> <div id="header-secondary-action"> <button id="header-actions-toggle" class="menutoggle icon-more-white"></button> <div id="header-actions-menu" class="popovermenu menu"> <ul> <?php /** @var \OCP\AppFramework\Http\Template\IMenuAction $action */ - foreach($others as $action) { + foreach ($others as $action) { print_unescaped($action->render()); } ?> @@ -75,12 +82,13 @@ </div> <?php } ?> </div> - <?php } ?> + <?php + } ?> </header> <div id="content" class="app-<?php p($_['appid']) ?>" role="main"> <?php print_unescaped($_['content']); ?> </div> - <?php if(isset($template) && $template->getFooterVisible()) { ?> + <?php if (isset($template) && $template->getFooterVisible()) { ?> <footer> <p><?php print_unescaped($theme->getLongFooter()); ?></p> <?php diff --git a/core/templates/layout.user.php b/core/templates/layout.user.php index 5dbc95e1179..318b1d5f34b 100644 --- a/core/templates/layout.user.php +++ b/core/templates/layout.user.php @@ -81,10 +81,10 @@ <div id="navigation" style="display: none;" aria-label="<?php p($l->t('More apps menu')); ?>"> <div id="apps"> <ul> - <?php foreach($_['navigation'] as $entry): ?> + <?php foreach ($_['navigation'] as $entry): ?> <li data-id="<?php p($entry['id']); ?>"> <a href="<?php print_unescaped($entry['href']); ?>" - <?php if($entry['active']): ?> class="active"<?php endif; ?> + <?php if ($entry['active']): ?> class="active"<?php endif; ?> aria-label="<?php p($entry['name']); ?>"> <svg width="16" height="16" viewBox="0 0 16 16" alt=""> <defs><filter id="invertMenuMore-<?php p($entry['id']); ?>"><feColorMatrix in="SourceGraphic" type="matrix" values="-1 0 0 0 1 0 -1 0 0 1 0 0 -1 0 1 0 0 0 1 0"></feColorMatrix></filter></defs> @@ -123,7 +123,11 @@ <div id="expand" tabindex="0" role="button" class="menutoggle" aria-label="<?php p($l->t('Settings'));?>" aria-haspopup="true" aria-controls="expanddiv" aria-expanded="false"> - <div class="avatardiv<?php if ($_['userAvatarSet']) { print_unescaped(' avatardiv-shown'); } else { print_unescaped('" style="display: none'); } ?>"> + <div class="avatardiv<?php if ($_['userAvatarSet']) { + print_unescaped(' avatardiv-shown'); + } else { + print_unescaped('" style="display: none'); + } ?>"> <?php if ($_['userAvatarSet']): ?> <img alt="" width="32" height="32" src="<?php p(\OC::$server->getURLGenerator()->linkToRoute('core.avatar.getAvatar', ['userId' => $_['user_uid'], 'size' => 32, 'v' => $_['userAvatarVersion']]));?>" @@ -136,10 +140,10 @@ <nav class="settings-menu" id="expanddiv" style="display:none;" aria-label="<?php p($l->t('Settings menu'));?>"> <ul> - <?php foreach($_['settingsnavigation'] as $entry):?> + <?php foreach ($_['settingsnavigation'] as $entry):?> <li data-id="<?php p($entry['id']); ?>"> <a href="<?php print_unescaped($entry['href']); ?>" - <?php if($entry["active"]): ?> class="active"<?php endif; ?>> + <?php if ($entry["active"]): ?> class="active"<?php endif; ?>> <img alt="" src="<?php print_unescaped($entry['icon'] . '?v=' . $_['versionHash']); ?>"> <?php p($entry['name']) ?> </a> diff --git a/core/templates/login.php b/core/templates/login.php index 9c6a81fe1ea..124a62f0646 100644 --- a/core/templates/login.php +++ b/core/templates/login.php @@ -7,7 +7,7 @@ script('core', 'dist/login'); <?php if (!empty($_['alt_login'])) { ?> <div id="alternative-logins"> - <?php foreach($_['alt_login'] as $login): ?> + <?php foreach ($_['alt_login'] as $login): ?> <a class="button <?php p($login['style'] ?? ''); ?>" href="<?php print_unescaped($login['href']); ?>" > <?php p($login['name']); ?> </a> diff --git a/core/templates/loginflow/authpicker.php b/core/templates/loginflow/authpicker.php index 5946eb78400..3a471525d80 100644 --- a/core/templates/loginflow/authpicker.php +++ b/core/templates/loginflow/authpicker.php @@ -59,6 +59,6 @@ $urlGenerator = $_['urlGenerator']; </form> </div> -<?php if(empty($_['oauthState'])): ?> +<?php if (empty($_['oauthState'])): ?> <a id="app-token-login" class="warning" href="#"><?php p($l->t('Alternative log in using app token')) ?></a> <?php endif; ?> diff --git a/core/templates/twofactorselectchallenge.php b/core/templates/twofactorselectchallenge.php index 830b82b0415..e815fa16631 100644 --- a/core/templates/twofactorselectchallenge.php +++ b/core/templates/twofactorselectchallenge.php @@ -61,7 +61,7 @@ $noProviders = empty($_['providers']); <?php endif ?> <?php if (!is_null($_['backupProvider'])): ?> <p> - <a class="<?php if($noProviders): ?>button primary two-factor-primary<?php else: ?>two-factor-secondary<?php endif ?>" href="<?php p(\OC::$server->getURLGenerator()->linkToRoute('core.TwoFactorChallenge.showChallenge', + <a class="<?php if ($noProviders): ?>button primary two-factor-primary<?php else: ?>two-factor-secondary<?php endif ?>" href="<?php p(\OC::$server->getURLGenerator()->linkToRoute('core.TwoFactorChallenge.showChallenge', [ 'challengeProviderId' => $_['backupProvider']->getId(), 'redirect_url' => $_['redirect_url'], diff --git a/core/templates/twofactorshowchallenge.php b/core/templates/twofactorshowchallenge.php index 3e789c7490d..481cea06eb0 100644 --- a/core/templates/twofactorshowchallenge.php +++ b/core/templates/twofactorshowchallenge.php @@ -14,7 +14,7 @@ $template = $_['template']; <div class="body-login-container update two-factor"> <h2 class="two-factor-header"><?php p($provider->getDisplayName()); ?></h2> <?php if ($error): ?> - <?php if($error_message): ?> + <?php if ($error_message): ?> <p><strong><?php p($error_message); ?></strong></p> <?php else: ?> <p><strong><?php p($l->t('Error while validating your second factor')); ?></strong></p> diff --git a/core/templates/update.use-cli.php b/core/templates/update.use-cli.php index 8cd7e37ffce..6e6d19483db 100644 --- a/core/templates/update.use-cli.php +++ b/core/templates/update.use-cli.php @@ -3,10 +3,10 @@ <h2 class="title"><?php p($l->t('Update needed')) ?></h2> <div class="infogroup"> <?php if ($_['tooBig']) { - p($l->t('Please use the command line updater because you have a big instance with more than 50 users.')); - } else { - p($l->t('Please use the command line updater because automatic updating is disabled in the config.php.')); - } ?><br><br> + p($l->t('Please use the command line updater because you have a big instance with more than 50 users.')); +} else { + p($l->t('Please use the command line updater because automatic updating is disabled in the config.php.')); +} ?><br><br> <?php print_unescaped($l->t('For help, see the <a target="_blank" rel="noreferrer noopener" href="%s">documentation</a>.', [link_to_docs('admin-cli-upgrade')])); ?><br><br> </div> |