Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/HuasoFoundries/phpPgAdmin6.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelipe Figueroa <amenadiel@gmail.com>2021-03-16 10:20:14 +0300
committerFelipe Figueroa <amenadiel@gmail.com>2021-03-16 10:20:14 +0300
commitdb612762bed3dae98877bf5920418464ec1e67c6 (patch)
treead9029ba71b47aee48cfffa9eb38c1cc37377471
parent978c0359fc0d332f175b6c9af314886dfa77f340 (diff)
runs rector
-rw-r--r--.php_cs.php7
-rw-r--r--Renderer.php3
-rw-r--r--composer.json4
-rw-r--r--composer.lock16
-rw-r--r--index.php2
-rw-r--r--rector.php28
-rw-r--r--src/classes/ADORecordSet.php12
-rw-r--r--src/classes/ArrayRecordSet.php3
-rw-r--r--src/classes/CheckStyleRenderer.php2
-rw-r--r--src/classes/Connection.php6
-rw-r--r--src/classes/ContainerUtils.php16
-rw-r--r--src/classes/Misc.php22
-rw-r--r--src/classes/Translations.php8
-rw-r--r--src/classes/ViewManager.php8
-rw-r--r--src/controllers/AggregatesController.php3
-rw-r--r--src/controllers/AlldbController.php3
-rw-r--r--src/controllers/BaseController.php17
-rw-r--r--src/controllers/CastsController.php13
-rw-r--r--src/controllers/ConstraintsController.php29
-rw-r--r--src/controllers/ConversionsController.php12
-rw-r--r--src/controllers/DatabaseController.php8
-rw-r--r--src/controllers/DataexportController.php4
-rw-r--r--src/controllers/DataimportController.php7
-rw-r--r--src/controllers/DisplayController.php9
-rw-r--r--src/controllers/DomainsController.php31
-rw-r--r--src/controllers/FulltextController.php63
-rw-r--r--src/controllers/FunctionsController.php96
-rw-r--r--src/controllers/HelpController.php2
-rw-r--r--src/controllers/IndexesController.php3
-rw-r--r--src/controllers/InfoController.php44
-rw-r--r--src/controllers/IntroController.php3
-rw-r--r--src/controllers/LanguagesController.php11
-rw-r--r--src/controllers/MaterializedviewsController.php91
-rw-r--r--src/controllers/OpclassesController.php10
-rw-r--r--src/controllers/OperatorsController.php3
-rw-r--r--src/controllers/PrivilegesController.php13
-rw-r--r--src/controllers/RolesController.php26
-rw-r--r--src/controllers/RulesController.php38
-rw-r--r--src/controllers/SchemasController.php87
-rw-r--r--src/controllers/SequencesController.php84
-rw-r--r--src/controllers/ServersController.php3
-rw-r--r--src/controllers/SqlController.php21
-rw-r--r--src/controllers/TablesController.php7
-rw-r--r--src/controllers/TblpropertiesController.php17
-rw-r--r--src/controllers/TreeController.php6
-rw-r--r--src/controllers/TriggersController.php3
-rw-r--r--src/controllers/TypesController.php3
-rw-r--r--src/controllers/UsersController.php32
-rw-r--r--src/controllers/ViewsController.php91
-rw-r--r--src/database/ADOdbBase.php32
-rw-r--r--src/database/Postgres.php32
-rw-r--r--src/database/databasetraits/DatabaseTrait.php12
-rw-r--r--src/database/databasetraits/FunctionTrait.php14
-rw-r--r--src/database/databasetraits/IndexTrait.php8
-rw-r--r--src/database/databasetraits/PrivilegesTrait.php34
-rw-r--r--src/database/databasetraits/RoleTrait.php2
-rw-r--r--src/database/databasetraits/RowTrait.php7
-rw-r--r--src/database/databasetraits/SchemaTrait.php2
-rw-r--r--src/database/databasetraits/SequenceTrait.php2
-rw-r--r--src/database/databasetraits/TableTrait.php9
-rw-r--r--src/database/databasetraits/TriggerTrait.php4
-rw-r--r--src/decorators/ActionUrlDecorator.php5
-rw-r--r--src/decorators/ArrayMergeDecorator.php1
-rw-r--r--src/decorators/BranchUrlDecorator.php5
-rw-r--r--src/decorators/CallbackDecorator.php5
-rw-r--r--src/decorators/ConcatDecorator.php1
-rw-r--r--src/decorators/Decorator.php1
-rw-r--r--src/decorators/FieldDecorator.php5
-rw-r--r--src/decorators/IfEmptyDecorator.php8
-rw-r--r--src/decorators/RedirectUrlDecorator.php5
-rw-r--r--src/decorators/ReplaceDecorator.php5
-rw-r--r--src/decorators/UrlDecorator.php10
-rw-r--r--src/middleware/PopulateRequestResponse.php14
-rw-r--r--tests/_support/AcceptanceTester.php2
-rw-r--r--tests/_support/FunctionalTester.php2
-rw-r--r--tests/_support/Helper/Acceptance.php2
-rw-r--r--tests/_support/Helper/Functional.php2
-rw-r--r--tests/_support/Helper/Unit.php2
-rw-r--r--tests/_support/UnitTester.php2
-rw-r--r--tests/_support/_generated/UnitTesterActions.php2
-rw-r--r--tests/unit/ContainerTest.php2
-rw-r--r--tests/unit/DataEntitiesTest.php2
-rw-r--r--tests/unit/PublicSectionsTest.php2
-rw-r--r--tests/unit/TablesAndViewsTest.php2
-rw-r--r--tests/unit/UserEntitiesTest.php2
-rw-r--r--tests/unit/ViewTest.php2
-rw-r--r--tests/views/acinsert.php2
-rw-r--r--tests/views/aggregates.php2
-rw-r--r--tests/views/alldb.php2
-rw-r--r--tests/views/browser.php2
-rw-r--r--tests/views/casts.php2
-rw-r--r--tests/views/colproperties.php2
-rw-r--r--tests/views/constraints.php2
-rw-r--r--tests/views/conversions.php2
-rw-r--r--tests/views/database.php2
-rw-r--r--tests/views/dataexport.php2
-rw-r--r--tests/views/dataimport.php2
-rw-r--r--tests/views/dbexport.php2
-rw-r--r--tests/views/display.php2
-rw-r--r--tests/views/domains.php2
-rw-r--r--tests/views/fulltext.php2
-rw-r--r--tests/views/functions.php2
-rw-r--r--tests/views/groups.php2
-rw-r--r--tests/views/help.php2
-rw-r--r--tests/views/history.php2
-rw-r--r--tests/views/indexes.php2
-rw-r--r--tests/views/info.php2
-rw-r--r--tests/views/intro.php2
-rw-r--r--tests/views/languages.php2
-rw-r--r--tests/views/login.php2
-rw-r--r--tests/views/materializedviewproperties.php2
-rw-r--r--tests/views/materializedviews.php2
-rw-r--r--tests/views/opclasses.php2
-rw-r--r--tests/views/operators.php2
-rw-r--r--tests/views/privileges.php2
-rw-r--r--tests/views/roles.php2
-rw-r--r--tests/views/rules.php2
-rw-r--r--tests/views/schemas.php2
-rw-r--r--tests/views/sequences.php2
-rw-r--r--tests/views/servers.php2
-rw-r--r--tests/views/sql.php2
-rw-r--r--tests/views/sqledit.php2
-rw-r--r--tests/views/tables.php2
-rw-r--r--tests/views/tablespaces.php2
-rw-r--r--tests/views/tblproperties.php2
-rw-r--r--tests/views/triggers.php2
-rw-r--r--tests/views/types.php2
-rw-r--r--tests/views/users.php2
-rw-r--r--tests/views/viewproperties.php2
-rw-r--r--tests/views/views.php2
l---------tools/phpcpd2
131 files changed, 595 insertions, 774 deletions
diff --git a/.php_cs.php b/.php_cs.php
index df39837a..92104cfb 100644
--- a/.php_cs.php
+++ b/.php_cs.php
@@ -3,7 +3,7 @@
declare(strict_types=1);
/**
- * PHPPgAdmin 6.1.3
+ * PHPPgAdmin6
*/
use Ergebnis\PhpCsFixer\Config;
@@ -12,10 +12,11 @@ $composerinfo = \json_decode(\file_get_contents('composer.json'));
$version = $composerinfo->extra->version;
-$header = "PHPPgAdmin {$version}";
+$header = 'PHPPgAdmin6';
-$config = Config\Factory::fromRuleSet(new Config\RuleSet\Php71($header), [
+$config = Config\Factory::fromRuleSet(new Config\RuleSet\Php74($header), [
'declare_strict_types' => false,
+ 'void_return' => false,
'escape_implicit_backslashes' => false,
'final_class' => false,
'final_internal_class' => false,
diff --git a/Renderer.php b/Renderer.php
index d3c59538..126baa85 100644
--- a/Renderer.php
+++ b/Renderer.php
@@ -1,11 +1,10 @@
<?php
/**
- * PHPPgAdmin 6.1.3
+ * PHPPgAdmin6
*/
use PHPMD\AbstractRenderer;
-use PHPMD\PHPMD;
use PHPMD\Report;
/**
diff --git a/composer.json b/composer.json
index 6ed31196..e5a88983 100644
--- a/composer.json
+++ b/composer.json
@@ -14,7 +14,7 @@
}
],
"require": {
- "php": ">=7.2",
+ "php": ">=7.4",
"ext-json": "*",
"ext-mbstring": "*",
"ext-pgsql": "*",
@@ -38,7 +38,7 @@
"php-parallel-lint/php-parallel-lint": "^1.2",
"phpmd/phpmd": "^2.9",
"phpstan/phpstan": "^0.12.64",
- "rector/rector-prefixed": "^0.9",
+ "rector/rector-prefixed": "^0.9.31",
"simpletest/simpletest": "^1.2",
"staabm/annotate-pull-request-from-checkstyle": "^1.4",
"vimeo/psalm": "^4"
diff --git a/composer.lock b/composer.lock
index 4967b0c5..97f9b6e4 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
- "content-hash": "d816e67674915a07938ecd48e0f3c836",
+ "content-hash": "66789c6f3cf55b113dfcd3cf15e9bdb9",
"packages": [
{
"name": "adodb/adodb-php",
@@ -4216,16 +4216,16 @@
},
{
"name": "rector/rector-prefixed",
- "version": "0.9.3",
+ "version": "0.9.31",
"source": {
"type": "git",
"url": "https://github.com/rectorphp/rector-prefixed.git",
- "reference": "31b49acefe7240cba59f94b01f7ee47325322d8b"
+ "reference": "cff116f7c19bf898c2d76751c8f01debb3c9c13f"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/rectorphp/rector-prefixed/zipball/31b49acefe7240cba59f94b01f7ee47325322d8b",
- "reference": "31b49acefe7240cba59f94b01f7ee47325322d8b",
+ "url": "https://api.github.com/repos/rectorphp/rector-prefixed/zipball/cff116f7c19bf898c2d76751c8f01debb3c9c13f",
+ "reference": "cff116f7c19bf898c2d76751c8f01debb3c9c13f",
"shasum": ""
},
"require": {
@@ -4242,9 +4242,9 @@
],
"description": "Prefixed scoped version of rector/rector package",
"support": {
- "source": "https://github.com/rectorphp/rector-prefixed/tree/0.9.3"
+ "source": "https://github.com/rectorphp/rector-prefixed/tree/0.9.31"
},
- "time": "2020-12-29T16:24:44+00:00"
+ "time": "2021-02-22T12:37:56+00:00"
},
{
"name": "sebastian/cli-parser",
@@ -7086,7 +7086,7 @@
"prefer-stable": false,
"prefer-lowest": false,
"platform": {
- "php": ">=7.2",
+ "php": ">=7.4",
"ext-json": "*",
"ext-mbstring": "*",
"ext-pgsql": "*",
diff --git a/index.php b/index.php
index 654b9446..f92ab6ba 100644
--- a/index.php
+++ b/index.php
@@ -3,7 +3,7 @@
declare(strict_types=1);
/**
- * PHPPgAdmin 6.1.3
+ * PHPPgAdmin6
*/
\defined('BASE_PATH') || \define('BASE_PATH', __DIR__);
diff --git a/rector.php b/rector.php
index d6bc7ba4..52b1f4d0 100644
--- a/rector.php
+++ b/rector.php
@@ -3,6 +3,7 @@
declare(strict_types=1);
use PhpParser\Node\Scalar\EncapsedStringPart;
+use Rector\CodeQuality\Rector\Concat\JoinStringConcatRector;
use Rector\CodingStyle\Rector\Encapsed\EncapsedStringsToSprintfRector;
use Rector\CodingStyle\Rector\FuncCall\VersionCompareFuncCallToConstantRector;
use Rector\CodingStyle\Rector\Property\AddFalseDefaultToBoolPropertyRector;
@@ -17,12 +18,15 @@ return static function (ContainerConfigurator $containerConfigurator): void {
$parameters = $containerConfigurator->parameters();
$parameters->set(Option::AUTO_IMPORT_NAMES, true);
+ //$parameters->set(Option::OPTION_DRY_RUN,true);
-/* $parameters->set(Option::SETS, [
+ $parameters->set(Option::SETS, [
+ SetList::CODE_QUALITY
+ ]);
+ /*
SetList::CODING_STYLE,
SetList::ACTION_INJECTION_TO_CONSTRUCTOR_INJECTION,
SetList::ARRAY_STR_FUNCTIONS_TO_STATIC_CALL,
- SetList::CODE_QUALITY,
SetList::PHP_53,
SetList::PHP_54,
SetList::PHP_56,
@@ -33,7 +37,7 @@ return static function (ContainerConfigurator $containerConfigurator): void {
]);*/
//
-
+
$parameters->set(Option::SKIP, [
VersionCompareFuncCallToConstantRector::class=>[ __DIR__ . '/src',],
@@ -50,20 +54,24 @@ return static function (ContainerConfigurator $containerConfigurator): void {
]
]);
$parameters->set(Option::PHPSTAN_FOR_RECTOR_PATH, __DIR__ . '/phpstan.neon');
- $parameters->set(Option::PHP_VERSION_FEATURES, PhpVersion::PHP_72);
+ $parameters->set(Option::PHP_VERSION_FEATURES, PhpVersion::PHP_74);
$parameters->set(Option::ENABLE_CACHE, true);
$parameters->set(Option::CACHE_DIR, __DIR__ . '/.build/rector');
$parameters->set(Option::PATHS, [
- __DIR__ . '/src',
- //__DIR__ . '/src/controllers',
- //__DIR__ . '/src/database',
- //__DIR__ . '/src/decorators',
- //__DIR__ . '/src/middleware',
- //__DIR__ . '/src/traits',
+ //__DIR__ . '/src/translations',
+ //__DIR__ . '/src',
+ __DIR__ . '/src/controllers',
+ __DIR__ . '/src/database',
+ __DIR__ . '/src/decorators',
+ __DIR__ . '/src/middleware',
+
+ __DIR__ . '/src/classes',
//__DIR__ . '/tests'
]);
// register single rule
$services = $containerConfigurator->services();
$services->set(EncapsedStringsToSprintfRector::class);
+ $services->set(JoinStringConcatRector::class);
+
}; \ No newline at end of file
diff --git a/src/classes/ADORecordSet.php b/src/classes/ADORecordSet.php
index 674ed8e1..cd1b0119 100644
--- a/src/classes/ADORecordSet.php
+++ b/src/classes/ADORecordSet.php
@@ -1,11 +1,12 @@
<?php
/**
- * PHPPgAdmin 6.1.3
+ * PHPPgAdmin6
*/
namespace PHPPgAdmin;
+use PHPPgAdmin\Interfaces\RecordSet;
use ADOFieldObject;
use ADORecordSet as ADODBRecordsetClass;
use Countable;
@@ -13,7 +14,7 @@ use Countable;
/**
* Extends ADORecordSet to let correct inference on PHPDoc params.
*/
-class ADORecordSet extends ADODBRecordsetClass implements Countable, Interfaces\RecordSet
+class ADORecordSet extends ADODBRecordsetClass implements Countable, RecordSet
{
/**
* Returns the recordCount.
@@ -28,7 +29,7 @@ class ADORecordSet extends ADODBRecordsetClass implements Countable, Interfaces\
*
* @return int number of rows or -1 if this is not supported
*/
- public function RecordCount()
+ public function RecordCount():int
{
return $this->count();
}
@@ -45,7 +46,8 @@ class ADORecordSet extends ADODBRecordsetClass implements Countable, Interfaces\
return parent::FetchField();
}
- public function MoveNext():void {
-parent::MoveNext();
+ public function MoveNext(): void
+ {
+ parent::MoveNext();
}
}
diff --git a/src/classes/ArrayRecordSet.php b/src/classes/ArrayRecordSet.php
index 17c2b43e..bc7337b3 100644
--- a/src/classes/ArrayRecordSet.php
+++ b/src/classes/ArrayRecordSet.php
@@ -6,6 +6,7 @@
namespace PHPPgAdmin;
+use PHPPgAdmin\Interfaces\RecordSet;
use ADOFieldObject;
use Countable;
@@ -22,7 +23,7 @@ use Countable;
*
* Id: ArrayRecordSet.php,v 1.3 2007/01/10 01:46:28 soranzo Exp $
*/
-class ArrayRecordSet implements Countable , Interfaces\RecordSet
+class ArrayRecordSet implements Countable , RecordSet
{
public $EOF = false;
diff --git a/src/classes/CheckStyleRenderer.php b/src/classes/CheckStyleRenderer.php
index 8d3dc2c2..ef23395c 100644
--- a/src/classes/CheckStyleRenderer.php
+++ b/src/classes/CheckStyleRenderer.php
@@ -45,7 +45,7 @@ class CheckStyleRenderer extends XMLRenderer
* This method will be called when the engine has finished the source analysis
* phase.
*
- * @param \PHPMD\Report $report
+ * @param Report $report
*/
public function renderReport(Report $report)
{
diff --git a/src/classes/Connection.php b/src/classes/Connection.php
index 645169fa..eb898f7c 100644
--- a/src/classes/Connection.php
+++ b/src/classes/Connection.php
@@ -165,11 +165,7 @@ class Connection
$this->conn->setFetchMode($fetchMode);
// Ignore host if null
if (null === $host || '' === $host) {
- if (null !== $port && '' !== $port) {
- $pghost = ':' . $port;
- } else {
- $pghost = '';
- }
+ $pghost = null !== $port && '' !== $port ? ':' . $port : '';
} else {
$pghost = \sprintf(
'%s:%s',
diff --git a/src/classes/ContainerUtils.php b/src/classes/ContainerUtils.php
index 300effc0..7199f163 100644
--- a/src/classes/ContainerUtils.php
+++ b/src/classes/ContainerUtils.php
@@ -110,7 +110,7 @@ class ContainerUtils extends Container implements ContainerInterface
$container = self::getContainerInstance($config);
- if (!self::$appInstance) {
+ if (self::$appInstance === null) {
self::$appInstance = new App($container);
}
@@ -137,7 +137,7 @@ class ContainerUtils extends Container implements ContainerInterface
];
self::$envConfig = \array_merge(self::$envConfig, $config);
- if (!self::$instance) {
+ if (self::$instance === null) {
self::$instance = new static(self::$envConfig);
self::$instance
@@ -171,12 +171,10 @@ class ContainerUtils extends Container implements ContainerInterface
$destinationurl = $this->subFolder . '/intro';
} else {
// otherwise, you'll be redirected to the login page for that server;
- $destinationurl = $this->subFolder . '/login' . ($query_string ? '?' . $query_string : '');
+ $destinationurl = $this->subFolder . '/login' . ($query_string !== '' ? '?' . $query_string : '');
}
-
- $destinationurl = (strpos($destinationurl, '/') === 0) ? $destinationurl : '/' . $destinationurl;
// ddd($destinationurl);
- return $destinationurl;
+ return (strpos($destinationurl, '/') === 0) ? $destinationurl : '/' . $destinationurl;
}
/**
@@ -223,9 +221,8 @@ class ContainerUtils extends Container implements ContainerInterface
}
$_REQUEST = \array_merge($_REQUEST, $urlvars);
$_GET = \array_merge($_GET, $urlvars);
- $actionurl = Decorator::actionurl($url['url'], $_GET);
//kdump($actionurl);
- return $actionurl;
+ return Decorator::actionurl($url['url'], $_GET);
}
//kdump($url);
return null;
@@ -269,8 +266,7 @@ class ContainerUtils extends Container implements ContainerInterface
$actionurl = Decorator::actionurl($url['url'], $_GET);
$destinationurl = str_replace($this->subFolder, '', $actionurl->value($_GET));
}
- $destinationurl = (($container->subFolder === '' || strpos($destinationurl, $container->subFolder) === 0) ? '' : $container->subFolder) . $destinationurl;
- return $destinationurl;
+ return (($container->subFolder === '' || strpos($destinationurl, $container->subFolder) === 0) ? '' : $container->subFolder) . $destinationurl;
}
/**
diff --git a/src/classes/Misc.php b/src/classes/Misc.php
index 71fbbb48..c32fceb5 100644
--- a/src/classes/Misc.php
+++ b/src/classes/Misc.php
@@ -337,7 +337,7 @@ class Misc
return null;
}
- if (!$_connection) {
+ if ($_connection === null) {
$this->container->addError($lang['strloginfailed']);
$this->setErrorMsg($lang['strloginfailed']);
@@ -382,7 +382,7 @@ class Misc
}
}
- if (false !== $this->getNoDBConnection() ||
+ if ($this->getNoDBConnection() ||
null === $this->getDatabase() ||
!isset($_REQUEST['schema'])
) {
@@ -454,7 +454,7 @@ class Misc
$this->container
);
} catch (ADOdbException $e) {
- throw new Exception($lang['strloginfailed']);
+ throw new Exception($lang['strloginfailed'], $e->getCode(), $e);
}
}
@@ -540,12 +540,10 @@ class Misc
} else {
$_SESSION['webdbLogin'][$server_id] = $value;
}
+ } elseif (null === $value) {
+ unset($_SESSION['webdbLogin'][$server_id][$key]);
} else {
- if (null === $value) {
- unset($_SESSION['webdbLogin'][$server_id][$key]);
- } else {
- $_SESSION['webdbLogin'][$server_id][$key] = $value;
- }
+ $_SESSION['webdbLogin'][$server_id][$key] = $value;
}
}
@@ -669,7 +667,7 @@ class Misc
public function stripVar(&$var): void
{
if (\is_array($var)) {
- foreach ($var as $k => $v) {
+ foreach (array_keys($var) as $k) {
$this->stripVar($var[$k]);
/* magic_quotes_gpc escape keys as well ...*/
@@ -804,15 +802,15 @@ class Misc
[$usec, $sec] = \explode(' ', \microtime());
$time = ((float) $usec + (float) $sec);
- $server = $this->container->server ? $this->container->server : $_REQUEST['server'];
- $database = $this->container->database ? $this->container->database : $_REQUEST['database'];
+ $server = $this->container->server !== '' ? $this->container->server : $_REQUEST['server'];
+ $database = $this->container->database !== '' ? $this->container->database : $_REQUEST['database'];
$_SESSION['history'][$server][$database][\sprintf(
'%s',
$time
)] = [
'query' => $script,
- 'paginate' => !isset($_REQUEST['paginate']) ? 'f' : 't',
+ 'paginate' => isset($_REQUEST['paginate']) ? 't' : 'f',
'queryid' => $time,
];
}
diff --git a/src/classes/Translations.php b/src/classes/Translations.php
index 517f0bbf..087f4701 100644
--- a/src/classes/Translations.php
+++ b/src/classes/Translations.php
@@ -219,11 +219,7 @@ class Translations
$_SESSION['webdbLanguage'] = $_language;
- if (\array_key_exists($_language, $languages_iso_code)) {
- $_isolang = $languages_iso_code[$_language];
- } else {
- $_isolang = 'en';
- }
+ $_isolang = \array_key_exists($_language, $languages_iso_code) ? $languages_iso_code[$_language] : 'en';
$_SESSION['isolang'] = $_isolang;
$container->offsetSet('appLangFiles', $appLangFiles);
@@ -247,7 +243,7 @@ class Translations
$_language = null;
$_acceptLang = [];
\preg_match_all(
- '/\s*([a-z]{1,8}(?:-[a-z]{1,8})*)(?:;q=([01](?:.[0-9]{0,3})?))?\s*(?:,|$)/',
+ '/\s*([a-z]{1,8}(?:-[a-z]{1,8})*)(?:;q=([01](?:.\d{0,3})?))?\s*(?:,|$)/',
\mb_strtolower($_SERVER['HTTP_ACCEPT_LANGUAGE']),
$_m,
\PREG_SET_ORDER
diff --git a/src/classes/ViewManager.php b/src/classes/ViewManager.php
index 1b125d72..0217b515 100644
--- a/src/classes/ViewManager.php
+++ b/src/classes/ViewManager.php
@@ -264,7 +264,7 @@ class ViewManager extends Twig
{
$form = [];
- if ($this->container->server) {
+ if ($this->container->server !== '') {
$form[] = \sprintf(
'<input type="hidden" name="%s" value="%s" />',
'server',
@@ -272,7 +272,7 @@ class ViewManager extends Twig
);
}
- if ($this->container->database) {
+ if ($this->container->database !== '') {
$form[] = \sprintf(
'<input type="hidden" name="%s" value="%s" />',
'database',
@@ -280,7 +280,7 @@ class ViewManager extends Twig
);
}
- if ($this->container->schema) {
+ if ($this->container->schema !== '') {
$form[] = \sprintf(
'<input type="hidden" name="%s" value="%s" />',
'schema',
@@ -505,7 +505,7 @@ public function maybeRenderIframes(Response $response, string $subject, string $
return $controller->render();
}
$viewVars = [
- 'url' => '/src/views/' . $subject . ($query_string ? '?' . $query_string : ''),
+ 'url' => '/src/views/' . $subject . ($query_string !== '' ? '?' . $query_string : ''),
'headertemplate' => 'header.twig',
];
diff --git a/src/controllers/AggregatesController.php b/src/controllers/AggregatesController.php
index 55f124b5..601dd562 100644
--- a/src/controllers/AggregatesController.php
+++ b/src/controllers/AggregatesController.php
@@ -6,6 +6,7 @@
namespace PHPPgAdmin\Controller;
+use Slim\Http\Response;
use PHPPgAdmin\Decorators\Decorator;
/**
@@ -183,7 +184,7 @@ class AggregatesController extends BaseController
}
/**
- * @return \Slim\Http\Response|string
+ * @return Response|string
*/
public function doTree()
{
diff --git a/src/controllers/AlldbController.php b/src/controllers/AlldbController.php
index 91a2ab14..479efe92 100644
--- a/src/controllers/AlldbController.php
+++ b/src/controllers/AlldbController.php
@@ -6,6 +6,7 @@
namespace PHPPgAdmin\Controller;
+use Slim\Http\Response;
use PHPPgAdmin\Decorators\Decorator;
use PHPPgAdmin\Traits\ExportTrait;
@@ -237,7 +238,7 @@ class AlldbController extends BaseController
}
/**
- * @return \Slim\Http\Response|string
+ * @return Response|string
*/
public function doTree()
{
diff --git a/src/controllers/BaseController.php b/src/controllers/BaseController.php
index 919b555c..c454b9f3 100644
--- a/src/controllers/BaseController.php
+++ b/src/controllers/BaseController.php
@@ -25,6 +25,7 @@ use ADORecordSet as ADODBRecordsetClass;
*/
class BaseController
{
+ public $postgresqlMinVer;
use HelperTrait;
public $appLangFiles = [];
@@ -174,13 +175,7 @@ class BaseController
$this->printHeader();
$this->printBody();
-
- switch ($this->action) {
- default:
- $this->doDefault();
-
- break;
- }
+ $this->doDefault();
$this->printFooter();
}
@@ -207,9 +202,9 @@ class BaseController
*/
public function headerTitle($title = '', $prefix = '', $suffix = '')
{
- $title = $title ? $title : $this->controller_title;
+ $title = $title !== '' ? $title : $this->controller_title;
- return $prefix . $this->lang[$title] . ($suffix ? ': ' . $suffix : '');
+ return $prefix . $this->lang[$title] . ($suffix !== '' ? ': ' . $suffix : '');
}
/**
@@ -404,7 +399,7 @@ class BaseController
*/
public function printHeader(string $title = '', ?string $script = null, bool $do_print = true, string $template = 'header.twig')
{
- $title = $title ? $title : $this->headerTitle();
+ $title = $title !== '' ? $title : $this->headerTitle();
$header_controller = $this->_getHeaderController();
return $header_controller->printHeader($title, $script, $do_print, $template);
@@ -509,7 +504,7 @@ class BaseController
private function renderInitialPageIfNotLogged(): void
{
- if (false === $this->misc->getNoDBConnection()) {
+ if (!$this->misc->getNoDBConnection()) {
if (null === $this->misc->getServerId()) {
$servers_controller = new ServersController($this->container);
diff --git a/src/controllers/CastsController.php b/src/controllers/CastsController.php
index 8d83745e..29451a9a 100644
--- a/src/controllers/CastsController.php
+++ b/src/controllers/CastsController.php
@@ -6,6 +6,7 @@
namespace PHPPgAdmin\Controller;
+use Slim\Http\Response;
use PHPPgAdmin\Decorators\Decorator;
/**
@@ -26,14 +27,8 @@ class CastsController extends BaseController
$this->printHeader();
$this->printBody();
-
- switch ($this->action) {
- default:
- $this->doDefault();
-
- break;
- }
-
+ $this->doDefault();
+
return $this->printFooter();
}
@@ -99,7 +94,7 @@ class CastsController extends BaseController
/**
* Generate XML for the browser tree.
*
- * @return \Slim\Http\Response|string
+ * @return Response|string
*/
public function doTree()
{
diff --git a/src/controllers/ConstraintsController.php b/src/controllers/ConstraintsController.php
index d10e4b80..332b3107 100644
--- a/src/controllers/ConstraintsController.php
+++ b/src/controllers/ConstraintsController.php
@@ -581,7 +581,6 @@ class ConstraintsController extends BaseController
$this->printTrail('table');
$this->printTitle($this->lang['straddcheck'], 'pg.constraint.check');
$this->printMsg($msg);
-
echo '<form action="constraints" method="post">' . \PHP_EOL;
echo '<table>' . \PHP_EOL;
echo \sprintf(
@@ -592,17 +591,14 @@ class ConstraintsController extends BaseController
'<th class="data required">%s</th></tr>',
$this->lang['strdefinition']
) . \PHP_EOL;
-
echo \sprintf(
'<tr><td class="data1"><input name="name" size="24" maxlength="%s" value="',
$data->_maxNameLen
),
\htmlspecialchars($_POST['name']), '" /></td>' . \PHP_EOL;
-
echo '<td class="data1">(<input name="definition" size="64" value="',
\htmlspecialchars($_POST['definition']), '" />)</td></tr>' . \PHP_EOL;
echo '</table>' . \PHP_EOL;
-
echo $this->getFormInputsAndButtons(
[
['name' => 'action', 'type' => 'hidden', 'value' => 'save_add_check'],
@@ -613,27 +609,24 @@ class ConstraintsController extends BaseController
['type' => 'submit', 'name' => 'cancel', 'value' => $this->lang['strcancel']],
]
);
-
echo \sprintf(
'</form>%s',
\PHP_EOL
);
+ } elseif ('' === \trim($_POST['definition'])) {
+ $this->addCheck(true, $this->lang['strcheckneedsdefinition']);
} else {
- if ('' === \trim($_POST['definition'])) {
- $this->addCheck(true, $this->lang['strcheckneedsdefinition']);
- } else {
- $status = $data->addCheckConstraint(
- $_POST['table'],
- $_POST['definition'],
- $_POST['name']
- );
-
- if (0 === $status) {
- return $this->doDefault($this->lang['strcheckadded']);
- }
+ $status = $data->addCheckConstraint(
+ $_POST['table'],
+ $_POST['definition'],
+ $_POST['name']
+ );
- return $this->addCheck(true, $this->lang['strcheckaddedbad']);
+ if (0 === $status) {
+ return $this->doDefault($this->lang['strcheckadded']);
}
+
+ return $this->addCheck(true, $this->lang['strcheckaddedbad']);
}
}
diff --git a/src/controllers/ConversionsController.php b/src/controllers/ConversionsController.php
index 9861672c..e2721f8b 100644
--- a/src/controllers/ConversionsController.php
+++ b/src/controllers/ConversionsController.php
@@ -6,6 +6,7 @@
namespace PHPPgAdmin\Controller;
+use Slim\Http\Response;
use PHPPgAdmin\Decorators\Decorator;
/**
@@ -26,13 +27,8 @@ class ConversionsController extends BaseController
$this->printHeader();
$this->printBody();
-
- switch ($this->action) {
- default:
- $this->doDefault();
-
- break;
- }
+ $this->doDefault();
+
return $this->printFooter();
}
@@ -82,7 +78,7 @@ class ConversionsController extends BaseController
}
/**
- * @return \Slim\Http\Response|string
+ * @return Response|string
*/
public function doTree()
{
diff --git a/src/controllers/DatabaseController.php b/src/controllers/DatabaseController.php
index a33b835d..e9801e91 100644
--- a/src/controllers/DatabaseController.php
+++ b/src/controllers/DatabaseController.php
@@ -6,6 +6,7 @@
namespace PHPPgAdmin\Controller;
+use Slim\Http\Response;
use PHPPgAdmin\Decorators\Decorator;
use PHPPgAdmin\Traits\AdminTrait;
use PHPPgAdmin\Traits\ExportTrait;
@@ -146,7 +147,7 @@ class DatabaseController extends BaseController
/**
* @param mixed $print
*
- * @return \Slim\Http\Response|string
+ * @return Response|string
*/
public function doTree($print = true)
{
@@ -737,10 +738,7 @@ class DatabaseController extends BaseController
switch ($curr) {
case 'SCHEMA':
$destination = $this->container->getDestinationWithLastTab('schema');
- echo '<li><a href="' . \containerInstance()->subFolder . \sprintf(
- '%s',
- $destination
- );
+ echo '<li><a href="' . \containerInstance()->subFolder . $destination;
echo $this->misc->printVal($rs->fields['name']), '">';
echo $this->_highlight($this->misc->printVal($rs->fields['name']), $_REQUEST['term']);
echo '</a></li>' . \PHP_EOL;
diff --git a/src/controllers/DataexportController.php b/src/controllers/DataexportController.php
index 5f18a25a..84c0899c 100644
--- a/src/controllers/DataexportController.php
+++ b/src/controllers/DataexportController.php
@@ -364,7 +364,7 @@ class DataexportController extends BaseController
// Output header row
$j = 0;
- foreach ($rs->fields as $k => $v) {
+ foreach (array_keys($rs->fields) as $k) {
$finfo = $rs->FetchField($j++);
if ($finfo->name === $data->id && !$oids) {
@@ -407,7 +407,7 @@ class DataexportController extends BaseController
$j = 0;
echo "\t<header>" . \PHP_EOL;
- foreach ($rs->fields as $k => $v) {
+ foreach (array_keys($rs->fields) as $k) {
$finfo = $rs->FetchField($j++);
$name = \htmlspecialchars($finfo->name);
$type = \htmlspecialchars($finfo->type);
diff --git a/src/controllers/DataimportController.php b/src/controllers/DataimportController.php
index f1c688d7..abb13179 100644
--- a/src/controllers/DataimportController.php
+++ b/src/controllers/DataimportController.php
@@ -232,12 +232,7 @@ class DataimportController extends BaseController
case 'tab':
// XXX: Length of CSV lines limited to 100k
$csv_max_line = 100000;
- // Set delimiter to tabs or commas
- if ('csv' === $_REQUEST['format']) {
- $csv_delimiter = ',';
- } else {
- $csv_delimiter = "\t";
- }
+ $csv_delimiter = 'csv' === $_REQUEST['format'] ? ',' : "\t";
// Get first line of field names
$fields = \fgetcsv($fd, $csv_max_line, $csv_delimiter);
diff --git a/src/controllers/DisplayController.php b/src/controllers/DisplayController.php
index 670220cd..7ca9a253 100644
--- a/src/controllers/DisplayController.php
+++ b/src/controllers/DisplayController.php
@@ -511,7 +511,7 @@ private function FetchField(ADORecordSet $ADORecordSet,int $index):ADOFieldObjec
$strings=$this->getRequestParam('string', 'collapsed');
$result=[];
foreach ($resultset->fields as $fieldname => $fieldvalue) {
- /** @var \ADOFieldObject */
+ /** @var ADOFieldObject */
$finfo =$this->FetchField( $resultset,$j++);
if (($fieldname === $data->id) && (!($withOid && $this->conf['show_oids']))) {
@@ -536,7 +536,7 @@ $result=[];
$strings=$this->getRequestParam('string', 'collapsed');
foreach ($resultset->fields as $fieldName => $fieldValue) {
- /** @var \ADOFieldObject */
+ /** @var ADOFieldObject */
$finfo =$this->FetchField( $resultset,$j++);
if (($fieldName === $data->id) && (!($withOid && $this->conf['show_oids']))) {
@@ -1139,7 +1139,7 @@ $result=[];
$ops = [];
- foreach ($_REQUEST['fkey'] as $x => $y) {
+ foreach (array_keys($_REQUEST['fkey']) as $x) {
$ops[$x] = '=';
}
$query = $data->getSelectSQL($_REQUEST['table'], [], $_REQUEST['fkey'], $ops);
@@ -1478,8 +1478,7 @@ $result=[];
\PHP_EOL
);
}
- $result .= '</p>' . \PHP_EOL;
- return $result;
+ return $result . ('</p>' . \PHP_EOL);
}
}
diff --git a/src/controllers/DomainsController.php b/src/controllers/DomainsController.php
index 469789ac..80ee6dc4 100644
--- a/src/controllers/DomainsController.php
+++ b/src/controllers/DomainsController.php
@@ -6,6 +6,7 @@
namespace PHPPgAdmin\Controller;
+use Slim\Http\Response;
use PHPPgAdmin\Decorators\Decorator;
/**
@@ -209,7 +210,7 @@ class DomainsController extends BaseController
/**
* Generate XML for the browser tree.
*
- * @return \Slim\Http\Response|string
+ * @return Response|string
*/
public function doTree()
{
@@ -365,7 +366,6 @@ class DomainsController extends BaseController
$this->printTrail('domain');
$this->printTitle($this->lang['straddcheck'], 'pg.constraint.check');
$this->printMsg($msg);
-
echo '<form action="domains" method="post">' . \PHP_EOL;
echo '<table>' . \PHP_EOL;
echo \sprintf(
@@ -376,17 +376,14 @@ class DomainsController extends BaseController
'<th class="data required">%s</th></tr>',
$this->lang['strdefinition']
) . \PHP_EOL;
-
echo \sprintf(
'<tr><td class="data1"><input name="name" size="16" maxlength="%s" value="',
$data->_maxNameLen
),
\htmlspecialchars($_POST['name']), '" /></td>' . \PHP_EOL;
-
echo '<td class="data1">(<input name="definition" size="32" value="',
\htmlspecialchars($_POST['definition']), '" />)</td></tr>' . \PHP_EOL;
echo '</table>' . \PHP_EOL;
-
echo '<p><input type="hidden" name="action" value="save_add_check" />' . \PHP_EOL;
echo '<input type="hidden" name="domain" value="', \htmlspecialchars($_REQUEST['domain']), '" />' . \PHP_EOL;
echo $this->view->form;
@@ -400,21 +397,19 @@ class DomainsController extends BaseController
\PHP_EOL
);
echo '</form>' . \PHP_EOL;
+ } elseif ('' === \trim($_POST['definition'])) {
+ $this->addCheck(true, $this->lang['strcheckneedsdefinition']);
} else {
- if ('' === \trim($_POST['definition'])) {
- $this->addCheck(true, $this->lang['strcheckneedsdefinition']);
+ $status = $data->addDomainCheckConstraint(
+ $_POST['domain'],
+ $_POST['definition'],
+ $_POST['name']
+ );
+
+ if (0 === $status) {
+ $this->doProperties($this->lang['strcheckadded']);
} else {
- $status = $data->addDomainCheckConstraint(
- $_POST['domain'],
- $_POST['definition'],
- $_POST['name']
- );
-
- if (0 === $status) {
- $this->doProperties($this->lang['strcheckadded']);
- } else {
- $this->addCheck(true, $this->lang['strcheckaddedbad']);
- }
+ $this->addCheck(true, $this->lang['strcheckaddedbad']);
}
}
}
diff --git a/src/controllers/FulltextController.php b/src/controllers/FulltextController.php
index 758b0df5..4c91d786 100644
--- a/src/controllers/FulltextController.php
+++ b/src/controllers/FulltextController.php
@@ -6,6 +6,7 @@
namespace PHPPgAdmin\Controller;
+use Slim\Http\Response;
use PHPPgAdmin\Decorators\Decorator;
use PHPPgAdmin\XHtml\HTMLController;
@@ -33,11 +34,7 @@ class FulltextController extends BaseController
$this->printBody();
if (null !== $this->getPostParam('cancel')) {
- if (isset($_POST['prev_action'])) {
- $this->action = $_POST['prev_action'];
- } else {
- $this->action = '';
- }
+ $this->action = isset($_POST['prev_action']) ? $_POST['prev_action'] : '';
}
switch ($this->action) {
@@ -221,7 +218,7 @@ class FulltextController extends BaseController
/**
* Generate XML for the browser tree.
*
- * @return \Slim\Http\Response|string
+ * @return Response|string
*/
public function doTree()
{
@@ -254,7 +251,7 @@ class FulltextController extends BaseController
/**
* @param mixed $what
*
- * @return null|\Slim\Http\Response|string
+ * @return null|Response|string
*/
public function doSubTree($what)
{
@@ -552,17 +549,9 @@ class FulltextController extends BaseController
return $this->doCreateConfig($err);
}
- if ('' !== $_POST['formParser']) {
- $formParser = \unserialize($_POST['formParser']);
- } else {
- $formParser = '';
- }
+ $formParser = '' !== $_POST['formParser'] ? \unserialize($_POST['formParser']) : '';
- if ('' !== $_POST['formTemplate']) {
- $formTemplate = \unserialize($_POST['formTemplate']);
- } else {
- $formTemplate = '';
- }
+ $formTemplate = '' !== $_POST['formTemplate'] ? \unserialize($_POST['formTemplate']) : '';
$status = $data->createFtsConfiguration($_POST['formName'], $formParser, $formTemplate, $_POST['formComment']);
@@ -1052,11 +1041,7 @@ class FulltextController extends BaseController
} else {
$this->coalesceArr($_POST, 'formIsTemplate', false);
- if (isset($_POST['formTemplate'])) {
- $formTemplate = \unserialize($_POST['formTemplate']);
- } else {
- $formTemplate = '';
- }
+ $formTemplate = isset($_POST['formTemplate']) ? \unserialize($_POST['formTemplate']) : '';
$this->coalesceArr($_POST, 'formLexize', '');
@@ -1192,11 +1177,10 @@ class FulltextController extends BaseController
}
if ($confirm) {
- $this->printTrail('ftscfg'); // TODO: proper breadcrumbs
+ $this->printTrail('ftscfg');
+ // TODO: proper breadcrumbs
$this->printTitle($this->lang['strdrop'], 'pg.ftscfg.alter');
-
echo '<form action="fulltext" method="post">' . \PHP_EOL;
-
// Case of multiaction drop
if (isset($_REQUEST['ma'])) {
foreach ($_REQUEST['ma'] as $v) {
@@ -1216,7 +1200,6 @@ class FulltextController extends BaseController
), '</p>' . \PHP_EOL;
echo '<input type="hidden" name="mapping" value="', \htmlspecialchars($_REQUEST['mapping']), '" />' . \PHP_EOL;
}
-
echo \sprintf(
'<input type="hidden" name="ftscfg" value="%s" />',
$_REQUEST['ftscfg']
@@ -1233,25 +1216,21 @@ class FulltextController extends BaseController
$this->lang['strcancel']
) . \PHP_EOL;
echo '</form>' . \PHP_EOL;
- } else {
- // Case of multiaction drop
- if (\is_array($_REQUEST['mapping'])) {
- $status = $data->changeFtsMapping($_REQUEST['ftscfg'], $_REQUEST['mapping'], 'drop');
+ } elseif (\is_array($_REQUEST['mapping'])) {
+ $status = $data->changeFtsMapping($_REQUEST['ftscfg'], $_REQUEST['mapping'], 'drop');
+ if (0 !== $status) {
+ $this->doViewConfig($_REQUEST['ftscfg'], $this->lang['strftsmappingdroppedbad']);
- if (0 !== $status) {
- $this->doViewConfig($_REQUEST['ftscfg'], $this->lang['strftsmappingdroppedbad']);
+ return;
+ }
+ $this->doViewConfig($_REQUEST['ftscfg'], $this->lang['strftsmappingdropped']);
+ } else {
+ $status = $data->changeFtsMapping($_REQUEST['ftscfg'], [$_REQUEST['mapping']], 'drop');
- return;
- }
+ if (0 === $status) {
$this->doViewConfig($_REQUEST['ftscfg'], $this->lang['strftsmappingdropped']);
} else {
- $status = $data->changeFtsMapping($_REQUEST['ftscfg'], [$_REQUEST['mapping']], 'drop');
-
- if (0 === $status) {
- $this->doViewConfig($_REQUEST['ftscfg'], $this->lang['strftsmappingdropped']);
- } else {
- $this->doViewConfig($_REQUEST['ftscfg'], $this->lang['strftsmappingdroppedbad']);
- }
+ $this->doViewConfig($_REQUEST['ftscfg'], $this->lang['strftsmappingdroppedbad']);
}
}
}
@@ -1418,7 +1397,7 @@ class FulltextController extends BaseController
'>%s',
$mapping
),
- $mapping_desc ? \sprintf(
+ $mapping_desc !== '' ? \sprintf(
' - %s',
$mapping_desc
) : '',
diff --git a/src/controllers/FunctionsController.php b/src/controllers/FunctionsController.php
index fea69aa8..e1a8f62c 100644
--- a/src/controllers/FunctionsController.php
+++ b/src/controllers/FunctionsController.php
@@ -6,6 +6,7 @@
namespace PHPPgAdmin\Controller;
+use Slim\Http\Response;
use ADORecordSet;
use PHPPgAdmin\Decorators\Decorator;
@@ -197,7 +198,7 @@ class FunctionsController extends BaseController
/**
* Generate XML for the browser tree.
*
- * @return \Slim\Http\Response|string
+ * @return Response|string
*/
public function doTree()
{
@@ -330,12 +331,7 @@ class FunctionsController extends BaseController
$_POST['formRows'] = $this->getPostParam('formRows', $fndata->fields['prorows']);
}
- // Deal with named parameters
- if ($data->hasNamedParams()) {
- $args = $this->_getNamedParamsArgs($data, $fndata);
- } else {
- $args = $fndata->fields['proarguments'];
- }
+ $args = $data->hasNamedParams() ? $this->_getNamedParamsArgs($data, $fndata) : $fndata->fields['proarguments'];
echo '<form action="functions" method="post">' . \PHP_EOL;
echo '<table style="width: 95%">' . \PHP_EOL;
@@ -473,7 +469,7 @@ class FunctionsController extends BaseController
'<td class="data1" colspan="2">%s: <input name="formRows" size="16" value="',
$this->lang['strresultrows']
),
- \htmlspecialchars($_POST['formRows']), '"', (!$fndata->fields['proretset']) ? 'disabled' : '', '/></td>';
+ \htmlspecialchars($_POST['formRows']), '"', ($fndata->fields['proretset']) ? '' : 'disabled', '/></td>';
}
// Display function properties
@@ -800,9 +796,7 @@ class FunctionsController extends BaseController
$this->printTrail('function');
$this->printTabs('function', 'definition');
$this->printTitle($this->lang['strdrop'], 'pg.function.drop');
-
echo '<form action="functions" method="post">' . \PHP_EOL;
-
//If multi drop
if (isset($_REQUEST['ma'])) {
foreach ($_REQUEST['ma'] as $v) {
@@ -822,9 +816,7 @@ class FunctionsController extends BaseController
echo '<input type="hidden" name="function" value="', \htmlspecialchars($_REQUEST['function']), '" />' . \PHP_EOL;
echo '<input type="hidden" name="function_oid" value="', \htmlspecialchars($_REQUEST['function_oid']), '" />' . \PHP_EOL;
}
-
echo '<input type="hidden" name="action" value="drop" />' . \PHP_EOL;
-
echo $this->view->form;
echo \sprintf(
'<p><input type="checkbox" id="cascade" name="cascade" /><label for="cascade">%s</label></p>',
@@ -839,51 +831,47 @@ class FunctionsController extends BaseController
$this->lang['strcancel']
) . \PHP_EOL;
echo '</form>' . \PHP_EOL;
- } else {
- if (\is_array($_POST['function_oid'])) {
- $msg = '';
- $status = $data->beginTransaction();
-
- if (0 === $status) {
- foreach ($_POST['function_oid'] as $k => $s) {
- $status = $data->dropFunction($s, isset($_POST['cascade']));
-
- if (0 === $status) {
- $msg .= \sprintf(
- '%s: %s<br />',
- \htmlentities($_POST['function'][$k], \ENT_QUOTES, 'UTF-8'),
- $this->lang['strfunctiondropped']
- );
- } else {
- $data->endTransaction();
- $this->doDefault(\sprintf(
- '%s%s: %s<br />',
- $msg,
- \htmlentities($_POST['function'][$k], \ENT_QUOTES, 'UTF-8'),
- $this->lang['strfunctiondroppedbad']
- ));
-
- return;
- }
+ } elseif (\is_array($_POST['function_oid'])) {
+ $msg = '';
+ $status = $data->beginTransaction();
+ if (0 === $status) {
+ foreach ($_POST['function_oid'] as $k => $s) {
+ $status = $data->dropFunction($s, isset($_POST['cascade']));
+
+ if (0 === $status) {
+ $msg .= \sprintf(
+ '%s: %s<br />',
+ \htmlentities($_POST['function'][$k], \ENT_QUOTES, 'UTF-8'),
+ $this->lang['strfunctiondropped']
+ );
+ } else {
+ $data->endTransaction();
+ $this->doDefault(\sprintf(
+ '%s%s: %s<br />',
+ $msg,
+ \htmlentities($_POST['function'][$k], \ENT_QUOTES, 'UTF-8'),
+ $this->lang['strfunctiondroppedbad']
+ ));
+
+ return;
}
}
-
- if (0 === $data->endTransaction()) {
- // Everything went fine, back to the Default page....
- $this->view->setReloadBrowser(true);
- $this->doDefault($msg);
- } else {
- $this->doDefault($this->lang['strfunctiondroppedbad']);
- }
+ }
+ if (0 === $data->endTransaction()) {
+ // Everything went fine, back to the Default page....
+ $this->view->setReloadBrowser(true);
+ $this->doDefault($msg);
} else {
- $status = $data->dropFunction($_POST['function_oid'], isset($_POST['cascade']));
+ $this->doDefault($this->lang['strfunctiondroppedbad']);
+ }
+ } else {
+ $status = $data->dropFunction($_POST['function_oid'], isset($_POST['cascade']));
- if (0 === $status) {
- $this->view->setReloadBrowser(true);
- $this->doDefault($this->lang['strfunctiondropped']);
- } else {
- $this->doDefault($this->lang['strfunctiondroppedbad']);
- }
+ if (0 === $status) {
+ $this->view->setReloadBrowser(true);
+ $this->doDefault($this->lang['strfunctiondropped']);
+ } else {
+ $this->doDefault($this->lang['strfunctiondroppedbad']);
}
}
}
@@ -1534,7 +1522,7 @@ class FunctionsController extends BaseController
foreach ($arrayArgs as $pV) {
$arrayWords = \explode(' ', $pV);
- if (true === \in_array($arrayWords[0], $arrayModes, true)) {
+ if (\in_array($arrayWords[0], $arrayModes, true)) {
$szMode = $arrayWords[0];
\array_shift($arrayWords);
}
diff --git a/src/controllers/HelpController.php b/src/controllers/HelpController.php
index 141fa636..49ef698b 100644
--- a/src/controllers/HelpController.php
+++ b/src/controllers/HelpController.php
@@ -72,7 +72,7 @@ class HelpController extends BaseController
$pages = $data->getHelpPages();
- foreach ($pages as $page => $dummy) {
+ foreach (array_keys($pages) as $page) {
echo \sprintf(
'<dt>%s</dt>',
$page
diff --git a/src/controllers/IndexesController.php b/src/controllers/IndexesController.php
index 96d76522..c0f7de8c 100644
--- a/src/controllers/IndexesController.php
+++ b/src/controllers/IndexesController.php
@@ -6,6 +6,7 @@
namespace PHPPgAdmin\Controller;
+use Slim\Http\Response;
use PHPPgAdmin\ADOdbException;
use PHPPgAdmin\Decorators\Decorator;
use PHPPgAdmin\XHtml\XHtmlButton;
@@ -218,7 +219,7 @@ class IndexesController extends BaseController
}
/**
- * @return \Slim\Http\Response|string
+ * @return Response|string
*/
public function doTree()
{
diff --git a/src/controllers/InfoController.php b/src/controllers/InfoController.php
index 2c358991..c55d04d0 100644
--- a/src/controllers/InfoController.php
+++ b/src/controllers/InfoController.php
@@ -13,6 +13,10 @@ use PHPPgAdmin\Decorators\Decorator;
*/
class InfoController extends BaseController
{
+ /**
+ * @var array<string, bool>|mixed
+ */
+ public $shownull;
public $controller_title = 'strtables';
/**
@@ -22,14 +26,8 @@ class InfoController extends BaseController
{
$this->printHeader($this->headerTitle('', '', $_REQUEST['table'] . ' - ' . $this->lang['strinfo']));
$this->printBody();
-
- switch ($this->action) {
- default:
- $this->doDefault();
-
- break;
- }
-
+ $this->doDefault();
+
$this->printFooter();
}
@@ -304,11 +302,7 @@ class InfoController extends BaseController
$total = $tablestatsio->fields['heap_blks_hit'] + $tablestatsio->fields['heap_blks_read'];
- if (0 < $total) {
- $percentage = \round(($tablestatsio->fields['heap_blks_hit'] / $total) * 100);
- } else {
- $percentage = 0;
- }
+ $percentage = 0 < $total ? \round(($tablestatsio->fields['heap_blks_hit'] / $total) * 100) : 0;
echo "\t\t<td>", $this->misc->printVal($tablestatsio->fields['heap_blks_read'], 'int4', $this->shownull), '</td>' . \PHP_EOL;
echo "\t\t<td>", $this->misc->printVal($tablestatsio->fields['heap_blks_hit'], 'int4', $this->shownull), '</td>' . \PHP_EOL;
@@ -320,11 +314,7 @@ class InfoController extends BaseController
$total = $tablestatsio->fields['idx_blks_hit'] + $tablestatsio->fields['idx_blks_read'];
- if (0 < $total) {
- $percentage = \round(($tablestatsio->fields['idx_blks_hit'] / $total) * 100);
- } else {
- $percentage = 0;
- }
+ $percentage = 0 < $total ? \round(($tablestatsio->fields['idx_blks_hit'] / $total) * 100) : 0;
echo "\t\t<td>", $this->misc->printVal($tablestatsio->fields['idx_blks_read'], 'int4', $this->shownull), '</td>' . \PHP_EOL;
echo "\t\t<td>", $this->misc->printVal($tablestatsio->fields['idx_blks_hit'], 'int4', $this->shownull), '</td>' . \PHP_EOL;
@@ -336,11 +326,7 @@ class InfoController extends BaseController
$total = $tablestatsio->fields['toast_blks_hit'] + $tablestatsio->fields['toast_blks_read'];
- if (0 < $total) {
- $percentage = \round(($tablestatsio->fields['toast_blks_hit'] / $total) * 100);
- } else {
- $percentage = 0;
- }
+ $percentage = 0 < $total ? \round(($tablestatsio->fields['toast_blks_hit'] / $total) * 100) : 0;
echo "\t\t<td>", $this->misc->printVal($tablestatsio->fields['toast_blks_read'], 'int4', $this->shownull), '</td>' . \PHP_EOL;
echo "\t\t<td>", $this->misc->printVal($tablestatsio->fields['toast_blks_hit'], 'int4', $this->shownull), '</td>' . \PHP_EOL;
@@ -352,11 +338,7 @@ class InfoController extends BaseController
$total = $tablestatsio->fields['tidx_blks_hit'] + $tablestatsio->fields['tidx_blks_read'];
- if (0 < $total) {
- $percentage = \round(($tablestatsio->fields['tidx_blks_hit'] / $total) * 100);
- } else {
- $percentage = 0;
- }
+ $percentage = 0 < $total ? \round(($tablestatsio->fields['tidx_blks_hit'] / $total) * 100) : 0;
echo "\t\t<td>", $this->misc->printVal($tablestatsio->fields['tidx_blks_read'], 'int4', $this->shownull), '</td>' . \PHP_EOL;
echo "\t\t<td>", $this->misc->printVal($tablestatsio->fields['tidx_blks_hit'], 'int4', $this->shownull), '</td>' . \PHP_EOL;
@@ -455,11 +437,7 @@ class InfoController extends BaseController
) . \PHP_EOL;
$total = $indexstatsio->fields['idx_blks_hit'] + $indexstatsio->fields['idx_blks_read'];
- if (0 < $total) {
- $percentage = \round(($indexstatsio->fields['idx_blks_hit'] / $total) * 100);
- } else {
- $percentage = 0;
- }
+ $percentage = 0 < $total ? \round(($indexstatsio->fields['idx_blks_hit'] / $total) * 100) : 0;
echo "\t\t<td>", $this->misc->printVal($indexstatsio->fields['indexrelname']), '</td>' . \PHP_EOL;
echo "\t\t<td>", $this->misc->printVal($indexstatsio->fields['idx_blks_read'], 'int4', $this->shownull), '</td>' . \PHP_EOL;
diff --git a/src/controllers/IntroController.php b/src/controllers/IntroController.php
index 1382da0a..9ffdb846 100644
--- a/src/controllers/IntroController.php
+++ b/src/controllers/IntroController.php
@@ -101,8 +101,7 @@ class IntroController extends BaseController
if (\requestInstance()->getQueryParam('language')) {
$this->view->setReloadBrowser(true);
}
- $intro_html .= $this->printFooter(false);
- return $intro_html;
+ return $intro_html . $this->printFooter(false);
}
}
diff --git a/src/controllers/LanguagesController.php b/src/controllers/LanguagesController.php
index 14f5b593..88452586 100644
--- a/src/controllers/LanguagesController.php
+++ b/src/controllers/LanguagesController.php
@@ -6,6 +6,7 @@
namespace PHPPgAdmin\Controller;
+use Slim\Http\Response;
use PHPPgAdmin\Decorators\Decorator;
/**
@@ -26,13 +27,7 @@ class LanguagesController extends BaseController
$this->printHeader();
$this->printBody();
-
- switch ($this->action) {
- default:
- $this->doDefault();
-
- break;
- }
+ $this->doDefault();
$this->printFooter();
}
@@ -76,7 +71,7 @@ class LanguagesController extends BaseController
/**
* Generate XML for the browser tree.
*
- * @return \Slim\Http\Response|string
+ * @return Response|string
*/
public function doTree()
{
diff --git a/src/controllers/MaterializedviewsController.php b/src/controllers/MaterializedviewsController.php
index 8831d6d1..45242dcc 100644
--- a/src/controllers/MaterializedviewsController.php
+++ b/src/controllers/MaterializedviewsController.php
@@ -6,6 +6,7 @@
namespace PHPPgAdmin\Controller;
+use Slim\Http\Response;
use PHPPgAdmin\Decorators\Decorator;
use PHPPgAdmin\Traits\ViewsMatviewsTrait;
@@ -246,7 +247,7 @@ class MaterializedviewsController extends BaseController
/**
* Generate XML for the browser tree.
*
- * @return \Slim\Http\Response|string
+ * @return Response|string
*/
public function doTree()
{
@@ -284,9 +285,7 @@ class MaterializedviewsController extends BaseController
if ($confirm) {
$this->printTrail('getTrail');
$this->printTitle($this->lang['strdrop'], 'pg.matview.drop');
-
echo '<form action="materializedviews" method="post">' . \PHP_EOL;
-
//If multi drop
if (isset($_REQUEST['ma'])) {
foreach ($_REQUEST['ma'] as $v) {
@@ -304,9 +303,7 @@ class MaterializedviewsController extends BaseController
), '</p>' . \PHP_EOL;
echo '<input type="hidden" name="view" value="', \htmlspecialchars($_REQUEST['matview']), '" />' . \PHP_EOL;
}
-
echo '<input type="hidden" name="action" value="drop" />' . \PHP_EOL;
-
echo $this->view->form;
echo \sprintf(
'<p><input type="checkbox" id="cascade" name="cascade" /> <label for="cascade">%s</label></p>',
@@ -321,51 +318,47 @@ class MaterializedviewsController extends BaseController
$this->lang['strcancel']
) . \PHP_EOL;
echo '</form>' . \PHP_EOL;
- } else {
- if (\is_array($_POST['view'])) {
- $msg = '';
- $status = $data->beginTransaction();
-
- if (0 === $status) {
- foreach ($_POST['view'] as $s) {
- $status = $data->dropView($s, isset($_POST['cascade']));
-
- if (0 === $status) {
- $msg .= \sprintf(
- '%s: %s<br />',
- \htmlentities($s, \ENT_QUOTES, 'UTF-8'),
- $this->lang['strviewdropped']
- );
- } else {
- $data->endTransaction();
- $this->doDefault(\sprintf(
- '%s%s: %s<br />',
- $msg,
- \htmlentities($s, \ENT_QUOTES, 'UTF-8'),
- $this->lang['strviewdroppedbad']
- ));
-
- return;
- }
+ } elseif (\is_array($_POST['view'])) {
+ $msg = '';
+ $status = $data->beginTransaction();
+ if (0 === $status) {
+ foreach ($_POST['view'] as $s) {
+ $status = $data->dropView($s, isset($_POST['cascade']));
+
+ if (0 === $status) {
+ $msg .= \sprintf(
+ '%s: %s<br />',
+ \htmlentities($s, \ENT_QUOTES, 'UTF-8'),
+ $this->lang['strviewdropped']
+ );
+ } else {
+ $data->endTransaction();
+ $this->doDefault(\sprintf(
+ '%s%s: %s<br />',
+ $msg,
+ \htmlentities($s, \ENT_QUOTES, 'UTF-8'),
+ $this->lang['strviewdroppedbad']
+ ));
+
+ return;
}
}
-
- if (0 === $data->endTransaction()) {
- // Everything went fine, back to the Default page....
- $this->view->setReloadBrowser(true);
- $this->doDefault($msg);
- } else {
- $this->doDefault($this->lang['strviewdroppedbad']);
- }
+ }
+ if (0 === $data->endTransaction()) {
+ // Everything went fine, back to the Default page....
+ $this->view->setReloadBrowser(true);
+ $this->doDefault($msg);
} else {
- $status = $data->dropView($_POST['view'], isset($_POST['cascade']));
+ $this->doDefault($this->lang['strviewdroppedbad']);
+ }
+ } else {
+ $status = $data->dropView($_POST['view'], isset($_POST['cascade']));
- if (0 === $status) {
- $this->view->setReloadBrowser(true);
- $this->doDefault($this->lang['strviewdropped']);
- } else {
- $this->doDefault($this->lang['strviewdroppedbad']);
- }
+ if (0 === $status) {
+ $this->view->setReloadBrowser(true);
+ $this->doDefault($this->lang['strviewdropped']);
+ } else {
+ $this->doDefault($this->lang['strviewdroppedbad']);
}
}
}
@@ -419,11 +412,7 @@ class MaterializedviewsController extends BaseController
$this->coalesceArr($_REQUEST, 'formView', '');
if (!isset($_REQUEST['formDefinition'])) {
- if (isset($_SESSION['sqlquery'])) {
- $_REQUEST['formDefinition'] = $_SESSION['sqlquery'];
- } else {
- $_REQUEST['formDefinition'] = 'SELECT ';
- }
+ $_REQUEST['formDefinition'] = isset($_SESSION['sqlquery']) ? $_SESSION['sqlquery'] : 'SELECT ';
}
$this->coalesceArr($_REQUEST, 'formComment', '');
diff --git a/src/controllers/OpclassesController.php b/src/controllers/OpclassesController.php
index b0d01065..2bb95657 100644
--- a/src/controllers/OpclassesController.php
+++ b/src/controllers/OpclassesController.php
@@ -6,6 +6,7 @@
namespace PHPPgAdmin\Controller;
+use Slim\Http\Response;
use PHPPgAdmin\Decorators\Decorator;
/**
@@ -26,13 +27,8 @@ class OpclassesController extends BaseController
$this->printHeader();
$this->printBody();
+ $this->doDefault();
- switch ($this->action) {
- default:
- $this->doDefault();
-
- break;
- }
$this->printFooter();
}
@@ -84,7 +80,7 @@ class OpclassesController extends BaseController
/**
* Generate XML for the browser tree.
*
- * @return \Slim\Http\Response|string
+ * @return Response|string
*/
public function doTree()
{
diff --git a/src/controllers/OperatorsController.php b/src/controllers/OperatorsController.php
index 5f3c0a63..01a4d075 100644
--- a/src/controllers/OperatorsController.php
+++ b/src/controllers/OperatorsController.php
@@ -6,6 +6,7 @@
namespace PHPPgAdmin\Controller;
+use Slim\Http\Response;
use PHPPgAdmin\Decorators\Decorator;
/**
@@ -69,7 +70,7 @@ class OperatorsController extends BaseController
/**
* Generate XML for the browser tree.
*
- * @return \Slim\Http\Response|string
+ * @return Response|string
*/
public function doTree()
{
diff --git a/src/controllers/PrivilegesController.php b/src/controllers/PrivilegesController.php
index 76bc24b4..182db391 100644
--- a/src/controllers/PrivilegesController.php
+++ b/src/controllers/PrivilegesController.php
@@ -84,12 +84,7 @@ class PrivilegesController extends BaseController
return;
}
- // Determine whether object should be ref'd by name or oid.
- if (isset($_REQUEST[$subject . '_oid'])) {
- $object = $_REQUEST[$subject . '_oid'];
- } else {
- $object = $_REQUEST[$subject];
- }
+ $object = isset($_REQUEST[$subject . '_oid']) ? $_REQUEST[$subject . '_oid'] : $_REQUEST[$subject];
// Get the privileges on the object, given its type
if ('column' === $subject) {
@@ -489,11 +484,7 @@ class PrivilegesController extends BaseController
$object = $_REQUEST[$_REQUEST['subject']];
}
- if (isset($_REQUEST['table'])) {
- $table = $_REQUEST['table'];
- } else {
- $table = null;
- }
+ $table = isset($_REQUEST['table']) ? $_REQUEST['table'] : null;
$status = $data->setPrivileges(
('grant' === $mode) ? 'GRANT' : 'REVOKE',
diff --git a/src/controllers/RolesController.php b/src/controllers/RolesController.php
index 6d236e7e..8fb58c24 100644
--- a/src/controllers/RolesController.php
+++ b/src/controllers/RolesController.php
@@ -993,11 +993,8 @@ class RolesController extends BaseController
$this->printTrail('role');
$this->printTitle($this->lang['strchangepassword'], 'pg.role.alter');
$this->printMsg($msg);
-
$this->coalesceArr($_POST, 'password', '');
-
$this->coalesceArr($_POST, 'confirm', '');
-
echo '<form action="roles" method="post">' . \PHP_EOL;
echo '<table>' . \PHP_EOL;
echo \sprintf(
@@ -1025,21 +1022,18 @@ class RolesController extends BaseController
$this->lang['strcancel']
) . \PHP_EOL;
echo '</p></form>' . \PHP_EOL;
+ } elseif (\mb_strlen($_POST['password']) < $this->conf['min_password_length']) {
+ $this->doChangePassword(true, $this->lang['strpasswordshort']);
+ } elseif ($_POST['password'] !== $_POST['confirm']) {
+ // Check that password matches confirmation password
+ $this->doChangePassword(true, $this->lang['strpasswordconfirm']);
} else {
- // Check that password is minimum length
- if (\mb_strlen($_POST['password']) < $this->conf['min_password_length']) {
- $this->doChangePassword(true, $this->lang['strpasswordshort']);
- } elseif ($_POST['password'] !== $_POST['confirm']) {
- // Check that password matches confirmation password
- $this->doChangePassword(true, $this->lang['strpasswordconfirm']);
- } else {
- $status = $data->changePassword($server_info['username'], $_POST['password']);
+ $status = $data->changePassword($server_info['username'], $_POST['password']);
- if (0 === $status) {
- $this->doAccount($this->lang['strpasswordchanged']);
- } else {
- $this->doAccount($this->lang['strpasswordchangedbad']);
- }
+ if (0 === $status) {
+ $this->doAccount($this->lang['strpasswordchanged']);
+ } else {
+ $this->doAccount($this->lang['strpasswordchangedbad']);
}
}
}
diff --git a/src/controllers/RulesController.php b/src/controllers/RulesController.php
index 195663cf..084621cc 100644
--- a/src/controllers/RulesController.php
+++ b/src/controllers/RulesController.php
@@ -6,6 +6,7 @@
namespace PHPPgAdmin\Controller;
+use Slim\Http\Response;
use PHPPgAdmin\Decorators\Decorator;
/**
@@ -132,7 +133,7 @@ class RulesController extends BaseController
}
/**
- * @return \Slim\Http\Response|string
+ * @return Response|string
*/
public function doTree()
{
@@ -172,7 +173,6 @@ class RulesController extends BaseController
$this->printTrail($_REQUEST['subject']);
$this->printTitle($this->lang['strcreaterule'], 'pg.rule.create');
$this->printMsg($msg);
-
echo '<form action="rules" method="post">' . \PHP_EOL;
echo '<table>' . \PHP_EOL;
echo \sprintf(
@@ -189,7 +189,6 @@ class RulesController extends BaseController
$this->lang['strevent']
) . \PHP_EOL;
echo '<td class="data1"><select name="event">' . \PHP_EOL;
-
foreach ($data->rule_events as $v) {
echo \sprintf(
'<option value="%s"',
@@ -224,7 +223,6 @@ class RulesController extends BaseController
echo '(<input name="raction" size="32" value="',
\htmlspecialchars($_POST['raction']), '" />)</td></tr>' . \PHP_EOL;
echo '</table>' . \PHP_EOL;
-
echo '<input type="hidden" name="action" value="save_create_rule" />' . \PHP_EOL;
echo '<input type="hidden" name="subject" value="', \htmlspecialchars($_REQUEST['subject']), '" />' . \PHP_EOL;
echo '<input type="hidden" name="', \htmlspecialchars($_REQUEST['subject']),
@@ -240,25 +238,23 @@ class RulesController extends BaseController
\PHP_EOL
);
echo '</form>' . \PHP_EOL;
+ } elseif ('' === \trim($_POST['name'])) {
+ $this->createRule(true, $this->lang['strruleneedsname']);
} else {
- if ('' === \trim($_POST['name'])) {
- $this->createRule(true, $this->lang['strruleneedsname']);
+ $status = $data->createRule(
+ $_POST['name'],
+ $_POST['event'],
+ $_POST[$_POST['subject']],
+ $_POST['where'],
+ isset($_POST['instead']),
+ $_POST['type'],
+ $_POST['raction']
+ );
+
+ if (0 === $status) {
+ $this->doDefault($this->lang['strrulecreated']);
} else {
- $status = $data->createRule(
- $_POST['name'],
- $_POST['event'],
- $_POST[$_POST['subject']],
- $_POST['where'],
- isset($_POST['instead']),
- $_POST['type'],
- $_POST['raction']
- );
-
- if (0 === $status) {
- $this->doDefault($this->lang['strrulecreated']);
- } else {
- $this->createRule(true, $this->lang['strrulecreatedbad']);
- }
+ $this->createRule(true, $this->lang['strrulecreatedbad']);
}
}
}
diff --git a/src/controllers/SchemasController.php b/src/controllers/SchemasController.php
index 58a9df75..2877548b 100644
--- a/src/controllers/SchemasController.php
+++ b/src/controllers/SchemasController.php
@@ -6,6 +6,7 @@
namespace PHPPgAdmin\Controller;
+use Slim\Http\Response;
use PHPPgAdmin\Decorators\Decorator;
use PHPPgAdmin\Traits\ExportTrait;
@@ -117,7 +118,7 @@ class SchemasController extends BaseController
'title' => $this->lang['strowner'],
'field' => Decorator::field('nspowner'),
]];
- if(boolval($this->conf['display_sizes']['schemas']??false)===true) {
+ if(boolval($this->conf['display_sizes']['schemas']??false)) {
$columns['schema_size'] = [
@@ -203,7 +204,7 @@ class SchemasController extends BaseController
/**
* Generate XML for the browser tree.
*
- * @return \Slim\Http\Response|string
+ * @return Response|string
*/
public function doTree()
{
@@ -239,7 +240,7 @@ class SchemasController extends BaseController
}
/**
- * @return \Slim\Http\Response|string
+ * @return Response|string
*/
public function doSubTree()
{
@@ -500,7 +501,6 @@ class SchemasController extends BaseController
if ($confirm) {
$this->printTrail('schema');
$this->printTitle($this->lang['strdrop'], 'pg.schema.drop');
-
echo '<form action="schemas" method="post">' . \PHP_EOL;
//If multi drop
if (isset($_REQUEST['ma'])) {
@@ -519,7 +519,6 @@ class SchemasController extends BaseController
), '</p>' . \PHP_EOL;
echo '<input type="hidden" name="nsp" value="', \htmlspecialchars($_REQUEST['nsp']), '" />' . \PHP_EOL;
}
-
echo \sprintf(
'<p><input type="checkbox" id="cascade" name="cascade" /> <label for="cascade">%s</label></p>',
$this->lang['strcascade']
@@ -537,51 +536,47 @@ class SchemasController extends BaseController
\PHP_EOL
);
echo '</form>' . \PHP_EOL;
- } else {
- if (\is_array($_POST['nsp'])) {
- $msg = '';
- $status = $data->beginTransaction();
-
- if (0 === $status) {
- foreach ($_POST['nsp'] as $s) {
- $status = $data->dropSchema($s, isset($_POST['cascade']));
-
- if (0 === $status) {
- $msg .= \sprintf(
- '%s: %s<br />',
- \htmlentities($s, \ENT_QUOTES, 'UTF-8'),
- $this->lang['strschemadropped']
- );
- } else {
- $data->endTransaction();
- $this->doDefault(\sprintf(
- '%s%s: %s<br />',
- $msg,
- \htmlentities($s, \ENT_QUOTES, 'UTF-8'),
- $this->lang['strschemadroppedbad']
- ));
-
- return;
- }
+ } elseif (\is_array($_POST['nsp'])) {
+ $msg = '';
+ $status = $data->beginTransaction();
+ if (0 === $status) {
+ foreach ($_POST['nsp'] as $s) {
+ $status = $data->dropSchema($s, isset($_POST['cascade']));
+
+ if (0 === $status) {
+ $msg .= \sprintf(
+ '%s: %s<br />',
+ \htmlentities($s, \ENT_QUOTES, 'UTF-8'),
+ $this->lang['strschemadropped']
+ );
+ } else {
+ $data->endTransaction();
+ $this->doDefault(\sprintf(
+ '%s%s: %s<br />',
+ $msg,
+ \htmlentities($s, \ENT_QUOTES, 'UTF-8'),
+ $this->lang['strschemadroppedbad']
+ ));
+
+ return;
}
}
-
- if (0 === $data->endTransaction()) {
- // Everything went fine, back to the Default page....
- $this->view->setReloadBrowser(true);
- $this->doDefault($msg);
- } else {
- $this->doDefault($this->lang['strschemadroppedbad']);
- }
+ }
+ if (0 === $data->endTransaction()) {
+ // Everything went fine, back to the Default page....
+ $this->view->setReloadBrowser(true);
+ $this->doDefault($msg);
} else {
- $status = $data->dropSchema($_POST['nsp'], isset($_POST['cascade']));
+ $this->doDefault($this->lang['strschemadroppedbad']);
+ }
+ } else {
+ $status = $data->dropSchema($_POST['nsp'], isset($_POST['cascade']));
- if (0 === $status) {
- $this->view->setReloadBrowser(true);
- $this->doDefault($this->lang['strschemadropped']);
- } else {
- $this->doDefault($this->lang['strschemadroppedbad']);
- }
+ if (0 === $status) {
+ $this->view->setReloadBrowser(true);
+ $this->doDefault($this->lang['strschemadropped']);
+ } else {
+ $this->doDefault($this->lang['strschemadroppedbad']);
}
}
}
diff --git a/src/controllers/SequencesController.php b/src/controllers/SequencesController.php
index 0bca0fab..da338e61 100644
--- a/src/controllers/SequencesController.php
+++ b/src/controllers/SequencesController.php
@@ -6,6 +6,7 @@
namespace PHPPgAdmin\Controller;
+use Slim\Http\Response;
use PHPPgAdmin\Decorators\Decorator;
/**
@@ -210,7 +211,7 @@ class SequencesController extends BaseController
/**
* Generate XML for the browser tree.
*
- * @return \Slim\Http\Response|string
+ * @return Response|string
*/
public function doTree()
{
@@ -437,9 +438,7 @@ class SequencesController extends BaseController
$this->printTrail('sequence');
$this->printTitle($this->lang['strdrop'], 'pg.sequence.drop');
$this->printMsg($msg);
-
echo '<form action="sequences" method="post">' . \PHP_EOL;
-
//If multi drop
if (isset($_REQUEST['ma'])) {
foreach ($_REQUEST['ma'] as $v) {
@@ -457,7 +456,6 @@ class SequencesController extends BaseController
), '</p>' . \PHP_EOL;
echo '<input type="hidden" name="sequence" value="', \htmlspecialchars($_REQUEST['sequence']), '" />' . \PHP_EOL;
}
-
echo \sprintf(
'<p><input type="checkbox" id="cascade" name="cascade" /> <label for="cascade">%s</label></p>',
$this->lang['strcascade']
@@ -474,51 +472,47 @@ class SequencesController extends BaseController
\PHP_EOL
);
echo '</form>' . \PHP_EOL;
- } else {
- if (\is_array($_POST['sequence'])) {
- $msg = '';
- $status = $data->beginTransaction();
-
- if (0 === $status) {
- foreach ($_POST['sequence'] as $s) {
- $status = $data->dropSequence($s, isset($_POST['cascade']));
-
- if (0 === $status) {
- $msg .= \sprintf(
- '%s: %s<br />',
- \htmlentities($s, \ENT_QUOTES, 'UTF-8'),
- $this->lang['strsequencedropped']
- );
- } else {
- $data->endTransaction();
- $this->doDefault(\sprintf(
- '%s%s: %s<br />',
- $msg,
- \htmlentities($s, \ENT_QUOTES, 'UTF-8'),
- $this->lang['strsequencedroppedbad']
- ));
-
- return;
- }
+ } elseif (\is_array($_POST['sequence'])) {
+ $msg = '';
+ $status = $data->beginTransaction();
+ if (0 === $status) {
+ foreach ($_POST['sequence'] as $s) {
+ $status = $data->dropSequence($s, isset($_POST['cascade']));
+
+ if (0 === $status) {
+ $msg .= \sprintf(
+ '%s: %s<br />',
+ \htmlentities($s, \ENT_QUOTES, 'UTF-8'),
+ $this->lang['strsequencedropped']
+ );
+ } else {
+ $data->endTransaction();
+ $this->doDefault(\sprintf(
+ '%s%s: %s<br />',
+ $msg,
+ \htmlentities($s, \ENT_QUOTES, 'UTF-8'),
+ $this->lang['strsequencedroppedbad']
+ ));
+
+ return;
}
}
-
- if (0 === $data->endTransaction()) {
- // Everything went fine, back to the Default page....
- $this->view->setReloadBrowser(true);
- $this->doDefault($msg);
- } else {
- $this->doDefault($this->lang['strsequencedroppedbad']);
- }
+ }
+ if (0 === $data->endTransaction()) {
+ // Everything went fine, back to the Default page....
+ $this->view->setReloadBrowser(true);
+ $this->doDefault($msg);
} else {
- $status = $data->dropSequence($_POST['sequence'], isset($_POST['cascade']));
+ $this->doDefault($this->lang['strsequencedroppedbad']);
+ }
+ } else {
+ $status = $data->dropSequence($_POST['sequence'], isset($_POST['cascade']));
- if (0 === $status) {
- $this->view->setReloadBrowser(true);
- $this->doDefault($this->lang['strsequencedropped']);
- } else {
- $this->doDrop(true, $this->lang['strsequencedroppedbad']);
- }
+ if (0 === $status) {
+ $this->view->setReloadBrowser(true);
+ $this->doDefault($this->lang['strsequencedropped']);
+ } else {
+ $this->doDrop(true, $this->lang['strsequencedroppedbad']);
}
}
}
diff --git a/src/controllers/ServersController.php b/src/controllers/ServersController.php
index fbdaeeef..781d4537 100644
--- a/src/controllers/ServersController.php
+++ b/src/controllers/ServersController.php
@@ -6,6 +6,7 @@
namespace PHPPgAdmin\Controller;
+use Slim\Http\Response;
use PHPPgAdmin\ArrayRecordSet;
use PHPPgAdmin\Decorators\Decorator;
use PHPPgAdmin\Traits\ServersTrait;
@@ -162,7 +163,7 @@ class ServersController extends BaseController
}
/**
- * @return \Slim\Http\Response|string
+ * @return Response|string
*/
public function doTree()
{
diff --git a/src/controllers/SqlController.php b/src/controllers/SqlController.php
index b36adb04..83d8646e 100644
--- a/src/controllers/SqlController.php
+++ b/src/controllers/SqlController.php
@@ -76,15 +76,13 @@ class SqlController extends BaseController
// Set the schema search path
- if (isset($_REQUEST['search_path'])) {
- if (0 !== $data->setSearchPath(\array_map('trim', \explode(',', $_REQUEST['search_path'])))) {
- $this->printHeader($this->headerTitle(), null, true );
- $body=$this->printBody(false);
- $trail=$this->printTrail('database',false);
- $title=$this->printTitle($this->lang['strqueryresults'],null,false);
- echo $body.$trail.$title;
- return $this->printFooter();
- }
+ if (isset($_REQUEST['search_path']) && 0 !== $data->setSearchPath(\array_map('trim', \explode(',', $_REQUEST['search_path'])))) {
+ $this->printHeader($this->headerTitle(), null, true );
+ $body=$this->printBody(false);
+ $trail=$this->printTrail('database',false);
+ $title=$this->printTitle($this->lang['strqueryresults'],null,false);
+ echo $body.$trail.$title;
+ return $this->printFooter();
}
@@ -200,9 +198,8 @@ class SqlController extends BaseController
}
}
};
- $final= $data->executeScript('script', $sqlCallback);
- return $final;
+ return $data->executeScript('script', $sqlCallback);
}
/**
@@ -242,7 +239,7 @@ $json=[];
if (0 < $rs->RecordCount()) {
echo "<table>\n<tr>";
- foreach ($rs->fields as $fieldName => $fieldValue) {
+ foreach (array_keys($rs->fields) as $fieldName) {
$finfo = $rs->FetchField($fieldName);
echo '<th class="data">', $this->misc->printVal($finfo->name), '</th>';
}
diff --git a/src/controllers/TablesController.php b/src/controllers/TablesController.php
index c3f31584..b21009e9 100644
--- a/src/controllers/TablesController.php
+++ b/src/controllers/TablesController.php
@@ -6,6 +6,7 @@
namespace PHPPgAdmin\Controller;
+use Slim\Http\Response;
use PHPPgAdmin\Decorators\Decorator;
use PHPPgAdmin\Traits\AdminTrait;
use PHPPgAdmin\Traits\InsertEditRowTrait;
@@ -158,7 +159,7 @@ class TablesController extends BaseController
$columns = $this->_getColumns();
- if(boolval($this->conf['display_sizes']['tables']??false)===false) {
+ if(!boolval($this->conf['display_sizes']['tables']??false)) {
unset($columns['table_size']);
}
@@ -230,7 +231,7 @@ class TablesController extends BaseController
/**
* Generate XML for the browser tree.
*
- * @return \Slim\Http\Response|string
+ * @return Response|string
*/
public function doTree()
{
@@ -253,7 +254,7 @@ class TablesController extends BaseController
}
/**
- * @return \Slim\Http\Response|string
+ * @return Response|string
*/
public function doSubTree()
{
diff --git a/src/controllers/TblpropertiesController.php b/src/controllers/TblpropertiesController.php
index 81ba3b81..971f5b2b 100644
--- a/src/controllers/TblpropertiesController.php
+++ b/src/controllers/TblpropertiesController.php
@@ -6,6 +6,8 @@
namespace PHPPgAdmin\Controller;
+use Slim\Http\Response;
+use Closure;
use PHPPgAdmin\Decorators\Decorator;
use PHPPgAdmin\Traits\ExportTrait;
@@ -237,7 +239,7 @@ class TblpropertiesController extends BaseController
}
/**
- * @return \Slim\Http\Response|string
+ * @return Response|string
*/
public function doTree()
{
@@ -862,11 +864,11 @@ class TblpropertiesController extends BaseController
*
* @param mixed $data
*
- * @return \Closure
+ * @return Closure
*/
private function _getAttPre($data)
{
- $attPre = static function (&$rowdata, $actions) use ($data) {
+ return static function (&$rowdata, $actions) use ($data) {
$rowdata->fields['+type'] = $data->formatType($rowdata->fields['type'], $rowdata->fields['atttypmod']);
$attname = $rowdata->fields['attname'];
$table = $_REQUEST['table'];
@@ -884,8 +886,6 @@ class TblpropertiesController extends BaseController
return $actions;
};
-
- return $attPre;
}
/**
@@ -894,12 +894,13 @@ class TblpropertiesController extends BaseController
* @param mixed $misc
* @param mixed $data
*
- * @return \Closure
+ * @return Closure
*/
private function _getCstrRender($misc, $data)
{
$view = $this->view;
- $cstrRender = static function ($s, $p) use ($misc, $data, $view) {
+
+ return static function ($s, $p) use ($misc, $data, $view) {
$str = '';
foreach ($p['keys'] as $k => $c) {
@@ -958,8 +959,6 @@ class TblpropertiesController extends BaseController
return $str;
};
-
- return $cstrRender;
}
private function _printTable($ck, $attrs): void
diff --git a/src/controllers/TreeController.php b/src/controllers/TreeController.php
index 94ec3210..e4b3cdf7 100644
--- a/src/controllers/TreeController.php
+++ b/src/controllers/TreeController.php
@@ -6,6 +6,8 @@
namespace PHPPgAdmin\Controller;
+use PHPPgAdmin\Interfaces\Recordset;
+use ADORecordSet;
use PHPPgAdmin\ArrayRecordSet;
use PHPPgAdmin\ContainerUtils;
use PHPPgAdmin\Decorators\Decorator;
@@ -69,7 +71,7 @@ class TreeController extends BaseController
/**
* Produce JSON data for the browser tree.
*
- * @param \PHPPgAdmin\Interfaces\Recordset|\ADORecordSet $_treedata a set of records to populate the tree
+ * @param Recordset|ADORecordSet $_treedata a set of records to populate the tree
* @param array $attrs Attributes for tree items
* 'text' - the text for the tree node
* 'icon' - an icon for node
@@ -206,7 +208,7 @@ class TreeController extends BaseController
}
//ddd($parent);
- if (true === $print) {
+ if ($print) {
if (isset($_REQUEST['children'])) {
$children = $parent;
$parent = ['children' => $children];
diff --git a/src/controllers/TriggersController.php b/src/controllers/TriggersController.php
index cc84f700..00319c6c 100644
--- a/src/controllers/TriggersController.php
+++ b/src/controllers/TriggersController.php
@@ -6,6 +6,7 @@
namespace PHPPgAdmin\Controller;
+use Slim\Http\Response;
use PHPPgAdmin\Decorators\Decorator;
use PHPPgAdmin\XHtml\XHtmlOption;
use PHPPgAdmin\XHtml\XHtmlSelect;
@@ -232,7 +233,7 @@ class TriggersController extends BaseController
}
/**
- * @return \Slim\Http\Response|string
+ * @return Response|string
*/
public function doTree()
{
diff --git a/src/controllers/TypesController.php b/src/controllers/TypesController.php
index c618cf09..5ac777a9 100644
--- a/src/controllers/TypesController.php
+++ b/src/controllers/TypesController.php
@@ -6,6 +6,7 @@
namespace PHPPgAdmin\Controller;
+use Slim\Http\Response;
use PHPPgAdmin\Decorators\Decorator;
/**
@@ -209,7 +210,7 @@ class TypesController extends BaseController
/**
* Generate XML for the browser tree.
*
- * @return \Slim\Http\Response|string
+ * @return Response|string
*/
public function doTree()
{
diff --git a/src/controllers/UsersController.php b/src/controllers/UsersController.php
index 3db2c095..6a380d1f 100644
--- a/src/controllers/UsersController.php
+++ b/src/controllers/UsersController.php
@@ -272,11 +272,8 @@ $this->action=isset($_REQUEST['cancel'])?'cancel':$this->action;
$this->printTrail('user');
$this->printTitle($this->lang['strchangepassword'], 'pg.user.alter');
$this->printMsg($msg);
-
$this->coalesceArr($_POST, 'password', '');
-
$this->coalesceArr($_POST, 'confirm', '');
-
echo '<form action="' . \containerInstance()->subFolder . '/users" method="post">' . \PHP_EOL;
echo '<table>' . \PHP_EOL;
echo \sprintf(
@@ -305,24 +302,21 @@ $this->action=isset($_REQUEST['cancel'])?'cancel':$this->action;
$this->lang['strcancel']
) . \PHP_EOL;
echo '</p></form>' . \PHP_EOL;
+ } elseif (\mb_strlen($_POST['password']) < $this->conf['min_password_length']) {
+ $this->doChangePassword(true, $this->lang['strpasswordshort']);
+ } elseif ($_POST['password'] !== $_POST['confirm']) {
+ // Check that password matches confirmation password
+ $this->doChangePassword(true, $this->lang['strpasswordconfirm']);
} else {
- // Check that password is minimum length
- if (\mb_strlen($_POST['password']) < $this->conf['min_password_length']) {
- $this->doChangePassword(true, $this->lang['strpasswordshort']);
- } elseif ($_POST['password'] !== $_POST['confirm']) {
- // Check that password matches confirmation password
- $this->doChangePassword(true, $this->lang['strpasswordconfirm']);
- } else {
- $status = $data->changePassword(
- $server_info['username'],
- $_POST['password']
- );
+ $status = $data->changePassword(
+ $server_info['username'],
+ $_POST['password']
+ );
- if (0 === $status) {
- $this->doAccount($this->lang['strpasswordchanged']);
- } else {
- $this->doAccount($this->lang['strpasswordchangedbad']);
- }
+ if (0 === $status) {
+ $this->doAccount($this->lang['strpasswordchanged']);
+ } else {
+ $this->doAccount($this->lang['strpasswordchangedbad']);
}
}
}
diff --git a/src/controllers/ViewsController.php b/src/controllers/ViewsController.php
index 1f8f5305..b3587391 100644
--- a/src/controllers/ViewsController.php
+++ b/src/controllers/ViewsController.php
@@ -6,6 +6,7 @@
namespace PHPPgAdmin\Controller;
+use Slim\Http\Response;
use PHPPgAdmin\Decorators\Decorator;
use PHPPgAdmin\Traits\ViewsMatviewsTrait;
@@ -246,7 +247,7 @@ class ViewsController extends BaseController
/**
* Generate XML for the browser tree.
*
- * @return \Slim\Http\Response|string
+ * @return Response|string
*/
public function doTree()
{
@@ -284,9 +285,7 @@ class ViewsController extends BaseController
if ($confirm) {
$this->printTrail('view');
$this->printTitle($this->lang['strdrop'], 'pg.view.drop');
-
echo '<form action="views" method="post">' . \PHP_EOL;
-
//If multi drop
if (isset($_REQUEST['ma'])) {
foreach ($_REQUEST['ma'] as $v) {
@@ -304,9 +303,7 @@ class ViewsController extends BaseController
), '</p>' . \PHP_EOL;
echo '<input type="hidden" name="view" value="', \htmlspecialchars($_REQUEST['view']), '" />' . \PHP_EOL;
}
-
echo '<input type="hidden" name="action" value="drop" />' . \PHP_EOL;
-
echo $this->view->form;
echo \sprintf(
'<p><input type="checkbox" id="cascade" name="cascade" /> <label for="cascade">%s</label></p>',
@@ -321,51 +318,47 @@ class ViewsController extends BaseController
$this->lang['strcancel']
) . \PHP_EOL;
echo '</form>' . \PHP_EOL;
- } else {
- if (\is_array($_POST['view'])) {
- $msg = '';
- $status = $data->beginTransaction();
-
- if (0 === $status) {
- foreach ($_POST['view'] as $s) {
- $status = $data->dropView($s, isset($_POST['cascade']));
-
- if (0 === $status) {
- $msg .= \sprintf(
- '%s: %s<br />',
- \htmlentities($s, \ENT_QUOTES, 'UTF-8'),
- $this->lang['strviewdropped']
- );
- } else {
- $data->endTransaction();
- $this->doDefault(\sprintf(
- '%s%s: %s<br />',
- $msg,
- \htmlentities($s, \ENT_QUOTES, 'UTF-8'),
- $this->lang['strviewdroppedbad']
- ));
-
- return;
- }
+ } elseif (\is_array($_POST['view'])) {
+ $msg = '';
+ $status = $data->beginTransaction();
+ if (0 === $status) {
+ foreach ($_POST['view'] as $s) {
+ $status = $data->dropView($s, isset($_POST['cascade']));
+
+ if (0 === $status) {
+ $msg .= \sprintf(
+ '%s: %s<br />',
+ \htmlentities($s, \ENT_QUOTES, 'UTF-8'),
+ $this->lang['strviewdropped']
+ );
+ } else {
+ $data->endTransaction();
+ $this->doDefault(\sprintf(
+ '%s%s: %s<br />',
+ $msg,
+ \htmlentities($s, \ENT_QUOTES, 'UTF-8'),
+ $this->lang['strviewdroppedbad']
+ ));
+
+ return;
}
}
-
- if (0 === $data->endTransaction()) {
- // Everything went fine, back to the Default page....
- $this->view->setReloadBrowser(true);
- $this->doDefault($msg);
- } else {
- $this->doDefault($this->lang['strviewdroppedbad']);
- }
+ }
+ if (0 === $data->endTransaction()) {
+ // Everything went fine, back to the Default page....
+ $this->view->setReloadBrowser(true);
+ $this->doDefault($msg);
} else {
- $status = $data->dropView($_POST['view'], isset($_POST['cascade']));
+ $this->doDefault($this->lang['strviewdroppedbad']);
+ }
+ } else {
+ $status = $data->dropView($_POST['view'], isset($_POST['cascade']));
- if (0 === $status) {
- $this->view->setReloadBrowser(true);
- $this->doDefault($this->lang['strviewdropped']);
- } else {
- $this->doDefault($this->lang['strviewdroppedbad']);
- }
+ if (0 === $status) {
+ $this->view->setReloadBrowser(true);
+ $this->doDefault($this->lang['strviewdropped']);
+ } else {
+ $this->doDefault($this->lang['strviewdroppedbad']);
}
}
}
@@ -419,11 +412,7 @@ class ViewsController extends BaseController
$this->coalesceArr($_REQUEST, 'formView', '');
if (!isset($_REQUEST['formDefinition'])) {
- if (isset($_SESSION['sqlquery'])) {
- $_REQUEST['formDefinition'] = $_SESSION['sqlquery'];
- } else {
- $_REQUEST['formDefinition'] = 'SELECT ';
- }
+ $_REQUEST['formDefinition'] = isset($_SESSION['sqlquery']) ? $_SESSION['sqlquery'] : 'SELECT ';
}
$this->coalesceArr($_REQUEST, 'formComment', '');
diff --git a/src/database/ADOdbBase.php b/src/database/ADOdbBase.php
index 28d04ce5..059a9e9d 100644
--- a/src/database/ADOdbBase.php
+++ b/src/database/ADOdbBase.php
@@ -409,7 +409,7 @@ class ADOdbBase
$this->clean($key);
$this->clean($value);
- if ($sql) {
+ if ($sql !== '') {
$sql .= \sprintf(
' AND "%s"=\'%s\'',
$key,
@@ -427,11 +427,9 @@ class ADOdbBase
}
// Check for failures
- if (!$this->conn->Execute($sql)) {
- // Check for referential integrity failure
- if (\mb_stristr($this->ErrorMsg(), 'referential')) {
- return -1;
- }
+ // Check for referential integrity failure
+ if (!$this->conn->Execute($sql) && \mb_stristr($this->ErrorMsg(), 'referential')) {
+ return -1;
}
// Check for no rows modified
@@ -454,9 +452,8 @@ class ADOdbBase
if (null === $str) {
return null;
}
- $str = \str_replace('"', '""', $str);
- return $str;
+ return \str_replace('"', '""', $str);
}
/**
@@ -472,9 +469,8 @@ class ADOdbBase
return null;
}
$str = \str_replace("\r\n", "\n", $str);
- $str = \pg_escape_string($str);
- return $str;
+ return \pg_escape_string($str);
}
/**
@@ -510,7 +506,7 @@ class ADOdbBase
$this->clean($key);
$this->clean($value);
- if ($fields) {
+ if ($fields !== '') {
$fields .= \sprintf(
', "%s"',
$key
@@ -523,7 +519,7 @@ class ADOdbBase
);
}
- if ($values) {
+ if ($values !== '') {
$values .= \sprintf(
', \'%s\'',
$value
@@ -577,7 +573,7 @@ class ADOdbBase
$this->fieldClean($key);
$this->clean($value);
- if ($setClause) {
+ if ($setClause !== '') {
$setClause .= \sprintf(
', "%s"=\'%s\'',
$key,
@@ -598,7 +594,7 @@ class ADOdbBase
foreach ($nulls as $key => $value) {
$this->fieldClean($value);
- if ($setClause) {
+ if ($setClause !== '') {
$setClause .= \sprintf(
', "%s"=NULL',
$value
@@ -618,7 +614,7 @@ class ADOdbBase
$this->fieldClean($key);
$this->clean($value);
- if ($whereClause) {
+ if ($whereClause !== '') {
$whereClause .= \sprintf(
' AND "%s"=\'%s\'',
$key,
@@ -710,11 +706,7 @@ class ADOdbBase
*/
public function dbBool(&$parameter)
{
- if ($parameter) {
- $parameter = 't';
- } else {
- $parameter = 'f';
- }
+ $parameter = $parameter ? 't' : 'f';
return $parameter;
}
diff --git a/src/database/Postgres.php b/src/database/Postgres.php
index fce8893b..4b718de5 100644
--- a/src/database/Postgres.php
+++ b/src/database/Postgres.php
@@ -455,11 +455,7 @@ class Postgres extends ADOdbBase
{
$conf = $this->conf;
- if ($conf['show_system'] || $all) {
- $where = '';
- } else {
- $where = 'WHERE lanispl';
- }
+ $where = $conf['show_system'] || $all ? '' : 'WHERE lanispl';
$sql = \sprintf(
'
@@ -567,7 +563,7 @@ class Postgres extends ADOdbBase
) {
$in_quote = 0;
}
- } elseif ($dol_quote) {
+ } elseif ($dol_quote !== '') {
$this->prtrace('dol_quote', $dol_quote, $line);
if (0 === \strncmp(\mb_substr($line, $i), $dol_quote, \mb_strlen($dol_quote))) {
@@ -658,7 +654,7 @@ class Postgres extends ADOdbBase
/* append the line to the query buffer */
$query_buf .= $subline;
/* is there anything in the query_buf? */
- if (\trim($query_buf)) {
+ if (\trim($query_buf) !== '') {
$query_buf .= ';';
// Execute the query. PHP cannot execute
@@ -785,11 +781,7 @@ class Postgres extends ADOdbBase
// If $type is TABLE, then generate the query
switch ($type) {
case 'TABLE':
- if (\preg_match('/^[0-9]+$/', $sortkey) && 0 < $sortkey) {
- $orderby = [$sortkey => $sortdir];
- } else {
- $orderby = [];
- }
+ $orderby = \preg_match('/^\d+$/', $sortkey) && 0 < $sortkey ? [$sortkey => $sortdir] : [];
$query = $this->getSelectSQL($table, [], [], [], $orderby);
@@ -862,7 +854,7 @@ class Postgres extends ADOdbBase
// Figure out ORDER BY. Sort key is always the column number (based from one)
// of the column to order by. Only need to do this for non-TABLE queries
- if ('TABLE' !== $type && \preg_match('/^[0-9]+$/', $sortkey) && 0 < $sortkey) {
+ if ('TABLE' !== $type && \preg_match('/^\d+$/', $sortkey) && 0 < $sortkey) {
$orderby = \sprintf(
' ORDER BY %s',
$sortkey
@@ -913,14 +905,10 @@ class Postgres extends ADOdbBase
// If an empty array is passed in, then show all columns
if (0 === \count($show)) {
- if ($this->hasObjectID($table)) {
- $sql = \sprintf(
- 'SELECT "%s", * FROM ',
- $this->id
- );
- } else {
- $sql = 'SELECT * FROM ';
- }
+ $sql = $this->hasObjectID($table) ? \sprintf(
+ 'SELECT "%s", * FROM ',
+ $this->id
+ ) : 'SELECT * FROM ';
} else {
// Add oid column automatically to results for editing purposes
if (!\in_array($this->id, $show, true) && $this->hasObjectID($table)) {
@@ -1025,7 +1013,7 @@ class Postgres extends ADOdbBase
$sql .= ', ';
}
- if (\preg_match('/^[0-9]+$/', $k)) {
+ if (\preg_match('/^\d+$/', $k)) {
$sql .= $k;
} else {
$this->fieldClean($k);
diff --git a/src/database/databasetraits/DatabaseTrait.php b/src/database/databasetraits/DatabaseTrait.php
index c932ec51..4f5d379a 100644
--- a/src/database/databasetraits/DatabaseTrait.php
+++ b/src/database/databasetraits/DatabaseTrait.php
@@ -155,11 +155,7 @@ trait DatabaseTrait
$orderby = 'ORDER BY pdb.datname';
}
- if (!$conf['show_system']) {
- $where = ' AND NOT pdb.datistemplate';
- } else {
- $where = ' AND pdb.datallowconn';
- }
+ $where = $conf['show_system'] ? ' AND pdb.datallowconn' : ' AND NOT pdb.datistemplate';
$sql = \sprintf(
'
@@ -507,11 +503,7 @@ trait DatabaseTrait
{
$conf = $this->conf;
- if (!$conf['show_system']) {
- $where = 'AND pn.nspname NOT LIKE $$pg\_%$$';
- } else {
- $where = "AND nspname !~ '^pg_t(emp_[0-9]+|oast)$'";
- }
+ $where = $conf['show_system'] ? "AND nspname !~ '^pg_t(emp_[0-9]+|oast)$'" : 'AND pn.nspname NOT LIKE $$pg\_%$$';
$sql = \sprintf(
'
diff --git a/src/database/databasetraits/FunctionTrait.php b/src/database/databasetraits/FunctionTrait.php
index 26e90dfa..7c4186eb 100644
--- a/src/database/databasetraits/FunctionTrait.php
+++ b/src/database/databasetraits/FunctionTrait.php
@@ -73,7 +73,7 @@ trait FunctionTrait
/**
* Returns a list of all functions that can be used in triggers.
*
- * @return int|\PHPPgAdmin\ADORecordSet Functions that can be used in a trigger
+ * @return int|ADORecordSet Functions that can be used in a trigger
*/
public function getTriggerFunctions()
{
@@ -105,20 +105,12 @@ trait FunctionTrait
// Null handling
$f['proisstrict'] = $this->phpBool($f['proisstrict']);
- if ($f['proisstrict']) {
- $temp[] = 'RETURNS NULL ON NULL INPUT';
- } else {
- $temp[] = 'CALLED ON NULL INPUT';
- }
+ $temp[] = $f['proisstrict'] ? 'RETURNS NULL ON NULL INPUT' : 'CALLED ON NULL INPUT';
// Security
$f['prosecdef'] = $this->phpBool($f['prosecdef']);
- if ($f['prosecdef']) {
- $temp[] = 'SECURITY DEFINER';
- } else {
- $temp[] = 'SECURITY INVOKER';
- }
+ $temp[] = $f['prosecdef'] ? 'SECURITY DEFINER' : 'SECURITY INVOKER';
return $temp;
}
diff --git a/src/database/databasetraits/IndexTrait.php b/src/database/databasetraits/IndexTrait.php
index 8adf53a0..9e381246 100644
--- a/src/database/databasetraits/IndexTrait.php
+++ b/src/database/databasetraits/IndexTrait.php
@@ -40,7 +40,7 @@ trait IndexTrait
$v = $this->selectSet($sql);
- return !(0 === $v->RecordCount());
+ return 0 !== $v->RecordCount();
}
/**
@@ -262,11 +262,7 @@ trait IndexTrait
$rs = $this->selectSet($sql);
- if ($rs->EOF) {
- $max_col = 0;
- } else {
- $max_col = $rs->fields['nb'];
- }
+ $max_col = $rs->EOF ? 0 : $rs->fields['nb'];
$sql = '
SELECT
diff --git a/src/database/databasetraits/PrivilegesTrait.php b/src/database/databasetraits/PrivilegesTrait.php
index fee33a74..a9f6aa45 100644
--- a/src/database/databasetraits/PrivilegesTrait.php
+++ b/src/database/databasetraits/PrivilegesTrait.php
@@ -176,16 +176,14 @@ trait PrivilegesTrait
if (\in_array('ALL PRIVILEGES', $privileges, true)) {
$sql .= ' ALL PRIVILEGES';
+ } elseif ('column' === $type) {
+ $this->fieldClean($object);
+ $sql .= ' ' . \implode(\sprintf(
+ ' ("%s"), ',
+ $object
+ ), $privileges);
} else {
- if ('column' === $type) {
- $this->fieldClean($object);
- $sql .= ' ' . \implode(\sprintf(
- ' ("%s"), ',
- $object
- ), $privileges);
- } else {
- $sql .= ' ' . \implode(', ', $privileges);
- }
+ $sql .= ' ' . \implode(', ', $privileges);
}
switch ($type) {
@@ -388,18 +386,14 @@ trait PrivilegesTrait
// Figure out type of ACE (public, user or group)
if (0 === \mb_strpos($v, '=')) {
$atype = 'public';
+ } elseif ($this->hasRoles()) {
+ $atype = 'role';
+ } elseif (0 === \mb_strpos($v, 'group ')) {
+ $atype = 'group';
+ // Tear off 'group' prefix
+ $v = \mb_substr($v, 6);
} else {
- if ($this->hasRoles()) {
- $atype = 'role';
- } else {
- if (0 === \mb_strpos($v, 'group ')) {
- $atype = 'group';
- // Tear off 'group' prefix
- $v = \mb_substr($v, 6);
- } else {
- $atype = 'user';
- }
- }
+ $atype = 'user';
}
// Break on unquoted equals sign...
diff --git a/src/database/databasetraits/RoleTrait.php b/src/database/databasetraits/RoleTrait.php
index 50ce9fe7..6b7150cc 100644
--- a/src/database/databasetraits/RoleTrait.php
+++ b/src/database/databasetraits/RoleTrait.php
@@ -1029,7 +1029,7 @@ trait RoleTrait
* @param mixed $inherits
* @param mixed $login
*
- * @return int|\PHPPgAdmin\ADORecordSet
+ * @return int|ADORecordSet
*/
private function _alterRole($rolename, $password, $connlimit, $expiry, $superuser, $createdb, $createrole, $inherits, $login)
{
diff --git a/src/database/databasetraits/RowTrait.php b/src/database/databasetraits/RowTrait.php
index e102f978..10b71d46 100644
--- a/src/database/databasetraits/RowTrait.php
+++ b/src/database/databasetraits/RowTrait.php
@@ -269,12 +269,7 @@ trait RowTrait
foreach ($vars as $key => $value) {
$this->fieldClean($key);
- // Handle NULL values
- if (isset($nulls[$key])) {
- $tmp = 'NULL';
- } else {
- $tmp = $this->formatValue($types[$key], $format[$key], $value);
- }
+ $tmp = isset($nulls[$key]) ? 'NULL' : $this->formatValue($types[$key], $format[$key], $value);
if (0 < \mb_strlen($sql)) {
$sql .= \sprintf(
diff --git a/src/database/databasetraits/SchemaTrait.php b/src/database/databasetraits/SchemaTrait.php
index d1194946..c2982d16 100644
--- a/src/database/databasetraits/SchemaTrait.php
+++ b/src/database/databasetraits/SchemaTrait.php
@@ -63,7 +63,7 @@ trait SchemaTrait
*
* @param string $schema The the name of the schema to work in
*
- * @return int|\PHPPgAdmin\ADORecordSet 0 if operation was successful
+ * @return int|ADORecordSet 0 if operation was successful
*/
public function setSchema($schema)
{
diff --git a/src/database/databasetraits/SequenceTrait.php b/src/database/databasetraits/SequenceTrait.php
index cb9fe670..0efcafbd 100644
--- a/src/database/databasetraits/SequenceTrait.php
+++ b/src/database/databasetraits/SequenceTrait.php
@@ -442,7 +442,7 @@ trait SequenceTrait
// toggle cycle yes/no
if (null !== $cycledvalue) {
- $sql .= (!$cycledvalue ? ' NO ' : '') . ' CYCLE';
+ $sql .= ($cycledvalue ? '' : ' NO ') . ' CYCLE';
}
if ('' !== $sql) {
diff --git a/src/database/databasetraits/TableTrait.php b/src/database/databasetraits/TableTrait.php
index 39a82db1..c992d2e3 100644
--- a/src/database/databasetraits/TableTrait.php
+++ b/src/database/databasetraits/TableTrait.php
@@ -1134,7 +1134,7 @@ trait TableTrait
);
if ($cascade) {
- $sql = $sql . ' CASCADE';
+ $sql .= ' CASCADE';
}
$status = $this->execute($sql);
@@ -1241,12 +1241,7 @@ trait TableTrait
{
$this->fieldClean($relation);
- // Actually retrieve the rows
- if ($oids) {
- $oid_str = $this->id . ', ';
- } else {
- $oid_str = '';
- }
+ $oid_str = $oids ? $this->id . ', ' : '';
return $this->selectSet(\sprintf(
'SELECT %s* FROM "%s"',
diff --git a/src/database/databasetraits/TriggerTrait.php b/src/database/databasetraits/TriggerTrait.php
index 1db15b1a..bfa89fd1 100644
--- a/src/database/databasetraits/TriggerTrait.php
+++ b/src/database/databasetraits/TriggerTrait.php
@@ -155,9 +155,7 @@ trait TriggerTrait
}
// Rule functions
-
// Operator Class functions
-
/**
* Edits a rule on a table OR view.
*
@@ -169,7 +167,7 @@ trait TriggerTrait
* @param string $type NOTHING for a do nothing rule, SOMETHING to use given action
* @param string $action The action to take
*
- * @return int|\PHPPgAdmin\ADORecordSet 0 if operation was successful
+ * @return int|ADORecordSet 0 if operation was successful
*/
public function setRule($name, $event, $table, $where, $instead, $type, $action)
{
diff --git a/src/decorators/ActionUrlDecorator.php b/src/decorators/ActionUrlDecorator.php
index 5eff0e8f..d680efb6 100644
--- a/src/decorators/ActionUrlDecorator.php
+++ b/src/decorators/ActionUrlDecorator.php
@@ -8,6 +8,11 @@ namespace PHPPgAdmin\Decorators;
class ActionUrlDecorator extends Decorator
{
+ public $base;
+ /**
+ * @var mixed
+ */
+ public $queryVars;
public function __construct($base, $queryVars = null)
{
$this->base = $base;
diff --git a/src/decorators/ArrayMergeDecorator.php b/src/decorators/ArrayMergeDecorator.php
index 75d4d104..645ae3bc 100644
--- a/src/decorators/ArrayMergeDecorator.php
+++ b/src/decorators/ArrayMergeDecorator.php
@@ -8,6 +8,7 @@ namespace PHPPgAdmin\Decorators;
class ArrayMergeDecorator extends Decorator
{
+ public $m;
public function __construct($arrays)
{
$this->m = $arrays;
diff --git a/src/decorators/BranchUrlDecorator.php b/src/decorators/BranchUrlDecorator.php
index f28ad2be..954de2fe 100644
--- a/src/decorators/BranchUrlDecorator.php
+++ b/src/decorators/BranchUrlDecorator.php
@@ -8,6 +8,11 @@ namespace PHPPgAdmin\Decorators;
class BranchUrlDecorator extends Decorator
{
+ public $base;
+ /**
+ * @var mixed
+ */
+ public $queryVars;
public function __construct($base, $queryVars = null)
{
$this->base = $base;
diff --git a/src/decorators/CallbackDecorator.php b/src/decorators/CallbackDecorator.php
index f6cd2bd5..844c0f94 100644
--- a/src/decorators/CallbackDecorator.php
+++ b/src/decorators/CallbackDecorator.php
@@ -10,6 +10,11 @@ use Closure;
class CallbackDecorator extends Decorator
{
+ /**
+ * @var \Closure|mixed
+ */
+ public $fn;
+ public $p;
public function __construct(Closure $callback, $param = null)
{
$this->fn = $callback;
diff --git a/src/decorators/ConcatDecorator.php b/src/decorators/ConcatDecorator.php
index 41124154..968fa67e 100644
--- a/src/decorators/ConcatDecorator.php
+++ b/src/decorators/ConcatDecorator.php
@@ -8,6 +8,7 @@ namespace PHPPgAdmin\Decorators;
class ConcatDecorator extends Decorator
{
+ public $c;
public function __construct($values)
{
$this->c = $values;
diff --git a/src/decorators/Decorator.php b/src/decorators/Decorator.php
index 347cf9b6..c95911e0 100644
--- a/src/decorators/Decorator.php
+++ b/src/decorators/Decorator.php
@@ -11,6 +11,7 @@ use PHPPgAdmin\Traits\HelperTrait;
class Decorator
{
+ public $val;
use HelperTrait;
public $container;
diff --git a/src/decorators/FieldDecorator.php b/src/decorators/FieldDecorator.php
index 325455fc..137a24c7 100644
--- a/src/decorators/FieldDecorator.php
+++ b/src/decorators/FieldDecorator.php
@@ -8,6 +8,11 @@ namespace PHPPgAdmin\Decorators;
class FieldDecorator extends Decorator
{
+ /**
+ * @var mixed|mixed[]
+ */
+ public $fieldName;
+ public $defaultValue;
public function __construct($fieldName, $defaultValue = null)
{
$this->fieldName = $fieldName;
diff --git a/src/decorators/IfEmptyDecorator.php b/src/decorators/IfEmptyDecorator.php
index 8116773d..9689825e 100644
--- a/src/decorators/IfEmptyDecorator.php
+++ b/src/decorators/IfEmptyDecorator.php
@@ -8,6 +8,12 @@ namespace PHPPgAdmin\Decorators;
class IfEmptyDecorator extends Decorator
{
+ public $val;
+ public $empty;
+ /**
+ * @var mixed
+ */
+ public $full;
public function __construct($value, $empty, $full = null)
{
$this->val = $value;
@@ -26,6 +32,6 @@ class IfEmptyDecorator extends Decorator
return Decorator::get_sanitized_value($this->empty, $fields);
}
- return isset($this->full) ? Decorator::get_sanitized_value($this->full, $fields) : $val;
+ return property_exists($this, 'full') && $this->full !== null ? Decorator::get_sanitized_value($this->full, $fields) : $val;
}
}
diff --git a/src/decorators/RedirectUrlDecorator.php b/src/decorators/RedirectUrlDecorator.php
index 47077623..6f824098 100644
--- a/src/decorators/RedirectUrlDecorator.php
+++ b/src/decorators/RedirectUrlDecorator.php
@@ -8,6 +8,11 @@ namespace PHPPgAdmin\Decorators;
class RedirectUrlDecorator extends Decorator
{
+ public $base;
+ /**
+ * @var mixed
+ */
+ public $queryVars;
public function __construct($base, $queryVars = null)
{
$this->base = $base;
diff --git a/src/decorators/ReplaceDecorator.php b/src/decorators/ReplaceDecorator.php
index 3680d8b2..846a385f 100644
--- a/src/decorators/ReplaceDecorator.php
+++ b/src/decorators/ReplaceDecorator.php
@@ -8,6 +8,11 @@ namespace PHPPgAdmin\Decorators;
class ReplaceDecorator extends Decorator
{
+ /**
+ * @var mixed
+ */
+ public $s;
+ public $p;
public function __construct($str, $params)
{
$this->s = $str;
diff --git a/src/decorators/UrlDecorator.php b/src/decorators/UrlDecorator.php
index cc22a4a1..19745627 100644
--- a/src/decorators/UrlDecorator.php
+++ b/src/decorators/UrlDecorator.php
@@ -8,6 +8,11 @@ namespace PHPPgAdmin\Decorators;
class UrlDecorator extends Decorator
{
+ public $base;
+ /**
+ * @var mixed
+ */
+ public $queryVars;
public function __construct($base, $queryVars = null)
{
$this->base = $base;
@@ -36,11 +41,8 @@ class UrlDecorator extends Decorator
$sep = '&';
}
}
-
-
- $url = \str_replace('//', '/', \containerInstance()->subFolder . '/' . $url);
- return $url;
+ return \str_replace('//', '/', \containerInstance()->subFolder . '/' . $url);
}
}
diff --git a/src/middleware/PopulateRequestResponse.php b/src/middleware/PopulateRequestResponse.php
index d3a7f5c6..92940334 100644
--- a/src/middleware/PopulateRequestResponse.php
+++ b/src/middleware/PopulateRequestResponse.php
@@ -54,24 +54,16 @@ class PopulateRequestResponse extends Middleware
$requestPath = $uri->getPath();
$view->offsetSet('query_string', $query_string);
- $path = $requestPath . ($query_string ? '?' . $query_string : '');
+ $path = $requestPath . ($query_string !== '' ? '?' . $query_string : '');
$view->offsetSet('path', $path);
$params = $request->getParams();
$viewparams = [];
- foreach ($params as $key => $value) {
- if (\is_scalar($value)) {
- $viewparams[$key] = $value;
- }
- }
+ $viewparams = array_filter($params, 'is_scalar');
- if (isset($_COOKIE['IN_TEST'])) {
- $in_test = (string) $_COOKIE['IN_TEST'];
- } else {
- $in_test = '0';
- }
+ $in_test = isset($_COOKIE['IN_TEST']) ? (string) $_COOKIE['IN_TEST'] : '0';
// remove tabs and linebreaks from query
if (isset($params['query'])) {
diff --git a/tests/_support/AcceptanceTester.php b/tests/_support/AcceptanceTester.php
index 3a798148..d81f02f5 100644
--- a/tests/_support/AcceptanceTester.php
+++ b/tests/_support/AcceptanceTester.php
@@ -1,7 +1,7 @@
<?php
/**
- * PHPPgAdmin 6.1.3
+ * PHPPgAdmin6
*/
/**
diff --git a/tests/_support/FunctionalTester.php b/tests/_support/FunctionalTester.php
index 36133270..ae2a8fd0 100644
--- a/tests/_support/FunctionalTester.php
+++ b/tests/_support/FunctionalTester.php
@@ -1,7 +1,7 @@
<?php
/**
- * PHPPgAdmin 6.1.3
+ * PHPPgAdmin6
*/
/**
diff --git a/tests/_support/Helper/Acceptance.php b/tests/_support/Helper/Acceptance.php
index 6645e3d9..3d9f12e4 100644
--- a/tests/_support/Helper/Acceptance.php
+++ b/tests/_support/Helper/Acceptance.php
@@ -1,7 +1,7 @@
<?php
/**
- * PHPPgAdmin 6.1.3
+ * PHPPgAdmin6
*/
namespace Helper;
diff --git a/tests/_support/Helper/Functional.php b/tests/_support/Helper/Functional.php
index 8aeab4ee..840edb48 100644
--- a/tests/_support/Helper/Functional.php
+++ b/tests/_support/Helper/Functional.php
@@ -1,7 +1,7 @@
<?php
/**
- * PHPPgAdmin 6.1.3
+ * PHPPgAdmin6
*/
namespace Helper;
diff --git a/tests/_support/Helper/Unit.php b/tests/_support/Helper/Unit.php
index aeabbe42..014b0a07 100644
--- a/tests/_support/Helper/Unit.php
+++ b/tests/_support/Helper/Unit.php
@@ -1,7 +1,7 @@
<?php
/**
- * PHPPgAdmin 6.1.3
+ * PHPPgAdmin6
*/
namespace Helper;
diff --git a/tests/_support/UnitTester.php b/tests/_support/UnitTester.php
index 551c7896..23df2c9c 100644
--- a/tests/_support/UnitTester.php
+++ b/tests/_support/UnitTester.php
@@ -1,7 +1,7 @@
<?php
/**
- * PHPPgAdmin 6.1.3
+ * PHPPgAdmin6
*/
/**
diff --git a/tests/_support/_generated/UnitTesterActions.php b/tests/_support/_generated/UnitTesterActions.php
index 9b7bd10e..4d0dda72 100644
--- a/tests/_support/_generated/UnitTesterActions.php
+++ b/tests/_support/_generated/UnitTesterActions.php
@@ -1,7 +1,7 @@
<?php
/**
- * PHPPgAdmin 6.1.3
+ * PHPPgAdmin6
*/
namespace _generated;
diff --git a/tests/unit/ContainerTest.php b/tests/unit/ContainerTest.php
index 7c7099a5..f1b6829f 100644
--- a/tests/unit/ContainerTest.php
+++ b/tests/unit/ContainerTest.php
@@ -1,7 +1,7 @@
<?php
/**
- * PHPPgAdmin 6.1.3
+ * PHPPgAdmin6
*/
/**
diff --git a/tests/unit/DataEntitiesTest.php b/tests/unit/DataEntitiesTest.php
index 42e25faf..405147cc 100644
--- a/tests/unit/DataEntitiesTest.php
+++ b/tests/unit/DataEntitiesTest.php
@@ -1,7 +1,7 @@
<?php
/**
- * PHPPgAdmin 6.1.3
+ * PHPPgAdmin6
*/
/**
diff --git a/tests/unit/PublicSectionsTest.php b/tests/unit/PublicSectionsTest.php
index 4d6a5215..f63c8ca8 100644
--- a/tests/unit/PublicSectionsTest.php
+++ b/tests/unit/PublicSectionsTest.php
@@ -1,7 +1,7 @@
<?php
/**
- * PHPPgAdmin 6.1.3
+ * PHPPgAdmin6
*/
/**
diff --git a/tests/unit/TablesAndViewsTest.php b/tests/unit/TablesAndViewsTest.php
index 050be021..d32fb6ff 100644
--- a/tests/unit/TablesAndViewsTest.php
+++ b/tests/unit/TablesAndViewsTest.php
@@ -1,7 +1,7 @@
<?php
/**
- * PHPPgAdmin 6.1.3
+ * PHPPgAdmin6
*/
/**
diff --git a/tests/unit/UserEntitiesTest.php b/tests/unit/UserEntitiesTest.php
index f9b0f310..066bdfc0 100644
--- a/tests/unit/UserEntitiesTest.php
+++ b/tests/unit/UserEntitiesTest.php
@@ -1,7 +1,7 @@
<?php
/**
- * PHPPgAdmin 6.1.3
+ * PHPPgAdmin6
*/
/**
diff --git a/tests/unit/ViewTest.php b/tests/unit/ViewTest.php
index 62acf634..f0a2b512 100644
--- a/tests/unit/ViewTest.php
+++ b/tests/unit/ViewTest.php
@@ -1,7 +1,7 @@
<?php
/**
- * PHPPgAdmin 6.1.3
+ * PHPPgAdmin6
*/
/**
diff --git a/tests/views/acinsert.php b/tests/views/acinsert.php
index de753ffc..bd956417 100644
--- a/tests/views/acinsert.php
+++ b/tests/views/acinsert.php
@@ -1,7 +1,7 @@
<?php
/**
- * PHPPgAdmin 6.1.3
+ * PHPPgAdmin6
*/
/**
diff --git a/tests/views/aggregates.php b/tests/views/aggregates.php
index 558be981..70ca3afc 100644
--- a/tests/views/aggregates.php
+++ b/tests/views/aggregates.php
@@ -1,7 +1,7 @@
<?php
/**
- * PHPPgAdmin 6.1.3
+ * PHPPgAdmin6
*/
// Include application functions
diff --git a/tests/views/alldb.php b/tests/views/alldb.php
index 016077db..7d93ebed 100644
--- a/tests/views/alldb.php
+++ b/tests/views/alldb.php
@@ -1,7 +1,7 @@
<?php
/**
- * PHPPgAdmin 6.1.3
+ * PHPPgAdmin6
*/
// Include application functions
diff --git a/tests/views/browser.php b/tests/views/browser.php
index adc08f62..6520a71e 100644
--- a/tests/views/browser.php
+++ b/tests/views/browser.php
@@ -1,7 +1,7 @@
<?php
/**
- * PHPPgAdmin 6.1.3
+ * PHPPgAdmin6
*/
/**
diff --git a/tests/views/casts.php b/tests/views/casts.php
index 181d1471..e9f39493 100644
--- a/tests/views/casts.php
+++ b/tests/views/casts.php
@@ -1,7 +1,7 @@
<?php
/**
- * PHPPgAdmin 6.1.3
+ * PHPPgAdmin6
*/
// Include application functions
diff --git a/tests/views/colproperties.php b/tests/views/colproperties.php
index 0ddd8472..4a25ddb6 100644
--- a/tests/views/colproperties.php
+++ b/tests/views/colproperties.php
@@ -1,7 +1,7 @@
<?php
/**
- * PHPPgAdmin 6.1.3
+ * PHPPgAdmin6
*/
// Include application functions
diff --git a/tests/views/constraints.php b/tests/views/constraints.php
index a9b27aa6..830175e8 100644
--- a/tests/views/constraints.php
+++ b/tests/views/constraints.php
@@ -1,7 +1,7 @@
<?php
/**
- * PHPPgAdmin 6.1.3
+ * PHPPgAdmin6
*/
// Include application functions
diff --git a/tests/views/conversions.php b/tests/views/conversions.php
index 9a278add..10783cd3 100644
--- a/tests/views/conversions.php
+++ b/tests/views/conversions.php
@@ -1,7 +1,7 @@
<?php
/**
- * PHPPgAdmin 6.1.3
+ * PHPPgAdmin6
*/
// Include application functions
diff --git a/tests/views/database.php b/tests/views/database.php
index 447c8727..383edda8 100644
--- a/tests/views/database.php
+++ b/tests/views/database.php
@@ -1,7 +1,7 @@
<?php
/**
- * PHPPgAdmin 6.1.3
+ * PHPPgAdmin6
*/
// Include application functions
diff --git a/tests/views/dataexport.php b/tests/views/dataexport.php
index 5b1ed004..ebe10843 100644
--- a/tests/views/dataexport.php
+++ b/tests/views/dataexport.php
@@ -1,7 +1,7 @@
<?php
/**
- * PHPPgAdmin 6.1.3
+ * PHPPgAdmin6
*/
/**
diff --git a/tests/views/dataimport.php b/tests/views/dataimport.php
index 1ff953e8..43eb7213 100644
--- a/tests/views/dataimport.php
+++ b/tests/views/dataimport.php
@@ -1,7 +1,7 @@
<?php
/**
- * PHPPgAdmin 6.1.3
+ * PHPPgAdmin6
*/
/**
diff --git a/tests/views/dbexport.php b/tests/views/dbexport.php
index fa6539f7..7f228225 100644
--- a/tests/views/dbexport.php
+++ b/tests/views/dbexport.php
@@ -1,7 +1,7 @@
<?php
/**
- * PHPPgAdmin 6.1.3
+ * PHPPgAdmin6
*/
/**
diff --git a/tests/views/display.php b/tests/views/display.php
index f8f1442a..ff193a06 100644
--- a/tests/views/display.php
+++ b/tests/views/display.php
@@ -1,7 +1,7 @@
<?php
/**
- * PHPPgAdmin 6.1.3
+ * PHPPgAdmin6
*/
// Include application functions
diff --git a/tests/views/domains.php b/tests/views/domains.php
index 62183885..a8dadd6a 100644
--- a/tests/views/domains.php
+++ b/tests/views/domains.php
@@ -1,7 +1,7 @@
<?php
/**
- * PHPPgAdmin 6.1.3
+ * PHPPgAdmin6
*/
// Include application functions
diff --git a/tests/views/fulltext.php b/tests/views/fulltext.php
index 26920f49..9451e120 100644
--- a/tests/views/fulltext.php
+++ b/tests/views/fulltext.php
@@ -1,7 +1,7 @@
<?php
/**
- * PHPPgAdmin 6.1.3
+ * PHPPgAdmin6
*/
// Include application functions
diff --git a/tests/views/functions.php b/tests/views/functions.php
index 23cadeaf..a9303b35 100644
--- a/tests/views/functions.php
+++ b/tests/views/functions.php
@@ -1,7 +1,7 @@
<?php
/**
- * PHPPgAdmin 6.1.3
+ * PHPPgAdmin6
*/
// Include application functions
diff --git a/tests/views/groups.php b/tests/views/groups.php
index 79696a67..e159ba56 100644
--- a/tests/views/groups.php
+++ b/tests/views/groups.php
@@ -1,7 +1,7 @@
<?php
/**
- * PHPPgAdmin 6.1.3
+ * PHPPgAdmin6
*/
// Include application functions
diff --git a/tests/views/help.php b/tests/views/help.php
index aa5c336d..7aa6f0e7 100644
--- a/tests/views/help.php
+++ b/tests/views/help.php
@@ -1,7 +1,7 @@
<?php
/**
- * PHPPgAdmin 6.1.3
+ * PHPPgAdmin6
*/
// Include application functions
diff --git a/tests/views/history.php b/tests/views/history.php
index a9b909e7..ee6468d6 100644
--- a/tests/views/history.php
+++ b/tests/views/history.php
@@ -1,7 +1,7 @@
<?php
/**
- * PHPPgAdmin 6.1.3
+ * PHPPgAdmin6
*/
// Include application functions
diff --git a/tests/views/indexes.php b/tests/views/indexes.php
index f05730bf..87e800a5 100644
--- a/tests/views/indexes.php
+++ b/tests/views/indexes.php
@@ -1,7 +1,7 @@
<?php
/**
- * PHPPgAdmin 6.1.3
+ * PHPPgAdmin6
*/
// Include application functions
diff --git a/tests/views/info.php b/tests/views/info.php
index 98592222..d22614ac 100644
--- a/tests/views/info.php
+++ b/tests/views/info.php
@@ -1,7 +1,7 @@
<?php
/**
- * PHPPgAdmin 6.1.3
+ * PHPPgAdmin6
*/
// Include application functions
diff --git a/tests/views/intro.php b/tests/views/intro.php
index e3939934..622b552c 100644
--- a/tests/views/intro.php
+++ b/tests/views/intro.php
@@ -1,7 +1,7 @@
<?php
/**
- * PHPPgAdmin 6.1.3
+ * PHPPgAdmin6
*/
/**
diff --git a/tests/views/languages.php b/tests/views/languages.php
index 952f5e3b..2a1df58b 100644
--- a/tests/views/languages.php
+++ b/tests/views/languages.php
@@ -1,7 +1,7 @@
<?php
/**
- * PHPPgAdmin 6.1.3
+ * PHPPgAdmin6
*/
// Include application functions
diff --git a/tests/views/login.php b/tests/views/login.php
index 0d2f023d..0a1c91e0 100644
--- a/tests/views/login.php
+++ b/tests/views/login.php
@@ -1,7 +1,7 @@
<?php
/**
- * PHPPgAdmin 6.1.3
+ * PHPPgAdmin6
*/
/**
diff --git a/tests/views/materializedviewproperties.php b/tests/views/materializedviewproperties.php
index 20088164..24aebaf4 100644
--- a/tests/views/materializedviewproperties.php
+++ b/tests/views/materializedviewproperties.php
@@ -1,7 +1,7 @@
<?php
/**
- * PHPPgAdmin 6.1.3
+ * PHPPgAdmin6
*/
// Include application functions
diff --git a/tests/views/materializedviews.php b/tests/views/materializedviews.php
index 239285c7..9a8a037b 100644
--- a/tests/views/materializedviews.php
+++ b/tests/views/materializedviews.php
@@ -1,7 +1,7 @@
<?php
/**
- * PHPPgAdmin 6.1.3
+ * PHPPgAdmin6
*/
// Include application functions
diff --git a/tests/views/opclasses.php b/tests/views/opclasses.php
index 1fcba912..97ce952a 100644
--- a/tests/views/opclasses.php
+++ b/tests/views/opclasses.php
@@ -1,7 +1,7 @@
<?php
/**
- * PHPPgAdmin 6.1.3
+ * PHPPgAdmin6
*/
// Include application functions
diff --git a/tests/views/operators.php b/tests/views/operators.php
index 0ef6d4c9..8ec017dc 100644
--- a/tests/views/operators.php
+++ b/tests/views/operators.php
@@ -1,7 +1,7 @@
<?php
/**
- * PHPPgAdmin 6.1.3
+ * PHPPgAdmin6
*/
// Include application functions
diff --git a/tests/views/privileges.php b/tests/views/privileges.php
index c7e65375..33a31bb3 100644
--- a/tests/views/privileges.php
+++ b/tests/views/privileges.php
@@ -1,7 +1,7 @@
<?php
/**
- * PHPPgAdmin 6.1.3
+ * PHPPgAdmin6
*/
/**
diff --git a/tests/views/roles.php b/tests/views/roles.php
index ef16b389..0ae0422c 100644
--- a/tests/views/roles.php
+++ b/tests/views/roles.php
@@ -1,7 +1,7 @@
<?php
/**
- * PHPPgAdmin 6.1.3
+ * PHPPgAdmin6
*/
// Include application functions
diff --git a/tests/views/rules.php b/tests/views/rules.php
index 03495c7d..e6b6a3b7 100644
--- a/tests/views/rules.php
+++ b/tests/views/rules.php
@@ -1,7 +1,7 @@
<?php
/**
- * PHPPgAdmin 6.1.3
+ * PHPPgAdmin6
*/
// Include application functions
diff --git a/tests/views/schemas.php b/tests/views/schemas.php
index a70c7d35..57acf203 100644
--- a/tests/views/schemas.php
+++ b/tests/views/schemas.php
@@ -1,7 +1,7 @@
<?php
/**
- * PHPPgAdmin 6.1.3
+ * PHPPgAdmin6
*/
// Include application functions
diff --git a/tests/views/sequences.php b/tests/views/sequences.php
index e6bd3d85..f65d59a0 100644
--- a/tests/views/sequences.php
+++ b/tests/views/sequences.php
@@ -1,7 +1,7 @@
<?php
/**
- * PHPPgAdmin 6.1.3
+ * PHPPgAdmin6
*/
// Include application functions
diff --git a/tests/views/servers.php b/tests/views/servers.php
index f914c811..4e22414f 100644
--- a/tests/views/servers.php
+++ b/tests/views/servers.php
@@ -1,7 +1,7 @@
<?php
/**
- * PHPPgAdmin 6.1.3
+ * PHPPgAdmin6
*/
/**
diff --git a/tests/views/sql.php b/tests/views/sql.php
index ee070943..7f44f1d7 100644
--- a/tests/views/sql.php
+++ b/tests/views/sql.php
@@ -1,7 +1,7 @@
<?php
/**
- * PHPPgAdmin 6.1.3
+ * PHPPgAdmin6
*/
// Include application functions
diff --git a/tests/views/sqledit.php b/tests/views/sqledit.php
index 9552a571..2cf52518 100644
--- a/tests/views/sqledit.php
+++ b/tests/views/sqledit.php
@@ -1,7 +1,7 @@
<?php
/**
- * PHPPgAdmin 6.1.3
+ * PHPPgAdmin6
*/
// Include application functions
diff --git a/tests/views/tables.php b/tests/views/tables.php
index 64de343d..86aba9da 100644
--- a/tests/views/tables.php
+++ b/tests/views/tables.php
@@ -1,7 +1,7 @@
<?php
/**
- * PHPPgAdmin 6.1.3
+ * PHPPgAdmin6
*/
/**
diff --git a/tests/views/tablespaces.php b/tests/views/tablespaces.php
index 9c034ff5..f4cbaf67 100644
--- a/tests/views/tablespaces.php
+++ b/tests/views/tablespaces.php
@@ -1,7 +1,7 @@
<?php
/**
- * PHPPgAdmin 6.1.3
+ * PHPPgAdmin6
*/
// Include application functions
diff --git a/tests/views/tblproperties.php b/tests/views/tblproperties.php
index d2b18404..af19b79c 100644
--- a/tests/views/tblproperties.php
+++ b/tests/views/tblproperties.php
@@ -1,7 +1,7 @@
<?php
/**
- * PHPPgAdmin 6.1.3
+ * PHPPgAdmin6
*/
// Include application functions
diff --git a/tests/views/triggers.php b/tests/views/triggers.php
index 57c34ed8..4ebe80f3 100644
--- a/tests/views/triggers.php
+++ b/tests/views/triggers.php
@@ -1,7 +1,7 @@
<?php
/**
- * PHPPgAdmin 6.1.3
+ * PHPPgAdmin6
*/
// Include application functions
diff --git a/tests/views/types.php b/tests/views/types.php
index 925fae99..0ed209ef 100644
--- a/tests/views/types.php
+++ b/tests/views/types.php
@@ -1,7 +1,7 @@
<?php
/**
- * PHPPgAdmin 6.1.3
+ * PHPPgAdmin6
*/
// Include application functions
diff --git a/tests/views/users.php b/tests/views/users.php
index 57204c79..5f3f0a40 100644
--- a/tests/views/users.php
+++ b/tests/views/users.php
@@ -1,7 +1,7 @@
<?php
/**
- * PHPPgAdmin 6.1.3
+ * PHPPgAdmin6
*/
// Include application functions
diff --git a/tests/views/viewproperties.php b/tests/views/viewproperties.php
index a1c6828b..10f9a45c 100644
--- a/tests/views/viewproperties.php
+++ b/tests/views/viewproperties.php
@@ -1,7 +1,7 @@
<?php
/**
- * PHPPgAdmin 6.1.3
+ * PHPPgAdmin6
*/
// Include application functions
diff --git a/tests/views/views.php b/tests/views/views.php
index 05cef4ac..72f9c890 100644
--- a/tests/views/views.php
+++ b/tests/views/views.php
@@ -1,7 +1,7 @@
<?php
/**
- * PHPPgAdmin 6.1.3
+ * PHPPgAdmin6
*/
// Include application functions
diff --git a/tools/phpcpd b/tools/phpcpd
index 8e085ba5..c4a647d8 120000
--- a/tools/phpcpd
+++ b/tools/phpcpd
@@ -1 +1 @@
-/home/ffflabs/.phive/phars/phpcpd-4.1.0.phar \ No newline at end of file
+/home/ffflabs/.phive/phars/phpcpd-6.0.2.phar \ No newline at end of file