diff options
author | Felipe Figueroa <amenadiel@gmail.com> | 2018-03-21 14:19:40 +0300 |
---|---|---|
committer | Felipe Figueroa <amenadiel@gmail.com> | 2018-03-21 14:19:40 +0300 |
commit | 0cc5a0bc23dc46ad9b61dc563dab480e024a36cd (patch) | |
tree | 889c4f826fd4b51e45acc325ec2e1d63fae25550 /src/controllers | |
parent | f750d03b4e14b0334dcf30281be794a9e4a925b6 (diff) |
more phpdocs for Postgres.php, replaces php views with actual slim routes
Diffstat (limited to 'src/controllers')
-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 |
12 files changed, 430 insertions, 418 deletions
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']); |