diff options
-rw-r--r-- | composer.json | 77 | ||||
-rw-r--r-- | composer.lock | 12 | ||||
-rw-r--r-- | src/classes/ADORecordSet.php | 23 | ||||
-rw-r--r-- | src/classes/Misc.php | 161 | ||||
-rw-r--r-- | src/controllers/AdminTrait.php | 98 | ||||
-rw-r--r-- | src/controllers/BaseController.php | 17 | ||||
-rw-r--r-- | src/controllers/ColpropertiesController.php | 4 | ||||
-rw-r--r-- | src/controllers/DatabaseController.php | 88 | ||||
-rw-r--r-- | src/controllers/DisplayController.php | 214 | ||||
-rw-r--r-- | src/controllers/IndexesController.php | 141 | ||||
-rw-r--r-- | src/controllers/MaterializedviewpropertiesController.php | 4 | ||||
-rw-r--r-- | src/controllers/MaterializedviewsController.php | 54 | ||||
-rw-r--r-- | src/controllers/TablesController.php | 74 | ||||
-rw-r--r-- | src/controllers/TblpropertiesController.php | 98 | ||||
-rw-r--r-- | src/controllers/ViewpropertiesController.php | 4 | ||||
-rw-r--r-- | src/controllers/ViewsController.php | 52 | ||||
-rw-r--r-- | src/database/Postgres.php | 321 |
17 files changed, 744 insertions, 698 deletions
diff --git a/composer.json b/composer.json index e4c5352d..e435de5d 100644 --- a/composer.json +++ b/composer.json @@ -1,43 +1,38 @@ { - "name": "huasofoundries/phppgadmin6", - "version": "6.0.0-beta.33", - "description": "Like phpmyadmin but for postgres", - "type": "project", - "license": "MIT", - "authors": [ - { - "name": "Amenadiel", - "email": "amenadiel@gmail.com" - }], - "minimum-stability": "beta", - "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\\Help\\": "src/help" - } - }, - "require": - { - "php": ">=5.6.0", - "ext-pgsql": "*", - "slim/slim": "^3.6", - "slim/twig-view": "~2.1.1", - "php-console/php-console": "~3.1", - - "twig/twig": "~1.28", - "kint-php/kint": "^2.1", - "adodb/adodb-php": "^5.20" - }, - "require-dev": - { - "friendsofphp/php-cs-fixer": "^2.4", - "codeception/codeception": "*" + "name": "huasofoundries/phppgadmin6", + "version": "6.0.0-beta.33", + "description": "Like phpmyadmin but for postgres", + "type": "project", + "license": "MIT", + "authors": [{ + "name": "Amenadiel", + "email": "amenadiel@gmail.com" + }], + "minimum-stability": "beta", + "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\\Help\\": "src/help" } -}
\ No newline at end of file + }, + "require": { + "php": ">=5.6.0", + "ext-pgsql": "*", + "slim/slim": "^3.6", + "slim/twig-view": "~2.1.1", + "php-console/php-console": "~3.1", + + "twig/twig": "~1.28", + "kint-php/kint": "^2.1", + "adodb/adodb-php": "^5.20" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^2.4", + "codeception/codeception": "*" + } +} diff --git a/composer.lock b/composer.lock index e8084411..6358fa62 100644 --- a/composer.lock +++ b/composer.lock @@ -8,16 +8,16 @@ "packages": [ { "name": "adodb/adodb-php", - "version": "v5.20.9", + "version": "v5.20.10", "source": { "type": "git", "url": "https://github.com/ADOdb/ADOdb.git", - "reference": "f601748cca1ccb86dfd427620a1692a70e681075" + "reference": "2db8794c142ecc9ca9c5398737bb35ca39031fe3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/ADOdb/ADOdb/zipball/f601748cca1ccb86dfd427620a1692a70e681075", - "reference": "f601748cca1ccb86dfd427620a1692a70e681075", + "url": "https://api.github.com/repos/ADOdb/ADOdb/zipball/2db8794c142ecc9ca9c5398737bb35ca39031fe3", + "reference": "2db8794c142ecc9ca9c5398737bb35ca39031fe3", "shasum": "" }, "require": { @@ -32,7 +32,7 @@ "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause", - "LGPL-2.1" + "LGPL-2.1-or-later" ], "authors": [ { @@ -58,7 +58,7 @@ "library", "php" ], - "time": "2016-12-21T17:19:42+00:00" + "time": "2018-03-08T22:32:18+00:00" }, { "name": "container-interop/container-interop", diff --git a/src/classes/ADORecordSet.php b/src/classes/ADORecordSet.php new file mode 100644 index 00000000..4df2d9ff --- /dev/null +++ b/src/classes/ADORecordSet.php @@ -0,0 +1,23 @@ +<?php + +/** + * PHPPgAdmin v6.0.0-beta.33 + */ + +namespace PHPPgAdmin; + +/** + * @file + * Extends ADORecordSet to let correct inference on PHPDoc params + * @package PHPPgAdmin + */ + +/** + * Extends ADORecordSet to let correct inference on PHPDoc params + * + * @package PHPPgAdmin + */ +class ADORecordSet extends \ADORecordSet +{ + +} diff --git a/src/classes/Misc.php b/src/classes/Misc.php index eef59fe5..bd10ecc7 100644 --- a/src/classes/Misc.php +++ b/src/classes/Misc.php @@ -461,7 +461,8 @@ class Misc // Otherwise, look for it in the conf file foreach ($this->conf['servers'] as $idx => $info) { - if ($this->_server_id == $info['host'] . ':' . $info['port'] . ':' . $info['sslmode']) { + $server_string = $info['host'] . ':' . $info['port'] . ':' . $info['sslmode']; + if ($this->_server_id == $server_string) { if (isset($info['username'])) { $this->setServerInfo(null, $info, $this->_server_id); } elseif (isset($_SESSION['sharedUsername'])) { @@ -827,7 +828,7 @@ class Misc break; case 'selectrows': $vars = [ - 'url' => 'tables.php', + 'url' => 'tables', 'params' => [ 'server' => $_REQUEST['server'], 'subject' => 'table', @@ -917,7 +918,7 @@ class Misc break; case 'plugin': $vars = [ - 'url' => 'plugin.php', + 'url' => 'plugin', 'params' => [ 'server' => $_REQUEST['server'], 'subject' => 'plugin', @@ -1231,12 +1232,12 @@ class Misc $tabs = [ 'intro' => [ 'title' => $lang['strintroduction'], - 'url' => 'intro.php', + 'url' => 'intro', 'icon' => 'Introduction', ], 'servers' => [ 'title' => $lang['strservers'], - 'url' => 'servers.php', + 'url' => 'servers', 'icon' => 'Servers', ], ]; @@ -1251,7 +1252,7 @@ class Misc $tabs = [ 'databases' => [ 'title' => $lang['strdatabases'], - 'url' => 'alldb.php', + 'url' => 'alldb', 'urlvars' => ['subject' => 'server'], 'help' => 'pg.database', 'icon' => 'Databases', @@ -1261,7 +1262,7 @@ class Misc $tabs = array_merge($tabs, [ 'roles' => [ 'title' => $lang['strroles'], - 'url' => 'roles.php', + 'url' => 'roles', 'urlvars' => ['subject' => 'server'], 'hide' => $hide_users, 'help' => 'pg.role', @@ -1272,7 +1273,7 @@ class Misc $tabs = array_merge($tabs, [ 'users' => [ 'title' => $lang['strusers'], - 'url' => 'users.php', + 'url' => 'users', 'urlvars' => ['subject' => 'server'], 'hide' => $hide_users, 'help' => 'pg.user', @@ -1280,7 +1281,7 @@ class Misc ], 'groups' => [ 'title' => $lang['strgroups'], - 'url' => 'groups.php', + 'url' => 'groups', 'urlvars' => ['subject' => 'server'], 'hide' => $hide_users, 'help' => 'pg.group', @@ -1292,7 +1293,7 @@ class Misc $tabs = array_merge($tabs, [ 'account' => [ 'title' => $lang['straccount'], - 'url' => ($data && $data->hasRoles()) ? 'roles.php' : 'users.php', + 'url' => ($data && $data->hasRoles()) ? 'roles' : 'users', 'urlvars' => ['subject' => 'server', 'action' => 'account'], 'hide' => !$hide_users, 'help' => 'pg.role', @@ -1300,7 +1301,7 @@ class Misc ], 'tablespaces' => [ 'title' => $lang['strtablespaces'], - 'url' => 'tablespaces.php', + 'url' => 'tablespaces', 'urlvars' => ['subject' => 'server'], 'hide' => !$data || !$data->hasTablespaces(), 'help' => 'pg.tablespace', @@ -1308,7 +1309,7 @@ class Misc ], 'export' => [ 'title' => $lang['strexport'], - 'url' => 'alldb.php', + 'url' => 'alldb', 'urlvars' => ['subject' => 'server', 'action' => 'export'], 'hide' => !$this->isDumpEnabled(), 'icon' => 'Export', @@ -1320,14 +1321,14 @@ class Misc $tabs = [ 'schemas' => [ 'title' => $lang['strschemas'], - 'url' => 'schemas.php', + 'url' => 'schemas', 'urlvars' => ['subject' => 'database'], 'help' => 'pg.schema', 'icon' => 'Schemas', ], 'sql' => [ 'title' => $lang['strsql'], - 'url' => 'database.php', + 'url' => 'database', 'urlvars' => ['subject' => 'database', 'action' => 'sql', 'new' => 1], 'help' => 'pg.sql', 'tree' => false, @@ -1335,14 +1336,14 @@ class Misc ], 'find' => [ 'title' => $lang['strfind'], - 'url' => 'database.php', + 'url' => 'database', 'urlvars' => ['subject' => 'database', 'action' => 'find'], 'tree' => false, 'icon' => 'Search', ], 'variables' => [ 'title' => $lang['strvariables'], - 'url' => 'database.php', + 'url' => 'database', 'urlvars' => ['subject' => 'database', 'action' => 'variables'], 'help' => 'pg.variable', 'tree' => false, @@ -1350,7 +1351,7 @@ class Misc ], 'processes' => [ 'title' => $lang['strprocesses'], - 'url' => 'database.php', + 'url' => 'database', 'urlvars' => ['subject' => 'database', 'action' => 'processes'], 'help' => 'pg.process', 'tree' => false, @@ -1358,7 +1359,7 @@ class Misc ], 'locks' => [ 'title' => $lang['strlocks'], - 'url' => 'database.php', + 'url' => 'database', 'urlvars' => ['subject' => 'database', 'action' => 'locks'], 'help' => 'pg.locks', 'tree' => false, @@ -1366,14 +1367,14 @@ class Misc ], 'admin' => [ 'title' => $lang['stradmin'], - 'url' => 'database.php', + 'url' => 'database', 'urlvars' => ['subject' => 'database', 'action' => 'admin'], 'tree' => false, 'icon' => 'Admin', ], 'privileges' => [ 'title' => $lang['strprivileges'], - 'url' => 'privileges.php', + 'url' => 'privileges', 'urlvars' => ['subject' => 'database'], 'hide' => !isset($data->privlist['database']), 'help' => 'pg.privilege', @@ -1382,7 +1383,7 @@ class Misc ], 'languages' => [ 'title' => $lang['strlanguages'], - 'url' => 'languages.php', + 'url' => 'languages', 'urlvars' => ['subject' => 'database'], 'hide' => $hide_advanced, 'help' => 'pg.language', @@ -1390,7 +1391,7 @@ class Misc ], 'casts' => [ 'title' => $lang['strcasts'], - 'url' => 'casts.php', + 'url' => 'casts', 'urlvars' => ['subject' => 'database'], 'hide' => $hide_advanced, 'help' => 'pg.cast', @@ -1398,7 +1399,7 @@ class Misc ], 'export' => [ 'title' => $lang['strexport'], - 'url' => 'database.php', + 'url' => 'database', 'urlvars' => ['subject' => 'database', 'action' => 'export'], 'hide' => !$this->isDumpEnabled(), 'tree' => false, @@ -1411,42 +1412,42 @@ class Misc $tabs = [ 'tables' => [ 'title' => $lang['strtables'], - 'url' => 'tables.php', + 'url' => 'tables', 'urlvars' => ['subject' => 'schema'], 'help' => 'pg.table', 'icon' => 'Tables', ], 'views' => [ 'title' => $lang['strviews'], - 'url' => 'views.php', + 'url' => 'views', 'urlvars' => ['subject' => 'schema'], 'help' => 'pg.view', 'icon' => 'Views', ], 'matviews' => [ 'title' => 'M ' . $lang['strviews'], - 'url' => 'materializedviews.php', + 'url' => 'materializedviews', 'urlvars' => ['subject' => 'schema'], 'help' => 'pg.matview', 'icon' => 'MViews', ], 'sequences' => [ 'title' => $lang['strsequences'], - 'url' => 'sequences.php', + 'url' => 'sequences', 'urlvars' => ['subject' => 'schema'], 'help' => 'pg.sequence', 'icon' => 'Sequences', ], 'functions' => [ 'title' => $lang['strfunctions'], - 'url' => 'functions.php', + 'url' => 'functions', 'urlvars' => ['subject' => 'schema'], 'help' => 'pg.function', 'icon' => 'Functions', ], 'fulltext' => [ 'title' => $lang['strfulltext'], - 'url' => 'fulltext.php', + 'url' => 'fulltext', 'urlvars' => ['subject' => 'schema'], 'help' => 'pg.fts', 'tree' => true, @@ -1454,14 +1455,14 @@ class Misc ], 'domains' => [ 'title' => $lang['strdomains'], - 'url' => 'domains.php', + 'url' => 'domains', 'urlvars' => ['subject' => 'schema'], 'help' => 'pg.domain', 'icon' => 'Domains', ], 'aggregates' => [ 'title' => $lang['straggregates'], - 'url' => 'aggregates.php', + 'url' => 'aggregates', 'urlvars' => ['subject' => 'schema'], 'hide' => $hide_advanced, 'help' => 'pg.aggregate', @@ -1469,7 +1470,7 @@ class Misc ], 'types' => [ 'title' => $lang['strtypes'], - 'url' => 'types.php', + 'url' => 'types', 'urlvars' => ['subject' => 'schema'], 'hide' => $hide_advanced, 'help' => 'pg.type', @@ -1477,7 +1478,7 @@ class Misc ], 'operators' => [ 'title' => $lang['stroperators'], - 'url' => 'operators.php', + 'url' => 'operators', 'urlvars' => ['subject' => 'schema'], 'hide' => $hide_advanced, 'help' => 'pg.operator', @@ -1485,7 +1486,7 @@ class Misc ], 'opclasses' => [ 'title' => $lang['stropclasses'], - 'url' => 'opclasses.php', + 'url' => 'opclasses', 'urlvars' => ['subject' => 'schema'], 'hide' => $hide_advanced, 'help' => 'pg.opclass', @@ -1493,7 +1494,7 @@ class Misc ], 'conversions' => [ 'title' => $lang['strconversions'], - 'url' => 'conversions.php', + 'url' => 'conversions', 'urlvars' => ['subject' => 'schema'], 'hide' => $hide_advanced, 'help' => 'pg.conversion', @@ -1501,7 +1502,7 @@ class Misc ], 'privileges' => [ 'title' => $lang['strprivileges'], - 'url' => 'privileges.php', + 'url' => 'privileges', 'urlvars' => ['subject' => 'schema'], 'help' => 'pg.privilege', 'tree' => false, @@ -1509,7 +1510,7 @@ class Misc ], 'export' => [ 'title' => $lang['strexport'], - 'url' => 'schemas.php', + 'url' => 'schemas', 'urlvars' => ['subject' => 'schema', 'action' => 'export'], 'hide' => !$this->isDumpEnabled(), 'tree' => false, @@ -1525,7 +1526,7 @@ class Misc $tabs = [ 'columns' => [ 'title' => $lang['strcolumns'], - 'url' => 'tblproperties.php', + 'url' => 'tblproperties', 'urlvars' => ['subject' => 'table', 'table' => Decorator::field('table')], 'icon' => 'Columns', 'branch' => true, @@ -1533,7 +1534,7 @@ class Misc 'browse' => [ 'title' => $lang['strbrowse'], 'icon' => 'Columns', - 'url' => 'display.php', + 'url' => 'display', 'urlvars' => ['subject' => 'table', 'table' => Decorator::field('table')], 'return' => 'table', 'branch' => true, @@ -1541,13 +1542,13 @@ class Misc 'select' => [ 'title' => $lang['strselect'], 'icon' => 'Search', - 'url' => 'tables.php', + 'url' => 'tables', 'urlvars' => ['subject' => 'table', 'table' => Decorator::field('table'), 'action' => 'confselectrows'], 'help' => 'pg.sql.select', ], 'insert' => [ 'title' => $lang['strinsert'], - 'url' => 'tables.php', + 'url' => 'tables', 'urlvars' => [ 'action' => 'confinsertrow', 'table' => Decorator::field('table'), @@ -1557,7 +1558,7 @@ class Misc ], 'indexes' => [ 'title' => $lang['strindexes'], - 'url' => 'indexes.php', + 'url' => 'indexes', 'urlvars' => ['subject' => 'table', 'table' => Decorator::field('table')], 'help' => 'pg.index', 'icon' => 'Indexes', @@ -1565,7 +1566,7 @@ class Misc ], 'constraints' => [ 'title' => $lang['strconstraints'], - 'url' => 'constraints.php', + 'url' => 'constraints', 'urlvars' => ['subject' => 'table', 'table' => Decorator::field('table')], 'help' => 'pg.constraint', 'icon' => 'Constraints', @@ -1573,7 +1574,7 @@ class Misc ], 'triggers' => [ 'title' => $lang['strtriggers'], - 'url' => 'triggers.php', + 'url' => 'triggers', 'urlvars' => ['subject' => 'table', 'table' => Decorator::field('table')], 'help' => 'pg.trigger', 'icon' => 'Triggers', @@ -1581,7 +1582,7 @@ class Misc ], 'rules' => [ 'title' => $lang['strrules'], - 'url' => 'rules.php', + 'url' => 'rules', 'urlvars' => ['subject' => 'table', 'table' => Decorator::field('table')], 'help' => 'pg.rule', 'icon' => 'Rules', @@ -1589,33 +1590,33 @@ class Misc ], 'admin' => [ 'title' => $lang['stradmin'], - 'url' => 'tables.php', + 'url' => 'tables', 'urlvars' => ['subject' => 'table', 'table' => Decorator::field('table'), 'action' => 'admin'], 'icon' => 'Admin', ], 'info' => [ 'title' => $lang['strinfo'], - 'url' => 'info.php', + 'url' => 'info', 'urlvars' => ['subject' => 'table', 'table' => Decorator::field('table')], 'icon' => 'Statistics', ], 'privileges' => [ 'title' => $lang['strprivileges'], - 'url' => 'privileges.php', + 'url' => 'privileges', 'urlvars' => ['subject' => 'table', 'table' => Decorator::field('table')], 'help' => 'pg.privilege', 'icon' => 'Privileges', ], 'import' => [ 'title' => $lang['strimport'], - 'url' => 'tblproperties.php', + 'url' => 'tblproperties', 'urlvars' => ['subject' => 'table', 'table' => Decorator::field('table'), 'action' => 'import'], 'icon' => 'Import', 'hide' => false, ], 'export' => [ 'title' => $lang['strexport'], - 'url' => 'tblproperties.php', + 'url' => 'tblproperties', 'urlvars' => ['subject' => 'table', 'table' => Decorator::field('table'), 'action' => 'export'], 'icon' => 'Export', 'hide' => false, @@ -1627,7 +1628,7 @@ class Misc $tabs = [ 'columns' => [ 'title' => $lang['strcolumns'], - 'url' => 'viewproperties.php', + 'url' => 'viewproperties', 'urlvars' => ['subject' => 'view', 'view' => Decorator::field('view')], 'icon' => 'Columns', 'branch' => true, @@ -1635,7 +1636,7 @@ class Misc 'browse' => [ 'title' => $lang['strbrowse'], 'icon' => 'Columns', - 'url' => 'display.php', + 'url' => 'display', 'urlvars' => [ 'action' => 'confselectrows', 'return' => 'schema', @@ -1647,19 +1648,19 @@ class Misc 'select' => [ 'title' => $lang['strselect'], 'icon' => 'Search', - 'url' => 'views.php', + 'url' => 'views', 'urlvars' => ['action' => 'confselectrows', 'view' => Decorator::field('view')], 'help' => 'pg.sql.select', ], 'definition' => [ 'title' => $lang['strdefinition'], - 'url' => 'viewproperties.php', + 'url' => 'viewproperties', 'urlvars' => ['subject' => 'view', 'view' => Decorator::field('view'), 'action' => 'definition'], 'icon' => 'Definition', ], 'rules' => [ 'title' => $lang['strrules'], - 'url' => 'rules.php', + 'url' => 'rules', 'urlvars' => ['subject' => 'view', 'view' => Decorator::field('view')], 'help' => 'pg.rule', 'icon' => 'Rules', @@ -1667,14 +1668,14 @@ class Misc ], 'privileges' => [ 'title' => $lang['strprivileges'], - 'url' => 'privileges.php', + 'url' => 'privileges', 'urlvars' => ['subject' => 'view', 'view' => Decorator::field('view')], 'help' => 'pg.privilege', 'icon' => 'Privileges', ], 'export' => [ 'title' => $lang['strexport'], - 'url' => 'viewproperties.php', + 'url' => 'viewproperties', 'urlvars' => ['subject' => 'view', 'view' => Decorator::field('view'), 'action' => 'export'], 'icon' => 'Export', 'hide' => false, @@ -1686,7 +1687,7 @@ class Misc $tabs = [ 'columns' => [ 'title' => $lang['strcolumns'], - 'url' => 'materializedviewproperties.php', + 'url' => 'materializedviewproperties', 'urlvars' => ['subject' => 'matview', 'matview' => Decorator::field('matview')], 'icon' => 'Columns', 'branch' => true, @@ -1694,7 +1695,7 @@ class Misc 'browse' => [ 'title' => $lang['strbrowse'], 'icon' => 'Columns', - 'url' => 'display.php', + 'url' => 'display', 'urlvars' => [ 'action' => 'confselectrows', 'return' => 'schema', @@ -1706,19 +1707,19 @@ class Misc 'select' => [ 'title' => $lang['strselect'], 'icon' => 'Search', - 'url' => 'materializedviews.php', + 'url' => 'materializedviews', 'urlvars' => ['action' => 'confselectrows', 'matview' => Decorator::field('matview')], 'help' => 'pg.sql.select', ], 'definition' => [ 'title' => $lang['strdefinition'], - 'url' => 'materializedviewproperties.php', + 'url' => 'materializedviewproperties', 'urlvars' => ['subject' => 'matview', 'matview' => Decorator::field('matview'), 'action' => 'definition'], 'icon' => 'Definition', ], 'indexes' => [ 'title' => $lang['strindexes'], - 'url' => 'indexes.php', + 'url' => 'indexes', 'urlvars' => ['subject' => 'matview', 'matview' => Decorator::field('matview')], 'help' => 'pg.index', 'icon' => 'Indexes', @@ -1726,7 +1727,7 @@ class Misc ], /*'constraints' => [ 'title' => $lang['strconstraints'], - 'url' => 'constraints.php', + 'url' => 'constraints', 'urlvars' => ['subject' => 'matview', 'matview' => Decorator::field('matview')], 'help' => 'pg.constraint', 'icon' => 'Constraints', @@ -1735,7 +1736,7 @@ class Misc 'rules' => [ 'title' => $lang['strrules'], - 'url' => 'rules.php', + 'url' => 'rules', 'urlvars' => ['subject' => 'matview', 'matview' => Decorator::field('matview')], 'help' => 'pg.rule', 'icon' => 'Rules', @@ -1743,14 +1744,14 @@ class Misc ], 'privileges' => [ 'title' => $lang['strprivileges'], - 'url' => 'privileges.php', + 'url' => 'privileges', 'urlvars' => ['subject' => 'matview', 'matview' => Decorator::field('matview')], 'help' => 'pg.privilege', 'icon' => 'Privileges', ], 'export' => [ 'title' => $lang['strexport'], - 'url' => 'materializedviewproperties.php', + 'url' => 'materializedviewproperties', 'urlvars' => ['subject' => 'matview', 'matview' => Decorator::field('matview'), 'action' => 'export'], 'icon' => 'Export', 'hide' => false, @@ -1762,7 +1763,7 @@ class Misc $tabs = [ 'definition' => [ 'title' => $lang['strdefinition'], - 'url' => 'functions.php', + 'url' => 'functions', 'urlvars' => [ 'subject' => 'function', 'function' => Decorator::field('function'), @@ -1773,7 +1774,7 @@ class Misc ], 'privileges' => [ 'title' => $lang['strprivileges'], - 'url' => 'privileges.php', + 'url' => 'privileges', 'urlvars' => [ 'subject' => 'function', 'function' => Decorator::field('function'), @@ -1788,7 +1789,7 @@ class Misc $tabs = [ 'definition' => [ 'title' => $lang['strdefinition'], - 'url' => 'aggregates.php', + 'url' => 'aggregates', 'urlvars' => [ 'subject' => 'aggregate', 'aggrname' => Decorator::field('aggrname'), @@ -1804,7 +1805,7 @@ class Misc $tabs = [ 'definition' => [ 'title' => $lang['strdefinition'], - 'url' => 'roles.php', + 'url' => 'roles', 'urlvars' => [ 'subject' => 'role', 'rolename' => Decorator::field('rolename'), @@ -1819,14 +1820,14 @@ class Misc $tabs = [ 'sql' => [ 'title' => $lang['strsql'], - 'url' => '/src/views/sqledit.php', + 'url' => '/src/views/sqledit', 'urlvars' => ['action' => 'sql', 'subject' => 'schema'], 'help' => 'pg.sql', 'icon' => 'SqlEditor', ], 'find' => [ 'title' => $lang['strfind'], - 'url' => '/src/views/sqledit.php', + 'url' => '/src/views/sqledit', 'urlvars' => ['action' => 'find', 'subject' => 'schema'], 'icon' => 'Search', ], @@ -1837,7 +1838,7 @@ class Misc $tabs = [ 'properties' => [ 'title' => $lang['strcolprop'], - 'url' => 'colproperties.php', + 'url' => 'colproperties', 'urlvars' => [ 'subject' => 'column', 'table' => Decorator::field('table'), @@ -1847,7 +1848,7 @@ class Misc ], 'privileges' => [ 'title' => $lang['strprivileges'], - 'url' => 'privileges.php', + 'url' => 'privileges', 'urlvars' => [ 'subject' => 'column', 'table' => Decorator::field('table'), @@ -1863,7 +1864,7 @@ class Misc $tabs = [ 'ftsconfigs' => [ 'title' => $lang['strftstabconfigs'], - 'url' => 'fulltext.php', + 'url' => 'fulltext', 'urlvars' => ['subject' => 'schema'], 'hide' => !$data->hasFTS(), 'help' => 'pg.ftscfg', @@ -1872,7 +1873,7 @@ class Misc ], 'ftsdicts' => [ 'title' => $lang['strftstabdicts'], - 'url' => 'fulltext.php', + 'url' => 'fulltext', 'urlvars' => ['subject' => 'schema', 'action' => 'viewdicts'], 'hide' => !$data->hasFTS(), 'help' => 'pg.ftsdict', @@ -1881,7 +1882,7 @@ class Misc ], 'ftsparsers' => [ 'title' => $lang['strftstabparsers'], - 'url' => 'fulltext.php', + 'url' => 'fulltext', 'urlvars' => ['subject' => 'schema', 'action' => 'viewparsers'], 'hide' => !$data->hasFTS(), 'help' => 'pg.ftsparser', @@ -1981,15 +1982,15 @@ class Misc for ($i = $min_page; $i <= $max_page; ++$i) { #if ($i != $page) echo "<a class=\"pagenav\" href=\"?{$url}&page={$i}\">$i</a>\n"; if ($i != $page) { - echo "<a class=\"pagenav\" href=\"display.php?{$url}&page={$i}\">${i}</a>\n"; + echo "<a class=\"pagenav\" href=\"display?{$url}&page={$i}\">${i}</a>\n"; } else { echo "${i}\n"; } } if ($page != $pages) { $temp = $page + 1; - echo "<a class=\"pagenav\" href=\"display.php?{$url}&page={$temp}\">{$lang['strnext']}</a>\n"; - echo "<a class=\"pagenav\" href=\"display.php?{$url}&page={$pages}\">{$lang['strlast']}</a>\n"; + echo "<a class=\"pagenav\" href=\"display?{$url}&page={$temp}\">{$lang['strnext']}</a>\n"; + echo "<a class=\"pagenav\" href=\"display?{$url}&page={$pages}\">{$lang['strlast']}</a>\n"; } echo "</p>\n"; } diff --git a/src/controllers/AdminTrait.php b/src/controllers/AdminTrait.php index 3cf4c4df..5229f7c2 100644 --- a/src/controllers/AdminTrait.php +++ b/src/controllers/AdminTrait.php @@ -21,7 +21,7 @@ trait AdminTrait */ public function doCluster($type, $confirm = false) { - $this->script = ('database' == $type) ? 'database.php' : 'tables.php'; + $this->script = ('database' == $type) ? 'database' : 'tables'; $script = $this->script; @@ -39,7 +39,7 @@ trait AdminTrait $this->printTrail('schema'); $this->printTitle($lang['strclusterindex'], 'pg.index.cluster'); - echo '<form action="'.\SUBFOLDER."/src/views/{$script}\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/{$script}\" method=\"post\">\n"; foreach ($_REQUEST['ma'] as $v) { $a = unserialize(htmlspecialchars_decode($v, ENT_QUOTES)); echo '<p>', sprintf($lang['strconfclustertable'], $this->misc->printVal($a['table'])), "</p>\n"; @@ -50,7 +50,7 @@ trait AdminTrait $this->printTrail($type); $this->printTitle($lang['strclusterindex'], 'pg.index.cluster'); - echo '<form action="'.\SUBFOLDER."/src/views/{$script}\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/{$script}\" method=\"post\">\n"; if ('table' == $type) { echo '<p>', sprintf($lang['strconfclustertable'], $this->misc->printVal($_REQUEST['object'])), "</p>\n"; @@ -91,9 +91,9 @@ trait AdminTrait list($status, $sql) = $data->clusterIndex($_REQUEST['object']); $msg .= sprintf('%s<br />', htmlentities($sql, ENT_QUOTES, 'UTF-8')); if (0 == $status) { - $this->doAdmin($type, $msg.$lang['strclusteredgood']); + $this->doAdmin($type, $msg . $lang['strclusteredgood']); } else { - $this->doAdmin($type, $msg.$lang['strclusteredbad']); + $this->doAdmin($type, $msg . $lang['strclusteredbad']); } } } else { @@ -101,9 +101,9 @@ trait AdminTrait list($status, $sql) = $data->clusterIndex(); $msg .= sprintf('%s<br />', htmlentities($sql, ENT_QUOTES, 'UTF-8')); if (0 == $status) { - $this->doAdmin($type, $msg.$lang['strclusteredgood']); + $this->doAdmin($type, $msg . $lang['strclusteredgood']); } else { - $this->doAdmin($type, $msg.$lang['strclusteredbad']); + $this->doAdmin($type, $msg . $lang['strclusteredbad']); } } } @@ -117,7 +117,7 @@ trait AdminTrait */ public function doReindex($type, $confirm = false) { - $this->script = ('database' == $type) ? 'database.php' : 'tables.php'; + $this->script = ('database' == $type) ? 'database' : 'tables'; $script = $this->script; $this->misc = $this->misc; $lang = $this->lang; @@ -134,7 +134,7 @@ trait AdminTrait $this->printTrail('schema'); $this->printTitle($lang['strreindex'], 'pg.reindex'); - echo '<form action="'.\SUBFOLDER."/src/views/{$script}\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/{$script}\" method=\"post\">\n"; foreach ($_REQUEST['ma'] as $v) { $a = unserialize(htmlspecialchars_decode($v, ENT_QUOTES)); echo '<p>', sprintf($lang['strconfreindextable'], $this->misc->printVal($a['table'])), "</p>\n"; @@ -145,7 +145,7 @@ trait AdminTrait $this->printTrail($type); $this->printTitle($lang['strreindex'], 'pg.reindex'); - echo '<form action="'.\SUBFOLDER."/src/views/{$script}\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/{$script}\" method=\"post\">\n"; if ('table' == $type) { echo '<p>', sprintf($lang['strconfreindextable'], $this->misc->printVal($_REQUEST['object'])), "</p>\n"; @@ -204,7 +204,7 @@ trait AdminTrait */ public function doAnalyze($type, $confirm = false) { - $this->script = ('database' == $type) ? 'database.php' : 'tables.php'; + $this->script = ('database' == $type) ? 'database' : 'tables'; $script = $this->script; @@ -222,7 +222,7 @@ trait AdminTrait $this->printTrail('schema'); $this->printTitle($lang['stranalyze'], 'pg.analyze'); - echo '<form action="'.\SUBFOLDER."/src/views/{$script}\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/{$script}\" method=\"post\">\n"; foreach ($_REQUEST['ma'] as $v) { $a = unserialize(htmlspecialchars_decode($v, ENT_QUOTES)); \Kint::dump($a); @@ -234,7 +234,7 @@ trait AdminTrait $this->printTrail($type); $this->printTitle($lang['stranalyze'], 'pg.analyze'); - echo '<form action="'.\SUBFOLDER."/src/views/{$script}\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/{$script}\" method=\"post\">\n"; if ('table' == $type) { echo '<p>', sprintf($lang['strconfanalyzetable'], $this->misc->printVal($_REQUEST['object'])), "</p>\n"; @@ -289,7 +289,7 @@ trait AdminTrait */ public function doVacuum($type, $confirm = false) { - $script = ('database' == $type) ? 'database.php' : 'tables.php'; + $script = ('database' == $type) ? 'database' : 'tables'; $lang = $this->lang; $data = $this->misc->getDatabaseAccessor(); @@ -305,7 +305,7 @@ trait AdminTrait $this->printTrail('schema'); $this->printTitle($lang['strvacuum'], 'pg.vacuum'); - echo '<form action="'.\SUBFOLDER."/src/views/{$script}\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/{$script}\" method=\"post\">\n"; foreach ($_REQUEST['ma'] as $v) { $a = unserialize(htmlspecialchars_decode($v, ENT_QUOTES)); echo '<p>', sprintf($lang['strconfvacuumtable'], $this->misc->printVal($a['table'])), "</p>\n"; @@ -316,7 +316,7 @@ trait AdminTrait $this->printTrail($type); $this->printTitle($lang['strvacuum'], 'pg.vacuum'); - echo '<form action="'.\SUBFOLDER."/src/views/{$script}\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/{$script}\" method=\"post\">\n"; if ('table' == $type) { echo '<p>', sprintf($lang['strconfvacuumtable'], $this->misc->printVal($_REQUEST['object'])), "</p>\n"; @@ -374,8 +374,6 @@ trait AdminTrait */ public function doEditAutovacuum($type, $confirm, $msg = '') { - $this->script = ('database' == $type) ? 'database.php' : 'tables.php'; - $script = $this->script; $lang = $this->lang; $data = $this->misc->getDatabaseAccessor(); @@ -386,7 +384,7 @@ trait AdminTrait return; } - $script = ('database' == $type) ? 'database.php' : 'tables.php'; + $script = ('database' == $type) ? 'database' : 'tables'; if ($confirm) { $this->printTrail($type); @@ -435,7 +433,7 @@ trait AdminTrait $old_val['autovacuum_vacuum_cost_limit'] = ''; } - echo '<form action="'.\SUBFOLDER."/src/views/{$script}\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/{$script}\" method=\"post\">\n"; echo $this->misc->form; echo "<input type=\"hidden\" name=\"action\" value=\"editautovac\" />\n"; echo '<input type="hidden" name="table" value="', htmlspecialchars($_REQUEST['table']), "\" />\n"; @@ -501,11 +499,9 @@ trait AdminTrait */ public function doDropAutovacuum($type, $confirm) { - $this->script = ('database' == $type) ? 'database.php' : 'tables.php'; - $script = $this->script; - - $lang = $this->lang; - $data = $this->misc->getDatabaseAccessor(); + $script = ('database' == $type) ? 'database' : 'tables'; + $lang = $this->lang; + $data = $this->misc->getDatabaseAccessor(); if (empty($_REQUEST['table'])) { $this->doAdmin($type, '', $lang['strspecifydelvacuumtable']); @@ -517,8 +513,6 @@ trait AdminTrait $this->printTrail($type); $this->printTabs($type, 'admin'); - $script = ('database' == $type) ? 'database.php' : 'tables.php'; - printf( "<p>{$lang['strdelvacuumtable']}</p>\n", $this->misc->printVal("\"{$_GET['schema']}\".\"{$_GET['table']}\"") @@ -532,7 +526,7 @@ trait AdminTrait echo "<input type=\"submit\" name=\"yes\" value=\"{$lang['stryes']}\" />\n"; echo "</form>\n"; - echo '<form action="'.\SUBFOLDER."/src/views/{$script}\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/{$script}\" method=\"post\">\n"; echo "<input type=\"hidden\" name=\"action\" value=\"admin\" />\n"; echo '<input type="hidden" name="table" value="', htmlspecialchars($_REQUEST['table']), "\" />\n"; echo $this->misc->form; @@ -559,7 +553,7 @@ trait AdminTrait */ public function doAdmin($type, $msg = '') { - $this->script = ('database' == $type) ? 'database.php' : 'tables.php'; + $this->script = ('database' == $type) ? 'database' : 'tables'; $script = $this->script; @@ -580,7 +574,7 @@ trait AdminTrait echo "<table style=\"width: 50%\">\n"; echo "<tr>\n"; echo '<th class="data">'; - $this->misc->printHelp($lang['strvacuum'], 'pg.admin.vacuum')."</th>\n"; + $this->misc->printHelp($lang['strvacuum'], 'pg.admin.vacuum') . "</th>\n"; echo '</th>'; echo '<th class="data">'; $this->misc->printHelp($lang['stranalyze'], 'pg.admin.analyze'); @@ -598,7 +592,7 @@ trait AdminTrait // Vacuum echo "<tr class=\"row1\">\n"; echo "<td style=\"text-align: center; vertical-align: bottom\">\n"; - echo '<form action="'.\SUBFOLDER."/src/views/{$script}\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/{$script}\" method=\"post\">\n"; echo "<p><input type=\"hidden\" name=\"action\" value=\"confirm_vacuum\" />\n"; echo $this->misc->form; @@ -612,7 +606,7 @@ trait AdminTrait // Analyze echo "<td style=\"text-align: center; vertical-align: bottom\">\n"; - echo '<form action="'.\SUBFOLDER."/src/views/{$script}\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/{$script}\" method=\"post\">\n"; echo "<p><input type=\"hidden\" name=\"action\" value=\"confirm_analyze\" />\n"; echo $this->misc->form; if ('table' == $type) { @@ -627,7 +621,7 @@ trait AdminTrait if ($data->hasRecluster()) { $disabled = ''; echo "<td style=\"text-align: center; vertical-align: bottom\">\n"; - echo '<form action="'.\SUBFOLDER."/src/views/{$script}\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/{$script}\" method=\"post\">\n"; echo $this->misc->form; if ('table' == $type) { echo '<input type="hidden" name="table" value="', htmlspecialchars($_REQUEST['object']), "\" />\n"; @@ -645,7 +639,7 @@ trait AdminTrait // Reindex echo "<td style=\"text-align: center; vertical-align: bottom\">\n"; - echo '<form action="'.\SUBFOLDER."/src/views/{$script}\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/{$script}\" method=\"post\">\n"; echo "<p><input type=\"hidden\" name=\"action\" value=\"confirm_reindex\" />\n"; echo $this->misc->form; if ('table' == $type) { @@ -670,46 +664,46 @@ trait AdminTrait } echo "<br /><br /><h2>{$lang['strvacuumpertable']}</h2>"; - echo '<p>'.(('on' == $defaults['autovacuum']) ? $lang['strturnedon'] : $lang['strturnedoff']).'</p>'; + echo '<p>' . (('on' == $defaults['autovacuum']) ? $lang['strturnedon'] : $lang['strturnedoff']) . '</p>'; echo "<p class=\"message\">{$lang['strnotdefaultinred']}</p>"; $enlight = function ($f, $p) { if (isset($f[$p[0]]) and ($f[$p[0]] != $p[1])) { - return '<span style="color:#F33;font-weight:bold">'.htmlspecialchars($f[$p[0]]).'</span>'; + return '<span style="color:#F33;font-weight:bold">' . htmlspecialchars($f[$p[0]]) . '</span>'; } return htmlspecialchars($p[1]); }; $columns = [ - 'namespace' => [ + 'namespace' => [ 'title' => $lang['strschema'], 'field' => Decorator::field('nspname'), - 'url' => \SUBFOLDER."/redirect/schema?{$this->misc->href}&", + 'url' => \SUBFOLDER . "/redirect/schema?{$this->misc->href}&", 'vars' => ['schema' => 'nspname'], ], - 'relname' => [ + 'relname' => [ 'title' => $lang['strtable'], 'field' => Decorator::field('relname'), - 'url' => \SUBFOLDER."/redirect/table?{$this->misc->href}&", + 'url' => \SUBFOLDER . "/redirect/table?{$this->misc->href}&", 'vars' => ['table' => 'relname', 'schema' => 'nspname'], ], - 'autovacuum_enabled' => [ + 'autovacuum_enabled' => [ 'title' => $lang['strenabled'], 'field' => Decorator::callback($enlight, ['autovacuum_enabled', $defaults['autovacuum']]), 'type' => 'verbatim', ], - 'autovacuum_vacuum_threshold' => [ + 'autovacuum_vacuum_threshold' => [ 'title' => $lang['strvacuumbasethreshold'], 'field' => Decorator::callback($enlight, ['autovacuum_vacuum_threshold', $defaults['autovacuum_vacuum_threshold']]), 'type' => 'verbatim', ], - 'autovacuum_vacuum_scale_factor' => [ + 'autovacuum_vacuum_scale_factor' => [ 'title' => $lang['strvacuumscalefactor'], 'field' => Decorator::callback($enlight, ['autovacuum_vacuum_scale_factor', $defaults['autovacuum_vacuum_scale_factor']]), 'type' => 'verbatim', ], - 'autovacuum_analyze_threshold' => [ + 'autovacuum_analyze_threshold' => [ 'title' => $lang['stranalybasethreshold'], 'field' => Decorator::callback($enlight, ['autovacuum_analyze_threshold', $defaults['autovacuum_analyze_threshold']]), 'type' => 'verbatim', @@ -719,12 +713,12 @@ trait AdminTrait 'field' => Decorator::callback($enlight, ['autovacuum_analyze_scale_factor', $defaults['autovacuum_analyze_scale_factor']]), 'type' => 'verbatim', ], - 'autovacuum_vacuum_cost_delay' => [ + 'autovacuum_vacuum_cost_delay' => [ 'title' => $lang['strvacuumcostdelay'], 'field' => Decorator::concat(Decorator::callback($enlight, ['autovacuum_vacuum_cost_delay', $defaults['autovacuum_vacuum_cost_delay']]), 'ms'), 'type' => 'verbatim', ], - 'autovacuum_vacuum_cost_limit' => [ + 'autovacuum_vacuum_cost_limit' => [ 'title' => $lang['strvacuumcostlimit'], 'field' => Decorator::callback($enlight, ['autovacuum_vacuum_cost_limit', $defaults['autovacuum_vacuum_cost_limit']]), 'type' => 'verbatim', @@ -735,7 +729,7 @@ trait AdminTrait $columns['actions'] = ['title' => $lang['stractions']]; $actions = [ - 'edit' => [ + 'edit' => [ 'content' => $lang['stredit'], 'attr' => [ 'href' => [ @@ -777,8 +771,10 @@ trait AdminTrait if (('table' == $type) and (0 == $autovac->recordCount())) { echo '<br />'; - echo "<a href=\"tables.php?action=confeditautovac&{$this->misc->href}&table=", htmlspecialchars($_REQUEST['table']) - , "\">{$lang['straddvacuumtable']}</a>"; + + echo '<a href="' . \SUBFOLDER . "/src/views/tables?action=confeditautovac&{$this->misc->href}&table="; + echo htmlspecialchars($_REQUEST['table']); + echo "\">{$lang['straddvacuumtable']}</a>"; } } } @@ -787,15 +783,11 @@ trait AdminTrait { if ('database' == $type) { $_REQUEST['object'] = $_REQUEST['database']; - $this->script = 'database.php'; } else { // $_REQUEST['table'] is no set if we are in the schema page $_REQUEST['object'] = (isset($_REQUEST['table']) ? $_REQUEST['table'] : ''); - $this->script = 'tables.php'; } - $script = $this->script; - switch ($action) { case 'confirm_cluster': $this->doCluster($type, true); diff --git a/src/controllers/BaseController.php b/src/controllers/BaseController.php index 85110330..c1b1bcc6 100644 --- a/src/controllers/BaseController.php +++ b/src/controllers/BaseController.php @@ -334,6 +334,21 @@ class BaseController return $header_controller->printTitle($title, $help, $do_print); } + public function getRequestParam($key, $default = null) + { + return $this->container->requestobj->getParam($key, $default); + } + + public function getPostParam($key, $default = null) + { + return $this->container->requestobj->getParsedBodyParam($key, $default); + } + + public function getQueryParam($key, $default = null) + { + return $this->container->requestobj->getQueryParam($key, $default); + } + /** * Print out a message. * @@ -347,7 +362,7 @@ class BaseController $html = ''; $msg = htmlspecialchars(\PHPPgAdmin\HelperTrait::br2ln($msg)); if ('' != $msg) { - $html .= '<p class="message">'.nl2br($msg).'</p>'."\n"; + $html .= '<p class="message">' . nl2br($msg) . '</p>' . "\n"; } if ($do_print) { echo $html; diff --git a/src/controllers/ColpropertiesController.php b/src/controllers/ColpropertiesController.php index 8c554f23..947432ab 100644 --- a/src/controllers/ColpropertiesController.php +++ b/src/controllers/ColpropertiesController.php @@ -142,7 +142,7 @@ class ColpropertiesController extends BaseController 'browse' => [ 'attr' => [ 'href' => [ - 'url' => 'display.php', + 'url' => 'display', 'urlvars' => [ 'subject' => 'column', 'server' => $_REQUEST['server'], @@ -196,7 +196,7 @@ class ColpropertiesController extends BaseController 'browse' => [ 'attr' => [ 'href' => [ - 'url' => 'display.php', + 'url' => 'display', 'urlvars' => [ 'subject' => 'column', 'server' => $_REQUEST['server'], diff --git a/src/controllers/DatabaseController.php b/src/controllers/DatabaseController.php index ab5216a9..dccff395 100644 --- a/src/controllers/DatabaseController.php +++ b/src/controllers/DatabaseController.php @@ -16,7 +16,7 @@ use PHPPgAdmin\Decorators\Decorator; class DatabaseController extends BaseController { use AdminTrait; - public $script = 'database.php'; + public $script = 'database'; public $controller_name = 'DatabaseController'; public $table_place = 'database-variables'; @@ -47,20 +47,20 @@ class DatabaseController extends BaseController $scripts = ''; // normal flow if ('locks' == $action || 'processes' == $action) { - $scripts .= '<script src="'.\SUBFOLDER.'/js/database.js" type="text/javascript"></script>'; + $scripts .= '<script src="' . \SUBFOLDER . '/js/database.js" type="text/javascript"></script>'; $refreshTime = $this->conf['ajax_refresh'] * 1500; $scripts .= "<script type=\"text/javascript\">\n"; $scripts .= "var Database = {\n"; $scripts .= "ajax_time_refresh: {$refreshTime},\n"; - $scripts .= "str_start: {text:'{$lang['strstart']}',icon: '".$this->misc->icon('Execute')."'},\n"; - $scripts .= "str_stop: {text:'{$lang['strstop']}',icon: '".$this->misc->icon('Stop')."'},\n"; - $scripts .= "load_icon: '".$this->misc->icon('Loading')."',\n"; + $scripts .= "str_start: {text:'{$lang['strstart']}',icon: '" . $this->misc->icon('Execute') . "'},\n"; + $scripts .= "str_stop: {text:'{$lang['strstop']}',icon: '" . $this->misc->icon('Stop') . "'},\n"; + $scripts .= "load_icon: '" . $this->misc->icon('Loading') . "',\n"; $scripts .= "server:'{$_REQUEST['server']}',\n"; $scripts .= "dbname:'{$_REQUEST['database']}',\n"; $scripts .= "action:'refresh_{$action}',\n"; - $scripts .= "errmsg: '".str_replace("'", "\\'", $lang['strconnectionfail'])."'\n"; + $scripts .= "errmsg: '" . str_replace("'", "\\'", $lang['strconnectionfail']) . "'\n"; $scripts .= "};\n"; $scripts .= "</script>\n"; } @@ -178,7 +178,7 @@ class DatabaseController extends BaseController $this->printTabs('database', 'find'); $this->printMsg($msg); - echo '<form action="'.\SUBFOLDER."/src/views/database.php\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/database.php\" method=\"post\">\n"; echo '<p><input name="term" value="', htmlspecialchars($_REQUEST['term']), "\" size=\"32\" maxlength=\"{$data->_maxNameLen}\" />\n"; // Output list of filters. This is complex due to all the 'has' and 'conf' feature possibilities @@ -316,20 +316,20 @@ class DatabaseController extends BaseController switch ($curr) { case 'SCHEMA': - echo '<li><a href="'.\SUBFOLDER."/redirect/schema?{$this->misc->href}&schema=", $this->misc->printVal($rs->fields['name']), '">', $this->_highlight($this->misc->printVal($rs->fields['name']), $_REQUEST['term']), "</a></li>\n"; + echo '<li><a href="' . \SUBFOLDER . "/redirect/schema?{$this->misc->href}&schema=", $this->misc->printVal($rs->fields['name']), '">', $this->_highlight($this->misc->printVal($rs->fields['name']), $_REQUEST['term']), "</a></li>\n"; break; case 'TABLE': echo '<li>'; echo "<a href=\"tables.php?subject=schema&{$this->misc->href}&schema=", urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['schemaname']), '</a>.'; - echo '<a href="'.\SUBFOLDER."/redirect/table?{$this->misc->href}&schema=", urlencode($rs->fields['schemaname']), '&table=', + echo '<a href="' . \SUBFOLDER . "/redirect/table?{$this->misc->href}&schema=", urlencode($rs->fields['schemaname']), '&table=', urlencode($rs->fields['name']), '">', $this->_highlight($this->misc->printVal($rs->fields['name']), $_REQUEST['term']), "</a></li>\n"; break; case 'VIEW': echo '<li>'; echo "<a href=\"views.php?subject=schema&{$this->misc->href}&schema=", urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['schemaname']), '</a>.'; - echo '<a href="'.\SUBFOLDER."/redirect/view?{$this->misc->href}&schema=", urlencode($rs->fields['schemaname']), '&view=', + echo '<a href="' . \SUBFOLDER . "/redirect/view?{$this->misc->href}&schema=", urlencode($rs->fields['schemaname']), '&view=', urlencode($rs->fields['name']), '">', $this->_highlight($this->misc->printVal($rs->fields['name']), $_REQUEST['term']), "</a></li>\n"; break; @@ -342,7 +342,7 @@ class DatabaseController extends BaseController break; case 'COLUMNTABLE': echo '<li>'; - echo '<a href="'.\SUBFOLDER."/redirect/schema?{$this->misc->href}&schema=", urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['schemaname']), '</a>.'; + echo '<a href="' . \SUBFOLDER . "/redirect/schema?{$this->misc->href}&schema=", urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['schemaname']), '</a>.'; echo "<a href=\"tblproperties.php?subject=table&{$this->misc->href}&table=", urlencode($rs->fields['relname']), '&schema=', urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['relname']), '</a>.'; echo "<a href=\"colproperties.php?{$this->misc->href}&schema=", urlencode($rs->fields['schemaname']), '&table=', urlencode($rs->fields['relname']), '&column=', urlencode($rs->fields['name']), '">', @@ -351,7 +351,7 @@ class DatabaseController extends BaseController break; case 'COLUMNVIEW': echo '<li>'; - echo '<a href="'.\SUBFOLDER."/redirect/schema?{$this->misc->href}&schema=", urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['schemaname']), '</a>.'; + echo '<a href="' . \SUBFOLDER . "/redirect/schema?{$this->misc->href}&schema=", urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['schemaname']), '</a>.'; echo "<a href=\"viewproperties.php?subject=view&{$this->misc->href}&view=", urlencode($rs->fields['relname']), '&schema=', urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['relname']), '</a>.'; echo "<a href=\"colproperties.php?{$this->misc->href}&schema=", urlencode($rs->fields['schemaname']), '&view=', urlencode($rs->fields['relname']), '&column=', urlencode($rs->fields['name']), '">', @@ -360,15 +360,15 @@ class DatabaseController extends BaseController break; case 'INDEX': echo '<li>'; - echo '<a href="'.\SUBFOLDER."/redirect/schema?{$this->misc->href}&schema=", urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['schemaname']), '</a>.'; - echo '<a href="'.\SUBFOLDER."/redirect/table?{$this->misc->href}&table=", urlencode($rs->fields['relname']), '&schema=', urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['relname']), '</a>.'; + echo '<a href="' . \SUBFOLDER . "/redirect/schema?{$this->misc->href}&schema=", urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['schemaname']), '</a>.'; + echo '<a href="' . \SUBFOLDER . "/redirect/table?{$this->misc->href}&table=", urlencode($rs->fields['relname']), '&schema=', urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['relname']), '</a>.'; echo "<a href=\"indexes.php?{$this->misc->href}&schema=", urlencode($rs->fields['schemaname']), '&table=', urlencode($rs->fields['relname']), '">', $this->_highlight($this->misc->printVal($rs->fields['name']), $_REQUEST['term']), "</a></li>\n"; break; case 'CONSTRAINTTABLE': echo '<li>'; - echo '<a href="'.\SUBFOLDER."/redirect/schema?{$this->misc->href}&schema=", urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['schemaname']), '</a>.'; - echo '<a href="'.\SUBFOLDER."/redirect/table?{$this->misc->href}&table=", urlencode($rs->fields['relname']), '&schema=', urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['relname']), '</a>.'; + echo '<a href="' . \SUBFOLDER . "/redirect/schema?{$this->misc->href}&schema=", urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['schemaname']), '</a>.'; + echo '<a href="' . \SUBFOLDER . "/redirect/table?{$this->misc->href}&table=", urlencode($rs->fields['relname']), '&schema=', urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['relname']), '</a>.'; echo "<a href=\"constraints.php?{$this->misc->href}&schema=", urlencode($rs->fields['schemaname']), '&table=', urlencode($rs->fields['relname']), '">', $this->_highlight($this->misc->printVal($rs->fields['name']), $_REQUEST['term']), "</a></li>\n"; @@ -382,24 +382,24 @@ class DatabaseController extends BaseController break; case 'TRIGGER': echo '<li>'; - echo '<a href="'.\SUBFOLDER."/redirect/schema?{$this->misc->href}&schema=", urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['schemaname']), '</a>.'; - echo '<a href="'.\SUBFOLDER."/redirect/table?{$this->misc->href}&table=", urlencode($rs->fields['relname']), '&schema=', urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['relname']), '</a>.'; + echo '<a href="' . \SUBFOLDER . "/redirect/schema?{$this->misc->href}&schema=", urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['schemaname']), '</a>.'; + echo '<a href="' . \SUBFOLDER . "/redirect/table?{$this->misc->href}&table=", urlencode($rs->fields['relname']), '&schema=', urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['relname']), '</a>.'; echo "<a href=\"triggers.php?{$this->misc->href}&schema=", urlencode($rs->fields['schemaname']), '&table=', urlencode($rs->fields['relname']), '">', $this->_highlight($this->misc->printVal($rs->fields['name']), $_REQUEST['term']), "</a></li>\n"; break; case 'RULETABLE': echo '<li>'; - echo '<a href="'.\SUBFOLDER."/redirect/schema?{$this->misc->href}&schema=", urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['schemaname']), '</a>.'; - echo '<a href="'.\SUBFOLDER."/redirect/table?{$this->misc->href}&table=", urlencode($rs->fields['relname']), '&schema=', urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['relname']), '</a>.'; + echo '<a href="' . \SUBFOLDER . "/redirect/schema?{$this->misc->href}&schema=", urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['schemaname']), '</a>.'; + echo '<a href="' . \SUBFOLDER . "/redirect/table?{$this->misc->href}&table=", urlencode($rs->fields['relname']), '&schema=', urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['relname']), '</a>.'; echo "<a href=\"rules.php?subject=table&{$this->misc->href}&schema=", urlencode($rs->fields['schemaname']), '&reltype=table&table=', urlencode($rs->fields['relname']), '">', $this->_highlight($this->misc->printVal($rs->fields['name']), $_REQUEST['term']), "</a></li>\n"; break; case 'RULEVIEW': echo '<li>'; - echo '<a href="'.\SUBFOLDER."/redirect/schema?{$this->misc->href}&schema=", urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['schemaname']), '</a>.'; - echo '<a href="'.\SUBFOLDER."/redirect/view?{$this->misc->href}&view=", urlencode($rs->fields['relname']), '&schema=', urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['relname']), '</a>.'; + echo '<a href="' . \SUBFOLDER . "/redirect/schema?{$this->misc->href}&schema=", urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['schemaname']), '</a>.'; + echo '<a href="' . \SUBFOLDER . "/redirect/view?{$this->misc->href}&view=", urlencode($rs->fields['relname']), '&schema=', urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['relname']), '</a>.'; echo "<a href=\"rules.php?subject=view&{$this->misc->href}&schema=", urlencode($rs->fields['schemaname']), '&reltype=view&view=', urlencode($rs->fields['relname']), '">', $this->_highlight($this->misc->printVal($rs->fields['name']), $_REQUEST['term']), "</a></li>\n"; @@ -453,7 +453,7 @@ class DatabaseController extends BaseController break; case 'OPCLASS': echo '<li>'; - echo '<a href="'.\SUBFOLDER."/redirect/schema?{$this->misc->href}&schema=", urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['schemaname']), '</a>.'; + echo '<a href="' . \SUBFOLDER . "/redirect/schema?{$this->misc->href}&schema=", urlencode($rs->fields['schemaname']), '">', $this->misc->printVal($rs->fields['schemaname']), '</a>.'; echo "<a href=\"opclasses.php?{$this->misc->href}&schema=", urlencode($rs->fields['schemaname']), '">', $this->_highlight($this->misc->printVal($rs->fields['name']), $_REQUEST['term']), "</a></li>\n"; @@ -484,7 +484,7 @@ class DatabaseController extends BaseController $this->printTabs('database', 'export'); $this->printMsg($msg); - echo '<form action="'.\SUBFOLDER."/src/views/dbexport.php\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/dbexport.php\" method=\"post\">\n"; echo "<table>\n"; echo "<tr><th class=\"data\">{$lang['strformat']}</th><th class=\"data\" colspan=\"2\">{$lang['stroptions']}</th></tr>\n"; // Data only @@ -544,7 +544,7 @@ class DatabaseController extends BaseController 'title' => $lang['strname'], 'field' => Decorator::field('name'), ], - 'value' => [ + 'value' => [ 'title' => $lang['strsetting'], 'field' => Decorator::field('setting'), ], @@ -571,7 +571,7 @@ class DatabaseController extends BaseController $this->printMsg($msg); if (0 === strlen($msg)) { - echo '<br /><a id="control" href=""><img src="'.$this->misc->icon('Refresh')."\" alt=\"{$lang['strrefresh']}\" title=\"{$lang['strrefresh']}\"/> {$lang['strrefresh']}</a>"; + echo '<br /><a id="control" href=""><img src="' . $this->misc->icon('Refresh') . "\" alt=\"{$lang['strrefresh']}\" title=\"{$lang['strrefresh']}\"/> {$lang['strrefresh']}</a>"; } echo '<div id="data_block">'; @@ -594,15 +594,15 @@ class DatabaseController extends BaseController 'title' => $lang['strxactid'], 'field' => Decorator::field('transaction'), ], - 'gid' => [ + 'gid' => [ 'title' => $lang['strgid'], 'field' => Decorator::field('gid'), ], - 'prepared' => [ + 'prepared' => [ 'title' => $lang['strstarttime'], 'field' => Decorator::field('prepared'), ], - 'owner' => [ + 'owner' => [ 'title' => $lang['strowner'], 'field' => Decorator::field('owner'), ], @@ -618,11 +618,11 @@ class DatabaseController extends BaseController $processes = $data->getProcesses($_REQUEST['database']); $columns = [ - 'user' => [ + 'user' => [ 'title' => $lang['strusername'], 'field' => Decorator::field('usename'), ], - 'process' => [ + 'process' => [ 'title' => $lang['strprocess'], 'field' => Decorator::field('pid'), ], @@ -630,19 +630,19 @@ class DatabaseController extends BaseController 'title' => 'application', 'field' => Decorator::field('application_name'), ], - 'client_addr' => [ + 'client_addr' => [ 'title' => 'address', 'field' => Decorator::field('client_addr'), ], - 'blocked' => [ + 'blocked' => [ 'title' => $lang['strblocked'], 'field' => Decorator::field('waiting'), ], - 'query' => [ + 'query' => [ 'title' => $lang['strsql'], 'field' => Decorator::field('query'), ], - 'start_time' => [ + 'start_time' => [ 'title' => $lang['strstarttime'], 'field' => Decorator::field('query_start'), ], @@ -667,7 +667,7 @@ class DatabaseController extends BaseController ], ], ], - 'kill' => [ + 'kill' => [ 'content' => $lang['strkill'], 'attr' => [ 'href' => [ @@ -708,15 +708,15 @@ class DatabaseController extends BaseController $variables = $data->getLocks(); $columns = [ - 'namespace' => [ + 'namespace' => [ 'title' => $lang['strschema'], 'field' => Decorator::field('nspname'), ], - 'tablename' => [ + 'tablename' => [ 'title' => $lang['strtablename'], 'field' => Decorator::field('tablename'), ], - 'vxid' => [ + 'vxid' => [ 'title' => $lang['strvirtualtransaction'], 'field' => Decorator::field('virtualtransaction'), ], @@ -724,15 +724,15 @@ class DatabaseController extends BaseController 'title' => $lang['strtransaction'], 'field' => Decorator::field('transaction'), ], - 'processid' => [ + 'processid' => [ 'title' => $lang['strprocessid'], 'field' => Decorator::field('pid'), ], - 'mode' => [ + 'mode' => [ 'title' => $lang['strmode'], 'field' => Decorator::field('mode'), ], - 'granted' => [ + 'granted' => [ 'title' => $lang['strislockheld'], 'field' => Decorator::field('granted'), 'type' => 'yesno', @@ -758,7 +758,7 @@ class DatabaseController extends BaseController $this->printTrail('database'); $this->printTabs('database', 'locks'); - echo '<br /><a id="control" href=""><img src="'.$this->misc->icon('Refresh')."\" alt=\"{$lang['strrefresh']}\" title=\"{$lang['strrefresh']}\"/> {$lang['strrefresh']}</a>"; + echo '<br /><a id="control" href=""><img src="' . $this->misc->icon('Refresh') . "\" alt=\"{$lang['strrefresh']}\" title=\"{$lang['strrefresh']}\"/> {$lang['strrefresh']}</a>"; echo '<div id="data_block">'; $this->currentLocks(); @@ -781,7 +781,7 @@ class DatabaseController extends BaseController $this->printTrail('database'); $this->printTabs('database', 'sql'); echo "<p>{$lang['strentersql']}</p>\n"; - echo '<form action="'.\SUBFOLDER.'/src/views/sql.php" method="post" enctype="multipart/form-data" id="sqlform">'."\n"; + echo '<form action="' . \SUBFOLDER . '/src/views/sql.php" method="post" enctype="multipart/form-data" id="sqlform">' . "\n"; echo "<p>{$lang['strsql']}<br />\n"; echo '<textarea style="width:95%;" rows="15" cols="50" name="query" id="query">', htmlspecialchars($_SESSION['sqlquery']), "</textarea></p>\n"; diff --git a/src/controllers/DisplayController.php b/src/controllers/DisplayController.php index f09e712c..1e1f7a4a 100644 --- a/src/controllers/DisplayController.php +++ b/src/controllers/DisplayController.php @@ -32,13 +32,13 @@ class DisplayController extends BaseController set_time_limit(0); - $scripts = '<script src="'.\SUBFOLDER.'/js/display.js" type="text/javascript"></script>'; + $scripts = '<script src="' . \SUBFOLDER . '/js/display.js" type="text/javascript"></script>'; - $scripts .= '<script type="text/javascript">'."\n"; + $scripts .= '<script type="text/javascript">' . "\n"; $scripts .= "var Display = {\n"; - $scripts .= "errmsg: '".str_replace("'", "\\'", $lang['strconnectionfail'])."'\n"; + $scripts .= "errmsg: '" . str_replace("'", "\\'", $lang['strconnectionfail']) . "'\n"; $scripts .= "};\n"; - $scripts .= '</script>'."\n"; + $scripts .= '</script>' . "\n"; $footer_template = 'footer.twig'; $header_template = 'header.twig'; @@ -85,13 +85,13 @@ class DisplayController extends BaseController // Set the title based on the subject of the request if (isset($_REQUEST['subject'], $_REQUEST[$_REQUEST['subject']])) { if ('table' == $_REQUEST['subject']) { - $this->printHeader($lang['strtables'].': '.$_REQUEST[$_REQUEST['subject']], $scripts, true, $header_template); + $this->printHeader($lang['strtables'] . ': ' . $_REQUEST[$_REQUEST['subject']], $scripts, true, $header_template); } elseif ('view' == $_REQUEST['subject']) { - $this->printHeader($lang['strviews'].': '.$_REQUEST[$_REQUEST['subject']], $scripts, true, $header_template); + $this->printHeader($lang['strviews'] . ': ' . $_REQUEST[$_REQUEST['subject']], $scripts, true, $header_template); } elseif ('matview' == $_REQUEST['subject']) { - $this->printHeader('M'.$lang['strviews'].': '.$_REQUEST[$_REQUEST['subject']], $scripts, true, $header_template); + $this->printHeader('M' . $lang['strviews'] . ': ' . $_REQUEST[$_REQUEST['subject']], $scripts, true, $header_template); } elseif ('column' == $_REQUEST['subject']) { - $this->printHeader($lang['strcolumn'].': '.$_REQUEST[$_REQUEST['subject']], $scripts, true, $header_template); + $this->printHeader($lang['strcolumn'] . ': ' . $_REQUEST[$_REQUEST['subject']], $scripts, true, $header_template); } } else { $this->printHeader($lang['strqueryresults'], $scripts, true, $header_template); @@ -285,13 +285,14 @@ class DisplayController extends BaseController $this->prtrace($query); //die(htmlspecialchars($query)); - echo '<form method="post" id="sqlform" action="'.$_SERVER['REQUEST_URI'].'">'; + echo '<form method="post" id="sqlform" action="' . $_SERVER['REQUEST_URI'] . '">'; echo '<textarea width="90%" name="query" id="query" rows="5" cols="100" resizable="true">'; echo htmlspecialchars($query); echo '</textarea><br><input type="submit"/></form>'; if (is_object($resultset) && $resultset->recordCount() > 0) { + // Show page navigation $this->misc->printPages($_REQUEST['page'], $max_pages, $_gets); @@ -311,11 +312,11 @@ class DisplayController extends BaseController } $buttons = [ - 'edit' => [ + 'edit' => [ 'content' => $lang['stredit'], 'attr' => [ 'href' => [ - 'url' => 'display.php', + 'url' => 'display', 'urlvars' => array_merge([ 'action' => 'confeditrow', 'strings' => $_REQUEST['strings'], @@ -328,7 +329,7 @@ class DisplayController extends BaseController 'content' => $lang['strdelete'], 'attr' => [ 'href' => [ - 'url' => 'display.php', + 'url' => 'display', 'urlvars' => array_merge([ 'action' => 'confdelrow', 'strings' => $_REQUEST['strings'], @@ -359,19 +360,19 @@ class DisplayController extends BaseController // Display edit and delete actions if we have a key $colspan = count($buttons); if ($colspan > 0 and count($key) > 0) { - echo "<th colspan=\"{$colspan}\" class=\"data\">{$lang['stractions']}</th>"."\n"; + echo "<th colspan=\"{$colspan}\" class=\"data\">{$lang['stractions']}</th>" . "\n"; } // we show OIDs only if we are in TABLE or SELECT type browsing $this->printTableHeaderCells($resultset, $_gets, isset($object)); - echo '</tr>'."\n"; + echo '</tr>' . "\n"; $i = 0; reset($resultset->fields); while (!$resultset->EOF) { $id = (0 == ($i % 2) ? '1' : '2'); - echo "<tr class=\"data{$id}\">"."\n"; + echo "<tr class=\"data{$id}\">" . "\n"; // Display edit and delete links if we have a key if ($colspan > 0 and count($key) > 0) { $keys_array = []; @@ -385,7 +386,7 @@ class DisplayController extends BaseController $keys_array["key[{$v}]"] = $resultset->fields[$v]; } if ($has_nulls) { - echo "<td colspan=\"{$colspan}\"> </td>"."\n"; + echo "<td colspan=\"{$colspan}\"> </td>" . "\n"; } else { if (isset($actions['actionbuttons']['edit'])) { $actions['actionbuttons']['edit'] = $edit_params; @@ -406,24 +407,27 @@ class DisplayController extends BaseController foreach ($actions['actionbuttons'] as $action) { echo "<td class=\"opbutton{$id}\">"; $this->printLink($action, true, __METHOD__); - echo '</td>'."\n"; + echo '</td>' . "\n"; } } } $this->printTableRowCells($resultset, $fkey_information, isset($object)); - echo '</tr>'."\n"; + echo '</tr>' . "\n"; $resultset->moveNext(); ++$i; } - echo '</table>'."\n"; + echo '</table>' . "\n"; - echo '<p>', $resultset->recordCount(), " {$lang['strrows']}</p>"."\n"; + echo '<p>', $resultset->recordCount(), " {$lang['strrows']}</p>" . "\n"; // Show page navigation $this->misc->printPages($_REQUEST['page'], $max_pages, $_gets); + + \Kint::dump(class_exists('\ADORecordSet')); + \Kint::dump($resultset); } else { - echo "<p>{$lang['strnodata']}</p>"."\n"; + echo "<p>{$lang['strnodata']}</p>" . "\n"; } // Navigation links @@ -443,7 +447,7 @@ class DisplayController extends BaseController $urlvars = $this->misc->getSubjectParams($_REQUEST['return']); $navlinks['back'] = [ - 'attr' => [ + 'attr' => [ 'href' => [ 'url' => $urlvars['url'], 'urlvars' => $urlvars['params'], @@ -456,7 +460,7 @@ class DisplayController extends BaseController // Edit SQL link if ('QUERY' == $type) { $navlinks['edit'] = [ - 'attr' => [ + 'attr' => [ 'href' => [ 'url' => 'database.php', 'urlvars' => array_merge($fields, [ @@ -472,9 +476,9 @@ class DisplayController extends BaseController // Expand/Collapse if ('expanded' == $_REQUEST['strings']) { $navlinks['collapse'] = [ - 'attr' => [ + 'attr' => [ 'href' => [ - 'url' => 'display.php', + 'url' => 'display', 'urlvars' => array_merge( $_gets, [ @@ -488,9 +492,9 @@ class DisplayController extends BaseController ]; } else { $navlinks['collapse'] = [ - 'attr' => [ + 'attr' => [ 'href' => [ - 'url' => 'display.php', + 'url' => 'display', 'urlvars' => array_merge( $_gets, [ @@ -509,7 +513,7 @@ class DisplayController extends BaseController // Report views don't set a schema, so we need to disable create view in that case if (isset($_REQUEST['schema'])) { $navlinks['createview'] = [ - 'attr' => [ + 'attr' => [ 'href' => [ 'url' => 'views.php', 'urlvars' => array_merge($fields, [ @@ -528,7 +532,7 @@ class DisplayController extends BaseController } $navlinks['download'] = [ - 'attr' => [ + 'attr' => [ 'href' => [ 'url' => 'dataexport.php', 'urlvars' => array_merge($fields, $urlvars), @@ -541,7 +545,7 @@ class DisplayController extends BaseController // Insert if (isset($object) && (isset($subject) && 'table' == $subject)) { $navlinks['insert'] = [ - 'attr' => [ + 'attr' => [ 'href' => [ 'url' => 'tables.php', 'urlvars' => array_merge($fields, [ @@ -556,9 +560,9 @@ class DisplayController extends BaseController // Refresh $navlinks['refresh'] = [ - 'attr' => [ + 'attr' => [ 'href' => [ - 'url' => 'display.php', + 'url' => 'display', 'urlvars' => array_merge( $_gets, [ @@ -608,7 +612,7 @@ class DisplayController extends BaseController $fksprops = false; } - echo '<form action="'.\SUBFOLDER.'/src/views/display.php" method="post" id="ac_form">'."\n"; + echo '<form action="' . \SUBFOLDER . '/src/views/display" method="post" id="ac_form">' . "\n"; /*echo '<p>'; if (!$error) { @@ -622,11 +626,11 @@ class DisplayController extends BaseController $elements = 0; $error = true; if (1 == $resultset->recordCount() && $attrs->recordCount() > 0) { - echo '<table>'."\n"; + echo '<table>' . "\n"; // Output table header echo "<tr><th class=\"data\">{$lang['strcolumn']}</th><th class=\"data\">{$lang['strtype']}</th>"; - echo "<th class=\"data\">{$lang['strformat']}</th>"."\n"; + echo "<th class=\"data\">{$lang['strformat']}</th>" . "\n"; echo "<th class=\"data\">{$lang['strnull']}</th><th class=\"data\">{$lang['strvalue']}</th></tr>"; $i = 0; @@ -639,19 +643,19 @@ class DisplayController extends BaseController $_REQUEST['format'][$attrs->fields['attname']] = 'VALUE'; } - echo "<tr class=\"data{$id}\">"."\n"; + echo "<tr class=\"data{$id}\">" . "\n"; echo '<td style="white-space:nowrap;">', $this->misc->printVal($attrs->fields['attname']), '</td>'; - echo '<td style="white-space:nowrap;">'."\n"; + echo '<td style="white-space:nowrap;">' . "\n"; echo $this->misc->printVal($data->formatType($attrs->fields['type'], $attrs->fields['atttypmod'])); echo '<input type="hidden" name="types[', htmlspecialchars($attrs->fields['attname']), ']" value="', htmlspecialchars($attrs->fields['type']), '" /></td>'; ++$elements; - echo '<td style="white-space:nowrap;">'."\n"; - echo '<select name="format['.htmlspecialchars($attrs->fields['attname']), ']">'."\n"; - echo '<option value="VALUE"', ($_REQUEST['format'][$attrs->fields['attname']] == 'VALUE') ? ' selected="selected"' : '', ">{$lang['strvalue']}</option>"."\n"; + echo '<td style="white-space:nowrap;">' . "\n"; + echo '<select name="format[' . htmlspecialchars($attrs->fields['attname']), ']">' . "\n"; + echo '<option value="VALUE"', ($_REQUEST['format'][$attrs->fields['attname']] == 'VALUE') ? ' selected="selected"' : '', ">{$lang['strvalue']}</option>" . "\n"; $selected = ($_REQUEST['format'][$attrs->fields['attname']] == 'EXPRESSION') ? ' selected="selected"' : ''; - echo '<option value="EXPRESSION"'.$selected.">{$lang['strexpression']}</option>"."\n"; - echo "</select>\n</td>"."\n"; + echo '<option value="EXPRESSION"' . $selected . ">{$lang['strexpression']}</option>" . "\n"; + echo "</select>\n</td>" . "\n"; ++$elements; echo '<td style="white-space:nowrap;">'; // Output null box if the column allows nulls (doesn't look at CHECKs or ASSERTIONS) @@ -661,7 +665,7 @@ class DisplayController extends BaseController $_REQUEST['nulls'][$attrs->fields['attname']] = 'on'; } echo "<label><span><input type=\"checkbox\" name=\"nulls[{$attrs->fields['attname']}]\"", - isset($_REQUEST['nulls'][$attrs->fields['attname']]) ? ' checked="checked"' : '', ' /></span></label></td>'."\n"; + isset($_REQUEST['nulls'][$attrs->fields['attname']]) ? ' checked="checked"' : '', ' /></span></label></td>' . "\n"; ++$elements; } else { echo ' </td>'; @@ -676,7 +680,7 @@ class DisplayController extends BaseController // keep track of which element offset we're up to. We can't refer to the null checkbox by name // as it contains '[' and ']' characters. if (!$attrs->fields['attnotnull']) { - $extras['onChange'] = 'elements['.($elements - 1).'].checked = false;'; + $extras['onChange'] = 'elements[' . ($elements - 1) . '].checked = false;'; } if ((false !== $fksprops) && isset($fksprops['byfield'][$attrs->fields['attnum']])) { @@ -688,63 +692,63 @@ class DisplayController extends BaseController echo '</td>'; ++$elements; - echo '</tr>'."\n"; + echo '</tr>' . "\n"; ++$i; $attrs->moveNext(); } - echo '</table>'."\n"; + echo '</table>' . "\n"; $error = false; } elseif (1 != $resultset->recordCount()) { - echo "<p>{$lang['strrownotunique']}</p>"."\n"; + echo "<p>{$lang['strrownotunique']}</p>" . "\n"; } else { - echo "<p>{$lang['strinvalidparam']}</p>"."\n"; + echo "<p>{$lang['strinvalidparam']}</p>" . "\n"; } - echo '<input type="hidden" name="action" value="editrow" />'."\n"; + echo '<input type="hidden" name="action" value="editrow" />' . "\n"; echo $this->misc->form; if (isset($_REQUEST['table'])) { - echo '<input type="hidden" name="table" value="', htmlspecialchars($_REQUEST['table']), '" />'."\n"; + echo '<input type="hidden" name="table" value="', htmlspecialchars($_REQUEST['table']), '" />' . "\n"; } if (isset($_REQUEST['subject'])) { - echo '<input type="hidden" name="subject" value="', htmlspecialchars($_REQUEST['subject']), '" />'."\n"; + echo '<input type="hidden" name="subject" value="', htmlspecialchars($_REQUEST['subject']), '" />' . "\n"; } if (isset($_REQUEST['query'])) { - echo '<input type="hidden" name="query" value="', htmlspecialchars($_REQUEST['query']), '" />'."\n"; + echo '<input type="hidden" name="query" value="', htmlspecialchars($_REQUEST['query']), '" />' . "\n"; } if (isset($_REQUEST['count'])) { - echo '<input type="hidden" name="count" value="', htmlspecialchars($_REQUEST['count']), '" />'."\n"; + echo '<input type="hidden" name="count" value="', htmlspecialchars($_REQUEST['count']), '" />' . "\n"; } if (isset($_REQUEST['return'])) { - echo '<input type="hidden" name="return" value="', htmlspecialchars($_REQUEST['return']), '" />'."\n"; + echo '<input type="hidden" name="return" value="', htmlspecialchars($_REQUEST['return']), '" />' . "\n"; } - echo '<input type="hidden" name="page" value="', htmlspecialchars($_REQUEST['page']), '" />'."\n"; - echo '<input type="hidden" name="sortkey" value="', htmlspecialchars($_REQUEST['sortkey']), '" />'."\n"; - echo '<input type="hidden" name="sortdir" value="', htmlspecialchars($_REQUEST['sortdir']), '" />'."\n"; - echo '<input type="hidden" name="strings" value="', htmlspecialchars($_REQUEST['strings']), '" />'."\n"; - echo '<input type="hidden" name="key" value="', htmlspecialchars(urlencode(serialize($key))), '" />'."\n"; + echo '<input type="hidden" name="page" value="', htmlspecialchars($_REQUEST['page']), '" />' . "\n"; + echo '<input type="hidden" name="sortkey" value="', htmlspecialchars($_REQUEST['sortkey']), '" />' . "\n"; + echo '<input type="hidden" name="sortdir" value="', htmlspecialchars($_REQUEST['sortdir']), '" />' . "\n"; + echo '<input type="hidden" name="strings" value="', htmlspecialchars($_REQUEST['strings']), '" />' . "\n"; + echo '<input type="hidden" name="key" value="', htmlspecialchars(urlencode(serialize($key))), '" />' . "\n"; echo '<p>'; if (!$error) { - echo "<input type=\"submit\" name=\"save\" accesskey=\"r\" value=\"{$lang['strsave']}\" />"."\n"; + echo "<input type=\"submit\" name=\"save\" accesskey=\"r\" value=\"{$lang['strsave']}\" />" . "\n"; } - echo "<input type=\"submit\" name=\"cancel\" value=\"{$lang['strcancel']}\" />"."\n"; + echo "<input type=\"submit\" name=\"cancel\" value=\"{$lang['strcancel']}\" />" . "\n"; if (false !== $fksprops) { if ('default off' != $this->conf['autocomplete']) { - echo "<input type=\"checkbox\" id=\"no_ac\" value=\"1\" checked=\"checked\" /><label for=\"no_ac\">{$lang['strac']}</label>"."\n"; + echo "<input type=\"checkbox\" id=\"no_ac\" value=\"1\" checked=\"checked\" /><label for=\"no_ac\">{$lang['strac']}</label>" . "\n"; } else { - echo "<input type=\"checkbox\" id=\"no_ac\" value=\"0\" /><label for=\"no_ac\">{$lang['strac']}</label>"."\n"; + echo "<input type=\"checkbox\" id=\"no_ac\" value=\"0\" /><label for=\"no_ac\">{$lang['strac']}</label>" . "\n"; } } - echo '</p>'."\n"; - echo '</form>'."\n"; + echo '</p>' . "\n"; + echo '</form>' . "\n"; } else { if (!isset($_POST['values'])) { $_POST['values'] = []; @@ -788,58 +792,58 @@ class DisplayController extends BaseController $resultset = $data->browseRow($_REQUEST['table'], $_REQUEST['key']); - echo '<form action="'.\SUBFOLDER.'/src/views/display.php" method="post">'."\n"; + echo '<form action="' . \SUBFOLDER . '/src/views/display" method="post">' . "\n"; echo $this->misc->form; if (1 == $resultset->recordCount()) { - echo "<p>{$lang['strconfdeleterow']}</p>"."\n"; + echo "<p>{$lang['strconfdeleterow']}</p>" . "\n"; $fkinfo = []; echo '<table><tr>'; $this->printTableHeaderCells($resultset, false, true); echo '</tr>'; - echo '<tr class="data1">'."\n"; + echo '<tr class="data1">' . "\n"; $this->printTableRowCells($resultset, $fkinfo, true); - echo '</tr>'."\n"; - echo '</table>'."\n"; - echo '<br />'."\n"; + echo '</tr>' . "\n"; + echo '</table>' . "\n"; + echo '<br />' . "\n"; - echo '<input type="hidden" name="action" value="delrow" />'."\n"; - echo "<input type=\"submit\" name=\"yes\" value=\"{$lang['stryes']}\" />"."\n"; - echo "<input type=\"submit\" name=\"no\" value=\"{$lang['strno']}\" />"."\n"; + echo '<input type="hidden" name="action" value="delrow" />' . "\n"; + echo "<input type=\"submit\" name=\"yes\" value=\"{$lang['stryes']}\" />" . "\n"; + echo "<input type=\"submit\" name=\"no\" value=\"{$lang['strno']}\" />" . "\n"; } elseif (1 != $resultset->recordCount()) { - echo "<p>{$lang['strrownotunique']}</p>"."\n"; - echo "<input type=\"submit\" name=\"cancel\" value=\"{$lang['strcancel']}\" />"."\n"; + echo "<p>{$lang['strrownotunique']}</p>" . "\n"; + echo "<input type=\"submit\" name=\"cancel\" value=\"{$lang['strcancel']}\" />" . "\n"; } else { - echo "<p>{$lang['strinvalidparam']}</p>"."\n"; - echo "<input type=\"submit\" name=\"cancel\" value=\"{$lang['strcancel']}\" />"."\n"; + echo "<p>{$lang['strinvalidparam']}</p>" . "\n"; + echo "<input type=\"submit\" name=\"cancel\" value=\"{$lang['strcancel']}\" />" . "\n"; } if (isset($_REQUEST['table'])) { - echo '<input type="hidden" name="table" value="', htmlspecialchars($_REQUEST['table']), '" />'."\n"; + echo '<input type="hidden" name="table" value="', htmlspecialchars($_REQUEST['table']), '" />' . "\n"; } if (isset($_REQUEST['subject'])) { - echo '<input type="hidden" name="subject" value="', htmlspecialchars($_REQUEST['subject']), '" />'."\n"; + echo '<input type="hidden" name="subject" value="', htmlspecialchars($_REQUEST['subject']), '" />' . "\n"; } if (isset($_REQUEST['query'])) { - echo '<input type="hidden" name="query" value="', htmlspecialchars($_REQUEST['query']), '" />'."\n"; + echo '<input type="hidden" name="query" value="', htmlspecialchars($_REQUEST['query']), '" />' . "\n"; } if (isset($_REQUEST['count'])) { - echo '<input type="hidden" name="count" value="', htmlspecialchars($_REQUEST['count']), '" />'."\n"; + echo '<input type="hidden" name="count" value="', htmlspecialchars($_REQUEST['count']), '" />' . "\n"; } if (isset($_REQUEST['return'])) { - echo '<input type="hidden" name="return" value="', htmlspecialchars($_REQUEST['return']), '" />'."\n"; + echo '<input type="hidden" name="return" value="', htmlspecialchars($_REQUEST['return']), '" />' . "\n"; } - echo '<input type="hidden" name="page" value="', htmlspecialchars($_REQUEST['page']), '" />'."\n"; - echo '<input type="hidden" name="sortkey" value="', htmlspecialchars($_REQUEST['sortkey']), '" />'."\n"; - echo '<input type="hidden" name="sortdir" value="', htmlspecialchars($_REQUEST['sortdir']), '" />'."\n"; - echo '<input type="hidden" name="strings" value="', htmlspecialchars($_REQUEST['strings']), '" />'."\n"; - echo '<input type="hidden" name="key" value="', htmlspecialchars(urlencode(serialize($_REQUEST['key']))), '" />'."\n"; - echo '</form>'."\n"; + echo '<input type="hidden" name="page" value="', htmlspecialchars($_REQUEST['page']), '" />' . "\n"; + echo '<input type="hidden" name="sortkey" value="', htmlspecialchars($_REQUEST['sortkey']), '" />' . "\n"; + echo '<input type="hidden" name="sortdir" value="', htmlspecialchars($_REQUEST['sortdir']), '" />' . "\n"; + echo '<input type="hidden" name="strings" value="', htmlspecialchars($_REQUEST['strings']), '" />' . "\n"; + echo '<input type="hidden" name="key" value="', htmlspecialchars(urlencode(serialize($_REQUEST['key']))), '" />' . "\n"; + echo '</form>' . "\n"; } else { $status = $data->deleteRow($_POST['table'], unserialize(urldecode($_POST['key']))); if (0 == $status) { @@ -869,7 +873,7 @@ class DisplayController extends BaseController if (isset($_REQUEST['table'])) { $constraints = $data->getConstraintsWithFields($_REQUEST['table']); if ($constraints->recordCount() > 0) { - $fkey_information['common_url'] = $this->misc->getHREF('schema').'&subject=table'; + $fkey_information['common_url'] = $this->misc->getHREF('schema') . '&subject=table'; // build the FK constraints data structure while (!$constraints->EOF) { @@ -877,7 +881,7 @@ class DisplayController extends BaseController if ('f' == $constr['contype']) { if (!isset($fkey_information['byconstr'][$constr['conid']])) { $fkey_information['byconstr'][$constr['conid']] = [ - 'url_data' => 'table='.urlencode($constr['f_table']).'&schema='.urlencode($constr['f_schema']), + 'url_data' => 'table=' . urlencode($constr['f_table']) . '&schema=' . urlencode($constr['f_schema']), 'fkeys' => [], 'consrc' => $constr['consrc'], ]; @@ -920,7 +924,7 @@ class DisplayController extends BaseController $finfo = $resultset->fetchField($j); if (false === $args) { - echo '<th class="data">', $this->misc->printVal($finfo->name), '</th>'."\n"; + echo '<th class="data">', $this->misc->printVal($finfo->name), '</th>' . "\n"; } else { $args['page'] = $_REQUEST['page']; $args['sortkey'] = $j + 1; @@ -936,12 +940,12 @@ class DisplayController extends BaseController , $this->misc->printVal($finfo->name); if ($_REQUEST['sortkey'] == ($j + 1)) { if ('asc' == $_REQUEST['sortdir']) { - echo '<img src="'.$this->misc->icon('RaiseArgument').'" alt="asc">'; + echo '<img src="' . $this->misc->icon('RaiseArgument') . '" alt="asc">'; } else { - echo '<img src="'.$this->misc->icon('LowerArgument').'" alt="desc">'; + echo '<img src="' . $this->misc->icon('LowerArgument') . '" alt="desc">'; } } - echo '</a></th>'."\n"; + echo '</a></th>' . "\n"; } ++$j; } @@ -976,16 +980,16 @@ class DisplayController extends BaseController $query_params = $fkey_information['byconstr'][$conid]['url_data']; foreach ($fkey_information['byconstr'][$conid]['fkeys'] as $p_field => $f_field) { - $query_params .= '&'.urlencode("fkey[{$f_field}]").'='.urlencode($resultset->fields[$p_field]); + $query_params .= '&' . urlencode("fkey[{$f_field}]") . '=' . urlencode($resultset->fields[$p_field]); } // $fkey_information['common_url'] is already urlencoded - $query_params .= '&'.$fkey_information['common_url']; + $query_params .= '&' . $fkey_information['common_url']; echo '<div style="display:inline-block;">'; - echo '<a class="fk fk_'.htmlentities($conid, ENT_QUOTES, 'UTF-8')."\" href=\"display.php?{$query_params}\">"; - echo '<img src="'.$this->misc->icon('ForeignKey').'" style="vertical-align:middle;" alt="[fk]" title="' - .htmlentities($fkey_information['byconstr'][$conid]['consrc'], ENT_QUOTES, 'UTF-8') - .'" />'; + echo '<a class="fk fk_' . htmlentities($conid, ENT_QUOTES, 'UTF-8') . "\" href=\"display?{$query_params}\">"; + echo '<img src="' . $this->misc->icon('ForeignKey') . '" style="vertical-align:middle;" alt="[fk]" title="' + . htmlentities($fkey_information['byconstr'][$conid]['consrc'], ENT_QUOTES, 'UTF-8') + . '" />'; echo '</a>'; echo '</div>'; } @@ -1026,7 +1030,7 @@ class DisplayController extends BaseController $max_pages ); - echo '<a href="javascript:void(0);" style="display:table-cell;" class="fk_delete"><img alt="[delete]" src="'.$this->misc->icon('Delete').'" /></a>'."\n"; + echo '<a href="javascript:void(0);" style="display:table-cell;" class="fk_delete"><img alt="[delete]" src="' . $this->misc->icon('Delete') . '" /></a>' . "\n"; echo '<div style="display:table-cell;">'; if (is_object($resultset) && $resultset->recordCount() > 0) { @@ -1037,10 +1041,10 @@ class DisplayController extends BaseController echo '<table><tr>'; $this->printTableHeaderCells($resultset, false, true); echo '</tr>'; - echo '<tr class="data1">'."\n"; + echo '<tr class="data1">' . "\n"; $this->printTableRowCells($resultset, $fkinfo, true); - echo '</tr>'."\n"; - echo '</table>'."\n"; + echo '</tr>' . "\n"; + echo '</table>' . "\n"; } else { echo $lang['strnodata']; } diff --git a/src/controllers/IndexesController.php b/src/controllers/IndexesController.php index af639852..2888ec39 100644 --- a/src/controllers/IndexesController.php +++ b/src/controllers/IndexesController.php @@ -29,7 +29,7 @@ class IndexesController extends BaseController return $this->doTree(); } - $this->printHeader($lang['strindexes'], '<script src="'.\SUBFOLDER.'/js/indexes.js" type="text/javascript"></script>'); + $this->printHeader($lang['strindexes'], '<script src="' . \SUBFOLDER . '/js/indexes.js" type="text/javascript"></script>'); $onloadInit = false; if ('create_index' == $action || 'save_create_index' == $action) { @@ -119,11 +119,11 @@ class IndexesController extends BaseController $indexes = $data->getIndexes($_REQUEST[$_REQUEST['subject']]); $columns = [ - 'index' => [ + 'index' => [ 'title' => $lang['strname'], 'field' => Decorator::field('indname'), ], - 'definition' => [ + 'definition' => [ 'title' => $lang['strdefinition'], 'field' => Decorator::field('inddef'), ], @@ -133,21 +133,21 @@ class IndexesController extends BaseController 'type' => 'verbatim', 'params' => ['align' => 'center'], ], - 'clustered' => [ + 'clustered' => [ 'title' => $lang['strclustered'], 'field' => Decorator::field('indisclustered'), 'type' => 'yesno', ], - 'actions' => [ + 'actions' => [ 'title' => $lang['stractions'], ], - 'comment' => [ + 'comment' => [ 'title' => $lang['strcomment'], 'field' => Decorator::field('idxcomment'), ], ]; - $url = \SUBFOLDER.'/src/views/indexes'; + $url = \SUBFOLDER . '/src/views/indexes'; $actions = [ 'cluster' => [ @@ -178,7 +178,7 @@ class IndexesController extends BaseController ], ], ], - 'drop' => [ + 'drop' => [ 'content' => $lang['strdrop'], 'attr' => [ 'href' => [ @@ -198,7 +198,7 @@ class IndexesController extends BaseController $this->printNavLinks([ 'create' => [ - 'attr' => [ + 'attr' => [ 'href' => [ 'url' => 'indexes.php', 'urlvars' => [ @@ -277,18 +277,18 @@ class IndexesController extends BaseController $this->printTabs($subject, 'indexes'); $this->printTitle($lang['strclusterindex'], 'pg.index.cluster'); - echo '<p>', sprintf($lang['strconfcluster'], $this->misc->printVal($_REQUEST['index'])), '</p>'."\n"; + echo '<p>', sprintf($lang['strconfcluster'], $this->misc->printVal($_REQUEST['index'])), '</p>' . "\n"; - echo '<form action="'.\SUBFOLDER.'/src/views/indexes.php" method="post">'."\n"; + echo '<form action="' . \SUBFOLDER . '/src/views/indexes.php" method="post">' . "\n"; echo '<p><input type="checkbox" id="analyze" name="analyze"', (isset($_REQUEST['analyze']) ? ' checked="checked"' : ''), ' />'; - echo "<label for=\"analyze\">{$lang['stranalyze']}</label></p>"."\n"; - echo '<input type="hidden" name="action" value="cluster_index" />'."\n"; - echo '<input type="hidden" name="table" value="', htmlspecialchars($object), '" />'."\n"; - echo '<input type="hidden" name="index" value="', htmlspecialchars($_REQUEST['index']), '" />'."\n"; + echo "<label for=\"analyze\">{$lang['stranalyze']}</label></p>" . "\n"; + echo '<input type="hidden" name="action" value="cluster_index" />' . "\n"; + echo '<input type="hidden" name="table" value="', htmlspecialchars($object), '" />' . "\n"; + echo '<input type="hidden" name="index" value="', htmlspecialchars($_REQUEST['index']), '" />' . "\n"; echo $this->misc->form; - echo "<input type=\"submit\" name=\"cluster\" value=\"{$lang['strclusterindex']}\" />"."\n"; - echo "<input type=\"submit\" name=\"cancel\" value=\"{$lang['strcancel']}\" />"."\n"; - echo '</form>'."\n"; + echo "<input type=\"submit\" name=\"cluster\" value=\"{$lang['strclusterindex']}\" />" . "\n"; + echo "<input type=\"submit\" name=\"cancel\" value=\"{$lang['strcancel']}\" />" . "\n"; + echo '</form>' . "\n"; } else { set_time_limit(0); list($status, $sql) = $data->clusterIndex($object, $_POST['index']); @@ -296,15 +296,15 @@ class IndexesController extends BaseController if (isset($_POST['analyze'])) { $status = $data->analyzeDB($object); if (0 == $status) { - $this->doDefault($sql.'<br>'.$lang['strclusteredgood'].' '.$lang['stranalyzegood']); + $this->doDefault($sql . '<br>' . $lang['strclusteredgood'] . ' ' . $lang['stranalyzegood']); } else { - $this->doDefault($sql.'<br>'.$lang['stranalyzebad']); + $this->doDefault($sql . '<br>' . $lang['stranalyzebad']); } } else { - $this->doDefault($sql.'<br>'.$lang['strclusteredgood']); + $this->doDefault($sql . '<br>' . $lang['strclusteredgood']); } } else { - $this->doDefault($sql.'<br>'.$lang['strclusteredbad']); + $this->doDefault($sql . '<br>' . $lang['strclusteredbad']); } } } @@ -391,61 +391,61 @@ class IndexesController extends BaseController $buttonRemove->set_attribute('onclick', 'buttonPressed(this);'); $buttonRemove->set_attribute('type', 'button'); - echo '<form onsubmit="doSelectAll();" name="formIndex" action="indexes.php" method="post">'."\n"; + echo '<form onsubmit="doSelectAll();" name="formIndex" action="indexes.php" method="post">' . "\n"; - echo '<table>'."\n"; - echo '<tr><th class="data required" colspan="3">'.$lang['strindexname'].'</th></tr>'; + echo '<table>' . "\n"; + echo '<tr><th class="data required" colspan="3">' . $lang['strindexname'] . '</th></tr>'; echo '<tr>'; echo '<td class="data1" colspan="3">'; - echo 'Index name cannot exceed '.$data->_maxNameLen.' characters<br>'; - echo '<input type="text" name="formIndexName" size="32" placeholder="Index Name" maxlength="'. - $data->_maxNameLen.'" value="'. - htmlspecialchars($_POST['formIndexName']).'" />'; + echo 'Index name cannot exceed ' . $data->_maxNameLen . ' characters<br>'; + echo '<input type="text" name="formIndexName" size="32" placeholder="Index Name" maxlength="' . + $data->_maxNameLen . '" value="' . + htmlspecialchars($_POST['formIndexName']) . '" />'; echo '</td>'; echo '</tr>'; echo '<tr>'; - echo '<th class="data">'.$lang['strtablecolumnlist'].'</th><th class="data"> </th>'; - echo '<th class="data required">'.$lang['strindexcolumnlist'].'</th>'; - echo '</tr>'."\n"; + echo '<th class="data">' . $lang['strtablecolumnlist'] . '</th><th class="data"> </th>'; + echo '<th class="data required">' . $lang['strindexcolumnlist'] . '</th>'; + echo '</tr>' . "\n"; - echo '<tr><td class="data1">'.$selColumns->fetch().'</td>'."\n"; - echo '<td class="data1">'.$buttonRemove->fetch().$buttonAdd->fetch().'</td>'; - echo '<td class="data1">'.$selIndex->fetch().'</td></tr>'."\n"; + echo '<tr><td class="data1">' . $selColumns->fetch() . '</td>' . "\n"; + echo '<td class="data1">' . $buttonRemove->fetch() . $buttonAdd->fetch() . '</td>'; + echo '<td class="data1">' . $selIndex->fetch() . '</td></tr>' . "\n"; echo '<tr>'; - echo '<th class="data left required" scope="row">'.$lang['strindextype'].'</th>'; + echo '<th class="data left required" scope="row">' . $lang['strindextype'] . '</th>'; echo '<td colspan="2" class="data1"><select name="formIndexType">'; foreach ($data->typIndexes as $v) { echo '<option value="', htmlspecialchars($v), '"', - ($v == $_POST['formIndexType']) ? ' selected="selected"' : '', '>', htmlspecialchars($v), '</option>'."\n"; + ($v == $_POST['formIndexType']) ? ' selected="selected"' : '', '>', htmlspecialchars($v), '</option>' . "\n"; } - echo '</select></td></tr>'."\n"; + echo '</select></td></tr>' . "\n"; echo '<tr>'; echo "<th class=\"data left\" scope=\"row\"><label for=\"formUnique\">{$lang['strunique']}</label></th>"; echo '<td colspan="2" class="data1"><input type="checkbox" id="formUnique" name="formUnique"', (isset($_POST['formUnique']) ? 'checked="checked"' : ''), ' /></td>'; echo '</tr>'; echo '<tr>'; echo "<th class=\"data left\" scope=\"row\">{$lang['strwhere']}</th>"; - echo '<td colspan="2" class="data1">(<input name="formWhere" size="32" maxlength="'.$data->_maxNameLen.'" value="'.htmlspecialchars($_POST['formWhere']).'" />)</td>'; + echo '<td colspan="2" class="data1">(<input name="formWhere" size="32" maxlength="' . $data->_maxNameLen . '" value="' . htmlspecialchars($_POST['formWhere']) . '" />)</td>'; echo '</tr>'; // Tablespace (if there are any) if ($data->hasTablespaces() && $tablespaces->recordCount() > 0) { - echo '<tr>'."\n"; - echo "<th class=\"data left\">{$lang['strtablespace']}</th>"."\n"; + echo '<tr>' . "\n"; + echo "<th class=\"data left\">{$lang['strtablespace']}</th>" . "\n"; echo '<td colspan="2" class="data1">'; - echo "\n\t\t\t<select name=\"formSpc\">"."\n"; + echo "\n\t\t\t<select name=\"formSpc\">" . "\n"; // Always offer the default (empty) option echo "\t\t\t\t<option value=\"\"", - ('' == $_POST['formSpc']) ? ' selected="selected"' : '', '></option>'."\n"; + ('' == $_POST['formSpc']) ? ' selected="selected"' : '', '></option>' . "\n"; // Display all other tablespaces while (!$tablespaces->EOF) { $spcname = htmlspecialchars($tablespaces->fields['spcname']); echo "\t\t\t\t<option value=\"{$spcname}\"", - ($spcname == $_POST['formSpc']) ? ' selected="selected"' : '', ">{$spcname}</option>"."\n"; + ($spcname == $_POST['formSpc']) ? ' selected="selected"' : '', ">{$spcname}</option>" . "\n"; $tablespaces->moveNext(); } - echo "\t\t\t</select>\n\t\t</td>\n\t</tr>"."\n"; + echo "\t\t\t</select>\n\t\t</td>\n\t</tr>" . "\n"; } if ($data->hasConcurrentIndexBuild()) { @@ -457,13 +457,13 @@ class IndexesController extends BaseController echo '</table>'; - echo '<p><input type="hidden" name="action" value="save_create_index" />'."\n"; + echo '<p><input type="hidden" name="action" value="save_create_index" />' . "\n"; echo $this->misc->form; - echo '<input type="hidden" name="subject" value="', htmlspecialchars($subject), '" />'."\n"; - echo '<input type="hidden" name="'.$subject.'" value="', htmlspecialchars($object), '" />'."\n"; - echo "<input type=\"submit\" value=\"{$lang['strcreate']}\" />"."\n"; - echo "<input type=\"submit\" name=\"cancel\" value=\"{$lang['strcancel']}\" /></p>"."\n"; - echo '</form>'."\n"; + echo '<input type="hidden" name="subject" value="', htmlspecialchars($subject), '" />' . "\n"; + echo '<input type="hidden" name="' . $subject . '" value="', htmlspecialchars($object), '" />' . "\n"; + echo "<input type=\"submit\" value=\"{$lang['strcreate']}\" />" . "\n"; + echo "<input type=\"submit\" name=\"cancel\" value=\"{$lang['strcancel']}\" /></p>" . "\n"; + echo '</form>' . "\n"; } /** @@ -526,32 +526,33 @@ class IndexesController extends BaseController $lang = $this->lang; $data = $this->misc->getDatabaseAccessor(); - if (!isset($_REQUEST['subject'])) { - $_REQUEST['subject'] = 'table'; - } - $subject = urlencode($_REQUEST['subject']); - $object = urlencode($_REQUEST[$_REQUEST['subject']]); + $subject = urlencode($this->getRequestParam('subject', 'table')); + $object = urlencode($this->getRequestParam($this->getRequestParam('subject', 'table'))); if ($confirm) { $this->printTrail('index'); $this->printTitle($lang['strdrop'], 'pg.index.drop'); - echo '<p>', sprintf($lang['strconfdropindex'], $this->misc->printVal($_REQUEST['index'])), '</p>'."\n"; - - echo '<form action="'.\SUBFOLDER.'/src/views/indexes.php" method="post">'."\n"; - echo '<input type="hidden" name="action" value="drop_index" />'."\n"; - echo '<input type="hidden" name="table" value="', htmlspecialchars($object), '" />'."\n"; - echo '<input type="hidden" name="index" value="', htmlspecialchars($_REQUEST['index']), '" />'."\n"; + echo '<p>', sprintf($lang['strconfdropindex'], $this->misc->printVal($this->getRequestParam('index'))), '</p>' . "\n"; + echo '<form action="' . \SUBFOLDER . '/src/views/indexes" method="post">' . "\n"; + echo '<input type="hidden" name="action" value="drop_index" />' . "\n"; + echo '<input type="hidden" name="table" value="', htmlspecialchars($object), '" />' . "\n"; + echo '<input type="hidden" name="index" value="', htmlspecialchars($this->getRequestParam('index')), '" />' . "\n"; echo $this->misc->form; - echo "<p><input type=\"checkbox\" id=\"cascade\" name=\"cascade\" /> <label for=\"cascade\">{$lang['strcascade']}</label></p>"."\n"; - echo "<input type=\"submit\" name=\"drop\" value=\"{$lang['strdrop']}\" />"."\n"; - echo "<input type=\"submit\" name=\"cancel\" value=\"{$lang['strcancel']}\" />"."\n"; - echo '</form>'."\n"; + echo '<p><input type="checkbox" id="cascade" name="cascade" value="1" />'; + echo '<label for="cascade">' . $lang['strcascade'] . '</label></p>' . "\n"; + echo "<input type=\"submit\" name=\"drop\" value=\"{$lang['strdrop']}\" />" . "\n"; + echo "<input type=\"submit\" name=\"cancel\" value=\"{$lang['strcancel']}\" />" . "\n"; + echo '</form>' . "\n"; } else { - $status = $data->dropIndex($_POST['index'], isset($_POST['cascade'])); - if (0 == $status) { - $this->doDefault($lang['strindexdropped']); - } else { + try { + list($status, $sql) = $data->dropIndex($this->getPostParam('index'), $this->getPostParam('cascade')); + if (0 == $status) { + $this->doDefault($sql . "\n" . $lang['strindexdropped']); + } else { + $this->doDefault($sql . "\n" . $lang['strindexdroppedbad']); + } + } catch (\PHPPgAdmin\ADOdbException $e) { $this->doDefault($lang['strindexdroppedbad']); } } diff --git a/src/controllers/MaterializedviewpropertiesController.php b/src/controllers/MaterializedviewpropertiesController.php index 3b68c819..d7c9116c 100644 --- a/src/controllers/MaterializedviewpropertiesController.php +++ b/src/controllers/MaterializedviewpropertiesController.php @@ -170,7 +170,7 @@ class MaterializedviewpropertiesController extends BaseController 'browse' => [ 'attr' => [ 'href' => [ - 'url' => 'display.php', + 'url' => 'display', 'urlvars' => [ 'server' => $_REQUEST['server'], 'database' => $_REQUEST['database'], @@ -253,7 +253,7 @@ class MaterializedviewpropertiesController extends BaseController ), 'icon' => 'Column', 'iconAction' => Decorator::url( - 'display.php', + 'display', $reqvars, [ 'view' => $_REQUEST['matview'], diff --git a/src/controllers/MaterializedviewsController.php b/src/controllers/MaterializedviewsController.php index cf00d83e..40eee12f 100644 --- a/src/controllers/MaterializedviewsController.php +++ b/src/controllers/MaterializedviewsController.php @@ -15,7 +15,7 @@ use PHPPgAdmin\Decorators\Decorator; */ class MaterializedviewsController extends BaseController { - public $script = 'materializedviews.php'; + public $script = 'materializedviews'; public $controller_name = 'MaterializedviewsController'; public $table_place = 'matviews-matviews'; @@ -34,7 +34,7 @@ class MaterializedviewsController extends BaseController return $this->doSubTree(); } - $this->printHeader('M '.$lang['strviews']); + $this->printHeader('M ' . $lang['strviews']); $this->printBody(); switch ($action) { @@ -122,12 +122,12 @@ class MaterializedviewsController extends BaseController $columns = [ 'matview' => [ - 'title' => 'M '.$lang['strview'], + 'title' => 'M ' . $lang['strview'], 'field' => Decorator::field('relname'), - 'url' => \SUBFOLDER."/redirect/matview?{$this->misc->href}&", + 'url' => \SUBFOLDER . "/redirect/matview?{$this->misc->href}&", 'vars' => ['matview' => 'relname'], ], - 'owner' => [ + 'owner' => [ 'title' => $lang['strowner'], 'field' => Decorator::field('relowner'), ], @@ -145,11 +145,11 @@ class MaterializedviewsController extends BaseController 'keycols' => ['matview' => 'relname'], 'url' => 'materializedviews.php', ], - 'browse' => [ + 'browse' => [ 'content' => $lang['strbrowse'], 'attr' => [ 'href' => [ - 'url' => 'display.php', + 'url' => 'display', 'urlvars' => [ 'action' => 'confselectrows', 'subject' => 'matview', @@ -159,7 +159,7 @@ class MaterializedviewsController extends BaseController ], ], ], - 'select' => [ + 'select' => [ 'content' => $lang['strselect'], 'attr' => [ 'href' => [ @@ -179,7 +179,7 @@ class MaterializedviewsController extends BaseController // 'vars' => array('view' => 'relname'), // ), - 'alter' => [ + 'alter' => [ 'content' => $lang['stralter'], 'attr' => [ 'href' => [ @@ -191,7 +191,7 @@ class MaterializedviewsController extends BaseController ], ], ], - 'drop' => [ + 'drop' => [ 'multiaction' => 'confirm_drop', 'content' => $lang['strdrop'], 'attr' => [ @@ -209,8 +209,8 @@ class MaterializedviewsController extends BaseController echo $this->printTable($matviews, $columns, $actions, $this->table_place, $lang['strnoviews']); $navlinks = [ - 'create' => [ - 'attr' => [ + 'create' => [ + 'attr' => [ 'href' => [ 'url' => 'materializedviews.php', 'urlvars' => [ @@ -224,7 +224,7 @@ class MaterializedviewsController extends BaseController 'content' => $lang['strcreateview'], ], 'createwiz' => [ - 'attr' => [ + 'attr' => [ 'href' => [ 'url' => 'materializedviews.php', 'urlvars' => [ @@ -256,7 +256,7 @@ class MaterializedviewsController extends BaseController $attrs = [ 'text' => Decorator::field('relname'), 'icon' => 'MView', - 'iconAction' => Decorator::url('display.php', $reqvars, ['matview' => Decorator::field('relname')]), + 'iconAction' => Decorator::url('display', $reqvars, ['matview' => Decorator::field('relname')]), 'toolTip' => Decorator::field('relcomment'), 'action' => Decorator::redirecturl('redirect.php', $reqvars, ['matview' => Decorator::field('relname')]), 'branch' => Decorator::url('materializedviews.php', $reqvars, ['action' => 'subtree', 'matview' => Decorator::field('relname')]), @@ -314,7 +314,7 @@ class MaterializedviewsController extends BaseController $attrs = $data->getTableAttributes($_REQUEST['matview']); - echo '<form action="'.\SUBFOLDER.'/src/views/'.$this->script.'" method="post" id="selectform">'; + echo '<form action="' . \SUBFOLDER . '/src/views/' . $this->script . '" method="post" id="selectform">'; echo "\n"; if ($attrs->recordCount() > 0) { @@ -447,7 +447,7 @@ class MaterializedviewsController extends BaseController $this->printTrail('getTrail'); $this->printTitle($lang['strdrop'], 'pg.matview.drop'); - echo '<form action="'.\SUBFOLDER."/src/views/materializedviews.php\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/materializedviews.php\" method=\"post\">\n"; //If multi drop if (isset($_REQUEST['ma'])) { @@ -559,7 +559,7 @@ class MaterializedviewsController extends BaseController [ 'schemaname' => $arrSelTables[$i]['schemaname'], 'tablename' => $arrSelTables[$i]['tablename'], - 'fieldname' => $attrs->fields['attname'], ] + 'fieldname' => $attrs->fields['attname']] ); $attrs->moveNext(); } @@ -568,7 +568,7 @@ class MaterializedviewsController extends BaseController } asort($arrFields); - echo '<form action="'.\SUBFOLDER."/src/views/materializedviews.php\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/materializedviews.php\" method=\"post\">\n"; echo "<table>\n"; echo "<tr><th class=\"data\">{$lang['strviewname']}</th></tr>"; echo "<tr>\n<td class=\"data1\">\n"; @@ -647,7 +647,7 @@ class MaterializedviewsController extends BaseController echo "<p><input type=\"hidden\" name=\"action\" value=\"save_create_wiz\" />\n"; foreach ($arrSelTables as $curTable) { - echo '<input type="hidden" name="formTables[]" value="'.htmlspecialchars(serialize($curTable))."\" />\n"; + echo '<input type="hidden" name="formTables[]" value="' . htmlspecialchars(serialize($curTable)) . "\" />\n"; } echo $this->misc->form; @@ -673,17 +673,17 @@ class MaterializedviewsController extends BaseController $this->printTitle($lang['strcreateviewwiz'], 'pg.matview.create'); $this->printMsg($msg); - echo '<form action="'.\SUBFOLDER."/src/views/materializedviews.php\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/materializedviews.php\" method=\"post\">\n"; echo "<table>\n"; echo "<tr><th class=\"data\">{$lang['strtables']}</th></tr>"; echo "<tr>\n<td class=\"data1\">\n"; $arrTables = []; while (!$tables->EOF) { - $arrTmp = []; - $arrTmp['schemaname'] = $tables->fields['nspname']; - $arrTmp['tablename'] = $tables->fields['relname']; - $arrTables[$tables->fields['nspname'].'.'.$tables->fields['relname']] = serialize($arrTmp); + $arrTmp = []; + $arrTmp['schemaname'] = $tables->fields['nspname']; + $arrTmp['tablename'] = $tables->fields['relname']; + $arrTables[$tables->fields['nspname'] . '.' . $tables->fields['relname']] = serialize($arrTmp); $tables->moveNext(); } echo \PHPPgAdmin\XHtml\HTMLController::printCombo($arrTables, 'formTables[]', false, '', true); @@ -726,7 +726,7 @@ class MaterializedviewsController extends BaseController $this->printTitle($lang['strcreateview'], 'pg.matview.create'); $this->printMsg($msg); - echo '<form action="'.\SUBFOLDER."/src/views/materializedviews.php\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/materializedviews.php\" method=\"post\">\n"; echo "<table style=\"width: 100%\">\n"; echo "\t<tr>\n\t\t<th class=\"data left required\">{$lang['strname']}</th>\n"; echo "\t<td class=\"data1\"><input name=\"formView\" size=\"32\" maxlength=\"{$data->_maxNameLen}\" value=\"", @@ -845,7 +845,7 @@ class MaterializedviewsController extends BaseController if ((!in_array($curLink, $arrJoined, true) && in_array($tbl1, $arrUsedTbls, true)) || !count($arrJoined)) { // Make sure for multi-column foreign keys that we use a table alias tables joined to more than once // This can (and should be) more optimized for multi-column foreign keys - $adj_tbl2 = in_array($tbl2, $arrUsedTbls, true) ? "${tbl2} AS alias_ppa_".mktime() : $tbl2; + $adj_tbl2 = in_array($tbl2, $arrUsedTbls, true) ? "${tbl2} AS alias_ppa_" . mktime() : $tbl2; $linkFields .= strlen($linkFields) ? "{$curLink['operator']} ${adj_tbl2} ON (\"{$arrLeftLink['schemaname']}\".\"{$arrLeftLink['tablename']}\".\"{$arrLeftLink['fieldname']}\" = \"{$arrRightLink['schemaname']}\".\"{$arrRightLink['tablename']}\".\"{$arrRightLink['fieldname']}\") " : "${tbl1} {$curLink['operator']} ${adj_tbl2} ON (\"{$arrLeftLink['schemaname']}\".\"{$arrLeftLink['tablename']}\".\"{$arrLeftLink['fieldname']}\" = \"{$arrRightLink['schemaname']}\".\"{$arrRightLink['tablename']}\".\"{$arrRightLink['fieldname']}\") "; @@ -891,7 +891,7 @@ class MaterializedviewsController extends BaseController //add where from additional conditions if (strlen($addConditions)) { - $viewQuery .= ' WHERE '.$addConditions; + $viewQuery .= ' WHERE ' . $addConditions; } $status = $data->createView($_POST['formView'], $viewQuery, false, $_POST['formComment']); diff --git a/src/controllers/TablesController.php b/src/controllers/TablesController.php index 8ed62747..e7986ac8 100644 --- a/src/controllers/TablesController.php +++ b/src/controllers/TablesController.php @@ -16,7 +16,7 @@ use PHPPgAdmin\Decorators\Decorator; class TablesController extends BaseController { use AdminTrait; - public $script = 'tables.php'; + public $script = 'tables'; public $controller_name = 'TablesController'; public $table_place = 'tables-tables'; @@ -154,13 +154,13 @@ class TablesController extends BaseController $tables = $data->getTables(); $columns = [ - 'table' => [ + 'table' => [ 'title' => $lang['strtable'], 'field' => Decorator::field('relname'), - 'url' => \SUBFOLDER."/redirect/table?{$this->misc->href}&", + 'url' => \SUBFOLDER . "/redirect/table?{$this->misc->href}&", 'vars' => ['table' => 'relname'], ], - 'owner' => [ + 'owner' => [ 'title' => $lang['strowner'], 'field' => Decorator::field('relowner'), ], @@ -168,15 +168,15 @@ class TablesController extends BaseController 'title' => $lang['strtablespace'], 'field' => Decorator::field('tablespace'), ], - 'tuples' => [ + 'tuples' => [ 'title' => $lang['strestimatedrowcount'], 'field' => Decorator::field('reltuples'), 'type' => 'numeric', ], - 'actions' => [ + 'actions' => [ 'title' => $lang['stractions'], ], - 'comment' => [ + 'comment' => [ 'title' => $lang['strcomment'], 'field' => Decorator::field('relcomment'), ], @@ -188,11 +188,11 @@ class TablesController extends BaseController 'url' => 'tables.php', 'default' => 'analyze', ], - 'browse' => [ + 'browse' => [ 'content' => $lang['strbrowse'], 'attr' => [ 'href' => [ - 'url' => 'display.php', + 'url' => 'display', 'urlvars' => [ 'subject' => 'table', 'return' => 'table', @@ -201,7 +201,7 @@ class TablesController extends BaseController ], ], ], - 'select' => [ + 'select' => [ 'content' => $lang['strselect'], 'attr' => [ 'href' => [ @@ -213,7 +213,7 @@ class TablesController extends BaseController ], ], ], - 'insert' => [ + 'insert' => [ 'content' => $lang['strinsert'], 'attr' => [ 'href' => [ @@ -225,7 +225,7 @@ class TablesController extends BaseController ], ], ], - 'empty' => [ + 'empty' => [ 'multiaction' => 'confirm_empty', 'content' => $lang['strempty'], 'attr' => [ @@ -238,7 +238,7 @@ class TablesController extends BaseController ], ], ], - 'alter' => [ + 'alter' => [ 'content' => $lang['stralter'], 'attr' => [ 'href' => [ @@ -250,7 +250,7 @@ class TablesController extends BaseController ], ], ], - 'drop' => [ + 'drop' => [ 'multiaction' => 'confirm_drop', 'content' => $lang['strdrop'], 'attr' => [ @@ -263,7 +263,7 @@ class TablesController extends BaseController ], ], ], - 'vacuum' => [ + 'vacuum' => [ 'multiaction' => 'confirm_vacuum', 'content' => $lang['strvacuum'], 'attr' => [ @@ -276,7 +276,7 @@ class TablesController extends BaseController ], ], ], - 'analyze' => [ + 'analyze' => [ 'multiaction' => 'confirm_analyze', 'content' => $lang['stranalyze'], 'attr' => [ @@ -289,7 +289,7 @@ class TablesController extends BaseController ], ], ], - 'reindex' => [ + 'reindex' => [ 'multiaction' => 'confirm_reindex', 'content' => $lang['strreindex'], 'attr' => [ @@ -315,7 +315,7 @@ class TablesController extends BaseController $navlinks = [ 'create' => [ - 'attr' => [ + 'attr' => [ 'href' => [ 'url' => 'tables.php', 'urlvars' => [ @@ -332,7 +332,7 @@ class TablesController extends BaseController if (($tables->recordCount() > 0) && $data->hasCreateTableLike()) { $navlinks['createlike'] = [ - 'attr' => [ + 'attr' => [ 'href' => [ 'url' => 'tables.php', 'urlvars' => [ @@ -366,7 +366,7 @@ class TablesController extends BaseController $attrs = [ 'text' => Decorator::field('relname'), 'icon' => 'Table', - 'iconAction' => Decorator::url('display.php', $reqvars, ['table' => Decorator::field('relname')]), + 'iconAction' => Decorator::url('display', $reqvars, ['table' => Decorator::field('relname')]), 'toolTip' => Decorator::field('relcomment'), 'action' => Decorator::redirecturl('redirect.php', $reqvars, ['table' => Decorator::field('relname')]), 'branch' => Decorator::url('tables.php', $reqvars, ['action' => 'subtree', 'table' => Decorator::field('relname')]), @@ -456,7 +456,7 @@ class TablesController extends BaseController $this->printTitle($lang['strcreatetable'], 'pg.table.create'); $this->printMsg($msg); - echo '<form action="'.\SUBFOLDER.'/src/views/'.$this->script.'" method="post">'; + echo '<form action="' . \SUBFOLDER . '/src/views/' . $this->script . '" method="post">'; echo "\n"; echo "<table>\n"; echo "\t<tr>\n\t\t<th class=\"data left required\">{$lang['strname']}</th>\n"; @@ -522,8 +522,8 @@ class TablesController extends BaseController $this->printTitle($lang['strcreatetable'], 'pg.table.create'); $this->printMsg($msg); - echo '<script src="'.\SUBFOLDER.'/js/tables.js" type="text/javascript"></script>'; - echo '<form action="'.\SUBFOLDER."/src/views/tables.php\" method=\"post\">\n"; + echo '<script src="' . \SUBFOLDER . '/js/tables.js" type="text/javascript"></script>'; + echo '<form action="' . \SUBFOLDER . "/src/views/tables.php\" method=\"post\">\n"; // Output table header echo "<table>\n"; @@ -577,7 +577,7 @@ class TablesController extends BaseController foreach ($predefined_size_types as $value) { $escaped_predef_types[] = "'{$value}'"; } - echo '<script type="text/javascript">predefined_lengths = new Array('.implode(',', $escaped_predef_types).");</script>\n\t</td>"; + echo '<script type="text/javascript">predefined_lengths = new Array(' . implode(',', $escaped_predef_types) . ");</script>\n\t</td>"; } // Output array type selector @@ -590,10 +590,10 @@ class TablesController extends BaseController htmlspecialchars($_REQUEST['length'][$i]), "\" /></td>\n"; echo "\t\t<td><input type=\"checkbox\" name=\"notnull[{$i}]\"", (isset($_REQUEST['notnull'][$i])) ? ' checked="checked"' : '', " /></td>\n"; echo "\t\t<td style=\"text-align: center\"><input type=\"checkbox\" name=\"uniquekey[{$i}]\"" - .(isset($_REQUEST['uniquekey'][$i]) ? ' checked="checked"' : '')." /></td>\n"; + . (isset($_REQUEST['uniquekey'][$i]) ? ' checked="checked"' : '') . " /></td>\n"; echo "\t\t<td style=\"text-align: center\"><input type=\"checkbox\" name=\"primarykey[{$i}]\" " - .(isset($_REQUEST['primarykey'][$i]) ? ' checked="checked"' : '') - ." /></td>\n"; + . (isset($_REQUEST['primarykey'][$i]) ? ' checked="checked"' : '') + . " /></td>\n"; echo "\t\t<td><input name=\"default[{$i}]\" size=\"20\" value=\"", htmlspecialchars($_REQUEST['default'][$i]), "\" /></td>\n"; echo "\t\t<td><input name=\"colcomment[{$i}]\" size=\"40\" value=\"", @@ -741,7 +741,7 @@ class TablesController extends BaseController unset($tbltmp); - echo '<form action="'.\SUBFOLDER."/src/views/tables.php\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/tables.php\" method=\"post\">\n"; echo "<table>\n\t<tr>\n\t\t<th class=\"data left required\">{$lang['strname']}</th>\n"; echo "\t\t<td class=\"data\"><input name=\"name\" size=\"32\" maxlength=\"{$data->_maxNameLen}\" value=\"", htmlspecialchars($_REQUEST['name']), "\" /></td>\n\t</tr>\n"; echo "\t<tr>\n\t\t<th class=\"data left required\">{$lang['strcreatetablelikeparent']}</th>\n"; @@ -839,7 +839,7 @@ class TablesController extends BaseController $attrs = $data->getTableAttributes($_REQUEST['table']); - echo '<form action="'.\SUBFOLDER."/src/views/tables.php\" method=\"post\" id=\"selectform\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/tables.php\" method=\"post\" id=\"selectform\">\n"; if ($attrs->recordCount() > 0) { // JavaScript for select all feature echo "<script type=\"text/javascript\">\n"; @@ -983,7 +983,7 @@ class TablesController extends BaseController $fksprops = false; } - echo '<form action="'.\SUBFOLDER."/src/views/tables.php\" method=\"post\" id=\"ac_form\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/tables.php\" method=\"post\" id=\"ac_form\">\n"; if ($attrs->recordCount() > 0) { echo "<table>\n"; @@ -1056,7 +1056,7 @@ class TablesController extends BaseController echo "<input type=\"hidden\" name=\"action\" value=\"insertrow\" />\n"; echo '<input type="hidden" name="fields" value="', htmlentities(serialize($fields), ENT_QUOTES, 'UTF-8'), "\" />\n"; - echo '<input type="hidden" name="protection_counter" value="'.$_SESSION['counter']."\" />\n"; + echo '<input type="hidden" name="protection_counter" value="' . $_SESSION['counter'] . "\" />\n"; echo '<input type="hidden" name="table" value="', htmlspecialchars($_REQUEST['table']), "\" />\n"; echo "<p><input type=\"submit\" name=\"insert\" value=\"{$lang['strinsert']}\" />\n"; echo "<input type=\"submit\" name=\"insertandrepeat\" accesskey=\"r\" value=\"{$lang['strinsertandrepeat']}\" />\n"; @@ -1124,10 +1124,10 @@ class TablesController extends BaseController $this->printTrail('schema'); $this->printTitle($lang['strempty'], 'pg.table.empty'); - echo '<form action="'.\SUBFOLDER."/src/views/tables.php\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/tables.php\" method=\"post\">\n"; foreach ($_REQUEST['ma'] as $v) { $a = unserialize(htmlspecialchars_decode($v, ENT_QUOTES)); - echo '<p>'.sprintf($lang['strconfemptytable'], $this->misc->printVal($a['table'])); + echo '<p>' . sprintf($lang['strconfemptytable'], $this->misc->printVal($a['table'])); echo "</p>\n"; printf('<input type="hidden" name="table[]" value="%s" />', htmlspecialchars($a['table'])); @@ -1139,7 +1139,7 @@ class TablesController extends BaseController echo '<p>', sprintf($lang['strconfemptytable'], $this->misc->printVal($_REQUEST['table'])), "</p>\n"; - echo '<form action="'.\SUBFOLDER."/src/views/tables.php\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/tables.php\" method=\"post\">\n"; echo '<input type="hidden" name="table" value="', htmlspecialchars($_REQUEST['table']), "\" />\n"; } // END not mutli empty @@ -1175,7 +1175,7 @@ class TablesController extends BaseController return $this->doDefault($msg); } - return $this->doDefault($lang['strtableemptiedbad']); + return $this->doDefault($sql . '<br>' . $lang['strtableemptiedbad']); } // END not mutli empty } // END do Empty } @@ -1200,7 +1200,7 @@ class TablesController extends BaseController $this->printTrail('schema'); $this->printTitle($lang['strdrop'], 'pg.table.drop'); - echo '<form action="'.\SUBFOLDER."/src/views/tables.php\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/tables.php\" method=\"post\">\n"; foreach ($_REQUEST['ma'] as $v) { $a = unserialize(htmlspecialchars_decode($v, ENT_QUOTES)); echo '<p>', sprintf($lang['strconfdroptable'], $this->misc->printVal($a['table'])), "</p>\n"; @@ -1212,7 +1212,7 @@ class TablesController extends BaseController echo '<p>', sprintf($lang['strconfdroptable'], $this->misc->printVal($_REQUEST['table'])), "</p>\n"; - echo '<form action="'.\SUBFOLDER."/src/views/tables.php\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/tables.php\" method=\"post\">\n"; echo '<input type="hidden" name="table" value="', htmlspecialchars($_REQUEST['table']), "\" />\n"; } // END if multi drop diff --git a/src/controllers/TblpropertiesController.php b/src/controllers/TblpropertiesController.php index e30fb1e9..326df933 100644 --- a/src/controllers/TblpropertiesController.php +++ b/src/controllers/TblpropertiesController.php @@ -93,7 +93,7 @@ class TblpropertiesController extends BaseController $output = ob_get_clean(); - $this->printHeader($lang['strtables'].' - '.$_REQUEST['table'], null, true, $header_template); + $this->printHeader($lang['strtables'] . ' - ' . $_REQUEST['table'], null, true, $header_template); $this->printBody(); echo $output; @@ -130,29 +130,29 @@ class TblpropertiesController extends BaseController foreach ($p['keys'] as $k => $c) { if (is_null($p['keys'][$k]['consrc'])) { $atts = $data->getAttributeNames($_REQUEST['table'], explode(' ', $p['keys'][$k]['indkey'])); - $c['consrc'] = ('u' == $c['contype'] ? 'UNIQUE (' : 'PRIMARY KEY (').join(',', $atts).')'; + $c['consrc'] = ('u' == $c['contype'] ? 'UNIQUE (' : 'PRIMARY KEY (') . join(',', $atts) . ')'; } if ($c['p_field'] == $s) { switch ($c['contype']) { case 'p': - $str .= '<a href="constraints.php?'.$misc->href.'&table='.urlencode($c['p_table']).'&schema='.urlencode($c['p_schema']).'"><img src="'. - $misc->icon('PrimaryKey').'" alt="[pk]" title="'.htmlentities($c['consrc'], ENT_QUOTES, 'UTF-8').'" /></a>'; + $str .= '<a href="constraints.php?' . $misc->href . '&table=' . urlencode($c['p_table']) . '&schema=' . urlencode($c['p_schema']) . '"><img src="' . + $misc->icon('PrimaryKey') . '" alt="[pk]" title="' . htmlentities($c['consrc'], ENT_QUOTES, 'UTF-8') . '" /></a>'; break; case 'f': - $str .= '<a href="tblproperties.php?'.$misc->href.'&table='.urlencode($c['f_table']).'&schema='.urlencode($c['f_schema']).'"><img src="'. - $misc->icon('ForeignKey').'" alt="[fk]" title="'.htmlentities($c['consrc'], ENT_QUOTES, 'UTF-8').'" /></a>'; + $str .= '<a href="tblproperties.php?' . $misc->href . '&table=' . urlencode($c['f_table']) . '&schema=' . urlencode($c['f_schema']) . '"><img src="' . + $misc->icon('ForeignKey') . '" alt="[fk]" title="' . htmlentities($c['consrc'], ENT_QUOTES, 'UTF-8') . '" /></a>'; break; case 'u': - $str .= '<a href="constraints.php?'.$misc->href.'&table='.urlencode($c['p_table']).'&schema='.urlencode($c['p_schema']).'"><img src="'. - $misc->icon('UniqueConstraint').'" alt="[uniq]" title="'.htmlentities($c['consrc'], ENT_QUOTES, 'UTF-8').'" /></a>'; + $str .= '<a href="constraints.php?' . $misc->href . '&table=' . urlencode($c['p_table']) . '&schema=' . urlencode($c['p_schema']) . '"><img src="' . + $misc->icon('UniqueConstraint') . '" alt="[uniq]" title="' . htmlentities($c['consrc'], ENT_QUOTES, 'UTF-8') . '" /></a>'; break; case 'c': - $str .= '<a href="constraints.php?'.$misc->href.'&table='.urlencode($c['p_table']).'&schema='.urlencode($c['p_schema']).'"><img src="'. - $misc->icon('CheckConstraint').'" alt="[check]" title="'.htmlentities($c['consrc'], ENT_QUOTES, 'UTF-8').'" /></a>'; + $str .= '<a href="constraints.php?' . $misc->href . '&table=' . urlencode($c['p_table']) . '&schema=' . urlencode($c['p_schema']) . '"><img src="' . + $misc->icon('CheckConstraint') . '" alt="[check]" title="' . htmlentities($c['consrc'], ENT_QUOTES, 'UTF-8') . '" /></a>'; } } } @@ -177,13 +177,13 @@ class TblpropertiesController extends BaseController } $columns = [ - 'column' => [ + 'column' => [ 'title' => $lang['strcolumn'], 'field' => Decorator::field('attname'), - 'url' => "colproperties.php?subject=column&{$misc->href}&table=".urlencode($_REQUEST['table']).'&', + 'url' => "colproperties.php?subject=column&{$misc->href}&table=" . urlencode($_REQUEST['table']) . '&', 'vars' => ['column' => 'attname'], ], - 'type' => [ + 'type' => [ 'title' => $lang['strtype'], 'field' => Decorator::field('+type'), ], @@ -217,34 +217,34 @@ class TblpropertiesController extends BaseController ]; $actions = [ - 'browse' => [ + 'browse' => [ 'title' => $lang['strbrowse'], - 'url' => "display.php?{$misc->href}&subject=column&return=table&table=".urlencode($_REQUEST['table']).'&', + 'url' => "display?{$misc->href}&subject=column&return=table&table=" . urlencode($_REQUEST['table']) . '&', 'vars' => ['column' => 'attname'], ], - 'alter' => [ + 'alter' => [ 'title' => $lang['stralter'], - 'url' => "colproperties.php?action=properties&{$misc->href}&table=".urlencode($_REQUEST['table']).'&', + 'url' => "colproperties.php?action=properties&{$misc->href}&table=" . urlencode($_REQUEST['table']) . '&', 'vars' => ['column' => 'attname'], ], 'privileges' => [ 'title' => $lang['strprivileges'], - 'url' => "privileges.php?subject=column&{$misc->href}&table=".urlencode($_REQUEST['table']).'&', + 'url' => "privileges.php?subject=column&{$misc->href}&table=" . urlencode($_REQUEST['table']) . '&', 'vars' => ['column' => 'attname'], ], - 'drop' => [ + 'drop' => [ 'title' => $lang['strdrop'], - 'url' => "tblproperties.php?action=confirm_drop&{$misc->href}&table=".urlencode($_REQUEST['table']).'&', + 'url' => "tblproperties.php?action=confirm_drop&{$misc->href}&table=" . urlencode($_REQUEST['table']) . '&', 'vars' => ['column' => 'attname'], ], ]; $actions = [ - 'browse' => [ + 'browse' => [ 'content' => $lang['strbrowse'], 'attr' => [ 'href' => [ - 'url' => 'display.php', + 'url' => 'display', 'urlvars' => [ 'table' => $_REQUEST['table'], 'subject' => 'column', @@ -254,7 +254,7 @@ class TblpropertiesController extends BaseController ], ], ], - 'alter' => [ + 'alter' => [ 'content' => $lang['stralter'], 'attr' => [ 'href' => [ @@ -281,7 +281,7 @@ class TblpropertiesController extends BaseController ], ], ], - 'drop' => [ + 'drop' => [ 'content' => $lang['strdrop'], 'attr' => [ 'href' => [ @@ -300,10 +300,10 @@ class TblpropertiesController extends BaseController echo $this->printTable($attrs, $columns, $actions, 'tblproperties-tblproperties', null, $attPre); $navlinks = [ - 'browse' => [ - 'attr' => [ + 'browse' => [ + 'attr' => [ 'href' => [ - 'url' => 'display.php', + 'url' => 'display', 'urlvars' => [ 'server' => $_REQUEST['server'], 'database' => $_REQUEST['database'], @@ -316,8 +316,8 @@ class TblpropertiesController extends BaseController ], 'content' => $lang['strbrowse'], ], - 'select' => [ - 'attr' => [ + 'select' => [ + 'attr' => [ 'href' => [ 'url' => 'tables.php', 'urlvars' => [ @@ -331,8 +331,8 @@ class TblpropertiesController extends BaseController ], 'content' => $lang['strselect'], ], - 'insert' => [ - 'attr' => [ + 'insert' => [ + 'attr' => [ 'href' => [ 'url' => 'tables.php', 'urlvars' => [ @@ -346,8 +346,8 @@ class TblpropertiesController extends BaseController ], 'content' => $lang['strinsert'], ], - 'empty' => [ - 'attr' => [ + 'empty' => [ + 'attr' => [ 'href' => [ 'url' => 'tables.php', 'urlvars' => [ @@ -361,8 +361,8 @@ class TblpropertiesController extends BaseController ], 'content' => $lang['strempty'], ], - 'drop' => [ - 'attr' => [ + 'drop' => [ + 'attr' => [ 'href' => [ 'url' => 'tables.php', 'urlvars' => [ @@ -377,7 +377,7 @@ class TblpropertiesController extends BaseController 'content' => $lang['strdrop'], ], 'addcolumn' => [ - 'attr' => [ + 'attr' => [ 'href' => [ 'url' => 'tblproperties.php', 'urlvars' => [ @@ -391,8 +391,8 @@ class TblpropertiesController extends BaseController ], 'content' => $lang['straddcolumn'], ], - 'alter' => [ - 'attr' => [ + 'alter' => [ + 'attr' => [ 'href' => [ 'url' => 'tblproperties.php', 'urlvars' => [ @@ -420,8 +420,8 @@ class TblpropertiesController extends BaseController $reqvars = $misc->getRequestVars('column'); $attrs = [ - 'text' => Decorator::field('attname'), - 'action' => Decorator::actionurl( + 'text' => Decorator::field('attname'), + 'action' => Decorator::actionurl( 'colproperties.php', $reqvars, [ @@ -431,7 +431,7 @@ class TblpropertiesController extends BaseController ), 'icon' => 'Column', 'iconAction' => Decorator::url( - 'display.php', + 'display', $reqvars, [ 'table' => $_REQUEST['table'], @@ -445,7 +445,7 @@ class TblpropertiesController extends BaseController ), ] ), - 'toolTip' => Decorator::field('comment'), + 'toolTip' => Decorator::field('comment'), ]; return $this->printTree($columns, $attrs, 'tblcolumns'); @@ -538,7 +538,7 @@ class TblpropertiesController extends BaseController $_POST['tablespace'] = $table->fields['tablespace']; } - echo '<form action="'.\SUBFOLDER."/src/views/tblproperties.php\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/tblproperties.php\" method=\"post\">\n"; echo "<table>\n"; echo "<tr><th class=\"data left required\">{$lang['strname']}</th>\n"; echo '<td class="data1">'; @@ -616,7 +616,7 @@ class TblpropertiesController extends BaseController $this->printTabs('table', 'export'); $this->printMsg($msg); - echo '<form action="'.\SUBFOLDER."/src/views/dataexport.php\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/dataexport.php\" method=\"post\">\n"; echo "<table>\n"; echo "<tr><th class=\"data\">{$lang['strformat']}</th><th class=\"data\" colspan=\"2\">{$lang['stroptions']}</th></tr>\n"; // Data only @@ -678,7 +678,7 @@ class TblpropertiesController extends BaseController // Don't show upload option if max size of uploads is zero $max_size = $misc->inisizeToBytes(ini_get('upload_max_filesize')); if (is_double($max_size) && $max_size > 0) { - echo '<form action="'.\SUBFOLDER."/src/views/dataimport.php\" method=\"post\" enctype=\"multipart/form-data\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/dataimport.php\" method=\"post\" enctype=\"multipart/form-data\">\n"; echo "<table>\n"; echo "\t<tr>\n\t\t<th class=\"data left required\">{$lang['strformat']}</th>\n"; echo "\t\t<td><select name=\"format\">\n"; @@ -758,8 +758,8 @@ class TblpropertiesController extends BaseController $this->printTitle($lang['straddcolumn'], 'pg.column.add'); $this->printMsg($msg); - echo '<script src="'.\SUBFOLDER.'/js/tables.js" type="text/javascript"></script>'; - echo '<form action="'.\SUBFOLDER."/src/views/tblproperties.php\" method=\"post\">\n"; + echo '<script src="' . \SUBFOLDER . '/js/tables.js" type="text/javascript"></script>'; + echo '<form action="' . \SUBFOLDER . "/src/views/tblproperties.php\" method=\"post\">\n"; // Output table header echo "<table>\n"; @@ -825,7 +825,7 @@ class TblpropertiesController extends BaseController echo "<input type=\"submit\" value=\"{$lang['stradd']}\" />\n"; echo "<input type=\"submit\" name=\"cancel\" value=\"{$lang['strcancel']}\" /></p>\n"; echo "</form>\n"; - echo '<script type="text/javascript">predefined_lengths = new Array('.implode(',', $escaped_predef_types).");checkLengths(document.getElementById('type').value,'');</script>\n"; + echo '<script type="text/javascript">predefined_lengths = new Array(' . implode(',', $escaped_predef_types) . ");checkLengths(document.getElementById('type').value,'');</script>\n"; break; case 2: @@ -887,7 +887,7 @@ class TblpropertiesController extends BaseController $misc->printVal($_REQUEST['table']) ), "</p>\n"; - echo '<form action="'.\SUBFOLDER."/src/views/tblproperties.php\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/tblproperties.php\" method=\"post\">\n"; echo "<input type=\"hidden\" name=\"action\" value=\"drop\" />\n"; echo '<input type="hidden" name="table" value="', htmlspecialchars($_REQUEST['table']), "\" />\n"; echo '<input type="hidden" name="column" value="', htmlspecialchars($_REQUEST['column']), "\" />\n"; diff --git a/src/controllers/ViewpropertiesController.php b/src/controllers/ViewpropertiesController.php index 73b01e9f..5034434f 100644 --- a/src/controllers/ViewpropertiesController.php +++ b/src/controllers/ViewpropertiesController.php @@ -170,7 +170,7 @@ class ViewpropertiesController extends BaseController 'browse' => [ 'attr' => [ 'href' => [ - 'url' => 'display.php', + 'url' => 'display', 'urlvars' => [ 'server' => $_REQUEST['server'], 'database' => $_REQUEST['database'], @@ -253,7 +253,7 @@ class ViewpropertiesController extends BaseController ), 'icon' => 'Column', 'iconAction' => Decorator::url( - 'display.php', + 'display', $reqvars, [ 'view' => $_REQUEST['view'], diff --git a/src/controllers/ViewsController.php b/src/controllers/ViewsController.php index 7f6513c4..48b0ae3c 100644 --- a/src/controllers/ViewsController.php +++ b/src/controllers/ViewsController.php @@ -15,7 +15,7 @@ use PHPPgAdmin\Decorators\Decorator; */ class ViewsController extends BaseController { - public $script = 'views.php'; + public $script = 'views'; public $controller_name = 'ViewsController'; public $table_place = 'views-views'; @@ -120,13 +120,13 @@ class ViewsController extends BaseController $views = $data->getViews(); $columns = [ - 'view' => [ + 'view' => [ 'title' => $lang['strview'], 'field' => Decorator::field('relname'), - 'url' => \SUBFOLDER."/redirect/view?{$this->misc->href}&", + 'url' => \SUBFOLDER . "/redirect/view?{$this->misc->href}&", 'vars' => ['view' => 'relname'], ], - 'owner' => [ + 'owner' => [ 'title' => $lang['strowner'], 'field' => Decorator::field('relowner'), ], @@ -144,11 +144,11 @@ class ViewsController extends BaseController 'keycols' => ['view' => 'relname'], 'url' => 'views.php', ], - 'browse' => [ + 'browse' => [ 'content' => $lang['strbrowse'], 'attr' => [ 'href' => [ - 'url' => 'display.php', + 'url' => 'display', 'urlvars' => [ 'action' => 'confselectrows', 'subject' => 'view', @@ -158,7 +158,7 @@ class ViewsController extends BaseController ], ], ], - 'select' => [ + 'select' => [ 'content' => $lang['strselect'], 'attr' => [ 'href' => [ @@ -178,7 +178,7 @@ class ViewsController extends BaseController // 'vars' => array('view' => 'relname'), // ), - 'alter' => [ + 'alter' => [ 'content' => $lang['stralter'], 'attr' => [ 'href' => [ @@ -190,7 +190,7 @@ class ViewsController extends BaseController ], ], ], - 'drop' => [ + 'drop' => [ 'multiaction' => 'confirm_drop', 'content' => $lang['strdrop'], 'attr' => [ @@ -208,8 +208,8 @@ class ViewsController extends BaseController echo $this->printTable($views, $columns, $actions, $this->table_place, $lang['strnoviews']); $navlinks = [ - 'create' => [ - 'attr' => [ + 'create' => [ + 'attr' => [ 'href' => [ 'url' => 'views.php', 'urlvars' => [ @@ -223,7 +223,7 @@ class ViewsController extends BaseController 'content' => $lang['strcreateview'], ], 'createwiz' => [ - 'attr' => [ + 'attr' => [ 'href' => [ 'url' => 'views.php', 'urlvars' => [ @@ -255,7 +255,7 @@ class ViewsController extends BaseController $attrs = [ 'text' => Decorator::field('relname'), 'icon' => 'View', - 'iconAction' => Decorator::url('display.php', $reqvars, ['view' => Decorator::field('relname')]), + 'iconAction' => Decorator::url('display', $reqvars, ['view' => Decorator::field('relname')]), 'toolTip' => Decorator::field('relcomment'), 'action' => Decorator::redirecturl('redirect.php', $reqvars, ['view' => Decorator::field('relname')]), 'branch' => Decorator::url('views.php', $reqvars, ['action' => 'subtree', 'view' => Decorator::field('relname')]), @@ -313,7 +313,7 @@ class ViewsController extends BaseController $attrs = $data->getTableAttributes($_REQUEST['view']); - echo '<form action="'.\SUBFOLDER.'/src/views/'.$this->script.'" method="post" id="selectform">'; + echo '<form action="' . \SUBFOLDER . '/src/views/' . $this->script . '" method="post" id="selectform">'; echo "\n"; if ($attrs->recordCount() > 0) { @@ -446,7 +446,7 @@ class ViewsController extends BaseController $this->printTrail('view'); $this->printTitle($lang['strdrop'], 'pg.view.drop'); - echo '<form action="'.\SUBFOLDER."/src/views/views.php\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/views.php\" method=\"post\">\n"; //If multi drop if (isset($_REQUEST['ma'])) { @@ -558,7 +558,7 @@ class ViewsController extends BaseController [ 'schemaname' => $arrSelTables[$i]['schemaname'], 'tablename' => $arrSelTables[$i]['tablename'], - 'fieldname' => $attrs->fields['attname'], ] + 'fieldname' => $attrs->fields['attname']] ); $attrs->moveNext(); } @@ -567,7 +567,7 @@ class ViewsController extends BaseController } asort($arrFields); - echo '<form action="'.\SUBFOLDER."/src/views/views.php\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/views.php\" method=\"post\">\n"; echo "<table>\n"; echo "<tr><th class=\"data\">{$lang['strviewname']}</th></tr>"; echo "<tr>\n<td class=\"data1\">\n"; @@ -646,7 +646,7 @@ class ViewsController extends BaseController echo "<p><input type=\"hidden\" name=\"action\" value=\"save_create_wiz\" />\n"; foreach ($arrSelTables as $curTable) { - echo '<input type="hidden" name="formTables[]" value="'.htmlspecialchars(serialize($curTable))."\" />\n"; + echo '<input type="hidden" name="formTables[]" value="' . htmlspecialchars(serialize($curTable)) . "\" />\n"; } echo $this->misc->form; @@ -672,17 +672,17 @@ class ViewsController extends BaseController $this->printTitle($lang['strcreateviewwiz'], 'pg.view.create'); $this->printMsg($msg); - echo '<form action="'.\SUBFOLDER."/src/views/views.php\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/views.php\" method=\"post\">\n"; echo "<table>\n"; echo "<tr><th class=\"data\">{$lang['strtables']}</th></tr>"; echo "<tr>\n<td class=\"data1\">\n"; $arrTables = []; while (!$tables->EOF) { - $arrTmp = []; - $arrTmp['schemaname'] = $tables->fields['nspname']; - $arrTmp['tablename'] = $tables->fields['relname']; - $arrTables[$tables->fields['nspname'].'.'.$tables->fields['relname']] = serialize($arrTmp); + $arrTmp = []; + $arrTmp['schemaname'] = $tables->fields['nspname']; + $arrTmp['tablename'] = $tables->fields['relname']; + $arrTables[$tables->fields['nspname'] . '.' . $tables->fields['relname']] = serialize($arrTmp); $tables->moveNext(); } echo \PHPPgAdmin\XHtml\HTMLController::printCombo($arrTables, 'formTables[]', false, '', true); @@ -725,7 +725,7 @@ class ViewsController extends BaseController $this->printTitle($lang['strcreateview'], 'pg.view.create'); $this->printMsg($msg); - echo '<form action="'.\SUBFOLDER."/src/views/views.php\" method=\"post\">\n"; + echo '<form action="' . \SUBFOLDER . "/src/views/views.php\" method=\"post\">\n"; echo "<table style=\"width: 100%\">\n"; echo "\t<tr>\n\t\t<th class=\"data left required\">{$lang['strname']}</th>\n"; echo "\t<td class=\"data1\"><input name=\"formView\" size=\"32\" maxlength=\"{$data->_maxNameLen}\" value=\"", @@ -844,7 +844,7 @@ class ViewsController extends BaseController if ((!in_array($curLink, $arrJoined, true) && in_array($tbl1, $arrUsedTbls, true)) || !count($arrJoined)) { // Make sure for multi-column foreign keys that we use a table alias tables joined to more than once // This can (and should be) more optimized for multi-column foreign keys - $adj_tbl2 = in_array($tbl2, $arrUsedTbls, true) ? "${tbl2} AS alias_ppa_".mktime() : $tbl2; + $adj_tbl2 = in_array($tbl2, $arrUsedTbls, true) ? "${tbl2} AS alias_ppa_" . mktime() : $tbl2; $linkFields .= strlen($linkFields) ? "{$curLink['operator']} ${adj_tbl2} ON (\"{$arrLeftLink['schemaname']}\".\"{$arrLeftLink['tablename']}\".\"{$arrLeftLink['fieldname']}\" = \"{$arrRightLink['schemaname']}\".\"{$arrRightLink['tablename']}\".\"{$arrRightLink['fieldname']}\") " : "${tbl1} {$curLink['operator']} ${adj_tbl2} ON (\"{$arrLeftLink['schemaname']}\".\"{$arrLeftLink['tablename']}\".\"{$arrLeftLink['fieldname']}\" = \"{$arrRightLink['schemaname']}\".\"{$arrRightLink['tablename']}\".\"{$arrRightLink['fieldname']}\") "; @@ -890,7 +890,7 @@ class ViewsController extends BaseController //add where from additional conditions if (strlen($addConditions)) { - $viewQuery .= ' WHERE '.$addConditions; + $viewQuery .= ' WHERE ' . $addConditions; } $status = $data->createView($_POST['formView'], $viewQuery, false, $_POST['formComment']); diff --git a/src/database/Postgres.php b/src/database/Postgres.php index fa421f14..a602e924 100644 --- a/src/database/Postgres.php +++ b/src/database/Postgres.php @@ -526,7 +526,7 @@ class Postgres extends ADOdbBase * * @param string $database the name of the database to get the comment for * - * @return \ADORecordSet recordset of the db comment info + * @return PHPPgAdmin\ADORecordSet recordset of the db comment info */ public function getDatabaseComment($database) { @@ -542,7 +542,7 @@ class Postgres extends ADOdbBase * * @param string $database the name of the database to get the owner for * - * @return \ADORecordSet recordset of the db owner info + * @return PHPPgAdmin\ADORecordSet recordset of the db owner info */ public function getDatabaseOwner($database) { @@ -853,7 +853,7 @@ class Postgres extends ADOdbBase * * @param $database (optional) Find only prepared transactions executed in a specific database * - * @return \ADORecordSet A recordset + * @return PHPPgAdmin\ADORecordSet A recordset */ public function getPreparedXacts($database = null) { @@ -874,7 +874,7 @@ class Postgres extends ADOdbBase * @param $term The search term * @param $filter The object type to restrict to ('' means no restriction) * - * @return \ADORecordSet A recordset + * @return PHPPgAdmin\ADORecordSet A recordset */ public function findObject($term, $filter) { @@ -1022,7 +1022,7 @@ class Postgres extends ADOdbBase /** * Returns all available variable information. * - * @return \ADORecordSet A recordset + * @return PHPPgAdmin\ADORecordSet A recordset */ public function getVariables() { @@ -1301,7 +1301,7 @@ class Postgres extends ADOdbBase * * @param bool|true $all True to fetch all tables, false for just in current schema * - * @return \ADORecordSet All tables, sorted alphabetically + * @return PHPPgAdmin\ADORecordSet All tables, sorted alphabetically */ public function getTables($all = false) { @@ -1333,7 +1333,7 @@ class Postgres extends ADOdbBase * * @param $table The table to find the parents for * - * @return \ADORecordSet A recordset + * @return PHPPgAdmin\ADORecordSet A recordset */ public function getTableParents($table) { @@ -1363,7 +1363,7 @@ class Postgres extends ADOdbBase * * @param $table The table to find the children for * - * @return \ADORecordSet A recordset + * @return PHPPgAdmin\ADORecordSet A recordset */ public function getTableChildren($table) { @@ -1734,7 +1734,7 @@ class Postgres extends ADOdbBase * * @param $table The name of the table * - * @return \ADORecordSet A recordset + * @return PHPPgAdmin\ADORecordSet A recordset */ public function getTable($table) { @@ -1836,7 +1836,7 @@ class Postgres extends ADOdbBase * * @param $table The table to find rules for * - * @return \ADORecordSet A recordset + * @return PHPPgAdmin\ADORecordSet A recordset */ public function getConstraints($table) { @@ -2346,7 +2346,7 @@ class Postgres extends ADOdbBase * @param string $table The name of a table whose indexes to retrieve * @param bool|\PHPPgAdmin\Database\Only $unique Only get unique/pk indexes * - * @return \ADORecordSet A recordset + * @return PHPPgAdmin\ADORecordSet A recordset */ public function getIndexes($table = '', $unique = false) { @@ -2373,7 +2373,7 @@ class Postgres extends ADOdbBase * * @param string $table The name of a table whose triggers to retrieve * - * @return \ADORecordSet A recordset + * @return PHPPgAdmin\ADORecordSet A recordset */ public function getTriggers($table = '') { @@ -2404,7 +2404,7 @@ class Postgres extends ADOdbBase * * @param $table The table to find rules for * - * @return \ADORecordSet A recordset + * @return PHPPgAdmin\ADORecordSet A recordset */ public function getRules($table) { @@ -3323,7 +3323,7 @@ class Postgres extends ADOdbBase * @param $relation The name of a relation * @param $oids * - * @return \ADORecordSet A recordset on success + * @return PHPPgAdmin\ADORecordSet A recordset on success */ public function dumpRelation($relation, $oids) { @@ -3344,7 +3344,7 @@ class Postgres extends ADOdbBase * * @param \PHPPgAdmin\Database\if|string $table if given, return autovacuum info for the given table or return all informations for all table * - * @return \ADORecordSet A recordset + * @return PHPPgAdmin\ADORecordSet A recordset */ public function getTableAutovacuum($table = '') { @@ -3692,7 +3692,7 @@ class Postgres extends ADOdbBase * * @param bool $all * - * @return \ADORecordSet A recordset + * @return PHPPgAdmin\ADORecordSet A recordset */ public function getSequences($all = false) { @@ -3812,7 +3812,7 @@ class Postgres extends ADOdbBase * * @param $sequence Sequence name * - * @return \ADORecordSet A recordset + * @return PHPPgAdmin\ADORecordSet A recordset */ public function getSequence($sequence) { @@ -4632,7 +4632,8 @@ class Postgres extends ADOdbBase $sql .= ' CASCADE'; } - return $this->execute($sql); + $status = $this->execute($sql); + return [$status, $sql]; } /** @@ -4712,7 +4713,7 @@ class Postgres extends ADOdbBase * * @param $table the table where we are looking for fk * - * @return \ADORecordSet A recordset + * @return PHPPgAdmin\ADORecordSet A recordset */ public function getConstraintsWithFields($table) { @@ -4938,17 +4939,17 @@ class Postgres extends ADOdbBase /** * Adds a foreign key constraint to a table. * - * @param $table - * @param $targschema The schema that houses the target table to which to add the foreign key - * @param $targtable The table to which to add the foreign key - * @param $sfields (array) An array of source fields over which to add the foreign key - * @param $tfields (array) An array of target fields over which to add the foreign key - * @param $upd_action The action for updates (eg. RESTRICT) - * @param $del_action The action for deletes (eg. RESTRICT) - * @param $match The match type (eg. MATCH FULL) - * @param $deferrable The deferrability (eg. NOT DEFERRABLE) - * @param $initially - * @param string $name (optional) The name to give the key, otherwise default name is assigned + * @param string $table The table on which to add an FK + * @param string $targschema The schema that houses the target table to which to add the foreign key + * @param string $targtable The table to which to add the foreign key + * @param array $sfields (array) An array of source fields over which to add the foreign key + * @param array $tfields (array) An array of target fields over which to add the foreign key + * @param string $upd_action The action for updates (eg. RESTRICT) + * @param string $del_action The action for deletes (eg. RESTRICT) + * @param string $match The match type (eg. MATCH FULL) + * @param string $deferrable The deferrability (eg. NOT DEFERRABLE) + * @param string $initially The initially parameter for the FK (eg. INITIALLY IMMEDIATE) + * @param string $name [optional] The name to give the key, otherwise default name is assigned * * @return integer 0 if operation was successful * @@ -5016,10 +5017,10 @@ class Postgres extends ADOdbBase /** * Removes a constraint from a relation. * - * @param $constraint The constraint to drop - * @param $relation The relation from which to drop - * @param $type The type of constraint (c, f, u or p) - * @param $cascade True to cascade drop, false to restrict + * @param string $constraint The constraint to drop + * @param string $relation The relation from which to drop + * @param string $type The type of constraint (c, f, u or p) + * @param bool $cascade True to cascade drop, false to restrict * * @return integer 0 if operation was successful */ @@ -5041,10 +5042,9 @@ class Postgres extends ADOdbBase /** * A function for getting all columns linked by foreign keys given a group of tables. * - * @param $tables multi dimensional assoc array that holds schema and table name + * @param array $tables multi dimensional assoc array that holds schema and table name * - * @return A recordset of linked tables and columns - * @return -1 $tables isn't an array + * @return PHPPgAdmin\ADORecordSet|integer recordset of linked tables and columns or -1 if $tables isn't an array */ public function getLinkingKeys($tables) { @@ -5132,9 +5132,9 @@ class Postgres extends ADOdbBase /** * Finds the foreign keys that refer to the specified table. * - * @param $table The table to find referrers for + * @param string $table The table to find referrers for * - * @return \ADORecordSet A recordset + * @return PHPPgAdmin\ADORecordSet A recordset */ public function getReferrers($table) { @@ -5176,9 +5176,9 @@ class Postgres extends ADOdbBase /** * Gets all information for a single domain. * - * @param $domain The name of the domain to fetch + * @param string $domain The name of the domain to fetch * - * @return \ADORecordSet A recordset + * @return PHPPgAdmin\ADORecordSet A recordset */ public function getDomain($domain) { @@ -5208,7 +5208,7 @@ class Postgres extends ADOdbBase /** * Return all domains in current schema. Excludes domain constraints. * - * @return All tables, sorted alphabetically + * @return PHPPgAdmin\ADORecordSet All tables, sorted alphabetically */ public function getDomains() { @@ -5239,7 +5239,7 @@ class Postgres extends ADOdbBase * * @param $domain The name of the domain whose constraints to fetch * - * @return \ADORecordSet A recordset + * @return PHPPgAdmin\ADORecordSet A recordset */ public function getDomainConstraints($domain) { @@ -5270,13 +5270,13 @@ class Postgres extends ADOdbBase /** * Creates a domain. * - * @param $domain The name of the domain to create - * @param $type The base type for the domain - * @param $length Optional type length - * @param $array True for array type, false otherwise - * @param $notnull True for NOT NULL, false otherwise - * @param $default Default value for domain - * @param $check A CHECK constraint if there is one + * @param string $domain The name of the domain to create + * @param string $type The base type for the domain + * @param string $length Optional type length + * @param bool $array True for array type, false otherwise + * @param bool $notnull True for NOT NULL, false otherwise + * @param string $default Default value for domain + * @param string $check A CHECK constraint if there is one * * @return integer 0 if operation was successful */ @@ -5331,6 +5331,11 @@ class Postgres extends ADOdbBase return $this->execute($sql); } + /** + * Determines if it has domain constraints. + * + * @return boolean True if has domain constraints, False otherwise. + */ public function hasDomainConstraints() { return true; @@ -5339,10 +5344,10 @@ class Postgres extends ADOdbBase /** * Alters a domain. * - * @param $domain The domain to alter - * @param $domdefault The domain default - * @param $domnotnull True for NOT NULL, false otherwise - * @param $domowner The domain owner + * @param string $domain The domain to alter + * @param string $domdefault The domain default + * @param bool $domnotnull True for NOT NULL, false otherwise + * @param string $domowner The domain owner * * @return bool|int 0 success */ @@ -5404,8 +5409,8 @@ class Postgres extends ADOdbBase /** * Drops a domain. * - * @param $domain The name of the domain to drop - * @param $cascade True to cascade drop, false to restrict + * @param string $domain The name of the domain to drop + * @param string $cascade True to cascade drop, false to restrict * * @return integer 0 if operation was successful */ @@ -5426,8 +5431,8 @@ class Postgres extends ADOdbBase /** * Adds a check constraint to a domain. * - * @param $domain The domain to which to add the check - * @param $definition The definition of the check + * @param string $domain The domain to which to add the check + * @param string $definition The definition of the check * @param string $name (optional) The name to give the check, otherwise default name is assigned * * @return integer 0 if operation was successful @@ -5452,9 +5457,9 @@ class Postgres extends ADOdbBase /** * Drops a domain constraint. * - * @param $domain The domain from which to remove the constraint - * @param $constraint The constraint to remove - * @param $cascade True to cascade, false otherwise + * @param string $domain The domain from which to remove the constraint + * @param string $constraint The constraint to remove + * @param bool $cascade True to cascade, false otherwise * * @return integer 0 if operation was successful */ @@ -5478,9 +5483,9 @@ class Postgres extends ADOdbBase /** * Returns an array containing a function's properties. * - * @param $f The array of data for the function + * @param array $f The array of data for the function * - * @return An array containing the properties + * @return array An array containing the properties */ public function getFunctionProperties($f) { @@ -5519,22 +5524,22 @@ class Postgres extends ADOdbBase /** * Updates (replaces) a function. * - * @param $function_oid The OID of the function - * @param $funcname The name of the function to create - * @param $newname The new name for the function - * @param $args The array of argument types - * @param $returns The return type - * @param $definition The definition for the new function - * @param $language The language the function is written for - * @param $flags An array of optional flags - * @param $setof True if returns a set, false otherwise - * @param $funcown - * @param $newown - * @param $funcschema - * @param $newschema - * @param $cost - * @param $rows - * @param $comment The comment on the function + * @param int $function_oid The OID of the function + * @param string $funcname The name of the function to create + * @param string $newname The new name for the function + * @param array $args The array of argument types + * @param string $returns The return type + * @param string $definition The definition for the new function + * @param string $language The language the function is written for + * @param array $flags An array of optional flags + * @param bool $setof True if returns a set, false otherwise + * @param string $funcown + * @param string $newown + * @param string $funcschema + * @param string $newschema + * @param float $cost + * @param integer $rows + * @param string $comment The comment on the function * * @return bool|int 0 success */ @@ -5625,19 +5630,20 @@ class Postgres extends ADOdbBase /** * Creates a new function. * - * @param $funcname The name of the function to create - * @param $args A comma separated string of types - * @param $returns The return type - * @param $definition The definition for the new function - * @param $language The language the function is written for - * @param $flags An array of optional flags - * @param $setof True if it returns a set, false otherwise - * @param $cost cost the planner should use in the function execution step - * @param $rows number of rows planner should estimate will be returned - * @param $comment Comment for the function - * @param bool $replace (optional) True if OR REPLACE, false for normal - * - * @return bool|int 0 success + * @param string $funcname The name of the function to create + * @param string $args A comma separated string of types + * @param string $returns The return type + * @param string $definition The definition for the new function + * @param string $language The language the function is written for + * @param array $flags An array of optional flags + * @param bool $setof True if it returns a set, false otherwise + * @param string $cost cost the planner should use in the function execution step + * @param integer $rows number of rows planner should estimate will be returned + * @param string $comment Comment for the function + * @param bool $replace (optional) True if OR REPLACE, false for + * normal + * + * @return bool|int 0 success */ public function createFunction($funcname, $args, $returns, $definition, $language, $flags, $setof, $cost, $rows, $comment, $replace = false) { @@ -5727,13 +5733,21 @@ class Postgres extends ADOdbBase return $this->endTransaction(); } + /** + * Determines if it has function alter owner. + * + * @return boolean True if has function alter owner, False otherwise. + */ public function hasFunctionAlterOwner() { return true; } - // Trigger functions - + /** + * Determines if it has function alter schema. + * + * @return boolean True if has function alter schema, False otherwise. + */ public function hasFunctionAlterSchema() { return true; @@ -5742,8 +5756,8 @@ class Postgres extends ADOdbBase /** * Drops a function. * - * @param $function_oid The OID of the function to drop - * @param $cascade True to cascade drop, false to restrict + * @param int $function_oid The OID of the function to drop + * @param bool $cascade True to cascade drop, false to restrict * * @return integer 0 if operation was successful */ @@ -5766,9 +5780,9 @@ class Postgres extends ADOdbBase /** * Returns all details for a particular function. * - * @param $function_oid + * @param int $function_oid * - * @return \ADORecordSet Function info + * @return PHPPgAdmin\ADORecordSet Function info * * @internal param string The $func name of the function to retrieve */ @@ -5805,9 +5819,9 @@ class Postgres extends ADOdbBase /** * Returns all details for a particular type. * - * @param $typname The name of the view to retrieve + * @param string $typname The name of the view to retrieve * - * @return Type info + * @return PHPPgAdmin\ADORecordSet info */ public function getType($typname) { @@ -5826,7 +5840,7 @@ class Postgres extends ADOdbBase * @param bool $tabletypes If true, will include table types * @param bool $domains If true, will include domains * - * @return \ADORecordSet A recordset + * @return PHPPgAdmin\ADORecordSet A recordset */ public function getTypes($all = false, $tabletypes = false, $domains = false) { @@ -5872,16 +5886,16 @@ class Postgres extends ADOdbBase /** * Creates a new type. * - * @param $typname - * @param $typin - * @param $typout - * @param $typlen - * @param $typdef - * @param $typelem - * @param $typdelim - * @param $typbyval - * @param $typalign - * @param $typstorage + * @param string $typname + * @param string $typin + * @param string $typout + * @param string $typlen + * @param string $typdef + * @param string $typelem + * @param string $typdelim + * @param string $typbyval + * @param string $typalign + * @param string $typstorage * * @return integer 0 if operation was successful * @@ -6021,7 +6035,7 @@ class Postgres extends ADOdbBase * * @param $name * - * @return \ADORecordSet A recordset + * @return PHPPgAdmin\ADORecordSet A recordset */ public function getEnumValues($name) { @@ -6163,7 +6177,7 @@ class Postgres extends ADOdbBase /** * Returns a list of all casts in the database. * - * @return All casts + * @return PHPPgAdmin\ADORecordSet All casts */ public function getCasts() { @@ -6208,7 +6222,7 @@ class Postgres extends ADOdbBase /** * Returns a list of all conversions in the database. * - * @return All conversions + * @return PHPPgAdmin\ADORecordSet All conversions */ public function getConversions() { @@ -6255,16 +6269,17 @@ class Postgres extends ADOdbBase /** * Creates a rule. * - * @param $name The name of the new rule - * @param $event SELECT, INSERT, UPDATE or DELETE - * @param $table Table on which to create the rule - * @param $where When to execute the rule, '' indicates always - * @param $instead True if an INSTEAD rule, false otherwise - * @param $type NOTHING for a do nothing rule, SOMETHING to use given action - * @param $action The action to take - * @param bool $replace (optional) True to replace existing rule, false otherwise + * @param string $name The name of the new rule + * @param string $event SELECT, INSERT, UPDATE or DELETE + * @param string $table Table on which to create the rule + * @param string $where When to execute the rule, '' indicates always + * @param boolean $instead True if an INSTEAD rule, false otherwise + * @param string $type NOTHING for a do nothing rule, SOMETHING to use given action + * @param string $action The action to take + * @param bool $replace (optional) True to replace existing rule, false + * otherwise * - * @return integer 0 if operation was successful + * @return integer 0 if operation was successful */ public function createRule($name, $event, $table, $where, $instead, $type, $action, $replace = false) { @@ -6304,9 +6319,9 @@ class Postgres extends ADOdbBase /** * Removes a rule from a table OR view. * - * @param $rule The rule to drop - * @param $relation The relation from which to drop - * @param $cascade True to cascade drop, false to restrict + * @param string $rule The rule to drop + * @param string $relation The relation from which to drop + * @param string $cascade True to cascade drop, false to restrict * * @return integer 0 if operation was successful */ @@ -6328,10 +6343,10 @@ class Postgres extends ADOdbBase /** * Grabs a single trigger. * - * @param $table The name of a table whose triggers to retrieve - * @param $trigger The name of the trigger to retrieve + * @param string $table The name of a table whose triggers to retrieve + * @param string $trigger The name of the trigger to retrieve * - * @return \ADORecordSet A recordset + * @return PHPPgAdmin\ADORecordSet A recordset */ public function getTrigger($table, $trigger) { @@ -6355,9 +6370,9 @@ class Postgres extends ADOdbBase * an array of attribute numbers to an array of field names. * Note: Only needed for pre-7.4 servers, this function is deprecated. * - * @param $trigger An array containing fields from the trigger table + * @param string $trigger An array containing fields from the trigger table * - * @return The trigger definition string + * @return string The trigger definition string */ public function getTriggerDef($trigger) { @@ -6490,7 +6505,7 @@ class Postgres extends ADOdbBase * @param bool $all If true, will find all available functions, if false just those in search path * @param $type If not null, will find all functions with return value = type * - * @return \ADORecordSet All functions + * @return PHPPgAdmin\ADORecordSet All functions */ public function getFunctions($all = false, $type = null) { @@ -6652,7 +6667,7 @@ class Postgres extends ADOdbBase /** * Returns a list of all operators in the database. * - * @return All operators + * @return PHPPgAdmin\ADORecordSet All operators */ public function getOperators() { @@ -6750,7 +6765,7 @@ class Postgres extends ADOdbBase /** * Gets all opclasses. * - * @return \ADORecordSet A recordset + * @return PHPPgAdmin\ADORecordSet A recordset */ public function getOpClasses() { @@ -6845,7 +6860,7 @@ class Postgres extends ADOdbBase * * @param bool $all if false, returns schema qualified FTS confs * - * @return \ADORecordSet A recordset + * @return PHPPgAdmin\ADORecordSet A recordset */ public function getFtsConfigurations($all = true) { @@ -6879,7 +6894,7 @@ class Postgres extends ADOdbBase * * @param string $ftscfg Name of the FTS configuration * - * @return \ADORecordSet recordset + * @return PHPPgAdmin\ADORecordSet recordset */ public function getFtsConfigurationMap($ftscfg) { @@ -6919,7 +6934,7 @@ class Postgres extends ADOdbBase * * @param bool $all if false, return only Parsers from the current schema * - * @return \ADORecordSet A recordset + * @return PHPPgAdmin\ADORecordSet A recordset */ public function getFtsParsers($all = true) { @@ -6948,7 +6963,7 @@ class Postgres extends ADOdbBase * * @param bool $all if false, return only Dics from the current schema * - * @return \ADORecordSet A recordset + * @return PHPPgAdmin\ADORecordSet A recordset */ public function getFtsDictionaries($all = true) { @@ -7230,7 +7245,7 @@ class Postgres extends ADOdbBase * * @param $ftsdict The name of the FTS dictionary * - * @return \ADORecordSet recordset of FTS dictionary information + * @return PHPPgAdmin\ADORecordSet recordset of FTS dictionary information */ public function getFtsDictionaryByName($ftsdict) { @@ -7398,7 +7413,7 @@ class Postgres extends ADOdbBase * * @param bool|true $all True to get all languages, regardless of show_system * - * @return \ADORecordSet A recordset + * @return PHPPgAdmin\ADORecordSet A recordset */ public function getLanguages($all = false) { @@ -7515,7 +7530,7 @@ class Postgres extends ADOdbBase * @param $name The name of the aggregate * @param $basetype The input data type of the aggregate * - * @return \ADORecordSet A recordset + * @return PHPPgAdmin\ADORecordSet A recordset */ public function getAggregate($name, $basetype) { @@ -7545,7 +7560,7 @@ class Postgres extends ADOdbBase /** * Gets all aggregates. * - * @return \ADORecordSet A recordset + * @return PHPPgAdmin\ADORecordSet A recordset */ public function getAggregates() { @@ -8640,7 +8655,7 @@ class Postgres extends ADOdbBase * * @param bool $all Include all tablespaces (necessary when moving objects back to the default space) * - * @return \ADORecordSet A recordset + * @return PHPPgAdmin\ADORecordSet A recordset */ public function getTablespaces($all = false) { @@ -8666,7 +8681,7 @@ class Postgres extends ADOdbBase * * @param $spcname * - * @return \ADORecordSet A recordset + * @return PHPPgAdmin\ADORecordSet A recordset */ public function getTablespace($spcname) { @@ -8890,7 +8905,7 @@ class Postgres extends ADOdbBase * @param $vaccostdelay * @param $vaccostlimit * - * @return \ADORecordSet A recordset + * @return PHPPgAdmin\ADORecordSet A recordset */ public function saveAutovacuum( $table, @@ -8964,7 +8979,7 @@ class Postgres extends ADOdbBase * * @param $database (optional) Find only connections to specified database * - * @return \ADORecordSet A recordset + * @return PHPPgAdmin\ADORecordSet A recordset */ public function getProcesses($database = null) { @@ -8990,7 +9005,7 @@ class Postgres extends ADOdbBase /** * Returns table locks information in the current database. * - * @return \ADORecordSet A recordset + * @return PHPPgAdmin\ADORecordSet A recordset */ public function getLocks() { @@ -9607,7 +9622,7 @@ class Postgres extends ADOdbBase * @param $table The name of a table * @param $key The associative array holding the key to retrieve * - * @return \ADORecordSet A recordset + * @return PHPPgAdmin\ADORecordSet A recordset */ public function browseRow($table, $key) { @@ -9651,7 +9666,7 @@ class Postgres extends ADOdbBase * * @param $database The database to fetch stats for * - * @return \ADORecordSet A recordset + * @return PHPPgAdmin\ADORecordSet A recordset */ public function getStatsDatabase($database) { @@ -9667,7 +9682,7 @@ class Postgres extends ADOdbBase * * @param $table The table to fetch stats for * - * @return \ADORecordSet A recordset + * @return PHPPgAdmin\ADORecordSet A recordset */ public function getStatsTableTuples($table) { @@ -9686,7 +9701,7 @@ class Postgres extends ADOdbBase * * @param $table The table to fetch stats for * - * @return \ADORecordSet A recordset + * @return PHPPgAdmin\ADORecordSet A recordset */ public function getStatsTableIO($table) { @@ -9705,7 +9720,7 @@ class Postgres extends ADOdbBase * * @param $table The table to fetch index stats for * - * @return \ADORecordSet A recordset + * @return PHPPgAdmin\ADORecordSet A recordset */ public function getStatsIndexTuples($table) { @@ -9724,7 +9739,7 @@ class Postgres extends ADOdbBase * * @param $table The table to fetch index stats for * - * @return \ADORecordSet A recordset + * @return PHPPgAdmin\ADORecordSet A recordset */ public function getStatsIndexIO($table) { |