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:
-rw-r--r--assets/js/jstree_events.js3
-rw-r--r--composer.json12
-rw-r--r--phpstan.neon2
-rw-r--r--psalm.xml2
-rw-r--r--src/Controller/AcinsertController.php (renamed from src/controllers/AcinsertController.php)0
-rw-r--r--src/Controller/AggregatesController.php (renamed from src/controllers/AggregatesController.php)5
-rw-r--r--src/Controller/AlldbController.php (renamed from src/controllers/AlldbController.php)4
-rw-r--r--src/Controller/BaseController.php (renamed from src/controllers/BaseController.php)54
-rw-r--r--src/Controller/BrowserController.php (renamed from src/controllers/BrowserController.php)4
-rw-r--r--src/Controller/CastsController.php (renamed from src/controllers/CastsController.php)1
-rw-r--r--src/Controller/ColpropertiesController.php (renamed from src/controllers/ColpropertiesController.php)238
-rw-r--r--src/Controller/ConstraintsController.php (renamed from src/controllers/ConstraintsController.php)3
-rw-r--r--src/Controller/ConversionsController.php (renamed from src/controllers/ConversionsController.php)1
-rw-r--r--src/Controller/DatabaseController.php (renamed from src/controllers/DatabaseController.php)2
-rw-r--r--src/Controller/DataexportController.php (renamed from src/controllers/DataexportController.php)2
-rw-r--r--src/Controller/DataimportController.php (renamed from src/controllers/DataimportController.php)0
-rw-r--r--src/Controller/DbexportController.php (renamed from src/controllers/DbexportController.php)0
-rw-r--r--src/Controller/DisplayController.php (renamed from src/controllers/DisplayController.php)15
-rw-r--r--src/Controller/DomainsController.php (renamed from src/controllers/DomainsController.php)5
-rw-r--r--src/Controller/FulltextController.php (renamed from src/controllers/FulltextController.php)10
-rw-r--r--src/Controller/FunctionsController.php (renamed from src/controllers/FunctionsController.php)7
-rw-r--r--src/Controller/GroupsController.php (renamed from src/controllers/GroupsController.php)4
-rw-r--r--src/Controller/HelpController.php (renamed from src/controllers/HelpController.php)6
-rw-r--r--src/Controller/HistoryController.php (renamed from src/controllers/HistoryController.php)8
-rw-r--r--src/Controller/IndexesController.php (renamed from src/controllers/IndexesController.php)6
-rw-r--r--src/Controller/InfoController.php (renamed from src/controllers/InfoController.php)15
-rw-r--r--src/Controller/IntroController.php (renamed from src/controllers/IntroController.php)0
-rw-r--r--src/Controller/LanguagesController.php (renamed from src/controllers/LanguagesController.php)1
-rw-r--r--src/Controller/LoginController.php (renamed from src/controllers/LoginController.php)10
-rw-r--r--src/Controller/MaterializedviewpropertiesController.php (renamed from src/controllers/MaterializedviewpropertiesController.php)0
-rw-r--r--src/Controller/MaterializedviewsController.php (renamed from src/controllers/MaterializedviewsController.php)3
-rw-r--r--src/Controller/OpclassesController.php (renamed from src/controllers/OpclassesController.php)4
-rw-r--r--src/Controller/OperatorsController.php (renamed from src/controllers/OperatorsController.php)6
-rw-r--r--src/Controller/PrivilegesController.php (renamed from src/controllers/PrivilegesController.php)7
-rw-r--r--src/Controller/RolesController.php (renamed from src/controllers/RolesController.php)8
-rw-r--r--src/Controller/RulesController.php (renamed from src/controllers/RulesController.php)2
-rw-r--r--src/Controller/SchemasController.php (renamed from src/controllers/SchemasController.php)2
-rw-r--r--src/Controller/SequencesController.php (renamed from src/controllers/SequencesController.php)13
-rw-r--r--src/Controller/ServersController.php (renamed from src/controllers/ServersController.php)19
-rw-r--r--src/Controller/SqlController.php (renamed from src/controllers/SqlController.php)14
-rw-r--r--src/Controller/SqleditController.php (renamed from src/controllers/SqleditController.php)0
-rw-r--r--src/Controller/TablesController.php (renamed from src/controllers/TablesController.php)32
-rw-r--r--src/Controller/TablespacesController.php (renamed from src/controllers/TablespacesController.php)2
-rw-r--r--src/Controller/TblpropertiesController.php (renamed from src/controllers/TblpropertiesController.php)3
-rw-r--r--src/Controller/TreeController.php (renamed from src/controllers/TreeController.php)41
-rw-r--r--src/Controller/TriggersController.php (renamed from src/controllers/TriggersController.php)2
-rw-r--r--src/Controller/TypesController.php (renamed from src/controllers/TypesController.php)7
-rw-r--r--src/Controller/UsersController.php (renamed from src/controllers/UsersController.php)4
-rw-r--r--src/Controller/ViewpropertiesController.php (renamed from src/controllers/ViewpropertiesController.php)20
-rw-r--r--src/Controller/ViewsController.php (renamed from src/controllers/ViewsController.php)4
-rw-r--r--src/Core/ADONewConnection.php (renamed from src/classes/ADONewConnection.php)4
-rw-r--r--src/Core/ADORecordSet.php (renamed from src/classes/ADORecordSet.php)4
-rw-r--r--src/Core/ADOdbException.php (renamed from src/classes/ADOdbException.php)4
-rw-r--r--src/Core/ArrayRecordset.php (renamed from src/classes/ArrayRecordSet.php)16
-rw-r--r--src/Core/CheckStyleRenderer.php (renamed from src/classes/CheckStyleRenderer.php)2
-rw-r--r--src/Core/Connection.php (renamed from src/classes/Connection.php)10
-rw-r--r--src/Core/ContainerHandlers.php (renamed from src/classes/ContainerHandlers.php)2
-rw-r--r--src/Core/ContainerUtils.php (renamed from src/classes/ContainerUtils.php)20
-rw-r--r--src/Core/Misc.php (renamed from src/classes/Misc.php)28
-rw-r--r--src/Core/Translations.php (renamed from src/classes/Translations.php)12
-rw-r--r--src/Core/ViewManager.php (renamed from src/classes/ViewManager.php)24
-rw-r--r--src/Database/ADOdbBase.php (renamed from src/database/ADOdbBase.php)10
-rw-r--r--src/Database/Postgres.php (renamed from src/database/Postgres.php)8
-rw-r--r--src/Database/Postgres10.php (renamed from src/database/Postgres10.php)0
-rw-r--r--src/Database/Postgres11.php (renamed from src/database/Postgres11.php)0
-rw-r--r--src/Database/Postgres12.php (renamed from src/database/Postgres12.php)0
-rw-r--r--src/Database/Postgres13.php (renamed from src/database/Postgres13.php)0
-rw-r--r--src/Database/Postgres90.php (renamed from src/database/Postgres90.php)0
-rw-r--r--src/Database/Postgres91.php (renamed from src/database/Postgres91.php)0
-rw-r--r--src/Database/Postgres92.php (renamed from src/database/Postgres92.php)0
-rw-r--r--src/Database/Postgres93.php (renamed from src/database/Postgres93.php)0
-rw-r--r--src/Database/Postgres94.php (renamed from src/database/Postgres94.php)0
-rw-r--r--src/Database/Postgres95.php (renamed from src/database/Postgres95.php)0
-rw-r--r--src/Database/Postgres96.php (renamed from src/database/Postgres96.php)0
-rw-r--r--src/Database/Traits/AggregateTrait.php (renamed from src/database/databasetraits/AggregateTrait.php)0
-rw-r--r--src/Database/Traits/ColumnTrait.php (renamed from src/database/databasetraits/ColumnTrait.php)0
-rw-r--r--src/Database/Traits/DatabaseTrait.php (renamed from src/database/databasetraits/DatabaseTrait.php)0
-rw-r--r--src/Database/Traits/DomainTrait.php (renamed from src/database/databasetraits/DomainTrait.php)0
-rw-r--r--src/Database/Traits/FtsTrait.php (renamed from src/database/databasetraits/FtsTrait.php)0
-rw-r--r--src/Database/Traits/FunctionTrait.php (renamed from src/database/databasetraits/FunctionTrait.php)0
-rw-r--r--src/Database/Traits/HasTrait.php (renamed from src/database/databasetraits/HasTrait.php)0
-rw-r--r--src/Database/Traits/IndexTrait.php (renamed from src/database/databasetraits/IndexTrait.php)0
-rw-r--r--src/Database/Traits/OperatorTrait.php (renamed from src/database/databasetraits/OperatorTrait.php)0
-rw-r--r--src/Database/Traits/PrivilegesTrait.php (renamed from src/database/databasetraits/PrivilegesTrait.php)0
-rw-r--r--src/Database/Traits/RoleTrait.php (renamed from src/database/databasetraits/RoleTrait.php)0
-rw-r--r--src/Database/Traits/RowTrait.php (renamed from src/database/databasetraits/RowTrait.php)0
-rw-r--r--src/Database/Traits/SchemaTrait.php (renamed from src/database/databasetraits/SchemaTrait.php)0
-rw-r--r--src/Database/Traits/SequenceTrait.php (renamed from src/database/databasetraits/SequenceTrait.php)0
-rw-r--r--src/Database/Traits/StatsTrait.php (renamed from src/database/databasetraits/StatsTrait.php)0
-rw-r--r--src/Database/Traits/TableTrait.php (renamed from src/database/databasetraits/TableTrait.php)99
-rw-r--r--src/Database/Traits/TablespaceTrait.php (renamed from src/database/databasetraits/TablespaceTrait.php)0
-rw-r--r--src/Database/Traits/TriggerTrait.php (renamed from src/database/databasetraits/TriggerTrait.php)0
-rw-r--r--src/Database/Traits/TypeTrait.php (renamed from src/database/databasetraits/TypeTrait.php)0
-rw-r--r--src/Database/Traits/ViewTrait.php (renamed from src/database/databasetraits/ViewTrait.php)26
-rw-r--r--src/Decorators/ActionUrlDecorator.php (renamed from src/decorators/ActionUrlDecorator.php)0
-rw-r--r--src/Decorators/ArrayMergeDecorator.php (renamed from src/decorators/ArrayMergeDecorator.php)0
-rw-r--r--src/Decorators/BranchUrlDecorator.php (renamed from src/decorators/BranchUrlDecorator.php)0
-rw-r--r--src/Decorators/CallbackDecorator.php (renamed from src/decorators/CallbackDecorator.php)0
-rw-r--r--src/Decorators/ConcatDecorator.php (renamed from src/decorators/ConcatDecorator.php)0
-rw-r--r--src/Decorators/Decorator.php (renamed from src/decorators/Decorator.php)107
-rw-r--r--src/Decorators/FieldDecorator.php (renamed from src/decorators/FieldDecorator.php)0
-rw-r--r--src/Decorators/IfEmptyDecorator.php (renamed from src/decorators/IfEmptyDecorator.php)0
-rw-r--r--src/Decorators/RedirectUrlDecorator.php (renamed from src/decorators/RedirectUrlDecorator.php)0
-rw-r--r--src/Decorators/ReplaceDecorator.php (renamed from src/decorators/ReplaceDecorator.php)0
-rw-r--r--src/Decorators/UrlDecorator.php (renamed from src/decorators/UrlDecorator.php)0
-rw-r--r--src/Help/PostgresDoc.php (renamed from src/help/PostgresDoc.php)0
-rw-r--r--src/Help/PostgresDoc10.php (renamed from src/help/PostgresDoc10.php)0
-rw-r--r--src/Help/PostgresDoc11.php (renamed from src/help/PostgresDoc11.php)0
-rw-r--r--src/Help/PostgresDoc12.php (renamed from src/help/PostgresDoc12.php)0
-rw-r--r--src/Help/PostgresDoc90.php (renamed from src/help/PostgresDoc90.php)0
-rw-r--r--src/Help/PostgresDoc91.php (renamed from src/help/PostgresDoc91.php)0
-rw-r--r--src/Help/PostgresDoc92.php (renamed from src/help/PostgresDoc92.php)0
-rw-r--r--src/Help/PostgresDoc93.php (renamed from src/help/PostgresDoc93.php)0
-rw-r--r--src/Help/PostgresDoc94.php (renamed from src/help/PostgresDoc94.php)0
-rw-r--r--src/Help/PostgresDoc95.php (renamed from src/help/PostgresDoc95.php)0
-rw-r--r--src/Help/PostgresDoc96.php (renamed from src/help/PostgresDoc96.php)0
-rw-r--r--src/Interfaces/RecordSet.php (renamed from src/interfaces/RecordSet.php)0
-rw-r--r--src/Middleware/Middleware.php (renamed from src/middleware/Middleware.php)0
-rw-r--r--src/Middleware/PopulateRequestResponse.php (renamed from src/middleware/PopulateRequestResponse.php)4
-rw-r--r--src/Traits/AdminTrait.php (renamed from src/traits/AdminTrait.php)14
-rw-r--r--src/Traits/ExportTrait.php (renamed from src/traits/ExportTrait.php)0
-rw-r--r--src/Traits/FormTrait.php (renamed from src/traits/FormTrait.php)0
-rw-r--r--src/Traits/HelperTrait.php (renamed from src/traits/HelperTrait.php)0
-rw-r--r--src/Traits/InsertEditRowTrait.php (renamed from src/traits/InsertEditRowTrait.php)0
-rw-r--r--src/Traits/MiscTrait.php (renamed from src/traits/MiscTrait.php)9
-rw-r--r--src/Traits/ServersTrait.php (renamed from src/traits/ServersTrait.php)8
-rw-r--r--src/Traits/ViewsMatViewsPropertiesTrait.php (renamed from src/traits/ViewsMatViewsPropertiesTrait.php)0
-rw-r--r--src/Traits/ViewsMatviewsTrait.php (renamed from src/traits/ViewsMatviewsTrait.php)3
-rw-r--r--src/Translations/AbstractLang.php (renamed from src/translations/AbstractLang.php)0
-rw-r--r--src/Translations/Afrikaans.php (renamed from src/translations/Afrikaans.php)0
-rw-r--r--src/Translations/Arabic.php (renamed from src/translations/Arabic.php)0
-rw-r--r--src/Translations/Catalan.php (renamed from src/translations/Catalan.php)0
-rw-r--r--src/Translations/ChineseSim.php (renamed from src/translations/ChineseSim.php)0
-rw-r--r--src/Translations/ChineseTr.php (renamed from src/translations/ChineseTr.php)0
-rw-r--r--src/Translations/ChineseUtf8ZhCn.php (renamed from src/translations/ChineseUtf8ZhCn.php)0
-rw-r--r--src/Translations/ChineseUtf8ZhTw.php (renamed from src/translations/ChineseUtf8ZhTw.php)0
-rw-r--r--src/Translations/Czech.php (renamed from src/translations/Czech.php)0
-rw-r--r--src/Translations/Danish.php (renamed from src/translations/Danish.php)0
-rw-r--r--src/Translations/Dutch.php (renamed from src/translations/Dutch.php)0
-rw-r--r--src/Translations/English.php (renamed from src/translations/English.php)0
-rw-r--r--src/Translations/French.php (renamed from src/translations/French.php)0
-rw-r--r--src/Translations/Galician.php (renamed from src/translations/Galician.php)0
-rw-r--r--src/Translations/German.php (renamed from src/translations/German.php)0
-rw-r--r--src/Translations/Greek.php (renamed from src/translations/Greek.php)0
-rw-r--r--src/Translations/Hebrew.php (renamed from src/translations/Hebrew.php)0
-rw-r--r--src/Translations/Hungarian.php (renamed from src/translations/Hungarian.php)0
-rw-r--r--src/Translations/Italian.php (renamed from src/translations/Italian.php)0
-rw-r--r--src/Translations/Japanese.php (renamed from src/translations/Japanese.php)0
-rw-r--r--src/Translations/Lithuanian.php (renamed from src/translations/Lithuanian.php)0
-rw-r--r--src/Translations/Mongol.php (renamed from src/translations/Mongol.php)0
-rw-r--r--src/Translations/Polish.php (renamed from src/translations/Polish.php)0
-rw-r--r--src/Translations/PortugueseBr.php (renamed from src/translations/PortugueseBr.php)0
-rw-r--r--src/Translations/PortuguesePt.php (renamed from src/translations/PortuguesePt.php)0
-rw-r--r--src/Translations/Romanian.php (renamed from src/translations/Romanian.php)0
-rw-r--r--src/Translations/Russian.php (renamed from src/translations/Russian.php)0
-rw-r--r--src/Translations/RussianUtf8.php (renamed from src/translations/RussianUtf8.php)0
-rw-r--r--src/Translations/Slovak.php (renamed from src/translations/Slovak.php)0
-rw-r--r--src/Translations/Spanish.php (renamed from src/translations/Spanish.php)0
-rw-r--r--src/Translations/Swedish.php (renamed from src/translations/Swedish.php)0
-rw-r--r--src/Translations/Turkish.php (renamed from src/translations/Turkish.php)0
-rw-r--r--src/Translations/Ukrainian.php (renamed from src/translations/Ukrainian.php)0
-rw-r--r--src/XHtml/HTMLController.php (renamed from src/xhtml/HTMLController.php)17
-rw-r--r--src/XHtml/HTMLFooterController.php (renamed from src/xhtml/HTMLFooterController.php)40
-rw-r--r--src/XHtml/HTMLHeaderController.php (renamed from src/xhtml/HTMLHeaderController.php)0
-rw-r--r--src/XHtml/HTMLNavbarController.php (renamed from src/xhtml/HTMLNavbarController.php)14
-rw-r--r--src/XHtml/HTMLTableController.php (renamed from src/xhtml/HTMLTableController.php)82
-rw-r--r--src/XHtml/XHtmlButton.php (renamed from src/xhtml/XHtmlButton.php)0
-rw-r--r--src/XHtml/XHtmlElement.php (renamed from src/xhtml/XHtmlElement.php)0
-rw-r--r--src/XHtml/XHtmlOption.php (renamed from src/xhtml/XHtmlOption.php)0
-rw-r--r--src/XHtml/XHtmlSelect.php (renamed from src/xhtml/XHtmlSelect.php)0
-rw-r--r--src/XHtml/XHtmlSimpleElement.php (renamed from src/xhtml/XHtmlSimpleElement.php)0
-rw-r--r--src/lib.inc.php2
-rw-r--r--src/router.php16
-rw-r--r--tests/Unit/ContainerTest.php4
174 files changed, 611 insertions, 591 deletions
diff --git a/assets/js/jstree_events.js b/assets/js/jstree_events.js
index 651dc62d..776a0223 100644
--- a/assets/js/jstree_events.js
+++ b/assets/js/jstree_events.js
@@ -72,8 +72,7 @@ $('#lazy').on('state_ready.jstree', function (e, data) {
});
});
$('#lazy').on('loaded.jstree', function (e, data) {
- console.log('loaded');
- $('#lazy').data('jstree').show_dots();
+ data.instance.show_dots();
});
$('#lazy').on('click', '.jstree-anchor', function () {
console.log(this);
diff --git a/composer.json b/composer.json
index f24b9cfd..63e8c7b7 100644
--- a/composer.json
+++ b/composer.json
@@ -48,17 +48,7 @@
},
"autoload": {
"psr-4": {
- "PHPPgAdmin\\": "src/classes",
- "PHPPgAdmin\\Controller\\": "src/controllers",
- "PHPPgAdmin\\Middleware\\": "src/middleware",
- "PHPPgAdmin\\Database\\": "src/database",
- "PHPPgAdmin\\XHtml\\": "src/xhtml",
- "PHPPgAdmin\\Decorators\\": "src/decorators",
- "PHPPgAdmin\\Traits\\": "src/traits",
- "PHPPgAdmin\\Database\\Traits\\": "src/database/databasetraits",
- "PHPPgAdmin\\Help\\": "src/help",
- "PHPPgAdmin\\Translations\\": "src/translations",
- "PHPPgAdmin\\Interfaces\\": "src/interfaces"
+ "PHPPgAdmin\\": "src"
},
"files": [
"src/lib.inc.php",
diff --git a/phpstan.neon b/phpstan.neon
index b806dc12..82e75587 100644
--- a/phpstan.neon
+++ b/phpstan.neon
@@ -25,7 +25,7 @@ parameters:
- assets/*
- temp/*
- vendor/*
- - src/classes/ADO*
+ - src/Core/ADO*
- src/router.php
reportUnmatchedIgnoredErrors: false
diff --git a/psalm.xml b/psalm.xml
index f882d4c0..7eba1674 100644
--- a/psalm.xml
+++ b/psalm.xml
@@ -7,7 +7,7 @@
<ignoreFiles>
<directory name="vendor" />
<directory name="temp" />
- <directory name="src/translations" />
+ <directory name="src/Translations" />
</ignoreFiles>
</projectFiles>
diff --git a/src/controllers/AcinsertController.php b/src/Controller/AcinsertController.php
index 94415d32..94415d32 100644
--- a/src/controllers/AcinsertController.php
+++ b/src/Controller/AcinsertController.php
diff --git a/src/controllers/AggregatesController.php b/src/Controller/AggregatesController.php
index 0be4c556..428621ca 100644
--- a/src/controllers/AggregatesController.php
+++ b/src/Controller/AggregatesController.php
@@ -184,7 +184,8 @@ class AggregatesController extends BaseController
'content' => $this->lang['strcreateaggregate'],
],
];
-return $this->printNavLinks($navlinks, $this->table_place, \get_defined_vars());
+
+ return $this->printNavLinks($navlinks, $this->table_place, \get_defined_vars());
}
/**
@@ -676,6 +677,6 @@ return $this->printNavLinks($navlinks, $this->table_place, \get_defined_vars())
'content' => $this->lang['strdrop'],
];
-return $this->printNavLinks($navlinks, 'aggregates-properties', \get_defined_vars());
+ return $this->printNavLinks($navlinks, 'aggregates-properties', \get_defined_vars());
}
}
diff --git a/src/controllers/AlldbController.php b/src/Controller/AlldbController.php
index 1d525900..96d67352 100644
--- a/src/controllers/AlldbController.php
+++ b/src/Controller/AlldbController.php
@@ -238,7 +238,8 @@ class AlldbController extends BaseController
'content' => $this->lang['strcreatedatabase'],
],
];
-return $this->printNavLinks($navlinks, $this->table_place, \get_defined_vars());
+
+ return $this->printNavLinks($navlinks, $this->table_place, \get_defined_vars());
}
/**
@@ -255,6 +256,7 @@ return $this->printNavLinks($navlinks, $this->table_place, \get_defined_vars())
$attrs = [
'text' => Decorator::field('datname'),
'icon' => 'Database',
+
'toolTip' => Decorator::field('datcomment'),
'action' => Decorator::redirecturl('redirect', $reqvars, ['subject' => 'database', 'database' => Decorator::field('datname')]),
'branch' => Decorator::url('/src/views/database', $reqvars, ['action' => 'tree', 'database' => Decorator::field('datname')]),
diff --git a/src/controllers/BaseController.php b/src/Controller/BaseController.php
index b2a79dd7..81a4403b 100644
--- a/src/controllers/BaseController.php
+++ b/src/Controller/BaseController.php
@@ -7,11 +7,11 @@
namespace PHPPgAdmin\Controller;
use IteratorAggregate;
-use PHPPgAdmin\ArrayRecordSet;
-use PHPPgAdmin\ContainerUtils;
-use PHPPgAdmin\Misc;
+use PHPPgAdmin\Core\ArrayRecordset;
+use PHPPgAdmin\Core\ContainerUtils;
+use PHPPgAdmin\Core\Misc;
+use PHPPgAdmin\Core\ViewManager;
use PHPPgAdmin\Traits\HelperTrait;
-use PHPPgAdmin\ViewManager;
use PHPPgAdmin\XHtml;
use PHPPgAdmin\XHtml\HTMLFooterController;
use PHPPgAdmin\XHtml\HTMLHeaderController;
@@ -244,7 +244,7 @@ class BaseController
*
* @param array $tabs The tabs
*
- * @return ArrayRecordSet filtered tabs in the form of an ArrayRecordSet
+ * @return ArrayRecordset filtered tabs in the form of an ArrayRecordSet
*/
public function adjustTabsForTree(&$tabs)
{
@@ -257,19 +257,18 @@ class BaseController
* Produce JSON data for the browser tree.
*
* @param \ADORecordSet|\PHPPgAdmin\Interfaces\RecordSet $_treedata
- * @param false|string $section
- * @param bool $print either to return or echo the result
+ * @param false|string $section
+ * @param bool $print either to return or echo the result
+ * @param mixed $attrs
*
* @return (array|bool|string)[]
*
* @psalm-return array<int|string, array<string, mixed>|bool|string>
*/
- public function printTree(&$_treedata, &$attrs, $section, $print = true)
+ public function printTree(IteratorAggregate &$_treedata, &$attrs, $section, $print = true)
{
- $tree = $this->_getTreeController();
+ $parent = $this->_getTreeController()->printTree($_treedata, $attrs, $section);
- $parent= $tree->printTree($_treedata, $attrs, $section);
-
if ($print) {
if (isset($_REQUEST['children'])) {
$children = $parent;
@@ -282,6 +281,7 @@ class BaseController
->withStatus(200)
->withJson($parent);
}
+
return $parent;
}
@@ -298,12 +298,11 @@ class BaseController
$from = __METHOD__;
$html_trail = $this->_getNavbarController();
- return tap( $html_trail->printTrail($trail ),function(?string $html) use ($do_print){
- if($do_print) {
-
+ return tap($html_trail->printTrail($trail), static function (?string $html) use ($do_print) {
+ if ($do_print) {
echo $html;
}
- } );
+ });
}
/**
@@ -317,12 +316,11 @@ class BaseController
$from = __METHOD__;
$footer_controller = $this->_getFooterController();
- return tap($footer_controller->printNavLinks($navlinks, $place, $env, $from),function(?string $navLinksHtml) use ($do_print){
- if($do_print) {
-
+ return tap($footer_controller->printNavLinks($navlinks, $place, $env, $from), static function (?string $navLinksHtml) use ($do_print) {
+ if ($do_print) {
echo $navLinksHtml;
}
- } );
+ });
}
public function printTabs(string $tabs, string $activetab, bool $do_print = true)
@@ -330,11 +328,11 @@ class BaseController
$from = __METHOD__;
$html_trail = $this->_getNavbarController();
- return tap($html_trail->printTabs($tabs, $activetab, false, $from),function(?string $html) use ($do_print){
- if($do_print) {
+ return tap($html_trail->printTabs($tabs, $activetab, false, $from), static function (?string $html) use ($do_print) {
+ if ($do_print) {
echo $html;
}
- } );
+ });
}
/**
@@ -351,11 +349,11 @@ class BaseController
$html_trail = $this->_getNavbarController();
- return tap($html_trail->printLink($link, $do_print, $from),function(?string $html) use ($do_print){
- if($do_print) {
+ return tap($html_trail->printLink($link, $do_print, $from), static function (?string $html) use ($do_print) {
+ if ($do_print) {
echo $html;
}
- } );
+ });
}
/**
@@ -394,7 +392,7 @@ class BaseController
public function printReload($database, $do_print = true)
{
- return '';
+ return '';
}
/**
@@ -443,7 +441,7 @@ class BaseController
$title = '' !== $title ? $title : $this->headerTitle();
$header_controller = $this->_getHeaderController();
- return $header_controller->printHeader($title, $script, $do_print, $template);
+ return $header_controller->printHeader($title, $script, $do_print, $template);
}
/**
@@ -467,7 +465,7 @@ class BaseController
{
$header_controller = $this->_getHeaderController();
- return $header_controller->printTitle($title, $help, $do_print);
+ return $header_controller->printTitle($title, $help, $do_print);
}
/**
diff --git a/src/controllers/BrowserController.php b/src/Controller/BrowserController.php
index 64fadb58..e98933c6 100644
--- a/src/controllers/BrowserController.php
+++ b/src/Controller/BrowserController.php
@@ -6,7 +6,7 @@
namespace PHPPgAdmin\Controller;
-use PHPPgAdmin\ArrayRecordSet;
+use PHPPgAdmin\Core\ArrayRecordset;
use PHPPgAdmin\Decorators\Decorator;
/**
@@ -68,7 +68,7 @@ class BrowserController extends BaseController
*/
public function doTree()
{
- $treedata = new ArrayRecordSet([]);
+ $treedata = new ArrayRecordset([]);
$reqvars = [];
$action = Decorator::url('/src/views/servers');
$branch = Decorator::url('/src/views/servers', $reqvars, ['action' => 'tree']);
diff --git a/src/controllers/CastsController.php b/src/Controller/CastsController.php
index ac82dd1a..f89c0e24 100644
--- a/src/controllers/CastsController.php
+++ b/src/Controller/CastsController.php
@@ -93,6 +93,7 @@ class CastsController extends BaseController
if (self::isRecordset($casts)) {
echo $this->printTable($casts, $columns, $actions, 'casts-casts', $this->lang['strnocasts']);
}
+
return '';
}
diff --git a/src/controllers/ColpropertiesController.php b/src/Controller/ColpropertiesController.php
index 06d4ccaa..680684e6 100644
--- a/src/controllers/ColpropertiesController.php
+++ b/src/Controller/ColpropertiesController.php
@@ -66,7 +66,7 @@ class ColpropertiesController extends BaseController
* @param string $msg message to display
* @param bool $isTable tells if we're showing table properties
*/
- public function doDefault($msg = '', $isTable = true)
+ public function doDefault($msg = '', $isTable = true)
{
if (!isset($_REQUEST['table']) || empty($_REQUEST['table'])) {
$isTable = false;
@@ -89,144 +89,142 @@ class ColpropertiesController extends BaseController
$this->printTabs('column', 'properties');
$this->printMsg($msg);
- if (empty($_REQUEST['column'])){
+ if (empty($_REQUEST['column'])) {
return '';
- }
- // Get table
- $tdata = $data->getTable($this->tableName);
- // Get columns
- $attrs = $data->getTableAttributes($this->tableName, $_REQUEST['column']);
-
- // Show comment if any
- if (null !== $attrs->fields['comment']) {
- echo '<p class="comment">', $this->misc->printVal($attrs->fields['comment']), '</p>' . \PHP_EOL;
- }
+ }
+ // Get table
+ $tdata = $data->getTable($this->tableName);
+ // Get columns
+ $attrs = $data->getTableAttributes($this->tableName, $_REQUEST['column']);
+
+ // Show comment if any
+ if (null !== $attrs->fields['comment']) {
+ echo '<p class="comment">', $this->misc->printVal($attrs->fields['comment']), '</p>' . \PHP_EOL;
+ }
- $column = [
- 'column' => [
- 'title' => $this->lang['strcolumn'],
- 'field' => Decorator::field('attname'),
- ],
- 'type' => [
- 'title' => $this->lang['strtype'],
- 'field' => Decorator::field('+type'),
- ],
+ $column = [
+ 'column' => [
+ 'title' => $this->lang['strcolumn'],
+ 'field' => Decorator::field('attname'),
+ ],
+ 'type' => [
+ 'title' => $this->lang['strtype'],
+ 'field' => Decorator::field('+type'),
+ ],
+ ];
+
+ if ($isTable) {
+ $column['notnull'] = [
+ 'title' => $this->lang['strnotnull'],
+ 'field' => Decorator::field('attnotnull'),
+ 'type' => 'bool',
+ 'params' => ['true' => 'NOT NULL', 'false' => ''],
];
+ $column['default'] = [
+ 'title' => $this->lang['strdefault'],
+ 'field' => Decorator::field('adsrc'),
+ ];
+ }
- if ($isTable) {
- $column['notnull'] = [
- 'title' => $this->lang['strnotnull'],
- 'field' => Decorator::field('attnotnull'),
- 'type' => 'bool',
- 'params' => ['true' => 'NOT NULL', 'false' => ''],
- ];
- $column['default'] = [
- 'title' => $this->lang['strdefault'],
- 'field' => Decorator::field('adsrc'),
- ];
- }
-
- $actions = [];
+ $actions = [];
- if (self::isRecordset($attrs)) {
- echo $this->printTable($attrs, $column, $actions, $this->table_place, $this->lang['strnodata'], $attPre);
- }
+ if (self::isRecordset($attrs)) {
+ echo $this->printTable($attrs, $column, $actions, $this->table_place, $this->lang['strnodata'], $attPre);
+ }
- echo '<br />' . \PHP_EOL;
-
- $f_attname = $_REQUEST['column'];
- $f_table = $this->tableName;
- $f_schema = $data->_schema;
- $data->fieldClean($f_attname);
- $data->fieldClean($f_table);
- $data->fieldClean($f_schema);
-
- if ($isTable) {
- $navlinks = [
- 'browse' => [
- 'attr' => [
- 'href' => [
- 'url' => 'display',
- 'method' => 'post',
- 'urlvars' => [
- 'subject' => 'column',
- 'server' => $_REQUEST['server'],
- 'database' => $_REQUEST['database'],
- 'schema' => $_REQUEST['schema'],
- 'table' => $this->tableName,
- 'column' => $_REQUEST['column'],
- 'return' => 'column',
- 'f_attname' => $f_attname,
- 'f_table' => $f_table,
- 'f_schema' => $f_schema,
- ],
+ echo '<br />' . \PHP_EOL;
+
+ $f_attname = $_REQUEST['column'];
+ $f_table = $this->tableName;
+ $f_schema = $data->_schema;
+ $data->fieldClean($f_attname);
+ $data->fieldClean($f_table);
+ $data->fieldClean($f_schema);
+
+ if ($isTable) {
+ $navlinks = [
+ 'browse' => [
+ 'attr' => [
+ 'href' => [
+ 'url' => 'display',
+ 'method' => 'post',
+ 'urlvars' => [
+ 'subject' => 'column',
+ 'server' => $_REQUEST['server'],
+ 'database' => $_REQUEST['database'],
+ 'schema' => $_REQUEST['schema'],
+ 'table' => $this->tableName,
+ 'column' => $_REQUEST['column'],
+ 'return' => 'column',
+ 'f_attname' => $f_attname,
+ 'f_table' => $f_table,
+ 'f_schema' => $f_schema,
],
],
- 'content' => $this->lang['strbrowse'],
],
- 'alter' => [
- 'attr' => [
- 'href' => [
- 'url' => 'colproperties',
- 'urlvars' => [
- 'action' => 'properties',
- 'server' => $_REQUEST['server'],
- 'database' => $_REQUEST['database'],
- 'schema' => $_REQUEST['schema'],
- 'table' => $this->tableName,
- 'column' => $_REQUEST['column'],
- ],
+ 'content' => $this->lang['strbrowse'],
+ ],
+ 'alter' => [
+ 'attr' => [
+ 'href' => [
+ 'url' => 'colproperties',
+ 'urlvars' => [
+ 'action' => 'properties',
+ 'server' => $_REQUEST['server'],
+ 'database' => $_REQUEST['database'],
+ 'schema' => $_REQUEST['schema'],
+ 'table' => $this->tableName,
+ 'column' => $_REQUEST['column'],
],
],
- 'content' => $this->lang['stralter'],
],
- 'drop' => [
- 'attr' => [
- 'href' => [
- 'url' => 'tblproperties',
- 'urlvars' => [
- 'action' => 'confirm_drop',
- 'server' => $_REQUEST['server'],
- 'database' => $_REQUEST['database'],
- 'schema' => $_REQUEST['schema'],
- 'table' => $this->tableName,
- 'column' => $_REQUEST['column'],
- ],
+ 'content' => $this->lang['stralter'],
+ ],
+ 'drop' => [
+ 'attr' => [
+ 'href' => [
+ 'url' => 'tblproperties',
+ 'urlvars' => [
+ 'action' => 'confirm_drop',
+ 'server' => $_REQUEST['server'],
+ 'database' => $_REQUEST['database'],
+ 'schema' => $_REQUEST['schema'],
+ 'table' => $this->tableName,
+ 'column' => $_REQUEST['column'],
],
],
- 'content' => $this->lang['strdrop'],
],
- ];
- } else {
- // Browse link
- $navlinks = [
- 'browse' => [
- 'attr' => [
- 'href' => [
- 'url' => 'display',
- 'method' => 'post',
- 'urlvars' => [
- 'subject' => 'column',
- 'server' => $_REQUEST['server'],
- 'database' => $_REQUEST['database'],
- 'schema' => $_REQUEST['schema'],
- 'view' => $this->tableName,
- 'column' => $_REQUEST['column'],
- 'return' => 'column',
- 'f_attname' => $f_attname,
- 'f_table' => $f_table,
- 'f_schema' => $f_schema,
- ],
+ 'content' => $this->lang['strdrop'],
+ ],
+ ];
+ } else {
+ // Browse link
+ $navlinks = [
+ 'browse' => [
+ 'attr' => [
+ 'href' => [
+ 'url' => 'display',
+ 'method' => 'post',
+ 'urlvars' => [
+ 'subject' => 'column',
+ 'server' => $_REQUEST['server'],
+ 'database' => $_REQUEST['database'],
+ 'schema' => $_REQUEST['schema'],
+ 'view' => $this->tableName,
+ 'column' => $_REQUEST['column'],
+ 'return' => 'column',
+ 'f_attname' => $f_attname,
+ 'f_table' => $f_table,
+ 'f_schema' => $f_schema,
],
],
- 'content' => $this->lang['strbrowse'],
],
- ];
- }
-
-return $this->printNavLinks($navlinks, $this->table_place, \get_defined_vars());
-
+ 'content' => $this->lang['strbrowse'],
+ ],
+ ];
+ }
+ return $this->printNavLinks($navlinks, $this->table_place, \get_defined_vars());
}
/**
diff --git a/src/controllers/ConstraintsController.php b/src/Controller/ConstraintsController.php
index c0a39c0b..abca23d7 100644
--- a/src/controllers/ConstraintsController.php
+++ b/src/Controller/ConstraintsController.php
@@ -237,7 +237,8 @@ class ConstraintsController extends BaseController
'content' => $this->lang['straddfk'],
],
];
-return $this->printNavLinks($navlinks, 'constraints-constraints', \get_defined_vars());
+
+ return $this->printNavLinks($navlinks, 'constraints-constraints', \get_defined_vars());
}
/**
diff --git a/src/controllers/ConversionsController.php b/src/Controller/ConversionsController.php
index cde0b8bd..69ec5772 100644
--- a/src/controllers/ConversionsController.php
+++ b/src/Controller/ConversionsController.php
@@ -78,6 +78,7 @@ class ConversionsController extends BaseController
if (self::isRecordset($conversions)) {
echo $this->printTable($conversions, $columns, $actions, 'conversions-conversions', $this->lang['strnoconversions']);
}
+
return '';
}
diff --git a/src/controllers/DatabaseController.php b/src/Controller/DatabaseController.php
index 8bab29f7..b8d7802e 100644
--- a/src/controllers/DatabaseController.php
+++ b/src/Controller/DatabaseController.php
@@ -142,7 +142,7 @@ class DatabaseController extends BaseController
echo $output;
- return $this->printFooter(true, $footer_template);
+ return $this->printFooter(true, $footer_template);
}
/**
diff --git a/src/controllers/DataexportController.php b/src/Controller/DataexportController.php
index 42a06509..d6a2ff9e 100644
--- a/src/controllers/DataexportController.php
+++ b/src/Controller/DataexportController.php
@@ -170,7 +170,7 @@ class DataexportController extends BaseController
) . \PHP_EOL;
echo '</form>' . \PHP_EOL;
- return $this->printFooter();
+ return $this->printFooter();
}
protected function mimicDumpFeature($format, string $cleanprefix, bool $oids)
diff --git a/src/controllers/DataimportController.php b/src/Controller/DataimportController.php
index ac0120e5..ac0120e5 100644
--- a/src/controllers/DataimportController.php
+++ b/src/Controller/DataimportController.php
diff --git a/src/controllers/DbexportController.php b/src/Controller/DbexportController.php
index 9190f96b..9190f96b 100644
--- a/src/controllers/DbexportController.php
+++ b/src/Controller/DbexportController.php
diff --git a/src/controllers/DisplayController.php b/src/Controller/DisplayController.php
index 22574c12..a7069b1d 100644
--- a/src/controllers/DisplayController.php
+++ b/src/Controller/DisplayController.php
@@ -9,7 +9,7 @@ namespace PHPPgAdmin\Controller;
use ADOFieldObject;
use ADORecordSet;
use Exception;
-use PHPPgAdmin\ADOdbException;
+use PHPPgAdmin\Core\ADOdbException;
use PHPPgAdmin\Traits\InsertEditRowTrait;
/**
@@ -46,7 +46,8 @@ class DisplayController extends BaseController
$header_template = 'header.twig';
$browseResult = [];
\ob_start();
-$jsonResult=[];
+ $jsonResult = [];
+
switch ($this->action) {
case 'editrow':
$this->view->offsetSet('codemirror', true);
@@ -116,7 +117,7 @@ $jsonResult=[];
echo $output;
- return $this->printFooter(true, $footer_template);
+ return $this->printFooter(true, $footer_template);
}
/**
@@ -314,7 +315,8 @@ $jsonResult=[];
// Navigation links
$navlinks = $this->getBrowseNavLinks($type, $_gets, $page, $subject, $object, $resultset);
-return $this->printNavLinks($navlinks, 'display-browse', \get_defined_vars());
+
+ return $this->printNavLinks($navlinks, 'display-browse', \get_defined_vars());
}
/**
@@ -983,7 +985,7 @@ return $this->printNavLinks($navlinks, 'display-browse', \get_defined_vars());
*
* @param mixed $confirm
*/
- public function doDelRow($confirm)
+ public function doDelRow($confirm)
{
$data = $this->misc->getDatabaseAccessor();
@@ -1183,9 +1185,6 @@ return $this->printNavLinks($navlinks, 'display-browse', \get_defined_vars());
echo '</div>';
}
- /**
- * @return \ADOFieldObject
- */
private function FetchField(ADORecordSet $ADORecordSet, int $index): ADOFieldObject
{
return $ADORecordSet->FetchField($index);
diff --git a/src/controllers/DomainsController.php b/src/Controller/DomainsController.php
index 15c3721e..037e1265 100644
--- a/src/controllers/DomainsController.php
+++ b/src/Controller/DomainsController.php
@@ -208,7 +208,8 @@ class DomainsController extends BaseController
'content' => $this->lang['strcreatedomain'],
],
];
-return $this->printNavLinks($navlinks, 'domains-domains', \get_defined_vars());
+
+ return $this->printNavLinks($navlinks, 'domains-domains', \get_defined_vars());
}
/**
@@ -620,7 +621,7 @@ return $this->printNavLinks($navlinks, 'domains-domains', \get_defined_vars());
];
}
-return $this->printNavLinks($navlinks, 'domains-properties', \get_defined_vars());
+ return $this->printNavLinks($navlinks, 'domains-properties', \get_defined_vars());
}
/**
diff --git a/src/controllers/FulltextController.php b/src/Controller/FulltextController.php
index 8f94ea59..3a0b3183 100644
--- a/src/controllers/FulltextController.php
+++ b/src/Controller/FulltextController.php
@@ -216,7 +216,7 @@ class FulltextController extends BaseController
],
];
-return $this->printNavLinks($navlinks, 'fulltext-fulltext', \get_defined_vars());
+ return $this->printNavLinks($navlinks, 'fulltext-fulltext', \get_defined_vars());
}
/**
@@ -310,7 +310,7 @@ return $this->printNavLinks($navlinks, 'fulltext-fulltext', \get_defined_vars()
return $this->printTree($items, $attrs, \mb_strtolower($what));
}
- public function doDropConfig(bool $confirm)
+ public function doDropConfig(bool $confirm)
{
$data = $this->misc->getDatabaseAccessor();
@@ -354,7 +354,7 @@ return $this->printNavLinks($navlinks, 'fulltext-fulltext', \get_defined_vars()
}
}
- public function doDropDict(bool $confirm)
+ public function doDropDict(bool $confirm)
{
$data = $this->misc->getDatabaseAccessor();
@@ -779,7 +779,7 @@ return $this->printNavLinks($navlinks, 'fulltext-fulltext', \get_defined_vars()
],
];
-return $this->printNavLinks($navlinks, 'fulltext-viewdicts', \get_defined_vars());
+ return $this->printNavLinks($navlinks, 'fulltext-viewdicts', \get_defined_vars());
}
/**
@@ -880,7 +880,7 @@ return $this->printNavLinks($navlinks, 'fulltext-viewdicts', \get_defined_vars(
],
];
-return $this->printNavLinks($navlinks, 'fulltext-viewconfig', \get_defined_vars());
+ return $this->printNavLinks($navlinks, 'fulltext-viewconfig', \get_defined_vars());
}
/**
diff --git a/src/controllers/FunctionsController.php b/src/Controller/FunctionsController.php
index f63b53c1..9d8261f2 100644
--- a/src/controllers/FunctionsController.php
+++ b/src/Controller/FunctionsController.php
@@ -99,7 +99,8 @@ class FunctionsController extends BaseController
$this->printHeader($this->headerTitle(), null, true, $header_template);
$this->printBody();
echo $output;
- return $this->printFooter(true, $footer_template);
+
+ return $this->printFooter(true, $footer_template);
}
/**
@@ -196,7 +197,7 @@ class FunctionsController extends BaseController
echo $this->printTable($funcs, $columns, $actions, $this->table_place, $this->lang['strnofunctions']);
}
- return $this->_printNavLinks('functions-functions');
+ return $this->_printNavLinks('functions-functions');
}
/**
@@ -1424,7 +1425,7 @@ class FunctionsController extends BaseController
return '';
}
-return $this->printNavLinks($navlinks, $place, \get_defined_vars());
+ return $this->printNavLinks($navlinks, $place, \get_defined_vars());
}
/**
diff --git a/src/controllers/GroupsController.php b/src/Controller/GroupsController.php
index c7354ced..aaf4e422 100644
--- a/src/controllers/GroupsController.php
+++ b/src/Controller/GroupsController.php
@@ -135,7 +135,7 @@ class GroupsController extends BaseController
echo $this->printTable($groups, $columns, $actions, 'groups-properties', $this->lang['strnogroups']);
}
-return $this->printNavLinks(['create' => [
+ return $this->printNavLinks(['create' => [
'attr' => [
'href' => [
'url' => 'groups',
@@ -290,7 +290,7 @@ return $this->printNavLinks(['create' => [
echo '<input type="hidden" name="action" value="add_member" />' . \PHP_EOL;
echo '</form>' . \PHP_EOL;
-return $this->printNavLinks(['showall' => [
+ return $this->printNavLinks(['showall' => [
'attr' => [
'href' => [
'url' => 'groups',
diff --git a/src/controllers/HelpController.php b/src/Controller/HelpController.php
index eb34c41e..b9114f4d 100644
--- a/src/controllers/HelpController.php
+++ b/src/Controller/HelpController.php
@@ -95,10 +95,10 @@ class HelpController extends BaseController
echo '</dl>' . \PHP_EOL;
- return $this->printFooter();
+ return $this->printFooter();
}
- public function doChoosePage(array $urls)
+ public function doChoosePage(array $urls)
{
$this->printHeader();
$this->printBody();
@@ -116,6 +116,6 @@ class HelpController extends BaseController
}
echo '</ul>' . \PHP_EOL;
- return $this->printFooter();
+ return $this->printFooter();
}
}
diff --git a/src/controllers/HistoryController.php b/src/Controller/HistoryController.php
index 8bcbc618..39ea85cb 100644
--- a/src/controllers/HistoryController.php
+++ b/src/Controller/HistoryController.php
@@ -6,7 +6,7 @@
namespace PHPPgAdmin\Controller;
-use PHPPgAdmin\ArrayRecordSet;
+use PHPPgAdmin\Core\ArrayRecordset;
use PHPPgAdmin\Decorators\Decorator;
use PHPPgAdmin\Traits\ServersTrait;
@@ -82,7 +82,7 @@ class HistoryController extends BaseController
echo '<body onload="window.focus();">' . \PHP_EOL;
echo '<form action="history" method="post">' . \PHP_EOL;
- echo $this->printConnection('history');
+ echo $this->printConnection('history');
echo '</form><br />';
if (!isset($_REQUEST['database'])) {
@@ -95,7 +95,7 @@ class HistoryController extends BaseController
}
if (isset($_SESSION['history'][$_REQUEST['server']][$_REQUEST['database']])) {
- $history = new ArrayRecordSet($_SESSION['history'][$_REQUEST['server']][$_REQUEST['database']]);
+ $history = new ArrayRecordset($_SESSION['history'][$_REQUEST['server']][$_REQUEST['database']]);
$columns = [
'query' => [
@@ -198,7 +198,7 @@ class HistoryController extends BaseController
];
}
-return $this->printNavLinks($navlinks, 'history-history', \get_defined_vars());
+ return $this->printNavLinks($navlinks, 'history-history', \get_defined_vars());
}
public function doDelHistory($qid, bool $confirm): void
diff --git a/src/controllers/IndexesController.php b/src/Controller/IndexesController.php
index 4c2f3b09..7900db1e 100644
--- a/src/controllers/IndexesController.php
+++ b/src/Controller/IndexesController.php
@@ -6,7 +6,7 @@
namespace PHPPgAdmin\Controller;
-use PHPPgAdmin\ADOdbException;
+use PHPPgAdmin\Core\ADOdbException;
use PHPPgAdmin\Decorators\Decorator;
use PHPPgAdmin\XHtml\XHtmlButton;
use PHPPgAdmin\XHtml\XHtmlOption;
@@ -93,7 +93,7 @@ class IndexesController extends BaseController
return $this->printFooter();
}
- public function doDefault(string $msg = '')
+ public function doDefault(string $msg = '')
{
$data = $this->misc->getDatabaseAccessor();
@@ -202,7 +202,7 @@ class IndexesController extends BaseController
echo $this->printTable($indexes, $columns, $actions, 'indexes-indexes', $this->lang['strnoindexes'], $indPre);
}
-return $this->printNavLinks([
+ return $this->printNavLinks([
'create' => [
'attr' => [
'href' => [
diff --git a/src/controllers/InfoController.php b/src/Controller/InfoController.php
index 13323ef6..3795dfc9 100644
--- a/src/controllers/InfoController.php
+++ b/src/Controller/InfoController.php
@@ -100,11 +100,12 @@ class InfoController extends BaseController
if (0 < $indexstatsio->RecordCount()) {
$this->_printIndexstatsio($indexstatsio);
}
+
return '';
}
/**
- * @param int|\PHPPgAdmin\ADORecordSet|string $children
+ * @param int|\PHPPgAdmin\Core\ADORecordSet|string $children
*/
private function _printChildren($children): void
{
@@ -148,7 +149,7 @@ class InfoController extends BaseController
}
/**
- * @param int|\PHPPgAdmin\ADORecordSet|string $tablestatstups
+ * @param int|\PHPPgAdmin\Core\ADORecordSet|string $tablestatstups
*/
private function _printTablestatstups($tablestatstups): void
{
@@ -226,7 +227,7 @@ class InfoController extends BaseController
}
/**
- * @param int|\PHPPgAdmin\ADORecordSet|string $tablestatsio
+ * @param int|\PHPPgAdmin\Core\ADORecordSet|string $tablestatsio
*/
private function _printTablestatsio($tablestatsio): void
{
@@ -369,7 +370,7 @@ class InfoController extends BaseController
}
/**
- * @param int|\PHPPgAdmin\ADORecordSet|string $indexstatstups
+ * @param int|\PHPPgAdmin\Core\ADORecordSet|string $indexstatstups
*/
private function _printIndexstatstups($indexstatstups): void
{
@@ -418,7 +419,7 @@ class InfoController extends BaseController
}
/**
- * @param int|\PHPPgAdmin\ADORecordSet|string $indexstatsio
+ * @param int|\PHPPgAdmin\Core\ADORecordSet|string $indexstatsio
*/
private function _printIndexstatsio($indexstatsio): void
{
@@ -475,7 +476,7 @@ class InfoController extends BaseController
}
/**
- * @param int|\PHPPgAdmin\ADORecordSet|string $parents
+ * @param int|\PHPPgAdmin\Core\ADORecordSet|string $parents
*/
private function _printParents($parents): void
{
@@ -519,7 +520,7 @@ class InfoController extends BaseController
}
/**
- * @param int|\PHPPgAdmin\ADORecordSet|string $referrers
+ * @param int|\PHPPgAdmin\Core\ADORecordSet|string $referrers
*/
private function _printReferring($referrers): void
{
diff --git a/src/controllers/IntroController.php b/src/Controller/IntroController.php
index 3aa4aa25..3aa4aa25 100644
--- a/src/controllers/IntroController.php
+++ b/src/Controller/IntroController.php
diff --git a/src/controllers/LanguagesController.php b/src/Controller/LanguagesController.php
index 43cc227f..0718c754 100644
--- a/src/controllers/LanguagesController.php
+++ b/src/Controller/LanguagesController.php
@@ -70,6 +70,7 @@ class LanguagesController extends BaseController
if (self::isRecordset($languages)) {
echo $this->printTable($languages, $columns, $actions, 'languages-languages', $this->lang['strnolanguages']);
}
+
return '';
}
diff --git a/src/controllers/LoginController.php b/src/Controller/LoginController.php
index 48fda81d..894e4778 100644
--- a/src/controllers/LoginController.php
+++ b/src/Controller/LoginController.php
@@ -50,13 +50,13 @@ class LoginController extends BaseController
{
if (null === \requestInstance()->getAttribute('route')) {
echo $this->doLoginForm();
- return '';
- } else {
- $body = \responseInstance()->getBody();
- $body->write($this->doLoginForm());
- return \responseInstance();
+ return '';
}
+ $body = \responseInstance()->getBody();
+ $body->write($this->doLoginForm());
+
+ return \responseInstance();
}
public function doLoginForm($msg = '')
diff --git a/src/controllers/MaterializedviewpropertiesController.php b/src/Controller/MaterializedviewpropertiesController.php
index 4cd5be87..4cd5be87 100644
--- a/src/controllers/MaterializedviewpropertiesController.php
+++ b/src/Controller/MaterializedviewpropertiesController.php
diff --git a/src/controllers/MaterializedviewsController.php b/src/Controller/MaterializedviewsController.php
index 32d1aaf7..8864d2b0 100644
--- a/src/controllers/MaterializedviewsController.php
+++ b/src/Controller/MaterializedviewsController.php
@@ -243,7 +243,8 @@ class MaterializedviewsController extends BaseController
'content' => $this->lang['strcreatematviewwiz'],
],
];
-return $this->printNavLinks($navlinks, $this->table_place, \get_defined_vars());
+
+ return $this->printNavLinks($navlinks, $this->table_place, \get_defined_vars());
}
/**
diff --git a/src/controllers/OpclassesController.php b/src/Controller/OpclassesController.php
index aa5e8094..bff6f433 100644
--- a/src/controllers/OpclassesController.php
+++ b/src/Controller/OpclassesController.php
@@ -77,7 +77,9 @@ class OpclassesController extends BaseController
if ($opclasses instanceof \PHPPgAdmin\Interfaces\RecordSet) {
echo $this->printTable($opclasses, $columns, $actions, 'opclasses-opclasses', $this->lang['strnoopclasses']);
- }return '';
+ }
+
+ return '';
}
/**
diff --git a/src/controllers/OperatorsController.php b/src/Controller/OperatorsController.php
index c5e892cf..983e9e88 100644
--- a/src/controllers/OperatorsController.php
+++ b/src/Controller/OperatorsController.php
@@ -171,6 +171,7 @@ class OperatorsController extends BaseController
if (self::isRecordset($operators)) {
echo $this->printTable($operators, $columns, $actions, 'operators-operators', $this->lang['strnooperators']);
}
+
return '';
// TODO operators action=create $this->lang['strcreateoperator']
}
@@ -270,7 +271,7 @@ class OperatorsController extends BaseController
}
echo '</table>' . \PHP_EOL;
-return $this->printNavLinks(
+ return $this->printNavLinks(
[
'showall' => [
'attr' => [
@@ -288,9 +289,8 @@ return $this->printNavLinks(
'operators-properties',
\get_defined_vars()
);
- } else {
- $this->doDefault($this->lang['strinvalidparam']);
}
+ $this->doDefault($this->lang['strinvalidparam']);
}
/**
diff --git a/src/controllers/PrivilegesController.php b/src/Controller/PrivilegesController.php
index b38828f7..e6c26c0d 100644
--- a/src/controllers/PrivilegesController.php
+++ b/src/Controller/PrivilegesController.php
@@ -182,10 +182,11 @@ class PrivilegesController extends BaseController
$this->lang['strnoprivileges']
) . \PHP_EOL;
}
- return $this->printGrantLinks();
+
+ return $this->printGrantLinks();
}
- public function printGrantLinks()
+ public function printGrantLinks()
{
$data = $this->misc->getDatabaseAccessor();
$subject = $_REQUEST['subject'];
@@ -313,7 +314,7 @@ class PrivilegesController extends BaseController
}
}
-return $this->printNavLinks($navlinks, $this->table_place, \get_defined_vars());
+ return $this->printNavLinks($navlinks, $this->table_place, \get_defined_vars());
}
/**
diff --git a/src/controllers/RolesController.php b/src/Controller/RolesController.php
index 2deb8839..39ae8527 100644
--- a/src/controllers/RolesController.php
+++ b/src/Controller/RolesController.php
@@ -212,7 +212,9 @@ class RolesController extends BaseController
'content' => $this->lang['strcreaterole'],
],
];
-return $this->printNavLinks($navlinks, 'roles-roles', \get_defined_vars());
+
+ return $this->printNavLinks($navlinks, 'roles-roles', \get_defined_vars());
+
return '';
}
@@ -869,7 +871,7 @@ return $this->printNavLinks($navlinks, 'roles-roles', \get_defined_vars());
],
];
-return $this->printNavLinks($navlinks, 'roles-properties', \get_defined_vars());
+ return $this->printNavLinks($navlinks, 'roles-properties', \get_defined_vars());
}
/**
@@ -949,7 +951,7 @@ return $this->printNavLinks($navlinks, 'roles-properties', \get_defined_vars())
) . \PHP_EOL;
}
-return $this->printNavLinks(['changepassword' => [
+ return $this->printNavLinks(['changepassword' => [
'attr' => [
'href' => [
'url' => 'roles',
diff --git a/src/controllers/RulesController.php b/src/Controller/RulesController.php
index a9b8ae25..9e70e821 100644
--- a/src/controllers/RulesController.php
+++ b/src/Controller/RulesController.php
@@ -118,7 +118,7 @@ class RulesController extends BaseController
echo $this->printTable($rules, $columns, $actions, 'rules-rules', $this->lang['strnorules']);
}
-return $this->printNavLinks(['create' => [
+ return $this->printNavLinks(['create' => [
'attr' => [
'href' => [
'url' => 'rules',
diff --git a/src/controllers/SchemasController.php b/src/Controller/SchemasController.php
index e8dbc174..f6d67bcd 100644
--- a/src/controllers/SchemasController.php
+++ b/src/Controller/SchemasController.php
@@ -190,7 +190,7 @@ class SchemasController extends BaseController
echo $this->printTable($schemas, $columns, $actions, 'schemas-schemas', $this->lang['strnoschemas']);
}
-return $this->printNavLinks(['create' => [
+ return $this->printNavLinks(['create' => [
'attr' => [
'href' => [
'url' => 'schemas',
diff --git a/src/controllers/SequencesController.php b/src/Controller/SequencesController.php
index f840c19f..cd85f6db 100644
--- a/src/controllers/SequencesController.php
+++ b/src/Controller/SequencesController.php
@@ -196,7 +196,7 @@ class SequencesController extends BaseController
echo $this->printTable($sequences, $columns, $actions, 'sequences-sequences', $this->lang['strnosequences']);
}
-return $this->printNavLinks(['create' => [
+ return $this->printNavLinks(['create' => [
'attr' => [
'href' => [
'url' => 'sequences',
@@ -415,13 +415,12 @@ return $this->printNavLinks(['create' => [
unset($navlinks['restart']);
}
-return $this->printNavLinks($navlinks, 'sequences-properties', \get_defined_vars());
- } else {
- echo \sprintf(
- '<p>%s</p>',
- $this->lang['strnodata']
- ) . \PHP_EOL;
+ return $this->printNavLinks($navlinks, 'sequences-properties', \get_defined_vars());
}
+ echo \sprintf(
+ '<p>%s</p>',
+ $this->lang['strnodata']
+ ) . \PHP_EOL;
}
/**
diff --git a/src/controllers/ServersController.php b/src/Controller/ServersController.php
index b674ac4a..d21e7b72 100644
--- a/src/controllers/ServersController.php
+++ b/src/Controller/ServersController.php
@@ -6,7 +6,7 @@
namespace PHPPgAdmin\Controller;
-use PHPPgAdmin\ArrayRecordSet;
+use PHPPgAdmin\Core\ArrayRecordset;
use PHPPgAdmin\Decorators\Decorator;
use PHPPgAdmin\Traits\ServersTrait;
use Slim\Http\Response;
@@ -73,13 +73,13 @@ class ServersController extends BaseController
// ddd($server_html);
if (null === $route) {
echo $server_html;
- return '';
- } else {
- $body = $theResponse->getBody();
- $body->write($server_html);
- return $theResponse;
+ return '';
}
+ $body = $theResponse->getBody();
+ $body->write($server_html);
+
+ return $theResponse;
}
public function doDefault($msg = '')
@@ -172,6 +172,7 @@ class ServersController extends BaseController
}
$thetable = $this->printTable($servers, $columns, $actions, $this->table_place, $this->lang['strnoobjects'], $svPre);
echo $thetable;
+
return '';
}
@@ -194,7 +195,7 @@ class ServersController extends BaseController
}
$nodes = \array_merge($nodes, $this->getServers(false, $group_id));
- $nodes = new ArrayRecordSet($nodes);
+ $nodes = new ArrayRecordset($nodes);
} else {
// no srv_group
$nodes = $this->getServers(true, false);
@@ -239,7 +240,7 @@ class ServersController extends BaseController
*
* @return (\PHPPgAdmin\Decorators\UrlDecorator|mixed|string)[][]|ArrayRecordSet either an array or a Recordset suitable for HTMLTableController::printTable
*
- * @psalm-return ArrayRecordSet|array<array-key, array{id: mixed|string, desc: mixed, icon: string, action: \PHPPgAdmin\Decorators\UrlDecorator, branch: \PHPPgAdmin\Decorators\UrlDecorator}>
+ * @psalm-return ArrayRecordset|array<array-key, array{id: mixed|string, desc: mixed, icon: string, action: \PHPPgAdmin\Decorators\UrlDecorator, branch: \PHPPgAdmin\Decorators\UrlDecorator}>
*/
private function getServersGroups($recordset = false, $group_id = false)
{
@@ -303,7 +304,7 @@ class ServersController extends BaseController
}
if ($recordset) {
- return new ArrayRecordSet($grps);
+ return new ArrayRecordset($grps);
}
return $grps;
diff --git a/src/controllers/SqlController.php b/src/Controller/SqlController.php
index e8324a91..68115f4b 100644
--- a/src/controllers/SqlController.php
+++ b/src/Controller/SqlController.php
@@ -8,7 +8,7 @@ namespace PHPPgAdmin\Controller;
use ADORecordSet;
use Exception;
-use PHPPgAdmin\ADOdbException;
+use PHPPgAdmin\Core\ADOdbException;
/**
* Base controller class.
@@ -95,14 +95,14 @@ class SqlController extends BaseController
$rs = $this->doDefault();
// echo $body.$trail.$title;
- return $this->doFooter(true, 'footer_sqledit.twig', $rs);
+ return $this->doFooter(true, 'footer_sqledit.twig', $rs);
} catch (Exception $e) {
exit($e->getMessage());
}
}
/**
- * @return null|\PHPPgAdmin\ADORecordSet
+ * @return null|\PHPPgAdmin\Core\ADORecordSet
*/
public function doDefault()
{
@@ -125,13 +125,13 @@ class SqlController extends BaseController
$data = $this->misc->getDatabaseAccessor();
$_connection = $this->misc->getConnection();
$lang = $this->lang;
-
+
/**
* This is a callback function to display the result of each separate query.
*
* @param ADORecordSet $rs The recordset returned by the script execetor
*/
- $sqlCallback = static function ($query, $rs, $lineno) use ($data, $misc, $lang, $_connection ): void {
+ $sqlCallback = static function ($query, $rs, $lineno) use ($data, $misc, $lang, $_connection): void {
// Check if $rs is false, if so then there was a fatal error
if (false === $rs) {
echo \htmlspecialchars($_FILES['script']['name']), ':', $lineno, ': ', \nl2br(\htmlspecialchars($_connection->getLastError())), '<br/>' . \PHP_EOL;
@@ -199,7 +199,7 @@ class SqlController extends BaseController
}
/**
- * @return null|\PHPPgAdmin\ADORecordSet
+ * @return null|\PHPPgAdmin\Core\ADORecordSet
*/
private function execute_query()
{
@@ -389,7 +389,7 @@ class SqlController extends BaseController
];
}
-return $this->printNavLinks($navlinks, 'sql-form', \get_defined_vars());
+ return $this->printNavLinks($navlinks, 'sql-form', \get_defined_vars());
return $this->printFooter($doBody, $template);
}
diff --git a/src/controllers/SqleditController.php b/src/Controller/SqleditController.php
index 7ae25626..7ae25626 100644
--- a/src/controllers/SqleditController.php
+++ b/src/Controller/SqleditController.php
diff --git a/src/controllers/TablesController.php b/src/Controller/TablesController.php
index 16361705..1d65012f 100644
--- a/src/controllers/TablesController.php
+++ b/src/Controller/TablesController.php
@@ -212,7 +212,8 @@ class TablesController extends BaseController
'content' => $this->lang['strcreatetablelike'],
];
}
-return $this->printNavLinks($navlinks, 'tables-tables', \get_defined_vars());
+
+ return $this->printNavLinks($navlinks, 'tables-tables', \get_defined_vars());
}
public function displayJson()
@@ -1013,24 +1014,23 @@ return $this->printNavLinks($navlinks, 'tables-tables', \get_defined_vars());
}
if (0 === \count($_POST['show'])) {
- return $this->doSelectRows(true, $this->lang['strselectneedscol']);
- } else {
- // Generate query SQL
- $query = $data->getSelectSQL(
- $_REQUEST['table'],
- \array_keys($_POST['show']),
- $_POST['values'],
- $_POST['ops']
- );
- $_REQUEST['query'] = $query;
- $_REQUEST['return'] = 'selectrows';
+ return $this->doSelectRows(true, $this->lang['strselectneedscol']);
+ }
+ // Generate query SQL
+ $query = $data->getSelectSQL(
+ $_REQUEST['table'],
+ \array_keys($_POST['show']),
+ $_POST['values'],
+ $_POST['ops']
+ );
+ $_REQUEST['query'] = $query;
+ $_REQUEST['return'] = 'selectrows';
- $this->setNoOutput(true);
+ $this->setNoOutput(true);
- $display_controller = new DisplayController($this->getContainer());
+ $display_controller = new DisplayController($this->getContainer());
- return $display_controller->render();
- }
+ return $display_controller->render();
}
/**
diff --git a/src/controllers/TablespacesController.php b/src/Controller/TablespacesController.php
index 935bf218..bb93ca6e 100644
--- a/src/controllers/TablespacesController.php
+++ b/src/Controller/TablespacesController.php
@@ -153,7 +153,7 @@ class TablespacesController extends BaseController
echo $this->printTable($tablespaces, $columns, $actions, 'tablespaces-tablespaces', $this->lang['strnotablespaces']);
}
-return $this->printNavLinks(['create' => [
+ return $this->printNavLinks(['create' => [
'attr' => [
'href' => [
'url' => 'tablespaces',
diff --git a/src/controllers/TblpropertiesController.php b/src/Controller/TblpropertiesController.php
index 126e8040..4773fa94 100644
--- a/src/controllers/TblpropertiesController.php
+++ b/src/Controller/TblpropertiesController.php
@@ -237,7 +237,8 @@ class TblpropertiesController extends BaseController
'content' => $this->lang['stralter'],
],
];
-return $this->printNavLinks($navlinks, 'tblproperties-tblproperties', \get_defined_vars());
+
+ return $this->printNavLinks($navlinks, 'tblproperties-tblproperties', \get_defined_vars());
}
/**
diff --git a/src/controllers/TreeController.php b/src/Controller/TreeController.php
index a9ea99c0..970407de 100644
--- a/src/controllers/TreeController.php
+++ b/src/Controller/TreeController.php
@@ -6,8 +6,9 @@
namespace PHPPgAdmin\Controller;
-use PHPPgAdmin\ArrayRecordSet;
-use PHPPgAdmin\ContainerUtils;
+use IteratorAggregate;
+use PHPPgAdmin\Core\ArrayRecordset;
+use PHPPgAdmin\Core\ContainerUtils;
use PHPPgAdmin\Decorators\Decorator;
use PHPPgAdmin\Interfaces\RecordSet;
use PHPPgAdmin\Traits\HelperTrait;
@@ -69,25 +70,25 @@ class TreeController extends BaseController
/**
* Produce JSON data for the browser tree.
*
- * @param \PHPPgAdmin\ADORecordSet|Recordset $_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
- * 'openIcon' - an alternative icon when the node is expanded
- * 'toolTip' - tool tip text for the node
- * 'action' - URL to visit when single clicking the node
- * 'iconAction' - URL to visit when single clicking the icon node
- * 'branch' - URL for child nodes (tree XML)
- * 'expand' - the action to return XML for the subtree
- * 'nodata' - message to display when node has no children
- * @param string $section The section where the branch is linked in the tree
- * @param bool $print either to return or echo the result
+ * @param \PHPPgAdmin\Core\ADORecordSet|RecordSet $_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
+ * 'openIcon' - an alternative icon when the node is expanded
+ * 'toolTip' - tool tip text for the node
+ * 'action' - URL to visit when single clicking the node
+ * 'iconAction' - URL to visit when single clicking the icon node
+ * 'branch' - URL for child nodes (tree XML)
+ * 'expand' - the action to return XML for the subtree
+ * 'nodata' - message to display when node has no children
+ * @param string $section The section where the branch is linked in the tree
+ * @param bool $print either to return or echo the result
*
* @return (array|bool|string)[] the json rendered tree
*
* @psalm-return array<int|string, array<string, mixed>|bool|string>
*/
- public function printTree(&$_treedata, &$attrs, $section, $print = true)
+ public function printTree(IteratorAggregate &$_treedata, &$attrs, $section, $print = true)
{
$treedata = [];
@@ -112,7 +113,7 @@ class TreeController extends BaseController
*
* @param array $tabs The tabs
*
- * @return ArrayRecordSet filtered tabs in the form of an ArrayRecordSet
+ * @return ArrayRecordset filtered tabs in the form of an ArrayRecordSet
*/
public function adjustTabsForTree(&$tabs)
{
@@ -122,7 +123,7 @@ class TreeController extends BaseController
}
}
- return new ArrayRecordSet($tabs);
+ return new ArrayRecordset($tabs);
}
/**
@@ -160,7 +161,8 @@ class TreeController extends BaseController
];
} elseif (0 < \count($treedata)) {
foreach ($treedata as $rec) {
- $icon = $this->view->icon(Decorator::get_sanitized_value($attrs['icon'], $rec));
+ $sanitized = tap(Decorator::get_sanitized_value($attrs['icon'], $rec), static fn ($sanitizedIcon) => kdump([$sanitizedIcon => $attrs['icon']]));
+ $icon = $this->view->icon($sanitized);
if (!empty($attrs['openicon'])) {
$icon = $this->view->icon(Decorator::get_sanitized_value($attrs['openIcon'], $rec));
@@ -204,7 +206,6 @@ class TreeController extends BaseController
}
//ddd($parent);
-
return $parent;
}
}
diff --git a/src/controllers/TriggersController.php b/src/Controller/TriggersController.php
index 27dcee9a..d6b85557 100644
--- a/src/controllers/TriggersController.php
+++ b/src/Controller/TriggersController.php
@@ -219,7 +219,7 @@ class TriggersController extends BaseController
echo $this->printTable($triggers, $columns, $actions, 'triggers-triggers', $this->lang['strnotriggers'], $tgPre);
}
-return $this->printNavLinks(['create' => [
+ return $this->printNavLinks(['create' => [
'attr' => [
'href' => [
'url' => 'triggers',
diff --git a/src/controllers/TypesController.php b/src/Controller/TypesController.php
index cf475c19..89df8c86 100644
--- a/src/controllers/TypesController.php
+++ b/src/Controller/TypesController.php
@@ -208,7 +208,7 @@ class TypesController extends BaseController
//if (!$data->hasEnumTypes()) { unset($navlinks['enum']); }
-return $this->printNavLinks($navlinks, 'types-types', \get_defined_vars());
+ return $this->printNavLinks($navlinks, 'types-types', \get_defined_vars());
}
/**
@@ -350,7 +350,7 @@ return $this->printNavLinks($navlinks, 'types-types', \get_defined_vars());
echo '</table>' . \PHP_EOL;
}
-return $this->printNavLinks(['showall' => [
+ return $this->printNavLinks(['showall' => [
'attr' => [
'href' => [
'url' => 'types',
@@ -363,9 +363,8 @@ return $this->printNavLinks(['showall' => [
],
'content' => $this->lang['strshowalltypes'],
]], 'types-properties', \get_defined_vars());
- } else {
- $this->doDefault($this->lang['strinvalidparam']);
}
+ $this->doDefault($this->lang['strinvalidparam']);
}
/**
diff --git a/src/controllers/UsersController.php b/src/Controller/UsersController.php
index 71e162ef..a9e0195e 100644
--- a/src/controllers/UsersController.php
+++ b/src/Controller/UsersController.php
@@ -176,7 +176,7 @@ class UsersController extends BaseController
echo $this->printTable($users, $columns, $actions, 'users-users', $this->lang['strnousers']);
}
-return $this->printNavLinks(['create' => [
+ return $this->printNavLinks(['create' => [
'attr' => [
'href' => [
'url' => 'users',
@@ -240,7 +240,7 @@ return $this->printNavLinks(['create' => [
) . \PHP_EOL;
}
-return $this->printNavLinks(['changepassword' => [
+ return $this->printNavLinks(['changepassword' => [
'attr' => [
'href' => [
'url' => 'users',
diff --git a/src/controllers/ViewpropertiesController.php b/src/Controller/ViewpropertiesController.php
index 94ebce6c..b068d1e3 100644
--- a/src/controllers/ViewpropertiesController.php
+++ b/src/Controller/ViewpropertiesController.php
@@ -34,7 +34,7 @@ class ViewpropertiesController extends BaseController
\ob_start();
- $this->printFooter(true, $footer_template);
+
switch ($this->action) {
case 'save_edit':
@@ -79,7 +79,7 @@ class ViewpropertiesController extends BaseController
$this->doAlter(true);
break;
- /*case 'drop':
+ /*case 'drop':
if($this->getPostParam('drop')!==null){
$this->doDrop(false);
} else {
@@ -151,16 +151,17 @@ class ViewpropertiesController extends BaseController
'formDefinition' => \htmlspecialchars($_POST['formDefinition']),
'formComment' => \htmlspecialchars($_POST['formComment']),
- 'subject' => \htmlspecialchars($_REQUEST[$this->subject]), ];
+ 'subject' => \htmlspecialchars($_REQUEST[$this->subject]),
+ ];
$edition_area = \sprintf(
'
<form action="%s" method="post">
- <table style="width: 100%">
+ <table style="width: %s">
<tr>
<th class="data left required">%s</th>
<td class="data1">
- <textarea style="width: 100%;" rows="20" cols="50" id="query" name="formDefinition">
+ <textarea style="width: %s;" rows="20" cols="50" id="query" name="formDefinition">
%s
</textarea>
</td>
@@ -183,13 +184,16 @@ class ViewpropertiesController extends BaseController
</p>
</form>',
$variables->subfolder,
+ '100%',
$this->lang['strdefinition'],
+ '100%',
$variables->formDefinition,
$this->lang['strcomment'],
$variables->formComment,
$variables->subject,
$this->view->form,
$this->lang['stralter'],
+ $this->lang['strcancel'],
$this->lang['strcancel']
);
echo $edition_area;
@@ -359,8 +363,7 @@ class ViewpropertiesController extends BaseController
while (!$users->EOF) {
$uname = $users->fields['usename'];
- echo '<option value="', \htmlspecialchars($uname), '"',
- ($uname === $_POST['owner']) ? ' selected="selected"' : '', '>', \htmlspecialchars($uname), '</option>' . \PHP_EOL;
+ echo '<option value="', \htmlspecialchars($uname), '"', ($uname === $_POST['owner']) ? ' selected="selected"' : '', '>', \htmlspecialchars($uname), '</option>' . \PHP_EOL;
$users->MoveNext();
}
echo '</select></td></tr>' . \PHP_EOL;
@@ -376,8 +379,7 @@ class ViewpropertiesController extends BaseController
while (!$schemas->EOF) {
$schema = $schemas->fields['nspname'];
- echo '<option value="', \htmlspecialchars($schema), '"',
- ($schema === $_POST['newschema']) ? ' selected="selected"' : '', '>', \htmlspecialchars($schema), '</option>' . \PHP_EOL;
+ echo '<option value="', \htmlspecialchars($schema), '"', ($schema === $_POST['newschema']) ? ' selected="selected"' : '', '>', \htmlspecialchars($schema), '</option>' . \PHP_EOL;
$schemas->MoveNext();
}
echo '</select></td></tr>' . \PHP_EOL;
diff --git a/src/controllers/ViewsController.php b/src/Controller/ViewsController.php
index adc24a1b..d0927a48 100644
--- a/src/controllers/ViewsController.php
+++ b/src/Controller/ViewsController.php
@@ -243,7 +243,8 @@ class ViewsController extends BaseController
'content' => $this->lang['strcreateviewwiz'],
],
];
-return $this->printNavLinks($navlinks, $this->table_place, \get_defined_vars());
+
+ return $this->printNavLinks($navlinks, $this->table_place, \get_defined_vars());
}
/**
@@ -268,6 +269,7 @@ return $this->printNavLinks($navlinks, $this->table_place, \get_defined_vars())
'branch' => Decorator::url('views', $reqvars, ['action' => 'subtree', $this->keystring => Decorator::field('relname')]),
];
kdump($attrs);
+
return $this->printTree($views, $attrs, 'views');
}
diff --git a/src/classes/ADONewConnection.php b/src/Core/ADONewConnection.php
index 4884f3f0..81e79afb 100644
--- a/src/classes/ADONewConnection.php
+++ b/src/Core/ADONewConnection.php
@@ -1,10 +1,10 @@
-<?php
+\ADODB_postgres7?php
/**
* PHPPgAdmin6
*/
-namespace PHPPgAdmin;
+namespace PHPPgAdmin\Core;
use ADODB_postgres9;
diff --git a/src/classes/ADORecordSet.php b/src/Core/ADORecordSet.php
index 4ebf3fcd..ff97d161 100644
--- a/src/classes/ADORecordSet.php
+++ b/src/Core/ADORecordSet.php
@@ -4,7 +4,7 @@
* PHPPgAdmin6
*/
-namespace PHPPgAdmin;
+namespace PHPPgAdmin\Core;
use ADOFieldObject;
use ADORecordSet as ADODBRecordsetClass;
@@ -39,7 +39,7 @@ class ADORecordSet extends ADODBRecordsetClass implements Countable, RecordSet
*
* @param int $fieldoffset
*
- * @return \ADOFieldObject the field
+ * @return ADOFieldObject the field
*/
public function FetchField($fieldoffset = -1): ADOFieldObject
{
diff --git a/src/classes/ADOdbException.php b/src/Core/ADOdbException.php
index b5d3ec1f..8ea811b7 100644
--- a/src/classes/ADOdbException.php
+++ b/src/Core/ADOdbException.php
@@ -4,7 +4,7 @@
* PHPPgAdmin6
*/
-namespace PHPPgAdmin;
+namespace PHPPgAdmin\Core;
use Exception;
@@ -148,7 +148,7 @@ class ADOdbException extends Exception
* @param string $p2 parameter 2
* @param mixed $thisConnection connection
*
- * @throws \PHPPgAdmin\ADOdbException
+ * @throws self
*
* @internal param $P2 $fn specific parameter - see below
*/
diff --git a/src/classes/ArrayRecordSet.php b/src/Core/ArrayRecordset.php
index 50def47b..2f555571 100644
--- a/src/classes/ArrayRecordSet.php
+++ b/src/Core/ArrayRecordset.php
@@ -4,7 +4,7 @@
* PHPPgAdmin6
*/
-namespace PHPPgAdmin;
+namespace PHPPgAdmin\Core;
use ADOFieldObject;
use Countable;
@@ -23,7 +23,7 @@ use PHPPgAdmin\Interfaces\RecordSet;
*
* Id: ArrayRecordSet.php,v 1.3 2007/01/10 01:46:28 soranzo Exp $
*/
-class ArrayRecordSet implements Countable, RecordSet
+class ArrayRecordset implements Countable, RecordSet
{
public $EOF = false;
@@ -34,7 +34,7 @@ class ArrayRecordSet implements Countable, RecordSet
/**
* Constructor.
*
- * @param array $data The input array
+ * @param array<array-key, mixed> $data The input array
*/
public function __construct($data)
{
@@ -45,10 +45,12 @@ class ArrayRecordSet implements Countable, RecordSet
$this->EOF = true;
}
}
-public function getIterator()
-{
- return $this->_array;
-}
+
+ public function getIterator()
+ {
+ return $this->_array;
+ }
+
/**
* Returns the recordCount.
*/
diff --git a/src/classes/CheckStyleRenderer.php b/src/Core/CheckStyleRenderer.php
index 02428209..f750efde 100644
--- a/src/classes/CheckStyleRenderer.php
+++ b/src/Core/CheckStyleRenderer.php
@@ -4,7 +4,7 @@
* PHPPgAdmin6
*/
-namespace PHPPgAdmin;
+namespace PHPPgAdmin\Core;
use PHPMD\Renderer\XMLRenderer;
use PHPMD\Report;
diff --git a/src/classes/Connection.php b/src/Core/Connection.php
index d49f4285..fe37410a 100644
--- a/src/classes/Connection.php
+++ b/src/Core/Connection.php
@@ -4,7 +4,7 @@
* PHPPgAdmin6
*/
-namespace PHPPgAdmin;
+namespace PHPPgAdmin\Core;
use ADODB_postgres9;
use PHPPgAdmin\Traits\HelperTrait;
@@ -65,10 +65,10 @@ class Connection
/**
* Creates a new connection. Will actually make a database connection.
*
- * @param array $server_info
- * @param string $database database name
- * @param ContainerUtils $container
- * @param int $fetchMode Defaults to associative. Override for different behaviour
+ * @param array<array-key, mixed> $server_info
+ * @param string $database database name
+ * @param ContainerUtils $container
+ * @param int $fetchMode Defaults to associative. Override for different behaviour
*/
public function __construct($server_info, $database, $container, $fetchMode = ADODB_FETCH_ASSOC)
{
diff --git a/src/classes/ContainerHandlers.php b/src/Core/ContainerHandlers.php
index aee76539..574966ca 100644
--- a/src/classes/ContainerHandlers.php
+++ b/src/Core/ContainerHandlers.php
@@ -4,7 +4,7 @@
* PHPPgAdmin6
*/
-namespace PHPPgAdmin;
+namespace PHPPgAdmin\Core;
use Slim\Flash\Messages;
diff --git a/src/classes/ContainerUtils.php b/src/Core/ContainerUtils.php
index f277f746..4040247a 100644
--- a/src/classes/ContainerUtils.php
+++ b/src/Core/ContainerUtils.php
@@ -4,7 +4,7 @@
* PHPPgAdmin6
*/
-namespace PHPPgAdmin;
+namespace PHPPgAdmin\Core;
use ArrayAccess;
use PHPPgAdmin\Decorators\Decorator;
@@ -23,7 +23,7 @@ use Slim\Http\Response;
* @property string $database
* @property bool $DEBUGMODE
* @property array $deploy_info
- * @property Messages $flash
+ * @property Messages $flash
* @property bool $IN_TEST
* @property Misc $misc
* @property Request $request
@@ -55,7 +55,7 @@ class ContainerUtils extends Container implements ContainerInterface
/**
* Default settings.
*
- * @var array
+ * @var array<array-key, mixed>
*/
private $defaultSettings = [
'httpVersion' => '1.1',
@@ -70,7 +70,7 @@ class ContainerUtils extends Container implements ContainerInterface
/**
* Undocumented variable.
*
- * @var array
+ * @var array<array-key, mixed>
*/
private static $envConfig = [
'BASE_PATH' => '',
@@ -80,7 +80,7 @@ class ContainerUtils extends Container implements ContainerInterface
];
/**
- * @param array $values the parameters or objects
+ * @param array<array-key, mixed> $values the parameters or objects
*/
final public function __construct(array $values = [])
{
@@ -198,7 +198,7 @@ class ContainerUtils extends Container implements ContainerInterface
/**
* @param mixed $subject
*
- * @return null|Decorators\ActionUrlDecorator
+ * @return null|\PHPPgAdmin\Decorators\ActionUrlDecorator
*/
public function getActionUrl($subject, bool $debug = false)
{
@@ -230,8 +230,8 @@ class ContainerUtils extends Container implements ContainerInterface
* Gets the destination with the last active tab selected for that controller
* Usually used after going through a redirect route.
*
- * @param string $subject The subject, usually a view name like 'server' or 'table'
- * @param array $urlvars
+ * @param string $subject The subject, usually a view name like 'server' or 'table'
+ * @param array<array-key, mixed> $urlvars
*
* @return string The destination url with last tab set in the query string
*/
@@ -324,7 +324,7 @@ class ContainerUtils extends Container implements ContainerInterface
}
/**
- * @param array $conf
+ * @param array<array-key, mixed> $conf
*
* @return static
*/
@@ -394,7 +394,7 @@ class ContainerUtils extends Container implements ContainerInterface
* All services are shared, they are registered such that the
* same instance is returned on subsequent calls.
*
- * @param array $userSettings Associative array of application settings
+ * @param array<array-key, mixed> $userSettings Associative array of application settings
*/
private function registerDefaultServices($userSettings): void
{
diff --git a/src/classes/Misc.php b/src/Core/Misc.php
index be570f12..a8f0b151 100644
--- a/src/classes/Misc.php
+++ b/src/Core/Misc.php
@@ -4,7 +4,7 @@
* PHPPgAdmin6
*/
-namespace PHPPgAdmin;
+namespace PHPPgAdmin\Core;
use Exception;
use PHPPgAdmin\Database\Postgres;
@@ -29,7 +29,7 @@ class Misc
use MiscTrait;
/**
- * @var array
+ * @var array<array-key, mixed>
*/
public $appLangFiles = [];
@@ -51,12 +51,12 @@ class Misc
public $href = '';
/**
- * @var array
+ * @var array<array-key, mixed>
*/
public $lang = [];
/**
- * @var array
+ * @var array<array-key, mixed>
*/
public $conf;
@@ -106,7 +106,7 @@ class Misc
private $_server_id;
/**
- * @var null|array
+ * @var array<array-key, mixed>|null
*/
private $_server_info;
@@ -163,7 +163,7 @@ class Misc
*
* @param null|string $key value of the key to be retrieved. If null, the full array is returnes
*
- * @return null|array|string the whole $conf array, the value of $conf[key] or null if said key does not exist
+ * @return array<array-key, mixed>|null|string the whole $conf array, the value of $conf[key] or null if said key does not exist
*/
public function getConf($key = null)
{
@@ -305,12 +305,12 @@ class Misc
/**
* Creates a database accessor.
*
- * @param string $database the name of the database
- * @param mixed $server_id the id of the server
+ * @param string $database the name of the database
+ * @param null|mixed $server_id the id of the server
*
* @internal mixed $plaform placeholder that will receive the value of the platform
*
- * @return null|Postgres|void the database accessor instance
+ * @return null|Postgres the database accessor instance
*/
public function getDatabaseAccessor($database = '', $server_id = null)
{
@@ -359,7 +359,7 @@ class Misc
return null;
}
/**
- * @var \class-string<Postgres>
+ * @var class-string<Postgres>
*/
$_type = '\\PHPPgAdmin\\Database\\' . $_type;
@@ -402,9 +402,7 @@ class Misc
/**
* Undocumented function.
*
- * @param string $server_id
- *
- * @return Connection
+ * @param null|string $server_id
*/
public function getConnection(string $database = '', $server_id = null): ?Connection
{
@@ -464,9 +462,9 @@ class Misc
* Validate and retrieve information on a server. If the parameter isn't supplied then the currently connected
* server is returned.
*
- * @param string $server_id A server identifier (host:port)
+ * @param null|string $server_id A server identifier (host:port)
*
- * @return null|array An associative array of server properties
+ * @return array<array-key, mixed>|null An associative array of server properties
*/
public function getServerInfo($server_id = null)
{
diff --git a/src/classes/Translations.php b/src/Core/Translations.php
index 9c8d8593..363fb5ce 100644
--- a/src/classes/Translations.php
+++ b/src/Core/Translations.php
@@ -4,7 +4,7 @@
* PHPPgAdmin6
*/
-namespace PHPPgAdmin;
+namespace PHPPgAdmin\Core;
/**
* Class for translations.
@@ -12,14 +12,14 @@ namespace PHPPgAdmin;
class Translations
{
/**
- * @var array
+ * @var array<array-key, mixed>
*/
public $lang;
// List of language files, and encoded language name.
/**
- * @var array
+ * @var array<array-key, mixed>
*/
public $appLangFiles = [
'afrikaans' => 'Afrikaans',
@@ -57,7 +57,7 @@ class Translations
];
/**
- * @var array
+ * @var array<array-key, mixed>
*/
public $appClasses = [
'afrikaans' => 'Afrikaans',
@@ -101,7 +101,7 @@ class Translations
* 'language' translation (eg. 'portuguese-br', but not 'portuguese')
* specify both 'la' => 'language-country' and 'la-co' => 'language-country'.
*
- * @var array */
+ * @var array<array-key, mixed> */
public $availableLanguages = [
'af' => 'afrikaans',
'ar' => 'arabic',
@@ -137,7 +137,7 @@ class Translations
];
/**
- * @var array
+ * @var array<array-key, mixed>
*/
public $languages_iso_code = [
'afrikaans' => 'af',
diff --git a/src/classes/ViewManager.php b/src/Core/ViewManager.php
index e4dd45e4..8d8fa7d8 100644
--- a/src/classes/ViewManager.php
+++ b/src/Core/ViewManager.php
@@ -4,7 +4,7 @@
* PHPPgAdmin6
*/
-namespace PHPPgAdmin;
+namespace PHPPgAdmin\Core;
use PHPPgAdmin\Traits\HelperTrait;
use Slim\Views\Twig;
@@ -26,7 +26,7 @@ class ViewManager extends Twig
use HelperTrait;
/**
- * @var array
+ * @var array<array-key, mixed>
*/
public $appLangFiles = [];
@@ -51,12 +51,12 @@ class ViewManager extends Twig
public $href = '';
/**
- * @var array
+ * @var array<array-key, mixed>
*/
public $lang = [];
/**
- * @var array
+ * @var array<array-key, mixed>
*/
public $conf;
@@ -85,7 +85,7 @@ class ViewManager extends Twig
/**
* Undocumented variable.
*
- * @var array
+ * @var array<array-key, mixed>
*/
private static $themeFolders = [];
@@ -204,8 +204,8 @@ class ViewManager extends Twig
* 2. Server specific config theme 3.- $_SESSION global (subsequent requests after 1.) 4.- $_COOKIE global (mostly
* fallback for $_SESSION after 1.- and 3.-) 5.- theme as set in config 6.- 'default' theme.
*
- * @param array $conf The conf
- * @param null|mixed $_server_info
+ * @param array<array-key, mixed> $conf The conf
+ * @param null|mixed $_server_info
*
* @return string the theme
*/
@@ -287,11 +287,11 @@ class ViewManager extends Twig
/**
* Displays link to the context help.
*
- * @param string $str the string that the context help is related to (already escaped)
- * @param string $help help section identifier
- * @param bool $do_print true to echo, false to return
+ * @param string $str the string that the context help is related to (already escaped)
+ * @param null|string $help help section identifier
+ * @param bool $do_print true to echo, false to return
*
- * @return string|void
+ * @return null|string
*/
public function printHelp($str, $help = null, $do_print = true)
{
@@ -495,7 +495,7 @@ class ViewManager extends Twig
* Traverse THEME_PATH, consider as theme folders those which
* contain a `global.css` stylesheet.
*
- * @return array the theme folders
+ * @return array<array-key, mixed> the theme folders
*/
private function getThemeFolders(): array
{
diff --git a/src/database/ADOdbBase.php b/src/Database/ADOdbBase.php
index a656fa7b..d182b917 100644
--- a/src/database/ADOdbBase.php
+++ b/src/Database/ADOdbBase.php
@@ -8,8 +8,8 @@ namespace PHPPgAdmin\Database;
use ADODB_postgres9;
use Exception;
-use PHPPgAdmin\Connection;
-use PHPPgAdmin\ContainerUtils;
+use PHPPgAdmin\Core\Connection;
+use PHPPgAdmin\Core\ContainerUtils;
use PHPPgAdmin\Database\Traits\DatabaseTrait;
use PHPPgAdmin\Database\Traits\HasTrait;
use PHPPgAdmin\Traits\HelperTrait;
@@ -60,8 +60,8 @@ class ADOdbBase
* Base constructor.
*
* @param Connection $conn The connection object
- * @param mixed $container
- * @param mixed $server_info
+ * @param mixed $container
+ * @param mixed $server_info
*/
public function __construct(Connection $conn, $container, $server_info)
{
@@ -74,7 +74,7 @@ class ADOdbBase
$this->prtrace('instanced connection class');
$this->lastExecutedSql = '';
$this->conn = $conn->conn;
- $this->platform=$conn->platform;
+ $this->platform = $conn->platform;
}
/**
diff --git a/src/database/Postgres.php b/src/Database/Postgres.php
index f5057d03..2e22bdf0 100644
--- a/src/database/Postgres.php
+++ b/src/Database/Postgres.php
@@ -6,7 +6,7 @@
namespace PHPPgAdmin\Database;
-use PHPPgAdmin\Connection;
+use PHPPgAdmin\Core\Connection;
use PHPPgAdmin\Database\Traits\AggregateTrait;
use PHPPgAdmin\Database\Traits\DatabaseTrait;
use PHPPgAdmin\Database\Traits\DomainTrait;
@@ -79,7 +79,7 @@ class Postgres extends ADOdbBase
{
//$this->prtrace('major_version :' . $this->major_version);
$this->conn = $connection->conn;
- $this->platform=$connection->platform;
+ $this->platform = $connection->platform;
$this->container = $container;
$this->lang = $container->get('lang');
@@ -441,6 +441,7 @@ class Postgres extends ADOdbBase
$filter
);
}
+ ddd($sql);
$sql .= 'ORDER BY type, schemaname, relname, name';
@@ -561,7 +562,8 @@ class Postgres extends ADOdbBase
* end of quote if matching non-backslashed character.
* backslashes don't count for double quotes, though.
*/
- if (\mb_substr($line, $i, 1) === $in_quote
+ if (
+ \mb_substr($line, $i, 1) === $in_quote
&& (0 === $bslash_count % 2 || '"' === $in_quote)
) {
$in_quote = 0;
diff --git a/src/database/Postgres10.php b/src/Database/Postgres10.php
index 93965ec5..93965ec5 100644
--- a/src/database/Postgres10.php
+++ b/src/Database/Postgres10.php
diff --git a/src/database/Postgres11.php b/src/Database/Postgres11.php
index 0bc8cab0..0bc8cab0 100644
--- a/src/database/Postgres11.php
+++ b/src/Database/Postgres11.php
diff --git a/src/database/Postgres12.php b/src/Database/Postgres12.php
index e88092bd..e88092bd 100644
--- a/src/database/Postgres12.php
+++ b/src/Database/Postgres12.php
diff --git a/src/database/Postgres13.php b/src/Database/Postgres13.php
index 1fad964d..1fad964d 100644
--- a/src/database/Postgres13.php
+++ b/src/Database/Postgres13.php
diff --git a/src/database/Postgres90.php b/src/Database/Postgres90.php
index af681451..af681451 100644
--- a/src/database/Postgres90.php
+++ b/src/Database/Postgres90.php
diff --git a/src/database/Postgres91.php b/src/Database/Postgres91.php
index 679fa4ca..679fa4ca 100644
--- a/src/database/Postgres91.php
+++ b/src/Database/Postgres91.php
diff --git a/src/database/Postgres92.php b/src/Database/Postgres92.php
index 41410da1..41410da1 100644
--- a/src/database/Postgres92.php
+++ b/src/Database/Postgres92.php
diff --git a/src/database/Postgres93.php b/src/Database/Postgres93.php
index a8cdecb6..a8cdecb6 100644
--- a/src/database/Postgres93.php
+++ b/src/Database/Postgres93.php
diff --git a/src/database/Postgres94.php b/src/Database/Postgres94.php
index c62a33ea..c62a33ea 100644
--- a/src/database/Postgres94.php
+++ b/src/Database/Postgres94.php
diff --git a/src/database/Postgres95.php b/src/Database/Postgres95.php
index 69988bf9..69988bf9 100644
--- a/src/database/Postgres95.php
+++ b/src/Database/Postgres95.php
diff --git a/src/database/Postgres96.php b/src/Database/Postgres96.php
index 8f57ba20..8f57ba20 100644
--- a/src/database/Postgres96.php
+++ b/src/Database/Postgres96.php
diff --git a/src/database/databasetraits/AggregateTrait.php b/src/Database/Traits/AggregateTrait.php
index c13f27af..c13f27af 100644
--- a/src/database/databasetraits/AggregateTrait.php
+++ b/src/Database/Traits/AggregateTrait.php
diff --git a/src/database/databasetraits/ColumnTrait.php b/src/Database/Traits/ColumnTrait.php
index 3cc8eccb..3cc8eccb 100644
--- a/src/database/databasetraits/ColumnTrait.php
+++ b/src/Database/Traits/ColumnTrait.php
diff --git a/src/database/databasetraits/DatabaseTrait.php b/src/Database/Traits/DatabaseTrait.php
index 6cd2fcfc..6cd2fcfc 100644
--- a/src/database/databasetraits/DatabaseTrait.php
+++ b/src/Database/Traits/DatabaseTrait.php
diff --git a/src/database/databasetraits/DomainTrait.php b/src/Database/Traits/DomainTrait.php
index b73a5c9b..b73a5c9b 100644
--- a/src/database/databasetraits/DomainTrait.php
+++ b/src/Database/Traits/DomainTrait.php
diff --git a/src/database/databasetraits/FtsTrait.php b/src/Database/Traits/FtsTrait.php
index 9e191ed1..9e191ed1 100644
--- a/src/database/databasetraits/FtsTrait.php
+++ b/src/Database/Traits/FtsTrait.php
diff --git a/src/database/databasetraits/FunctionTrait.php b/src/Database/Traits/FunctionTrait.php
index 7a12d04a..7a12d04a 100644
--- a/src/database/databasetraits/FunctionTrait.php
+++ b/src/Database/Traits/FunctionTrait.php
diff --git a/src/database/databasetraits/HasTrait.php b/src/Database/Traits/HasTrait.php
index c3c1642d..c3c1642d 100644
--- a/src/database/databasetraits/HasTrait.php
+++ b/src/Database/Traits/HasTrait.php
diff --git a/src/database/databasetraits/IndexTrait.php b/src/Database/Traits/IndexTrait.php
index 9bb944b7..9bb944b7 100644
--- a/src/database/databasetraits/IndexTrait.php
+++ b/src/Database/Traits/IndexTrait.php
diff --git a/src/database/databasetraits/OperatorTrait.php b/src/Database/Traits/OperatorTrait.php
index 2be91f54..2be91f54 100644
--- a/src/database/databasetraits/OperatorTrait.php
+++ b/src/Database/Traits/OperatorTrait.php
diff --git a/src/database/databasetraits/PrivilegesTrait.php b/src/Database/Traits/PrivilegesTrait.php
index af882c02..af882c02 100644
--- a/src/database/databasetraits/PrivilegesTrait.php
+++ b/src/Database/Traits/PrivilegesTrait.php
diff --git a/src/database/databasetraits/RoleTrait.php b/src/Database/Traits/RoleTrait.php
index fc15a197..fc15a197 100644
--- a/src/database/databasetraits/RoleTrait.php
+++ b/src/Database/Traits/RoleTrait.php
diff --git a/src/database/databasetraits/RowTrait.php b/src/Database/Traits/RowTrait.php
index 8ec7db35..8ec7db35 100644
--- a/src/database/databasetraits/RowTrait.php
+++ b/src/Database/Traits/RowTrait.php
diff --git a/src/database/databasetraits/SchemaTrait.php b/src/Database/Traits/SchemaTrait.php
index a99e744c..a99e744c 100644
--- a/src/database/databasetraits/SchemaTrait.php
+++ b/src/Database/Traits/SchemaTrait.php
diff --git a/src/database/databasetraits/SequenceTrait.php b/src/Database/Traits/SequenceTrait.php
index 4db9801c..4db9801c 100644
--- a/src/database/databasetraits/SequenceTrait.php
+++ b/src/Database/Traits/SequenceTrait.php
diff --git a/src/database/databasetraits/StatsTrait.php b/src/Database/Traits/StatsTrait.php
index f949d2eb..f949d2eb 100644
--- a/src/database/databasetraits/StatsTrait.php
+++ b/src/Database/Traits/StatsTrait.php
diff --git a/src/database/databasetraits/TableTrait.php b/src/Database/Traits/TableTrait.php
index 6c6ca7df..bb1401b6 100644
--- a/src/database/databasetraits/TableTrait.php
+++ b/src/Database/Traits/TableTrait.php
@@ -6,9 +6,6 @@
namespace PHPPgAdmin\Database\Traits;
-use PHPPgAdmin\ADORecordSet;
-use PHPPgAdmin\ArrayRecordSet;
-
/**
* Common trait for tables manipulation.
*/
@@ -904,7 +901,7 @@ trait TableTrait
$status = $this->beginTransaction();
//dump(['beginTransaction' => $status]);
- if (0 !== $status || !($tblrs instanceof ADORecordSet)) {
+ if (0 !== $status || !($tblrs instanceof \PHPPgAdmin\Core\ADORecordSet)) {
$this->rollbackTransaction();
return -1;
@@ -930,7 +927,7 @@ trait TableTrait
* Enables or disables the oid system column to a table a table's owner
* /!\ this function is called from _alterTable which take care of escaping fields.
*
- * @param ADORecordSet $tblrs The table RecordSet returned by getTable()
+ * @param \PHPPgAdmin\Core\ADORecordSet $tblrs The table RecordSet returned by getTable()
*
* @return array{0:int,1:string} [status:0 if successful, change_sql: changed attribute]
*/
@@ -968,8 +965,8 @@ trait TableTrait
* Alter a table's owner
* /!\ this function is called from _alterTable which take care of escaping fields.
*
- * @param ADORecordSet $tblrs The table RecordSet returned by getTable()
- * @param null|string $owner
+ * @param \PHPPgAdmin\Core\ADORecordSet $tblrs The table RecordSet returned by getTable()
+ * @param null|string $owner
*
* @return array{0:int,1:string} [status:0 if successful, change_sql: changed attribute]
*/
@@ -1005,8 +1002,8 @@ trait TableTrait
* Alter a table's tablespace
* /!\ this function is called from _alterTable which take care of escaping fields.
*
- * @param ADORecordSet $tblrs The table RecordSet returned by getTable()
- * @param null|string $tablespace
+ * @param \PHPPgAdmin\Core\ADORecordSet $tblrs The table RecordSet returned by getTable()
+ * @param null|string $tablespace
*
* @return array{0:int,1:string} [status:0 if successful, change_sql: changed attribute]
*/
@@ -1042,8 +1039,8 @@ trait TableTrait
* Alter a table's name
* /!\ this function is called from _alterTable which take care of escaping fields.
*
- * @param ADORecordSet $tblrs The table RecordSet returned by getTable()
- * @param string $name The new table's name
+ * @param \PHPPgAdmin\Core\ADORecordSet $tblrs The table RecordSet returned by getTable()
+ * @param string $name The new table's name
*
* @return array{0:int,1:string} [status:0 if successful, change_sql: changed attribute]
*/
@@ -1083,8 +1080,8 @@ trait TableTrait
* Alter a table's schema
* /!\ this function is called from _alterTable which take care of escaping fields.
*
- * @param ADORecordSet $tblrs The table RecordSet returned by getTable()
- * @param null|string $schema
+ * @param \PHPPgAdmin\Core\ADORecordSet $tblrs The table RecordSet returned by getTable()
+ * @param null|string $schema
*
* @return array{0:int,1:string} [status:0 if successful, change_sql: changed attribute]
*/
@@ -1263,7 +1260,7 @@ trait TableTrait
*
* @param string $table if given, return autovacuum info for the given table or return all informations for all table
*
- * @return ArrayRecordSet A recordset
+ * @return \PHPPgAdmin\Core\ArrayRecordset A recordset
*/
public function getTableAutovacuum($table = '')
{
@@ -1318,7 +1315,7 @@ trait TableTrait
$_autovacs->MoveNext();
}
- return new ArrayRecordSet($autovacs);
+ return new \PHPPgAdmin\Core\ArrayRecordset($autovacs);
}
/**
@@ -1505,13 +1502,13 @@ trait TableTrait
* Protected method which alter a table
* SHOULDN'T BE CALLED OUTSIDE OF A TRANSACTION.
*
- * @param ADORecordSet $tblrs The table recordSet returned by getTable()
- * @param string $name The new name for the table
- * @param string $owner The new owner for the table
- * @param string $schema The new schema for the table
- * @param string $comment The comment on the table
- * @param string $tablespace The new tablespace for the table ('' means leave as is)
- * @param bool $withoutoids If set to TRUE, will drop oids column
+ * @param \PHPPgAdmin\Core\ADORecordSet $tblrs The table recordSet returned by getTable()
+ * @param string $name The new name for the table
+ * @param string $owner The new owner for the table
+ * @param string $schema The new schema for the table
+ * @param string $comment The comment on the table
+ * @param string $tablespace The new tablespace for the table ('' means leave as is)
+ * @param bool $withoutoids If set to TRUE, will drop oids column
*
* @return int
*
@@ -1603,19 +1600,19 @@ trait TableTrait
/**
* Dumps serial-like columns in the table.
*
- * @param ADORecordSet $atts table attributes
- * @param ADORecordSet $tblfields table fields object
- * @param string $sql The sql sentence
- * generated so far
- * @param string $col_comments_sql Column comments,
- * passed by reference
- * @param int $i current counter to
- * know if we should
- * append a comma to the
- * sentence
- * @param int $num Table attributes
- * count + table
- * constraints count
+ * @param \PHPPgAdmin\Core\ADORecordSet $atts table attributes
+ * @param \PHPPgAdmin\Core\ADORecordSet $tblfields table fields object
+ * @param string $sql The sql sentence
+ * generated so far
+ * @param string $col_comments_sql Column comments,
+ * passed by reference
+ * @param int $i current counter to
+ * know if we should
+ * append a comma to the
+ * sentence
+ * @param int $num Table attributes
+ * count + table
+ * constraints count
*
* @return string original $sql plus appended strings
*/
@@ -1682,13 +1679,13 @@ trait TableTrait
/**
* Dumps constraints.
*
- * @param ADORecordSet $cons The table constraints
- * @param string $table The table to define
- * @param string $sql The sql sentence generated so
- * far
- * @param mixed $i
- * @param int $num Table attributes count + table
- * constraints count
+ * @param \PHPPgAdmin\Core\ADORecordSet $cons The table constraints
+ * @param string $table The table to define
+ * @param string $sql The sql sentence generated so
+ * far
+ * @param mixed $i
+ * @param int $num Table attributes count + table
+ * constraints count
*/
private function _dumpConstraints($cons, $table, $sql, $i, $num): ?string
{
@@ -1740,9 +1737,9 @@ trait TableTrait
/**
* Dumps col statistics.
*
- * @param ADORecordSet $atts table attributes
- * @param ADORecordSet $tblfields table field attributes
- * @param string $sql The sql sentence generated so far
+ * @param \PHPPgAdmin\Core\ADORecordSet $atts table attributes
+ * @param \PHPPgAdmin\Core\ADORecordSet $tblfields table field attributes
+ * @param string $sql The sql sentence generated so far
*/
private function _dumpColStats($atts, $tblfields, $sql): ?string
{
@@ -1812,9 +1809,9 @@ trait TableTrait
/**
* Dumps privileges.
*
- * @param ADORecordSet $privs The table privileges
- * @param ADORecordSet $tblfields The table fields definition
- * @param string $sql The sql sentence generated so far
+ * @param \PHPPgAdmin\Core\ADORecordSet $privs The table privileges
+ * @param \PHPPgAdmin\Core\ADORecordSet $tblfields The table fields definition
+ * @param string $sql The sql sentence generated so far
*/
private function _dumpPrivileges($privs, $tblfields, $sql): ?string
{
@@ -1961,9 +1958,9 @@ trait TableTrait
/**
* Dumps a create.
*
- * @param ADORecordSet $tblfields table fields object
- * @param string $sql The sql sentence generated so far
- * @param string $cleanprefix set to '-- ' to avoid issuing DROP statement
+ * @param \PHPPgAdmin\Core\ADORecordSet $tblfields table fields object
+ * @param string $sql The sql sentence generated so far
+ * @param string $cleanprefix set to '-- ' to avoid issuing DROP statement
*
* @return string original $sql plus appended strings
*/
diff --git a/src/database/databasetraits/TablespaceTrait.php b/src/Database/Traits/TablespaceTrait.php
index ba80bc2e..ba80bc2e 100644
--- a/src/database/databasetraits/TablespaceTrait.php
+++ b/src/Database/Traits/TablespaceTrait.php
diff --git a/src/database/databasetraits/TriggerTrait.php b/src/Database/Traits/TriggerTrait.php
index e89220db..e89220db 100644
--- a/src/database/databasetraits/TriggerTrait.php
+++ b/src/Database/Traits/TriggerTrait.php
diff --git a/src/database/databasetraits/TypeTrait.php b/src/Database/Traits/TypeTrait.php
index c21e03de..c21e03de 100644
--- a/src/database/databasetraits/TypeTrait.php
+++ b/src/Database/Traits/TypeTrait.php
diff --git a/src/database/databasetraits/ViewTrait.php b/src/Database/Traits/ViewTrait.php
index b532650c..b58409f1 100644
--- a/src/database/databasetraits/ViewTrait.php
+++ b/src/Database/Traits/ViewTrait.php
@@ -6,8 +6,6 @@
namespace PHPPgAdmin\Database\Traits;
-use PHPPgAdmin\ADORecordSet;
-
/**
* Common trait for views manipulation.
*/
@@ -145,7 +143,7 @@ trait ViewTrait
$status = $this->beginTransaction();
- if (0 !== $status || !($data instanceof ADORecordSet)) {
+ if (0 !== $status || !($data instanceof \PHPPgAdmin\Core\ADORecordSet)) {
$this->rollbackTransaction();
return -1;
@@ -190,8 +188,8 @@ trait ViewTrait
/**
* Alter a view's owner.
*
- * @param ADORecordSet $vwrs The view recordSet returned by getView()
- * @param null|string $owner
+ * @param \PHPPgAdmin\Core\ADORecordSet $vwrs The view recordSet returned by getView()
+ * @param null|string $owner
*
* @return int|string
*
@@ -218,8 +216,8 @@ trait ViewTrait
/**
* Rename a view.
*
- * @param ADORecordSet $vwrs The view recordSet returned by getView()
- * @param string $name The new view's name
+ * @param \PHPPgAdmin\Core\ADORecordSet $vwrs The view recordSet returned by getView()
+ * @param string $name The new view's name
*
* @return int|string
*/
@@ -247,8 +245,8 @@ trait ViewTrait
/**
* Alter a view's schema.
*
- * @param ADORecordSet $vwrs The view recordSet returned by getView()
- * @param string $schema
+ * @param \PHPPgAdmin\Core\ADORecordSet $vwrs The view recordSet returned by getView()
+ * @param string $schema
*
* @return int|string
*
@@ -320,11 +318,11 @@ trait ViewTrait
* Protected method which alter a view
* SHOULDN'T BE CALLED OUTSIDE OF A TRANSACTION.
*
- * @param ADORecordSet $vwrs The view recordSet returned by getView()
- * @param string $name The new name for the view
- * @param string $owner The new owner for the view
- * @param string $schema Schema name
- * @param string $comment The comment on the view
+ * @param \PHPPgAdmin\Core\ADORecordSet $vwrs The view recordSet returned by getView()
+ * @param string $name The new name for the view
+ * @param string $owner The new owner for the view
+ * @param string $schema Schema name
+ * @param string $comment The comment on the view
*
* @return int
*
diff --git a/src/decorators/ActionUrlDecorator.php b/src/Decorators/ActionUrlDecorator.php
index 8173a346..8173a346 100644
--- a/src/decorators/ActionUrlDecorator.php
+++ b/src/Decorators/ActionUrlDecorator.php
diff --git a/src/decorators/ArrayMergeDecorator.php b/src/Decorators/ArrayMergeDecorator.php
index c40e93b5..c40e93b5 100644
--- a/src/decorators/ArrayMergeDecorator.php
+++ b/src/Decorators/ArrayMergeDecorator.php
diff --git a/src/decorators/BranchUrlDecorator.php b/src/Decorators/BranchUrlDecorator.php
index 57222690..57222690 100644
--- a/src/decorators/BranchUrlDecorator.php
+++ b/src/Decorators/BranchUrlDecorator.php
diff --git a/src/decorators/CallbackDecorator.php b/src/Decorators/CallbackDecorator.php
index 1f1e93b1..1f1e93b1 100644
--- a/src/decorators/CallbackDecorator.php
+++ b/src/Decorators/CallbackDecorator.php
diff --git a/src/decorators/ConcatDecorator.php b/src/Decorators/ConcatDecorator.php
index cd79a134..cd79a134 100644
--- a/src/decorators/ConcatDecorator.php
+++ b/src/Decorators/ConcatDecorator.php
diff --git a/src/decorators/Decorator.php b/src/Decorators/Decorator.php
index 2e6fb824..21babee6 100644
--- a/src/decorators/Decorator.php
+++ b/src/Decorators/Decorator.php
@@ -6,7 +6,6 @@
namespace PHPPgAdmin\Decorators;
-use Closure;
use PHPPgAdmin\Traits\HelperTrait;
class Decorator
@@ -22,58 +21,41 @@ class Decorator
$this->val = $value;
}
+ /**
+ * In specific decorators this method has a meaningful purpose.
+ * In this class it's just a noop.
+ */
public function value(array $fields)
{
return $this->val;
}
- /**
- * @param scalar $var
- */
- public static function get_sanitized_value(&$var, array &$fields, ?string $esc = null)
+ public function sanitizeFor(array &$fields, ?string $escape = null)
{
- if ($var instanceof self) {
- $val = $var->value($fields);
- } else {
- $val = &$var;
- }
-
- if (\is_string($val)) {
- switch ($esc) {
- case 'xml':
- return \strtr($val, [
- '&' => '&amp;',
- "'" => '&apos;',
- '"' => '&quot;',
- '<' => '&lt;',
- '>' => '&gt;',
- ]);
- case 'html':
- return \htmlentities($val, \ENT_COMPAT, 'UTF-8');
- case 'url':
- return \urlencode($val);
- }
- }
-
- return $val;
+ return $this->value($fields);
}
/**
- * @param ((mixed|string)[]|null) $params
+ * Just a factory method to chain decorators nicely.
*
- * @return CallbackDecorator
+ * @example Decorator::for($field)->sanitizeFor(['name','value'],'html');
+ *
+ * @param [type] ...$args
+ *
+ * @return static
*/
- public static function callback(Closure $callback, ?array $params = null)
+ public static function for(...$args): self
{
- return new CallbackDecorator($callback, $params);
+ return new static(...$args);
}
/**
- * @param scalar $var
+ * @param mixed $var
+ * @param string $escape
*/
- public static function value_url(&$var, array &$fields)
+ public static function get_sanitized_value(&$var, array &$fields, ?string $escape = null)
{
- return self::get_sanitized_value($var, $fields, 'url');
+ return ($var instanceof self) ? $var->value($fields) : self::escape($var, $escape);
}
/**
@@ -93,6 +75,14 @@ class Decorator
}
/**
+ * @param scalar $var
+ */
+ public static function value_url(&$var, array &$fields)
+ {
+ return self::get_sanitized_value($var, $fields, 'url');
+ }
+
+ /**
* @return FieldDecorator
*/
public static function field(string $fieldName, ?array $default = null)
@@ -161,6 +151,17 @@ class Decorator
}
/**
+ * @param FieldDecorator $value
+ * @param null|UrlDecorator $full
+ *
+ * @return IfEmptyDecorator
+ */
+ public static function ifempty($value, string $empty, $full = null)
+ {
+ return new IfEmptyDecorator($value, $empty, $full);
+ }
+
+ /**
* @param mixed $base
*
* @return UrlDecorator
@@ -180,15 +181,35 @@ class Decorator
return new UrlDecorator($base, $vars);
}
-
- /**
- * @param FieldDecorator $value
- * @param null|UrlDecorator $full
+ /**
+ * @param ((mixed|string)[]|null) $params
*
- * @return IfEmptyDecorator
+ * @return CallbackDecorator
*/
- public static function ifempty($value, string $empty, $full = null)
+ public static function callback(Closure $callback, ?array $params = null)
{
- return new IfEmptyDecorator($value, $empty, $full);
+ return new CallbackDecorator($callback, $params);
+ }
+
+ private static function escape(&$value, ?string $escape = null)
+ {
+ if (\is_string($value)) {
+ switch ($escape) {
+ case 'xml':
+ return \strtr($value, [
+ '&' => '&amp;',
+ "'" => '&apos;',
+ '"' => '&quot;',
+ '<' => '&lt;',
+ '>' => '&gt;',
+ ]);
+ case 'html':
+ return \htmlentities($value, \ENT_COMPAT, 'UTF-8');
+ case 'url':
+ return \urlencode($value);
+ }
+ }
+
+ return $value;
}
}
diff --git a/src/decorators/FieldDecorator.php b/src/Decorators/FieldDecorator.php
index fb4da991..fb4da991 100644
--- a/src/decorators/FieldDecorator.php
+++ b/src/Decorators/FieldDecorator.php
diff --git a/src/decorators/IfEmptyDecorator.php b/src/Decorators/IfEmptyDecorator.php
index 794981d6..794981d6 100644
--- a/src/decorators/IfEmptyDecorator.php
+++ b/src/Decorators/IfEmptyDecorator.php
diff --git a/src/decorators/RedirectUrlDecorator.php b/src/Decorators/RedirectUrlDecorator.php
index c806bf4b..c806bf4b 100644
--- a/src/decorators/RedirectUrlDecorator.php
+++ b/src/Decorators/RedirectUrlDecorator.php
diff --git a/src/decorators/ReplaceDecorator.php b/src/Decorators/ReplaceDecorator.php
index e487362c..e487362c 100644
--- a/src/decorators/ReplaceDecorator.php
+++ b/src/Decorators/ReplaceDecorator.php
diff --git a/src/decorators/UrlDecorator.php b/src/Decorators/UrlDecorator.php
index 7f781c8e..7f781c8e 100644
--- a/src/decorators/UrlDecorator.php
+++ b/src/Decorators/UrlDecorator.php
diff --git a/src/help/PostgresDoc.php b/src/Help/PostgresDoc.php
index e40fa95d..e40fa95d 100644
--- a/src/help/PostgresDoc.php
+++ b/src/Help/PostgresDoc.php
diff --git a/src/help/PostgresDoc10.php b/src/Help/PostgresDoc10.php
index 24947c23..24947c23 100644
--- a/src/help/PostgresDoc10.php
+++ b/src/Help/PostgresDoc10.php
diff --git a/src/help/PostgresDoc11.php b/src/Help/PostgresDoc11.php
index fce4e5bc..fce4e5bc 100644
--- a/src/help/PostgresDoc11.php
+++ b/src/Help/PostgresDoc11.php
diff --git a/src/help/PostgresDoc12.php b/src/Help/PostgresDoc12.php
index da2275e9..da2275e9 100644
--- a/src/help/PostgresDoc12.php
+++ b/src/Help/PostgresDoc12.php
diff --git a/src/help/PostgresDoc90.php b/src/Help/PostgresDoc90.php
index d880ded1..d880ded1 100644
--- a/src/help/PostgresDoc90.php
+++ b/src/Help/PostgresDoc90.php
diff --git a/src/help/PostgresDoc91.php b/src/Help/PostgresDoc91.php
index 9578197a..9578197a 100644
--- a/src/help/PostgresDoc91.php
+++ b/src/Help/PostgresDoc91.php
diff --git a/src/help/PostgresDoc92.php b/src/Help/PostgresDoc92.php
index 706404a6..706404a6 100644
--- a/src/help/PostgresDoc92.php
+++ b/src/Help/PostgresDoc92.php
diff --git a/src/help/PostgresDoc93.php b/src/Help/PostgresDoc93.php
index a1a93869..a1a93869 100644
--- a/src/help/PostgresDoc93.php
+++ b/src/Help/PostgresDoc93.php
diff --git a/src/help/PostgresDoc94.php b/src/Help/PostgresDoc94.php
index f2797591..f2797591 100644
--- a/src/help/PostgresDoc94.php
+++ b/src/Help/PostgresDoc94.php
diff --git a/src/help/PostgresDoc95.php b/src/Help/PostgresDoc95.php
index 46d40fe9..46d40fe9 100644
--- a/src/help/PostgresDoc95.php
+++ b/src/Help/PostgresDoc95.php
diff --git a/src/help/PostgresDoc96.php b/src/Help/PostgresDoc96.php
index deaa30a2..deaa30a2 100644
--- a/src/help/PostgresDoc96.php
+++ b/src/Help/PostgresDoc96.php
diff --git a/src/interfaces/RecordSet.php b/src/Interfaces/RecordSet.php
index 9310db75..9310db75 100644
--- a/src/interfaces/RecordSet.php
+++ b/src/Interfaces/RecordSet.php
diff --git a/src/middleware/Middleware.php b/src/Middleware/Middleware.php
index 9e99344a..9e99344a 100644
--- a/src/middleware/Middleware.php
+++ b/src/Middleware/Middleware.php
diff --git a/src/middleware/PopulateRequestResponse.php b/src/Middleware/PopulateRequestResponse.php
index 686b07f7..3b4e498a 100644
--- a/src/middleware/PopulateRequestResponse.php
+++ b/src/Middleware/PopulateRequestResponse.php
@@ -6,9 +6,9 @@
namespace PHPPgAdmin\Middleware;
-use PHPPgAdmin\ContainerUtils;
+use PHPPgAdmin\Core\ContainerUtils;
+use PHPPgAdmin\Core\ViewManager;
use PHPPgAdmin\Traits\HelperTrait;
-use PHPPgAdmin\ViewManager;
use Slim\Http\Request;
use Slim\Http\Response;
use Slim\Http\Uri;
diff --git a/src/traits/AdminTrait.php b/src/Traits/AdminTrait.php
index 32bc47f3..2eb43182 100644
--- a/src/traits/AdminTrait.php
+++ b/src/Traits/AdminTrait.php
@@ -7,7 +7,6 @@
namespace PHPPgAdmin\Traits;
use IteratorAggregate;
-use PHPPgAdmin\ArrayRecordSet;
use PHPPgAdmin\Decorators\Decorator;
/**
@@ -788,8 +787,8 @@ trait AdminTrait
echo '</tr>' . \PHP_EOL;
echo '</table>' . \PHP_EOL;
- if($data) {
- $this->_printAutoVacuumConf($data, $type);
+ if ($data) {
+ $this->_printAutoVacuumConf($data, $type);
}
}
@@ -937,7 +936,6 @@ trait AdminTrait
private function _printAutoVacuumConf(\PHPPgAdmin\Database\Postgres $data, $type): void
{
-
if (!$data->hasAutovacuum()) {
return;
}
@@ -1062,9 +1060,11 @@ trait AdminTrait
$columns['relname']
);
}
- if($autovac instanceof ArrayRecordSet) {
- echo $this->printTable($autovac, $columns, $actions, 'admin-admin', $this->lang['strnovacuumconf']);
- }
+
+ if ($autovac instanceof \PHPPgAdmin\Core\ArrayRecordset) {
+ echo $this->printTable($autovac, $columns, $actions, 'admin-admin', $this->lang['strnovacuumconf']);
+ }
+
if (('table' === $type) && (0 === $autovac->RecordCount())) {
echo '<br />';
diff --git a/src/traits/ExportTrait.php b/src/Traits/ExportTrait.php
index 0bf9bc94..0bf9bc94 100644
--- a/src/traits/ExportTrait.php
+++ b/src/Traits/ExportTrait.php
diff --git a/src/traits/FormTrait.php b/src/Traits/FormTrait.php
index bb4ccd3c..bb4ccd3c 100644
--- a/src/traits/FormTrait.php
+++ b/src/Traits/FormTrait.php
diff --git a/src/traits/HelperTrait.php b/src/Traits/HelperTrait.php
index c4df1e9f..c4df1e9f 100644
--- a/src/traits/HelperTrait.php
+++ b/src/Traits/HelperTrait.php
diff --git a/src/traits/InsertEditRowTrait.php b/src/Traits/InsertEditRowTrait.php
index a79b424b..a79b424b 100644
--- a/src/traits/InsertEditRowTrait.php
+++ b/src/Traits/InsertEditRowTrait.php
diff --git a/src/traits/MiscTrait.php b/src/Traits/MiscTrait.php
index ad47129c..47c0677d 100644
--- a/src/traits/MiscTrait.php
+++ b/src/Traits/MiscTrait.php
@@ -6,7 +6,6 @@
namespace PHPPgAdmin\Traits;
-use PHPPgAdmin\ContainerUtils;
use PHPPgAdmin\Decorators\Decorator;
/**
@@ -304,7 +303,7 @@ trait MiscTrait
case 'cid':
case 'tid':
$align = 'right';
- $out = \nl2br(\htmlspecialchars(ContainerUtils::br2ln($str)));
+ $out = \nl2br(\htmlspecialchars(\PHPPgAdmin\Core\ContainerUtils::br2ln($str)));
break;
case 'yesno':
@@ -336,7 +335,7 @@ trait MiscTrait
break;
case 'nbsp':
- $out = \nl2br(\str_replace(' ', '&nbsp;', ContainerUtils::br2ln($str)));
+ $out = \nl2br(\str_replace(' ', '&nbsp;', \PHPPgAdmin\Core\ContainerUtils::br2ln($str)));
break;
case 'verbatim':
@@ -348,7 +347,7 @@ trait MiscTrait
break;
case 'prettysize':
- $out = self::formatSizeUnits($str, $lang);
+ $out = \PHPPgAdmin\Core\Misc::formatSizeUnits($str, $lang);
break;
@@ -362,7 +361,7 @@ trait MiscTrait
$out = \htmlspecialchars($str);
} else {
//$tag = 'span';
- $out = \nl2br(\htmlspecialchars(ContainerUtils::br2ln($str)));
+ $out = \nl2br(\htmlspecialchars(\PHPPgAdmin\Core\ContainerUtils::br2ln($str)));
}
}
diff --git a/src/traits/ServersTrait.php b/src/Traits/ServersTrait.php
index 24236039..59264f5c 100644
--- a/src/traits/ServersTrait.php
+++ b/src/Traits/ServersTrait.php
@@ -21,7 +21,7 @@ trait ServersTrait
*
* @return array|\PHPPgAdmin\ArrayRecordSet either an array or a Recordset suitable for HTMLTableController::printTable
*
- * @psalm-return \PHPPgAdmin\ArrayRecordSet|array<string, mixed>
+ * @psalm-return \PHPPgAdmin\Core\ArrayRecordset|array<string, mixed>
*/
public function getServers($recordset = false, $group = false)
{
@@ -85,7 +85,7 @@ trait ServersTrait
});
if ($recordset) {
- return new \PHPPgAdmin\ArrayRecordSet($srvs);
+ return new \PHPPgAdmin\Core\ArrayRecordset($srvs);
}
return $srvs;
@@ -174,8 +174,6 @@ trait ServersTrait
$connection_html .= '</td></tr></table>' . \PHP_EOL;
-
- return $connection_html;
-
+ return $connection_html;
}
}
diff --git a/src/traits/ViewsMatViewsPropertiesTrait.php b/src/Traits/ViewsMatViewsPropertiesTrait.php
index 57364c80..57364c80 100644
--- a/src/traits/ViewsMatViewsPropertiesTrait.php
+++ b/src/Traits/ViewsMatViewsPropertiesTrait.php
diff --git a/src/traits/ViewsMatviewsTrait.php b/src/Traits/ViewsMatviewsTrait.php
index 4619c909..7c148768 100644
--- a/src/traits/ViewsMatviewsTrait.php
+++ b/src/Traits/ViewsMatviewsTrait.php
@@ -25,7 +25,6 @@ trait ViewsMatviewsTrait
$items = $this->adjustTabsForTree($tabs);
$reqvars = $this->misc->getRequestVars($this->keystring);
-
$attrs = [
'text' => Decorator::field('title'),
'icon' => Decorator::field('icon'),
@@ -329,7 +328,7 @@ trait ViewsMatviewsTrait
}
return $this->doSetParamsCreate($this->lang['strviewcreatedbad']);
- } catch (\PHPPgAdmin\ADOdbException $e) {
+ } catch (\PHPPgAdmin\Core\ADOdbException $e) {
return $this->halt($e->getMessage());
}
}
diff --git a/src/translations/AbstractLang.php b/src/Translations/AbstractLang.php
index e55cbe85..e55cbe85 100644
--- a/src/translations/AbstractLang.php
+++ b/src/Translations/AbstractLang.php
diff --git a/src/translations/Afrikaans.php b/src/Translations/Afrikaans.php
index de4e1ef0..de4e1ef0 100644
--- a/src/translations/Afrikaans.php
+++ b/src/Translations/Afrikaans.php
diff --git a/src/translations/Arabic.php b/src/Translations/Arabic.php
index b1181e54..b1181e54 100644
--- a/src/translations/Arabic.php
+++ b/src/Translations/Arabic.php
diff --git a/src/translations/Catalan.php b/src/Translations/Catalan.php
index 624e3f9d..624e3f9d 100644
--- a/src/translations/Catalan.php
+++ b/src/Translations/Catalan.php
diff --git a/src/translations/ChineseSim.php b/src/Translations/ChineseSim.php
index c2f057df..c2f057df 100644
--- a/src/translations/ChineseSim.php
+++ b/src/Translations/ChineseSim.php
diff --git a/src/translations/ChineseTr.php b/src/Translations/ChineseTr.php
index d15c39b0..d15c39b0 100644
--- a/src/translations/ChineseTr.php
+++ b/src/Translations/ChineseTr.php
diff --git a/src/translations/ChineseUtf8ZhCn.php b/src/Translations/ChineseUtf8ZhCn.php
index 75a69edd..75a69edd 100644
--- a/src/translations/ChineseUtf8ZhCn.php
+++ b/src/Translations/ChineseUtf8ZhCn.php
diff --git a/src/translations/ChineseUtf8ZhTw.php b/src/Translations/ChineseUtf8ZhTw.php
index 250364cf..250364cf 100644
--- a/src/translations/ChineseUtf8ZhTw.php
+++ b/src/Translations/ChineseUtf8ZhTw.php
diff --git a/src/translations/Czech.php b/src/Translations/Czech.php
index c6fafb73..c6fafb73 100644
--- a/src/translations/Czech.php
+++ b/src/Translations/Czech.php
diff --git a/src/translations/Danish.php b/src/Translations/Danish.php
index c2d32399..c2d32399 100644
--- a/src/translations/Danish.php
+++ b/src/Translations/Danish.php
diff --git a/src/translations/Dutch.php b/src/Translations/Dutch.php
index cd04f9be..cd04f9be 100644
--- a/src/translations/Dutch.php
+++ b/src/Translations/Dutch.php
diff --git a/src/translations/English.php b/src/Translations/English.php
index ccd011af..ccd011af 100644
--- a/src/translations/English.php
+++ b/src/Translations/English.php
diff --git a/src/translations/French.php b/src/Translations/French.php
index 5b72ad02..5b72ad02 100644
--- a/src/translations/French.php
+++ b/src/Translations/French.php
diff --git a/src/translations/Galician.php b/src/Translations/Galician.php
index 3b75fc9a..3b75fc9a 100644
--- a/src/translations/Galician.php
+++ b/src/Translations/Galician.php
diff --git a/src/translations/German.php b/src/Translations/German.php
index 104a5d15..104a5d15 100644
--- a/src/translations/German.php
+++ b/src/Translations/German.php
diff --git a/src/translations/Greek.php b/src/Translations/Greek.php
index 94642f43..94642f43 100644
--- a/src/translations/Greek.php
+++ b/src/Translations/Greek.php
diff --git a/src/translations/Hebrew.php b/src/Translations/Hebrew.php
index d9f320ec..d9f320ec 100644
--- a/src/translations/Hebrew.php
+++ b/src/Translations/Hebrew.php
diff --git a/src/translations/Hungarian.php b/src/Translations/Hungarian.php
index 93a094af..93a094af 100644
--- a/src/translations/Hungarian.php
+++ b/src/Translations/Hungarian.php
diff --git a/src/translations/Italian.php b/src/Translations/Italian.php
index 3722a2a4..3722a2a4 100644
--- a/src/translations/Italian.php
+++ b/src/Translations/Italian.php
diff --git a/src/translations/Japanese.php b/src/Translations/Japanese.php
index 5fbac5e9..5fbac5e9 100644
--- a/src/translations/Japanese.php
+++ b/src/Translations/Japanese.php
diff --git a/src/translations/Lithuanian.php b/src/Translations/Lithuanian.php
index d31b02e7..d31b02e7 100644
--- a/src/translations/Lithuanian.php
+++ b/src/Translations/Lithuanian.php
diff --git a/src/translations/Mongol.php b/src/Translations/Mongol.php
index 61445af3..61445af3 100644
--- a/src/translations/Mongol.php
+++ b/src/Translations/Mongol.php
diff --git a/src/translations/Polish.php b/src/Translations/Polish.php
index 00737572..00737572 100644
--- a/src/translations/Polish.php
+++ b/src/Translations/Polish.php
diff --git a/src/translations/PortugueseBr.php b/src/Translations/PortugueseBr.php
index 388f0fac..388f0fac 100644
--- a/src/translations/PortugueseBr.php
+++ b/src/Translations/PortugueseBr.php
diff --git a/src/translations/PortuguesePt.php b/src/Translations/PortuguesePt.php
index 807ad8ef..807ad8ef 100644
--- a/src/translations/PortuguesePt.php
+++ b/src/Translations/PortuguesePt.php
diff --git a/src/translations/Romanian.php b/src/Translations/Romanian.php
index a604fcec..a604fcec 100644
--- a/src/translations/Romanian.php
+++ b/src/Translations/Romanian.php
diff --git a/src/translations/Russian.php b/src/Translations/Russian.php
index 4fa2d83e..4fa2d83e 100644
--- a/src/translations/Russian.php
+++ b/src/Translations/Russian.php
diff --git a/src/translations/RussianUtf8.php b/src/Translations/RussianUtf8.php
index 83360c83..83360c83 100644
--- a/src/translations/RussianUtf8.php
+++ b/src/Translations/RussianUtf8.php
diff --git a/src/translations/Slovak.php b/src/Translations/Slovak.php
index 6d18d409..6d18d409 100644
--- a/src/translations/Slovak.php
+++ b/src/Translations/Slovak.php
diff --git a/src/translations/Spanish.php b/src/Translations/Spanish.php
index a39c3b6c..a39c3b6c 100644
--- a/src/translations/Spanish.php
+++ b/src/Translations/Spanish.php
diff --git a/src/translations/Swedish.php b/src/Translations/Swedish.php
index be3e205f..be3e205f 100644
--- a/src/translations/Swedish.php
+++ b/src/Translations/Swedish.php
diff --git a/src/translations/Turkish.php b/src/Translations/Turkish.php
index f2009944..f2009944 100644
--- a/src/translations/Turkish.php
+++ b/src/Translations/Turkish.php
diff --git a/src/translations/Ukrainian.php b/src/Translations/Ukrainian.php
index b8ba7c2f..b8ba7c2f 100644
--- a/src/translations/Ukrainian.php
+++ b/src/Translations/Ukrainian.php
diff --git a/src/xhtml/HTMLController.php b/src/XHtml/HTMLController.php
index e4743271..27e2e58b 100644
--- a/src/xhtml/HTMLController.php
+++ b/src/XHtml/HTMLController.php
@@ -28,12 +28,12 @@ class HTMLController
public $controller_title = 'html';
/**
- * @var \PHPPgAdmin\ViewManager
+ * @var \PHPPgAdmin\Core\ViewManager
*/
public $view;
/**
- * @var \PHPPgAdmin\Misc
+ * @var \PHPPgAdmin\Core\Misc
*/
public $misc;
@@ -48,12 +48,12 @@ class HTMLController
public $appThemes;
/**
- * @var \PHPPgAdmin\ContainerUtils
+ * @var \PHPPgAdmin\Core\ContainerUtils
*/
protected $container;
// Constructor
- public function __construct(\PHPPgAdmin\ContainerUtils $container, $controller_name = null)
+ public function __construct(\PHPPgAdmin\Core\ContainerUtils $container, $controller_name = null)
{
$this->container = $container;
$this->lang = $container->get('lang');
@@ -73,7 +73,7 @@ class HTMLController
}
/**
- * @return \PHPPgAdmin\ContainerUtils
+ * @return \PHPPgAdmin\Core\ContainerUtils
*/
public function getContainer()
{
@@ -118,10 +118,11 @@ class HTMLController
if ($do_print) {
echo $tag;
+
return '';
- } else {
- return $tag;
}
+
+ return $tag;
}
/**
@@ -250,6 +251,4 @@ class HTMLController
return $url;
}
-
-
}
diff --git a/src/xhtml/HTMLFooterController.php b/src/XHtml/HTMLFooterController.php
index f888257c..59837cdc 100644
--- a/src/xhtml/HTMLFooterController.php
+++ b/src/XHtml/HTMLFooterController.php
@@ -76,10 +76,11 @@ class HTMLFooterController extends HTMLController
if ($doBody) {
echo $footer_html;
+
return '';
- }
- return $footer_html;
-
+ }
+
+ return $footer_html;
}
/**
@@ -120,11 +121,11 @@ class HTMLFooterController extends HTMLController
* @param array $env - Associative array of defined variables in the scope of the caller.
* Allows to give some environnement details to plugins.
* and 'browse' is the place inside that code (doBrowse).
- * @param mixed $from can either be null, false or the method calling this one
+ * @param mixed $from can either be null, false or the method calling this one
*
* @return null|string
*/
- public function printNavLinks($navlinks, $place, $env, $from)
+ public function printNavLinks($navlinks, $place, $env, $from)
{
if (null === $from || false === $from) {
$from = __METHOD__;
@@ -138,24 +139,26 @@ class HTMLFooterController extends HTMLController
];
if (0 < \count($navlinks)) {
-
- return $this->printLinksList($navlinks, 'navlink', $from);
-
+ kdump($navlinks);
+
+ return $this->printLinksList($navlinks, 'navlink', $from);
}
+
return '';
}
- /**
+
+ /**
* Display a list of links.
*
- * @param array $links An associative array of links to print. See printLink function for
- * the links array format.
- * @param string $class an optional HTML class or list of classes seprated by a space
- * WARNING: This field is NOT escaped! No user should be able to inject something here, use with care
- * @param null|string $from which method is calling this one
+ * @param array $links An associative array of links to print. See printLink function for
+ * the links array format.
+ * @param string $class an optional HTML class or list of classes seprated by a space
+ * WARNING: This field is NOT escaped! No user should be able to inject something here, use with care
+ * @param null|string $from which method is calling this one
*
* @return null|string
*/
- protected function printLinksList($links, $class = '', $from = null)
+ protected function printLinksList($links, $class = '', $from = null)
{
if (null === $from || false === $from) {
$from = __METHOD__;
@@ -163,17 +166,12 @@ class HTMLFooterController extends HTMLController
$list_html = "<ul class=\"{$class}\">" . \PHP_EOL;
foreach ($links as $link) {
- if ('PHPPgAdmin\Controller\BaseController::printNavLinks' === $from) {
- }
-
$list_html .= "\t<li>";
$list_html .= \str_replace('.php', '', $this->printLink($link, false, $from));
$list_html .= '</li>' . \PHP_EOL;
}
$list_html .= '</ul>' . \PHP_EOL;
-
- return $list_html;
-
+ return $list_html;
}
}
diff --git a/src/xhtml/HTMLHeaderController.php b/src/XHtml/HTMLHeaderController.php
index eeaf5440..eeaf5440 100644
--- a/src/xhtml/HTMLHeaderController.php
+++ b/src/XHtml/HTMLHeaderController.php
diff --git a/src/xhtml/HTMLNavbarController.php b/src/XHtml/HTMLNavbarController.php
index b5d00455..ef01578b 100644
--- a/src/xhtml/HTMLNavbarController.php
+++ b/src/XHtml/HTMLNavbarController.php
@@ -26,7 +26,7 @@ class HTMLNavbarController extends HTMLController
{
$from = $from ?: __METHOD__;
- $trail_html = $this->printTopbar( $from);
+ $trail_html = $this->printTopbar($from);
if (\is_string($trail)) {
$subject = $trail;
@@ -51,8 +51,6 @@ class HTMLNavbarController extends HTMLController
$trail_html .= $containerInstance->view->fetch('components/trail.twig', $viewVars);
-
-
return $trail_html;
}
@@ -138,9 +136,7 @@ class HTMLNavbarController extends HTMLController
$tabs_html = $this->getContainer()->view->fetch('components/tabs.twig', $viewVars);
}
-
- return $tabs_html;
-
+ return $tabs_html;
}
/**
@@ -214,11 +210,11 @@ class HTMLNavbarController extends HTMLController
/**
* [printTopbar description].
*
- * @param null|mixed $from which method is calling this one
+ * @param null|mixed $from which method is calling this one
*
* @return string
*/
- private function printTopbar( $from = null): ?string
+ private function printTopbar($from = null): ?string
{
$from = $from ?: __METHOD__;
@@ -344,8 +340,6 @@ class HTMLNavbarController extends HTMLController
$topbar_html .= '</div></div>' . \PHP_EOL;
-
-
return $topbar_html;
}
diff --git a/src/xhtml/HTMLTableController.php b/src/XHtml/HTMLTableController.php
index 93ca1f08..95335408 100644
--- a/src/xhtml/HTMLTableController.php
+++ b/src/XHtml/HTMLTableController.php
@@ -36,43 +36,43 @@ class HTMLTableController extends HTMLController
/**
* Display a table of data.
*
- * @param \ADORecordSet|\PHPPgAdmin\ArrayRecordSet $tabledata a set of data to be formatted, as returned by $data->getDatabases() etc
- * @param array $columns An associative array of columns to be displayed:
- * $columns = array(
- * column_id => array(
- * 'title' => Column heading,
- * 'class' => The class to apply on the column cells,
- * 'field' => Field name for $tabledata->fields[...],
- * 'help' => Help page for this column,
- * ), ...
- * );
- * @param array $actions Actions that can be performed on each object:
- * $actions = array(
- * * multi action support
- * * parameters are serialized for each entries and given in $_REQUEST['ma']
- * 'multiactions' => array(
- * 'keycols' => Associative array of (URL variable => field name), // fields included in the form
- * 'url' => URL submission,
- * 'default' => Default selected action in the form. If null, an empty action is added & selected
- * ),
- * * actions *
- * action_id => array(
- * 'title' => Action heading,
- * 'url' => Static part of URL. Often we rely
- * relative urls, usually the page itself (not '' !), or just a query string,
- * 'vars' => Associative array of (URL variable => field name),
- * 'multiaction' => Name of the action to execute.
- * Add this action to the multi action form
- * ), ...
- * );
- * @param string $place Place where the $actions are displayed. Like 'display-browse', where 'display'
- * is the entrypoint (/src/views/display) and 'browse' is the action used inside its controller (in this case, doBrowse).
- * @param string $nodata (optional) Message to display if data set is empty
- * @param callable $pre_fn (optional) callback closure for each row. It will be passed two params: $rowdata and $actions,
- * it may be used to derive new fields or modify actions.
- * It can return an array of actions specific to the row, or if nothing is returned then the standard actions are used.
- * (see TblpropertiesController and ConstraintsController for examples)
- * The function must not must not store urls because they are relative and won't work out of context.
+ * @param \ADORecordSet|\PHPPgAdmin\Core\ArrayRecordset $tabledata a set of data to be formatted, as returned by $data->getDatabases() etc
+ * @param array $columns An associative array of columns to be displayed:
+ * $columns = array(
+ * column_id => array(
+ * 'title' => Column heading,
+ * 'class' => The class to apply on the column cells,
+ * 'field' => Field name for $tabledata->fields[...],
+ * 'help' => Help page for this column,
+ * ), ...
+ * );
+ * @param array $actions Actions that can be performed on each object:
+ * $actions = array(
+ * * multi action support
+ * * parameters are serialized for each entries and given in $_REQUEST['ma']
+ * 'multiactions' => array(
+ * 'keycols' => Associative array of (URL variable => field name), // fields included in the form
+ * 'url' => URL submission,
+ * 'default' => Default selected action in the form. If null, an empty action is added & selected
+ * ),
+ * * actions *
+ * action_id => array(
+ * 'title' => Action heading,
+ * 'url' => Static part of URL. Often we rely
+ * relative urls, usually the page itself (not '' !), or just a query string,
+ * 'vars' => Associative array of (URL variable => field name),
+ * 'multiaction' => Name of the action to execute.
+ * Add this action to the multi action form
+ * ), ...
+ * );
+ * @param string $place Place where the $actions are displayed. Like 'display-browse', where 'display'
+ * is the entrypoint (/src/views/display) and 'browse' is the action used inside its controller (in this case, doBrowse).
+ * @param string $nodata (optional) Message to display if data set is empty
+ * @param callable $pre_fn (optional) callback closure for each row. It will be passed two params: $rowdata and $actions,
+ * it may be used to derive new fields or modify actions.
+ * It can return an array of actions specific to the row, or if nothing is returned then the standard actions are used.
+ * (see TblpropertiesController and ConstraintsController for examples)
+ * The function must not must not store urls because they are relative and won't work out of context.
*/
public function initialize(&$tabledata, &$columns, &$actions, $place, $nodata = '', $pre_fn = null): void
{
@@ -339,7 +339,7 @@ class HTMLTableController extends HTMLController
break;
case 'comment':
$tbody_html .= "<td class='comment_cell'>";
- $tbody_html .= \htmlentities(Decorator::get_sanitized_value($column['field'], $tabledata->fields));
+ $tbody_html .= Decorator::get_sanitized_value($column['field'], $tabledata->fields, 'html');
$tbody_html .= '</td>';
break;
@@ -401,7 +401,7 @@ class HTMLTableController extends HTMLController
*
* @return null|string
*/
- private function printUrlVars(&$vars, &$fields )
+ private function printUrlVars(&$vars, &$fields)
{
$url_vars_html = '';
@@ -409,8 +409,6 @@ class HTMLTableController extends HTMLController
$url_vars_html .= "{$var}=" . \urlencode($fields[$varfield]) . '&amp;';
}
-
- return $url_vars_html;
-
+ return $url_vars_html;
}
}
diff --git a/src/xhtml/XHtmlButton.php b/src/XHtml/XHtmlButton.php
index 4c2de918..4c2de918 100644
--- a/src/xhtml/XHtmlButton.php
+++ b/src/XHtml/XHtmlButton.php
diff --git a/src/xhtml/XHtmlElement.php b/src/XHtml/XHtmlElement.php
index a31b49d5..a31b49d5 100644
--- a/src/xhtml/XHtmlElement.php
+++ b/src/XHtml/XHtmlElement.php
diff --git a/src/xhtml/XHtmlOption.php b/src/XHtml/XHtmlOption.php
index 3ff9f953..3ff9f953 100644
--- a/src/xhtml/XHtmlOption.php
+++ b/src/XHtml/XHtmlOption.php
diff --git a/src/xhtml/XHtmlSelect.php b/src/XHtml/XHtmlSelect.php
index c7a6c72a..c7a6c72a 100644
--- a/src/xhtml/XHtmlSelect.php
+++ b/src/XHtml/XHtmlSelect.php
diff --git a/src/xhtml/XHtmlSimpleElement.php b/src/XHtml/XHtmlSimpleElement.php
index 6df8bd5a..6df8bd5a 100644
--- a/src/xhtml/XHtmlSimpleElement.php
+++ b/src/XHtml/XHtmlSimpleElement.php
diff --git a/src/lib.inc.php b/src/lib.inc.php
index e1b3dc98..b3679879 100644
--- a/src/lib.inc.php
+++ b/src/lib.inc.php
@@ -4,7 +4,7 @@
* PHPPgAdmin6
*/
-use PHPPgAdmin\ContainerUtils;
+use PHPPgAdmin\Core\ContainerUtils;
use Slim\App;
use Slim\Http\Request;
use Slim\Http\Response;
diff --git a/src/router.php b/src/router.php
index e0dff244..ab47ea8f 100644
--- a/src/router.php
+++ b/src/router.php
@@ -18,18 +18,30 @@ require_once \dirname(__DIR__) . '/vendor/autoload.php';
// Enforce PHP environment
\ini_set('arg_separator.output', '&amp;');
\defined('ADODB_ERROR_HANDLER_TYPE') || \define('ADODB_ERROR_HANDLER_TYPE', \E_USER_ERROR);
-\defined('ADODB_ERROR_HANDLER') || \define('ADODB_ERROR_HANDLER', '\PHPPgAdmin\ADOdbException::adodb_throw');
+\defined('ADODB_ERROR_HANDLER') || \define('ADODB_ERROR_HANDLER', '\PHPPgAdmin\Core\ADOdbException::adodb_throw');
$shouldSetSession = (\defined('PHP_SESSION_ACTIVE') ? \PHP_SESSION_ACTIVE !== \session_status() : !\session_id())
&& !\headers_sent()
&& !\ini_get('session.auto_start');
if ($shouldSetSession && \PHP_SAPI !== 'cli') {
+ \define('SESSION_SAVE_PATH', \implode(\DIRECTORY_SEPARATOR, [BASE_PATH, 'temp/sessions']));
+ \defined('IN_TEST') || \define('IN_TEST', false);
+
+ if (
+ !IN_TEST && \defined('SESSION_SAVE_PATH')
+ && (\is_dir(SESSION_SAVE_PATH)
+ || \mkdir(SESSION_SAVE_PATH, 0777, true))
+ ) {
+ \session_save_path(SESSION_SAVE_PATH);
+ }
+
\session_set_cookie_params(0, '/', $_SERVER['HTTP_HOST'], isset($_SERVER['HTTPS']));
\session_name('PPA_ID');
\session_start();
}
+
\defined('ADODB_ASSOC_CASE') || \define('ADODB_ASSOC_CASE', ADODB_ASSOC_CASE_NATIVE);
$app = getAppInstance();
@@ -195,7 +207,7 @@ $app->get('/', function (
return $controller->render();
});
-$app->get('[/{path:.*}]', function (
+$app->get('[/{path:.*}]', function (
\Slim\Http\Request $request,
\Slim\Http\Response $response,
array $args
diff --git a/tests/Unit/ContainerTest.php b/tests/Unit/ContainerTest.php
index c23af327..e64cda8e 100644
--- a/tests/Unit/ContainerTest.php
+++ b/tests/Unit/ContainerTest.php
@@ -6,8 +6,8 @@
namespace Tests\Unit;
-use PHPPgAdmin\ContainerUtils;
-use PHPPgAdmin\Misc;
+use PHPPgAdmin\Core\ContainerUtils;
+use PHPPgAdmin\Core\Misc;
use Psr\Container\ContainerInterface;
use Slim\Views\Twig;