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

github.com/HuasoFoundries/phpPgAdmin6.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAmenadiel <amenadiel@gmail.com>2020-01-07 01:00:55 +0300
committerAmenadiel <amenadiel@gmail.com>2020-01-07 01:00:55 +0300
commitf7ace68edc066f121e22feeb3db4e7cd738e5015 (patch)
treee26f8f81a382e01fed1967dae95865b7434c425e /src
parentbdfa517c5b957f1c658b43ebdccd720f82fc4f03 (diff)
export routine wont use -i parameter
Diffstat (limited to 'src')
-rw-r--r--src/controllers/BaseController.php7
-rw-r--r--src/controllers/DbexportController.php51
-rw-r--r--src/controllers/HelpController.php16
-rw-r--r--src/controllers/IntroController.php22
-rw-r--r--src/controllers/TablesController.php260
-rw-r--r--src/controllers/ViewpropertiesController.php136
6 files changed, 264 insertions, 228 deletions
diff --git a/src/controllers/BaseController.php b/src/controllers/BaseController.php
index 6e6fde31..195a0f10 100644
--- a/src/controllers/BaseController.php
+++ b/src/controllers/BaseController.php
@@ -68,7 +68,7 @@ class BaseController
$this->container = $container;
$this->lang = $container->get('lang');
- $this->controller_name = str_replace(__NAMESPACE__.'\\', '', get_class($this));
+ $this->controller_name = str_replace(__NAMESPACE__ . '\\', '', get_class($this));
$this->view_name = str_replace('controller', '', strtolower($this->controller_name));
$this->script = $this->view_name;
@@ -111,7 +111,6 @@ class BaseController
}
}
- //\PC::debug(['name' => $this->controller_name, 'no_db_connection' => $this->misc->getNoDBConnection()], 'instanced controller');
}
/**
@@ -155,7 +154,7 @@ class BaseController
{
$title = $title ? $title : $this->controller_title;
- return $prefix.$this->lang[$title].($suffix ? ': '.$suffix : '');
+ return $prefix . $this->lang[$title] . ($suffix ? ': ' . $suffix : '');
}
public function getContainer()
@@ -399,7 +398,7 @@ class BaseController
$html = '';
$msg = htmlspecialchars(\PHPPgAdmin\Traits\HelperTrait::br2ln($msg));
if ('' != $msg) {
- $html .= '<p class="message">'.nl2br($msg).'</p>'.PHP_EOL;
+ $html .= '<p class="message">' . nl2br($msg) . '</p>' . PHP_EOL;
}
if ($do_print) {
echo $html;
diff --git a/src/controllers/DbexportController.php b/src/controllers/DbexportController.php
index 2b177f3b..b720b967 100644
--- a/src/controllers/DbexportController.php
+++ b/src/controllers/DbexportController.php
@@ -48,7 +48,7 @@ class DbexportController extends BaseController
// Obtain the pg_dump version number and check if the path is good
$version = [];
- preg_match('/(\\d+(?:\\.\\d+)?)(?:\\.\\d+)?.*$/', exec($exe.' --version'), $version);
+ preg_match('/(\\d+(?:\\.\\d+)?)(?:\\.\\d+)?.*$/', exec($exe . ' --version'), $version);
if (empty($version)) {
$this->prtrace('$exe', $exe, 'version', $version[1]);
@@ -97,23 +97,26 @@ class DbexportController extends BaseController
}
// Set environmental variables that pg_dump uses
- putenv('PGPASSWORD='.$server_info['password']);
- putenv('PGUSER='.$server_info['username']);
+ putenv('PGPASSWORD=' . $server_info['password']);
+ putenv('PGUSER=' . $server_info['username']);
$hostname = $server_info['host'];
if (null !== $hostname && '' != $hostname) {
- putenv('PGHOST='.$hostname);
+ putenv('PGHOST=' . $hostname);
}
$port = $server_info['port'];
if (null !== $port && '' != $port) {
- putenv('PGPORT='.$port);
+ putenv('PGPORT=' . $port);
}
-
+ $cmd = $exe;
// Build command for executing pg_dump. '-i' means ignore version differences.
- if (((float) $version[1]) < 9.5) {
- $cmd = $exe.' -i';
+ // deprecated
+ /*if (((float) $version[1]) < 9.5) {
+ $this->prtrace('version', $version);
+
+ $cmd = $exe . ' -i';
} else {
- $cmd = $exe;
- }
+ $cmd = $exe;
+ }*/
// we are PG 7.4+, so we always have a schema
if (isset($_REQUEST['schema'])) {
@@ -125,7 +128,7 @@ class DbexportController extends BaseController
switch ($_REQUEST['subject']) {
case 'schema':
// This currently works for 8.2+ (due to the orthoganl -t -n issue introduced then)
- $cmd .= ' -n '.$this->misc->escapeShellArg("\"{$f_schema}\"");
+ $cmd .= ' -n ' . $this->misc->escapeShellArg("\"{$f_schema}\"");
break;
case 'table':
@@ -138,13 +141,13 @@ class DbexportController extends BaseController
// Starting in 8.2, -n and -t are orthagonal, so we now schema qualify
// the table name in the -t argument and quote both identifiers
if (((float) $version[1]) >= 8.2) {
- $cmd .= ' -t '.$this->misc->escapeShellArg("\"{$f_schema}\".\"{$f_object}\"");
+ $cmd .= ' -t ' . $this->misc->escapeShellArg("\"{$f_schema}\".\"{$f_object}\"");
} else {
// If we are 7.4 or higher, assume they are using 7.4 pg_dump and
// set dump schema as well. Also, mixed case dumping has been fixed
// then..
- $cmd .= ' -t '.$this->misc->escapeShellArg($f_object)
- .' -n '.$this->misc->escapeShellArg($f_schema);
+ $cmd .= ' -t ' . $this->misc->escapeShellArg($f_object)
+ . ' -n ' . $this->misc->escapeShellArg($f_schema);
}
}
@@ -185,21 +188,21 @@ class DbexportController extends BaseController
}
if (!$dumpall) {
- putenv('PGDATABASE='.$_REQUEST['database']);
+ putenv('PGDATABASE=' . $_REQUEST['database']);
} else {
//$cmd .= ' --no-role-password';
putenv('PGDATABASE');
}
- /*$this->prtrace(
- 'ENV VARS', [
- 'PGUSER' => getenv('PGUSER'),
- 'PGPASSWORD' => getenv('PGPASSWORD'),
- 'PGHOST' => getenv('PGHOST'),
- 'PGPORT' => getenv('PGPORT'),
- 'PGDATABASE' => getenv('PGDATABASE'),
- ]
- );*/
+ $this->prtrace(
+ 'ENV VARS', [
+ 'PGUSER' => getenv('PGUSER'),
+ 'PGPASSWORD' => getenv('PGPASSWORD'),
+ 'PGHOST' => getenv('PGHOST'),
+ 'PGPORT' => getenv('PGPORT'),
+ 'PGDATABASE' => getenv('PGDATABASE'),
+ ]
+ );
$this->prtrace('cmd', $cmd);
// Execute command and return the output to the screen
diff --git a/src/controllers/HelpController.php b/src/controllers/HelpController.php
index 51d863e5..a436f63e 100644
--- a/src/controllers/HelpController.php
+++ b/src/controllers/HelpController.php
@@ -39,7 +39,7 @@ class HelpController extends BaseController
if (isset($_REQUEST['help'])) {
$url = $data->getHelp($_REQUEST['help']);
- \PC::debug(['url' => $url], 'HelpController::doDefault');
+ //\PC::debug(['url' => $url], 'HelpController::doDefault');
if (is_array($url)) {
$this->doChoosePage($url);
@@ -67,11 +67,11 @@ class HelpController extends BaseController
echo $this->printMsg($msg);
- echo '<dl>'.PHP_EOL;
+ echo '<dl>' . PHP_EOL;
$pages = $data->getHelpPages();
foreach ($pages as $page => $dummy) {
- echo "<dt>{$page}</dt>".PHP_EOL;
+ echo "<dt>{$page}</dt>" . PHP_EOL;
$urls = $data->getHelp($page);
if (!is_array($urls)) {
@@ -79,11 +79,11 @@ class HelpController extends BaseController
}
foreach ($urls as $url) {
- echo "<dd><a href=\"{$url}\">{$url}</a></dd>".PHP_EOL;
+ echo "<dd><a href=\"{$url}\">{$url}</a></dd>" . PHP_EOL;
}
}
- echo '</dl>'.PHP_EOL;
+ echo '</dl>' . PHP_EOL;
$this->printFooter();
}
@@ -95,11 +95,11 @@ class HelpController extends BaseController
$this->printTitle($this->lang['strselecthelppage']);
- echo '<ul>'.PHP_EOL;
+ echo '<ul>' . PHP_EOL;
foreach ($urls as $url) {
- echo "<li><a href=\"{$url}\">{$url}</a></li>".PHP_EOL;
+ echo "<li><a href=\"{$url}\">{$url}</a></li>" . PHP_EOL;
}
- echo '</ul>'.PHP_EOL;
+ echo '</ul>' . PHP_EOL;
$this->printFooter();
}
diff --git a/src/controllers/IntroController.php b/src/controllers/IntroController.php
index 01303515..f9e55099 100644
--- a/src/controllers/IntroController.php
+++ b/src/controllers/IntroController.php
@@ -44,48 +44,48 @@ class IntroController extends BaseController
$intro_html .= $this->printTabs('root', 'intro', false);
- $intro_html .= '<h1>'.$this->appName.' '.$this->appVersion.'</h1>';
- $intro_html .= '<h3>(PHP '.PHP_VERSION.')</h3>';
+ $intro_html .= '<h1 style="margin-top:2em">' . $this->appName . ' ' . $this->appVersion . '</h1>';
+ $intro_html .= '<h3>(PHP ' . PHP_VERSION . ')</h3>';
$intro_html .= '<form method="get" action="intro">';
$intro_html .= '<table>';
$intro_html .= '<tr class="data1">';
- $intro_html .= '<th class="data">'.$this->lang['strlanguage'].'</th>';
+ $intro_html .= '<th class="data">' . $this->lang['strlanguage'] . '</th>';
$intro_html .= '<td>';
$intro_html .= '<select name="language" onchange="this.form.submit()">';
$language = isset($_SESSION['webdbLanguage']) ? $_SESSION['webdbLanguage'] : 'english';
foreach ($this->appLangFiles as $k => $v) {
$selected = ($k == $language) ? ' selected="selected"' : '';
- $intro_html .= "\t<option value=\"{$k}\"".$selected.">{$v}</option>".PHP_EOL;
+ $intro_html .= "\t<option value=\"{$k}\"" . $selected . ">{$v}</option>" . PHP_EOL;
}
$intro_html .= '</select>';
$intro_html .= '</td>';
$intro_html .= '</tr>';
$intro_html .= '<tr class="data2">';
- $intro_html .= '<th class="data">'.$this->lang['strtheme'].'</th>';
+ $intro_html .= '<th class="data">' . $this->lang['strtheme'] . '</th>';
$intro_html .= '<td>';
$intro_html .= '<select name="theme" onchange="this.form.submit()">';
foreach ($this->appThemes as $k => $v) {
$selected = ($k == $this->conf['theme']) ? ' selected="selected"' : '';
- $intro_html .= "\t<option value=\"{$k}\"".$selected.">{$v}</option>".PHP_EOL;
+ $intro_html .= "\t<option value=\"{$k}\"" . $selected . ">{$v}</option>" . PHP_EOL;
}
$intro_html .= '</select>';
$intro_html .= '</td>';
$intro_html .= '</tr>';
$intro_html .= '</table>';
- $intro_html .= '<noscript><p><input type="submit" value="'.$this->lang['stralter'].'" /></p></noscript>';
+ $intro_html .= '<noscript><p><input type="submit" value="' . $this->lang['stralter'] . '" /></p></noscript>';
$intro_html .= '</form>';
- $intro_html .= '<p>'.$this->lang['strintro'].'</p>';
+ $intro_html .= '<p>' . $this->lang['strintro'] . '</p>';
$intro_html .= '<ul class="intro">';
- $intro_html .= ' <li><a href="https://github.com/HuasoFoundries/phpPgAdmin6">'.$this->lang['strppahome'].'</a></li>';
- $intro_html .= '<li><a href="'.$this->lang['strpgsqlhome_url'].'">'.$this->lang['strpgsqlhome'].'</a></li>';
- $intro_html .= '<li><a href="https://github.com/HuasoFoundries/phpPgAdmin6/issues">'.$this->lang['strreportbug'].'</a></li>';
+ $intro_html .= ' <li><a href="https://github.com/HuasoFoundries/phpPgAdmin6">' . $this->lang['strppahome'] . '</a></li>';
+ $intro_html .= '<li><a href="' . $this->lang['strpgsqlhome_url'] . '">' . $this->lang['strpgsqlhome'] . '</a></li>';
+ $intro_html .= '<li><a href="https://github.com/HuasoFoundries/phpPgAdmin6/issues">' . $this->lang['strreportbug'] . '</a></li>';
//$intro_html .= '<li><a href="' . $this->lang['strviewfaq_url'] . '">' . $this->lang['strviewfaq'] . '</a></li>';
$intro_html .= '</ul>';
diff --git a/src/controllers/TablesController.php b/src/controllers/TablesController.php
index 1019fae3..a48924a6 100644
--- a/src/controllers/TablesController.php
+++ b/src/controllers/TablesController.php
@@ -142,7 +142,7 @@ class TablesController extends BaseController
'table' => [
'title' => $this->lang['strtable'],
'field' => Decorator::field('relname'),
- 'url' => \SUBFOLDER."/redirect/table?{$this->misc->href}&amp;",
+ 'url' => \SUBFOLDER . "/redirect/table?{$this->misc->href}&amp;",
'vars' => ['table' => 'relname'],
],
'owner' => [
@@ -383,8 +383,6 @@ class TablesController extends BaseController
{
$data = $this->misc->getDatabaseAccessor();
- //\PC::debug($this->misc->getDatabase(), 'getDatabase');
-
$tables = $data->getTables();
$reqvars = $this->misc->getRequestVars('table');
@@ -471,46 +469,46 @@ class TablesController extends BaseController
$this->printTitle($this->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 PHP_EOL;
- echo '<table>'.PHP_EOL;
- echo "\t<tr>\n\t\t<th class=\"data left required\">{$this->lang['strname']}</th>".PHP_EOL;
+ echo '<table>' . PHP_EOL;
+ echo "\t<tr>\n\t\t<th class=\"data left required\">{$this->lang['strname']}</th>" . PHP_EOL;
echo "\t\t<td class=\"data\"><input name=\"name\" size=\"32\" maxlength=\"{$data->_maxNameLen}\" value=\"",
- htmlspecialchars($_REQUEST['name']), "\" /></td>\n\t</tr>".PHP_EOL;
- echo "\t<tr>\n\t\t<th class=\"data left required\">{$this->lang['strnumcols']}</th>".PHP_EOL;
+ htmlspecialchars($_REQUEST['name']), "\" /></td>\n\t</tr>" . PHP_EOL;
+ echo "\t<tr>\n\t\t<th class=\"data left required\">{$this->lang['strnumcols']}</th>" . PHP_EOL;
echo "\t\t<td class=\"data\"><input name=\"fields\" size=\"5\" maxlength=\"{$data->_maxNameLen}\" value=\"",
- htmlspecialchars($_REQUEST['fields']), "\" /></td>\n\t</tr>".PHP_EOL;
- echo "\t<tr>\n\t\t<th class=\"data left\">{$this->lang['stroptions']}</th>".PHP_EOL;
- echo "\t\t<td class=\"data\"><label for=\"withoutoids\"><input type=\"checkbox\" id=\"withoutoids\" name=\"withoutoids\"", isset($_REQUEST['withoutoids']) ? ' checked="checked"' : '', " />WITHOUT OIDS</label></td>\n\t</tr>".PHP_EOL;
+ htmlspecialchars($_REQUEST['fields']), "\" /></td>\n\t</tr>" . PHP_EOL;
+ echo "\t<tr>\n\t\t<th class=\"data left\">{$this->lang['stroptions']}</th>" . PHP_EOL;
+ echo "\t\t<td class=\"data\"><label for=\"withoutoids\"><input type=\"checkbox\" id=\"withoutoids\" name=\"withoutoids\"", isset($_REQUEST['withoutoids']) ? ' checked="checked"' : '', " />WITHOUT OIDS</label></td>\n\t</tr>" . PHP_EOL;
// Tablespace (if there are any)
if ($data->hasTablespaces() && $tablespaces->recordCount() > 0) {
- echo "\t<tr>\n\t\t<th class=\"data left\">{$this->lang['strtablespace']}</th>".PHP_EOL;
- echo "\t\t<td class=\"data1\">\n\t\t\t<select name=\"spcname\">".PHP_EOL;
+ echo "\t<tr>\n\t\t<th class=\"data left\">{$this->lang['strtablespace']}</th>" . PHP_EOL;
+ echo "\t\t<td class=\"data1\">\n\t\t\t<select name=\"spcname\">" . PHP_EOL;
// Always offer the default (empty) option
echo "\t\t\t\t<option value=\"\"",
- ('' == $_REQUEST['spcname']) ? ' selected="selected"' : '', '></option>'.PHP_EOL;
+ ('' == $_REQUEST['spcname']) ? ' selected="selected"' : '', '></option>' . PHP_EOL;
// Display all other tablespaces
while (!$tablespaces->EOF) {
$spcname = htmlspecialchars($tablespaces->fields['spcname']);
echo "\t\t\t\t<option value=\"{$spcname}\"",
- ($tablespaces->fields['spcname'] == $_REQUEST['spcname']) ? ' selected="selected"' : '', ">{$spcname}</option>".PHP_EOL;
+ ($tablespaces->fields['spcname'] == $_REQUEST['spcname']) ? ' selected="selected"' : '', ">{$spcname}</option>" . PHP_EOL;
$tablespaces->moveNext();
}
- echo "\t\t\t</select>\n\t\t</td>\n\t</tr>".PHP_EOL;
+ echo "\t\t\t</select>\n\t\t</td>\n\t</tr>" . PHP_EOL;
}
- echo "\t<tr>\n\t\t<th class=\"data left\">{$this->lang['strcomment']}</th>".PHP_EOL;
+ echo "\t<tr>\n\t\t<th class=\"data left\">{$this->lang['strcomment']}</th>" . PHP_EOL;
echo "\t\t<td><textarea name=\"tblcomment\" rows=\"3\" cols=\"32\">",
- htmlspecialchars($_REQUEST['tblcomment']), "</textarea></td>\n\t</tr>".PHP_EOL;
+ htmlspecialchars($_REQUEST['tblcomment']), "</textarea></td>\n\t</tr>" . PHP_EOL;
- echo '</table>'.PHP_EOL;
- echo '<p><input type="hidden" name="action" value="create" />'.PHP_EOL;
- echo '<input type="hidden" name="stage" value="2" />'.PHP_EOL;
+ echo '</table>' . PHP_EOL;
+ echo '<p><input type="hidden" name="action" value="create" />' . PHP_EOL;
+ echo '<input type="hidden" name="stage" value="2" />' . PHP_EOL;
echo $this->misc->form;
- echo "<input type=\"submit\" value=\"{$this->lang['strnext']}\" />".PHP_EOL;
- echo "<input type=\"submit\" name=\"cancel\" value=\"{$this->lang['strcancel']}\" /></p>".PHP_EOL;
- echo '</form>'.PHP_EOL;
+ echo "<input type=\"submit\" value=\"{$this->lang['strnext']}\" />" . PHP_EOL;
+ echo "<input type=\"submit\" name=\"cancel\" value=\"{$this->lang['strcancel']}\" /></p>" . PHP_EOL;
+ echo '</form>' . PHP_EOL;
break;
case 2:
@@ -536,15 +534,15 @@ class TablesController extends BaseController
$this->printTitle($this->lang['strcreatetable'], 'pg.table.create');
$this->printMsg($msg);
- echo '<script src="'.\SUBFOLDER.'/assets/js/tables.js" type="text/javascript"></script>';
- echo '<form action="'.\SUBFOLDER.'/src/views/tables" method="post">'.PHP_EOL;
+ echo '<script src="' . \SUBFOLDER . '/assets/js/tables.js" type="text/javascript"></script>';
+ echo '<form action="' . \SUBFOLDER . '/src/views/tables" method="post">' . PHP_EOL;
// Output table header
- echo '<table>'.PHP_EOL;
+ echo '<table>' . PHP_EOL;
echo "\t<tr><th colspan=\"2\" class=\"data required\">{$this->lang['strcolumn']}</th><th colspan=\"2\" class=\"data required\">{$this->lang['strtype']}</th>";
echo "<th class=\"data\">{$this->lang['strlength']}</th><th class=\"data\">{$this->lang['strnotnull']}</th>";
echo "<th class=\"data\">{$this->lang['struniquekey']}</th><th class=\"data\">{$this->lang['strprimarykey']}</th>";
- echo "<th class=\"data\">{$this->lang['strdefault']}</th><th class=\"data\">{$this->lang['strcomment']}</th></tr>".PHP_EOL;
+ echo "<th class=\"data\">{$this->lang['strdefault']}</th><th class=\"data\">{$this->lang['strcomment']}</th></tr>" . PHP_EOL;
for ($i = 0; $i < $_REQUEST['fields']; ++$i) {
if (!isset($_REQUEST['field'][$i])) {
@@ -563,16 +561,16 @@ class TablesController extends BaseController
$_REQUEST['colcomment'][$i] = '';
}
- echo "\t<tr>\n\t\t<td>", $i + 1, '.&nbsp;</td>'.PHP_EOL;
+ echo "\t<tr>\n\t\t<td>", $i + 1, '.&nbsp;</td>' . PHP_EOL;
echo "\t\t<td><input name=\"field[{$i}]\" size=\"16\" maxlength=\"{$data->_maxNameLen}\" value=\"",
- htmlspecialchars($_REQUEST['field'][$i]), '" /></td>'.PHP_EOL;
- echo "\t\t<td>\n\t\t\t<select name=\"type[{$i}]\" class=\"select2\" id=\"types{$i}\" onchange=\"checkLengths(this.options[this.selectedIndex].value,{$i});\">".PHP_EOL;
+ htmlspecialchars($_REQUEST['field'][$i]), '" /></td>' . PHP_EOL;
+ echo "\t\t<td>\n\t\t\t<select name=\"type[{$i}]\" class=\"select2\" id=\"types{$i}\" onchange=\"checkLengths(this.options[this.selectedIndex].value,{$i});\">" . PHP_EOL;
// Output any "magic" types
foreach ($data->extraTypes as $v) {
$types_for_js[strtolower($v)] = 1;
echo "\t\t\t\t<option value=\"", htmlspecialchars($v), '"',
(isset($_REQUEST['type'][$i]) && $_REQUEST['type'][$i] == $v) ? ' selected="selected"' : '', '>',
- $this->misc->printVal($v), '</option>'.PHP_EOL;
+ $this->misc->printVal($v), '</option>' . PHP_EOL;
}
$types->moveFirst();
while (!$types->EOF) {
@@ -580,7 +578,7 @@ class TablesController extends BaseController
$types_for_js[$typname] = 1;
echo "\t\t\t\t<option value=\"", htmlspecialchars($typname), '"',
(isset($_REQUEST['type'][$i]) && $_REQUEST['type'][$i] == $typname) ? ' selected="selected"' : '', '>',
- $this->misc->printVal($typname), '</option>'.PHP_EOL;
+ $this->misc->printVal($typname), '</option>' . PHP_EOL;
$types->moveNext();
}
echo "\t\t\t</select>\n\t\t\n";
@@ -591,46 +589,46 @@ 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
- echo "\t\t<td>\n\t\t\t<select name=\"array[{$i}]\">".PHP_EOL;
- echo "\t\t\t\t<option value=\"\"", (isset($_REQUEST['array'][$i]) && $_REQUEST['array'][$i] == '') ? ' selected="selected"' : '', '></option>'.PHP_EOL;
- echo "\t\t\t\t<option value=\"[]\"", (isset($_REQUEST['array'][$i]) && $_REQUEST['array'][$i] == '[]') ? ' selected="selected"' : '', '>[ ]</option>'.PHP_EOL;
- echo "\t\t\t</select>\n\t\t</td>".PHP_EOL;
+ echo "\t\t<td>\n\t\t\t<select name=\"array[{$i}]\">" . PHP_EOL;
+ echo "\t\t\t\t<option value=\"\"", (isset($_REQUEST['array'][$i]) && $_REQUEST['array'][$i] == '') ? ' selected="selected"' : '', '></option>' . PHP_EOL;
+ echo "\t\t\t\t<option value=\"[]\"", (isset($_REQUEST['array'][$i]) && $_REQUEST['array'][$i] == '[]') ? ' selected="selected"' : '', '>[ ]</option>' . PHP_EOL;
+ echo "\t\t\t</select>\n\t\t</td>" . PHP_EOL;
echo "\t\t<td><input name=\"length[{$i}]\" id=\"lengths{$i}\" size=\"10\" value=\"",
- htmlspecialchars($_REQUEST['length'][$i]), '" /></td>'.PHP_EOL;
- echo "\t\t<td><input type=\"checkbox\" name=\"notnull[{$i}]\"", (isset($_REQUEST['notnull'][$i])) ? ' checked="checked"' : '', ' /></td>'.PHP_EOL;
+ htmlspecialchars($_REQUEST['length'][$i]), '" /></td>' . PHP_EOL;
+ echo "\t\t<td><input type=\"checkbox\" name=\"notnull[{$i}]\"", (isset($_REQUEST['notnull'][$i])) ? ' checked="checked"' : '', ' /></td>' . PHP_EOL;
echo "\t\t<td style=\"text-align: center\"><input type=\"checkbox\" name=\"uniquekey[{$i}]\""
- .(isset($_REQUEST['uniquekey'][$i]) ? ' checked="checked"' : '').' /></td>'.PHP_EOL;
+ . (isset($_REQUEST['uniquekey'][$i]) ? ' checked="checked"' : '') . ' /></td>' . PHP_EOL;
echo "\t\t<td style=\"text-align: center\"><input type=\"checkbox\" name=\"primarykey[{$i}]\" "
- .(isset($_REQUEST['primarykey'][$i]) ? ' checked="checked"' : '')
- .' /></td>'.PHP_EOL;
+ . (isset($_REQUEST['primarykey'][$i]) ? ' checked="checked"' : '')
+ . ' /></td>' . PHP_EOL;
echo "\t\t<td><input name=\"default[{$i}]\" size=\"20\" value=\"",
- htmlspecialchars($_REQUEST['default'][$i]), '" /></td>'.PHP_EOL;
+ htmlspecialchars($_REQUEST['default'][$i]), '" /></td>' . PHP_EOL;
echo "\t\t<td><input name=\"colcomment[{$i}]\" size=\"40\" value=\"",
htmlspecialchars($_REQUEST['colcomment'][$i]), "\" />
<script type=\"text/javascript\">checkLengths(document.getElementById('types{$i}').value,{$i});</script>
- </td>\n\t</tr>".PHP_EOL;
+ </td>\n\t</tr>" . PHP_EOL;
}
- echo '</table>'.PHP_EOL;
- echo '<p><input type="hidden" name="action" value="create" />'.PHP_EOL;
- echo '<input type="hidden" name="stage" value="3" />'.PHP_EOL;
+ echo '</table>' . PHP_EOL;
+ echo '<p><input type="hidden" name="action" value="create" />' . PHP_EOL;
+ echo '<input type="hidden" name="stage" value="3" />' . PHP_EOL;
echo $this->misc->form;
- echo '<input type="hidden" name="name" value="', htmlspecialchars($_REQUEST['name']), '" />'.PHP_EOL;
- echo '<input type="hidden" name="fields" value="', htmlspecialchars($_REQUEST['fields']), '" />'.PHP_EOL;
+ echo '<input type="hidden" name="name" value="', htmlspecialchars($_REQUEST['name']), '" />' . PHP_EOL;
+ echo '<input type="hidden" name="fields" value="', htmlspecialchars($_REQUEST['fields']), '" />' . PHP_EOL;
if (isset($_REQUEST['withoutoids'])) {
- echo '<input type="hidden" name="withoutoids" value="true" />'.PHP_EOL;
+ echo '<input type="hidden" name="withoutoids" value="true" />' . PHP_EOL;
}
- echo '<input type="hidden" name="tblcomment" value="', htmlspecialchars($_REQUEST['tblcomment']), '" />'.PHP_EOL;
+ echo '<input type="hidden" name="tblcomment" value="', htmlspecialchars($_REQUEST['tblcomment']), '" />' . PHP_EOL;
if (isset($_REQUEST['spcname'])) {
- echo '<input type="hidden" name="spcname" value="', htmlspecialchars($_REQUEST['spcname']), '" />'.PHP_EOL;
+ echo '<input type="hidden" name="spcname" value="', htmlspecialchars($_REQUEST['spcname']), '" />' . PHP_EOL;
}
- echo "<input type=\"submit\" value=\"{$this->lang['strcreate']}\" />".PHP_EOL;
- echo "<input type=\"submit\" name=\"cancel\" value=\"{$this->lang['strcancel']}\" /></p>".PHP_EOL;
- echo '</form>'.PHP_EOL;
+ echo "<input type=\"submit\" value=\"{$this->lang['strcreate']}\" />" . PHP_EOL;
+ echo "<input type=\"submit\" name=\"cancel\" value=\"{$this->lang['strcancel']}\" /></p>" . PHP_EOL;
+ echo '</form>' . PHP_EOL;
break;
case 3:
@@ -695,7 +693,7 @@ class TablesController extends BaseController
break;
default:
- echo "<p>{$this->lang['strinvalidparam']}</p>".PHP_EOL;
+ echo "<p>{$this->lang['strinvalidparam']}</p>" . PHP_EOL;
}
}
@@ -738,13 +736,13 @@ class TablesController extends BaseController
unset($tbltmp);
- echo '<form action="'.\SUBFOLDER.'/src/views/tables" method="post">'.PHP_EOL;
- echo "<table>\n\t<tr>\n\t\t<th class=\"data left required\">{$this->lang['strname']}</th>".PHP_EOL;
- echo "\t\t<td class=\"data\"><input name=\"name\" size=\"32\" maxlength=\"{$data->_maxNameLen}\" value=\"", htmlspecialchars($_REQUEST['name']), "\" /></td>\n\t</tr>".PHP_EOL;
- echo "\t<tr>\n\t\t<th class=\"data left required\">{$this->lang['strcreatetablelikeparent']}</th>".PHP_EOL;
+ echo '<form action="' . \SUBFOLDER . '/src/views/tables" method="post">' . PHP_EOL;
+ echo "<table>\n\t<tr>\n\t\t<th class=\"data left required\">{$this->lang['strname']}</th>" . PHP_EOL;
+ echo "\t\t<td class=\"data\"><input name=\"name\" size=\"32\" maxlength=\"{$data->_maxNameLen}\" value=\"", htmlspecialchars($_REQUEST['name']), "\" /></td>\n\t</tr>" . PHP_EOL;
+ echo "\t<tr>\n\t\t<th class=\"data left required\">{$this->lang['strcreatetablelikeparent']}</th>" . PHP_EOL;
echo "\t\t<td class=\"data\">";
echo \PHPPgAdmin\XHtml\HTMLController::printCombo($tables, 'like', true, $tblsel, false);
- echo "</td>\n\t</tr>".PHP_EOL;
+ echo "</td>\n\t</tr>" . PHP_EOL;
if ($data->hasTablespaces()) {
$tblsp_ = $data->getTablespaces();
if ($tblsp_->recordCount() > 0) {
@@ -754,10 +752,10 @@ class TablesController extends BaseController
$tblsp[$a['spcname']] = $a['spcname'];
}
- echo "\t<tr>\n\t\t<th class=\"data left\">{$this->lang['strtablespace']}</th>".PHP_EOL;
+ echo "\t<tr>\n\t\t<th class=\"data left\">{$this->lang['strtablespace']}</th>" . PHP_EOL;
echo "\t\t<td class=\"data\">";
echo \PHPPgAdmin\XHtml\HTMLController::printCombo($tblsp, 'tablespace', true, $_REQUEST['tablespace'], false);
- echo "</td>\n\t</tr>".PHP_EOL;
+ echo "</td>\n\t</tr>" . PHP_EOL;
}
}
echo "\t<tr>\n\t\t<th class=\"data left\">{$this->lang['stroptions']}</th>\n\t\t<td class=\"data\">";
@@ -774,14 +772,14 @@ class TablesController extends BaseController
isset($_REQUEST['withindexes']) ? ' checked="checked"' : '',
"/>{$this->lang['strcreatelikewithindexes']}</label>";
}
- echo "</td>\n\t</tr>".PHP_EOL;
+ echo "</td>\n\t</tr>" . PHP_EOL;
echo '</table>';
- echo '<input type="hidden" name="action" value="confcreatelike" />'.PHP_EOL;
+ echo '<input type="hidden" name="action" value="confcreatelike" />' . PHP_EOL;
echo $this->misc->form;
- echo "<p><input type=\"submit\" value=\"{$this->lang['strcreate']}\" />".PHP_EOL;
- echo "<input type=\"submit\" name=\"cancel\" value=\"{$this->lang['strcancel']}\" /></p>".PHP_EOL;
- echo '</form>'.PHP_EOL;
+ echo "<p><input type=\"submit\" value=\"{$this->lang['strcreate']}\" />" . PHP_EOL;
+ echo "<input type=\"submit\" name=\"cancel\" value=\"{$this->lang['strcancel']}\" /></p>" . PHP_EOL;
+ echo '</form>' . PHP_EOL;
} else {
if ('' == trim($_REQUEST['name'])) {
$this->doCreateLike(false, $this->lang['strtableneedsname']);
@@ -833,10 +831,10 @@ class TablesController extends BaseController
$attrs = $data->getTableAttributes($_REQUEST['table']);
- echo '<form action="'.\SUBFOLDER.'/src/views/tables" method="post" id="selectform">'.PHP_EOL;
+ echo '<form action="' . \SUBFOLDER . '/src/views/tables" method="post" id="selectform">' . PHP_EOL;
if ($attrs->recordCount() > 0) {
// JavaScript for select all feature
- echo '<script type="text/javascript">'.PHP_EOL;
+ echo '<script type="text/javascript">' . PHP_EOL;
echo "//<![CDATA[\n";
echo " function selectAll() {\n";
echo " for (var i=0; i<document.getElementById('selectform').elements.length; i++) {\n";
@@ -844,10 +842,10 @@ class TablesController extends BaseController
echo " if (e.name.indexOf('show') == 0) e.checked = document.getElementById('selectform').selectall.checked;\n";
echo " }\n";
echo " }\n";
- echo '//]]>'.PHP_EOL;
- echo '</script>'.PHP_EOL;
+ echo '//]]>' . PHP_EOL;
+ echo '</script>' . PHP_EOL;
- echo '<table>'.PHP_EOL;
+ echo '<table>' . PHP_EOL;
// Output table header
echo "<tr><th class=\"data\">{$this->lang['strshow']}</th><th class=\"data\">{$this->lang['strcolumn']}</th>";
@@ -868,42 +866,42 @@ class TablesController extends BaseController
// Continue drawing row
$id = (0 == ($i % 2) ? '1' : '2');
- echo "<tr class=\"data{$id}\">".PHP_EOL;
+ echo "<tr class=\"data{$id}\">" . PHP_EOL;
echo '<td style="white-space:nowrap;">';
echo '<input type="checkbox" name="show[', htmlspecialchars($attrs->fields['attname']), ']"',
isset($_REQUEST['show'][$attrs->fields['attname']]) ? ' checked="checked"' : '', ' /></td>';
echo '<td style="white-space:nowrap;">', $this->misc->printVal($attrs->fields['attname']), '</td>';
echo '<td style="white-space:nowrap;">', $this->misc->printVal($data->formatType($attrs->fields['type'], $attrs->fields['atttypmod'])), '</td>';
echo '<td style="white-space:nowrap;">';
- echo "<select name=\"ops[{$attrs->fields['attname']}]\">".PHP_EOL;
+ echo "<select name=\"ops[{$attrs->fields['attname']}]\">" . PHP_EOL;
foreach (array_keys($data->selectOps) as $v) {
echo '<option value="', htmlspecialchars($v), '"', ($_REQUEST['ops'][$attrs->fields['attname']] == $v) ? ' selected="selected"' : '',
- '>', htmlspecialchars($v), '</option>'.PHP_EOL;
+ '>', htmlspecialchars($v), '</option>' . PHP_EOL;
}
- echo "</select>\n</td>".PHP_EOL;
+ echo "</select>\n</td>" . PHP_EOL;
echo '<td style="white-space:nowrap;">', $data->printField(
"values[{$attrs->fields['attname']}]",
$_REQUEST['values'][$attrs->fields['attname']],
$attrs->fields['type']
), '</td>';
- echo '</tr>'.PHP_EOL;
+ echo '</tr>' . PHP_EOL;
++$i;
$attrs->moveNext();
}
// Select all checkbox
echo "<tr><td colspan=\"5\"><input type=\"checkbox\" id=\"selectall\" name=\"selectall\" accesskey=\"a\" onclick=\"javascript:selectAll()\" /><label for=\"selectall\">{$this->lang['strselectallfields']}</label></td>";
- echo '</tr></table>'.PHP_EOL;
+ echo '</tr></table>' . PHP_EOL;
} else {
- echo "<p>{$this->lang['strinvalidparam']}</p>".PHP_EOL;
+ echo "<p>{$this->lang['strinvalidparam']}</p>" . PHP_EOL;
}
- echo '<p><input type="hidden" name="action" value="selectrows" />'.PHP_EOL;
- echo '<input type="hidden" name="table" value="', htmlspecialchars($_REQUEST['table']), '" />'.PHP_EOL;
- echo '<input type="hidden" name="subject" value="table" />'.PHP_EOL;
+ echo '<p><input type="hidden" name="action" value="selectrows" />' . PHP_EOL;
+ echo '<input type="hidden" name="table" value="', htmlspecialchars($_REQUEST['table']), '" />' . PHP_EOL;
+ echo '<input type="hidden" name="subject" value="table" />' . PHP_EOL;
echo $this->misc->form;
- echo "<input type=\"submit\" name=\"select\" accesskey=\"r\" value=\"{$this->lang['strselect']}\" />".PHP_EOL;
- echo "<input type=\"submit\" name=\"cancel\" value=\"{$this->lang['strcancel']}\" /></p>".PHP_EOL;
- echo '</form>'.PHP_EOL;
+ echo "<input type=\"submit\" name=\"select\" accesskey=\"r\" value=\"{$this->lang['strselect']}\" />" . PHP_EOL;
+ echo "<input type=\"submit\" name=\"cancel\" value=\"{$this->lang['strcancel']}\" /></p>" . PHP_EOL;
+ echo '</form>' . PHP_EOL;
return;
}
@@ -965,9 +963,9 @@ class TablesController extends BaseController
$this->coalesceArr($_REQUEST, 'nulls', []);
$this->coalesceArr($_REQUEST, 'format', []);
- echo '<form action="'.\SUBFOLDER.'/src/views/tables" method="post" id="ac_form">'.PHP_EOL;
+ echo '<form action="' . \SUBFOLDER . '/src/views/tables" method="post" id="ac_form">' . PHP_EOL;
if ($attrs->recordCount() > 0) {
- echo '<table>'.PHP_EOL;
+ echo '<table>' . PHP_EOL;
// Output table header
echo "<tr><th class=\"data\">{$this->lang['strcolumn']}</th><th class=\"data\">{$this->lang['strtype']}</th>";
@@ -995,17 +993,17 @@ class TablesController extends BaseController
// Continue drawing row
$id = (0 == ($i % 2) ? '1' : '2');
- echo "<tr class=\"data{$id}\">".PHP_EOL;
+ echo "<tr class=\"data{$id}\">" . PHP_EOL;
echo '<td style="white-space:nowrap;">', $this->misc->printVal($attrs->fields['attname']), '</td>';
- echo '<td style="white-space:nowrap;">'.PHP_EOL;
+ echo '<td style="white-space:nowrap;">' . PHP_EOL;
echo $this->misc->printVal($data->formatType($attrs->fields['type'], $attrs->fields['atttypmod']));
echo "<input type=\"hidden\" name=\"types[{$attrs->fields['attnum']}]\" value=\"",
htmlspecialchars($attrs->fields['type']), '" /></td>';
- echo '<td style="white-space:nowrap;">'.PHP_EOL;
- echo "<select name=\"format[{$attrs->fields['attnum']}]\">".PHP_EOL;
- echo '<option value="VALUE"', ($_REQUEST['format'][$attrs->fields['attnum']] == 'VALUE') ? ' selected="selected"' : '', ">{$this->lang['strvalue']}</option>".PHP_EOL;
- echo '<option value="EXPRESSION"', ($_REQUEST['format'][$attrs->fields['attnum']] == 'EXPRESSION') ? ' selected="selected"' : '', ">{$this->lang['strexpression']}</option>".PHP_EOL;
- echo "</select>\n</td>".PHP_EOL;
+ echo '<td style="white-space:nowrap;">' . PHP_EOL;
+ echo "<select name=\"format[{$attrs->fields['attnum']}]\">" . PHP_EOL;
+ echo '<option value="VALUE"', ($_REQUEST['format'][$attrs->fields['attnum']] == 'VALUE') ? ' selected="selected"' : '', ">{$this->lang['strvalue']}</option>" . PHP_EOL;
+ echo '<option value="EXPRESSION"', ($_REQUEST['format'][$attrs->fields['attnum']] == 'EXPRESSION') ? ' selected="selected"' : '', ">{$this->lang['strexpression']}</option>" . PHP_EOL;
+ echo "</select>\n</td>" . PHP_EOL;
echo '<td style="white-space:nowrap;">';
// Output null box if the column allows nulls (doesn't look at CHECKs or ASSERTIONS)
if (!$attrs->fields['attnotnull']) {
@@ -1031,40 +1029,40 @@ class TablesController extends BaseController
} else {
echo $data->printField("values[{$attrs->fields['attnum']}]", $_REQUEST['values'][$attrs->fields['attnum']], $attrs->fields['type'], ['class' => 'insert_row_input']);
}
- echo '</td>'.PHP_EOL;
- echo '</tr>'.PHP_EOL;
+ echo '</td>' . PHP_EOL;
+ echo '</tr>' . PHP_EOL;
++$i;
$attrs->moveNext();
}
- echo '</table>'.PHP_EOL;
+ echo '</table>' . PHP_EOL;
if (!isset($_SESSION['counter'])) {
$_SESSION['counter'] = 0;
}
- echo '<input type="hidden" name="action" value="insertrow" />'.PHP_EOL;
- echo '<input type="hidden" name="fields" value="', htmlentities(serialize($fields), ENT_QUOTES, 'UTF-8'), '" />'.PHP_EOL;
- echo '<input type="hidden" name="protection_counter" value="'.$_SESSION['counter'].'" />'.PHP_EOL;
- echo '<input type="hidden" name="table" value="', htmlspecialchars($_REQUEST['table']), '" />'.PHP_EOL;
- echo "<p><input type=\"submit\" name=\"insert\" value=\"{$this->lang['strinsert']}\" />".PHP_EOL;
- echo "<input type=\"submit\" name=\"insertandrepeat\" accesskey=\"r\" value=\"{$this->lang['strinsertandrepeat']}\" />".PHP_EOL;
- echo "<input type=\"submit\" name=\"cancel\" value=\"{$this->lang['strcancel']}\" />".PHP_EOL;
+ echo '<input type="hidden" name="action" value="insertrow" />' . PHP_EOL;
+ echo '<input type="hidden" name="fields" value="', htmlentities(serialize($fields), ENT_QUOTES, 'UTF-8'), '" />' . PHP_EOL;
+ echo '<input type="hidden" name="protection_counter" value="' . $_SESSION['counter'] . '" />' . PHP_EOL;
+ echo '<input type="hidden" name="table" value="', htmlspecialchars($_REQUEST['table']), '" />' . PHP_EOL;
+ echo "<p><input type=\"submit\" name=\"insert\" value=\"{$this->lang['strinsert']}\" />" . PHP_EOL;
+ echo "<input type=\"submit\" name=\"insertandrepeat\" accesskey=\"r\" value=\"{$this->lang['strinsertandrepeat']}\" />" . PHP_EOL;
+ echo "<input type=\"submit\" name=\"cancel\" value=\"{$this->lang['strcancel']}\" />" . PHP_EOL;
if (false !== $fksprops) {
if ('default off' != $this->conf['autocomplete']) {
- echo "<input type=\"checkbox\" id=\"no_ac\" value=\"1\" checked=\"checked\" /><label for=\"no_ac\">{$this->lang['strac']}</label>".PHP_EOL;
+ echo "<input type=\"checkbox\" id=\"no_ac\" value=\"1\" checked=\"checked\" /><label for=\"no_ac\">{$this->lang['strac']}</label>" . PHP_EOL;
} else {
- echo "<input type=\"checkbox\" id=\"no_ac\" value=\"0\" /><label for=\"no_ac\">{$this->lang['strac']}</label>".PHP_EOL;
+ echo "<input type=\"checkbox\" id=\"no_ac\" value=\"0\" /><label for=\"no_ac\">{$this->lang['strac']}</label>" . PHP_EOL;
}
}
- echo '</p>'.PHP_EOL;
+ echo '</p>' . PHP_EOL;
} else {
- echo "<p>{$this->lang['strnofieldsforinsert']}</p>".PHP_EOL;
- echo "<input type=\"submit\" name=\"cancel\" value=\"{$this->lang['strcancel']}\" />".PHP_EOL;
+ echo "<p>{$this->lang['strnofieldsforinsert']}</p>" . PHP_EOL;
+ echo "<input type=\"submit\" name=\"cancel\" value=\"{$this->lang['strcancel']}\" />" . PHP_EOL;
}
echo $this->misc->form;
- echo '</form>'.PHP_EOL;
- echo '<script src="'.\SUBFOLDER.'/assets/js/insert_or_edit_row.js" type="text/javascript"></script>';
+ echo '</form>' . PHP_EOL;
+ echo '<script src="' . \SUBFOLDER . '/assets/js/insert_or_edit_row.js" type="text/javascript"></script>';
}
/**
@@ -1116,29 +1114,29 @@ class TablesController extends BaseController
$this->printTrail('schema');
$this->printTitle($this->lang['strempty'], 'pg.table.empty');
- echo '<form action="'.\SUBFOLDER.'/src/views/tables" method="post">'.PHP_EOL;
+ echo '<form action="' . \SUBFOLDER . '/src/views/tables" method="post">' . PHP_EOL;
foreach ($_REQUEST['ma'] as $v) {
$a = unserialize(htmlspecialchars_decode($v, ENT_QUOTES));
- echo '<p>'.sprintf($this->lang['strconfemptytable'], $this->misc->printVal($a['table']));
+ echo '<p>' . sprintf($this->lang['strconfemptytable'], $this->misc->printVal($a['table']));
- echo '</p>'.PHP_EOL;
+ echo '</p>' . PHP_EOL;
printf('<input type="hidden" name="table[]" value="%s" />', htmlspecialchars($a['table']));
} // END mutli empty
} else {
$this->printTrail('table');
$this->printTitle($this->lang['strempty'], 'pg.table.empty');
- echo '<p>', sprintf($this->lang['strconfemptytable'], $this->misc->printVal($_REQUEST['table'])), '</p>'.PHP_EOL;
+ echo '<p>', sprintf($this->lang['strconfemptytable'], $this->misc->printVal($_REQUEST['table'])), '</p>' . PHP_EOL;
- echo '<form action="'.\SUBFOLDER.'/src/views/tables" method="post">'.PHP_EOL;
+ echo '<form action="' . \SUBFOLDER . '/src/views/tables" method="post">' . PHP_EOL;
- echo '<input type="hidden" name="table" value="', htmlspecialchars($_REQUEST['table']), '" />'.PHP_EOL;
+ echo '<input type="hidden" name="table" value="', htmlspecialchars($_REQUEST['table']), '" />' . PHP_EOL;
// END not mutli empty
}
echo "<input type=\"checkbox\" id=\"cascade\" name=\"cascade\" /> <label for=\"cascade\">{$this->lang['strcascade']}</label>";
- echo '<input type="hidden" name="action" value="empty" />'.PHP_EOL;
+ echo '<input type="hidden" name="action" value="empty" />' . PHP_EOL;
echo $this->misc->form;
- echo "<input type=\"submit\" name=\"empty\" value=\"{$this->lang['strempty']}\" /> <input type=\"submit\" name=\"cancel\" value=\"{$this->lang['strcancel']}\" />".PHP_EOL;
+ echo "<input type=\"submit\" name=\"empty\" value=\"{$this->lang['strempty']}\" /> <input type=\"submit\" name=\"cancel\" value=\"{$this->lang['strcancel']}\" />" . PHP_EOL;
echo "</form>\n"; // END if confirm
} else {
// Do Empty
@@ -1165,7 +1163,7 @@ class TablesController extends BaseController
return $this->doDefault($msg);
}
- return $this->doDefault($sql.'<br>'.$this->lang['strtableemptiedbad']);
+ return $this->doDefault($sql . '<br>' . $this->lang['strtableemptiedbad']);
// END not mutli empty
}
// END do Empty
@@ -1191,28 +1189,28 @@ class TablesController extends BaseController
$this->printTrail('schema');
$this->printTitle($this->lang['strdrop'], 'pg.table.drop');
- echo '<form action="'.\SUBFOLDER.'/src/views/tables" method="post">'.PHP_EOL;
+ echo '<form action="' . \SUBFOLDER . '/src/views/tables" method="post">' . PHP_EOL;
foreach ($_REQUEST['ma'] as $v) {
$a = unserialize(htmlspecialchars_decode($v, ENT_QUOTES));
- echo '<p>', sprintf($this->lang['strconfdroptable'], $this->misc->printVal($a['table'])), '</p>'.PHP_EOL;
+ echo '<p>', sprintf($this->lang['strconfdroptable'], $this->misc->printVal($a['table'])), '</p>' . PHP_EOL;
printf('<input type="hidden" name="table[]" value="%s" />', htmlspecialchars($a['table']));
}
} else {
$this->printTrail('table');
$this->printTitle($this->lang['strdrop'], 'pg.table.drop');
- echo '<p>', sprintf($this->lang['strconfdroptable'], $this->misc->printVal($_REQUEST['table'])), '</p>'.PHP_EOL;
+ echo '<p>', sprintf($this->lang['strconfdroptable'], $this->misc->printVal($_REQUEST['table'])), '</p>' . PHP_EOL;
- echo '<form action="'.\SUBFOLDER.'/src/views/tables" method="post">'.PHP_EOL;
- echo '<input type="hidden" name="table" value="', htmlspecialchars($_REQUEST['table']), '" />'.PHP_EOL;
+ echo '<form action="' . \SUBFOLDER . '/src/views/tables" method="post">' . PHP_EOL;
+ echo '<input type="hidden" name="table" value="', htmlspecialchars($_REQUEST['table']), '" />' . PHP_EOL;
// END if multi drop
}
- echo '<input type="hidden" name="action" value="drop" />'.PHP_EOL;
+ echo '<input type="hidden" name="action" value="drop" />' . PHP_EOL;
echo $this->misc->form;
- echo "<p><input type=\"checkbox\" id=\"cascade\" name=\"cascade\" /> <label for=\"cascade\">{$this->lang['strcascade']}</label></p>".PHP_EOL;
- echo "<input type=\"submit\" name=\"drop\" value=\"{$this->lang['strdrop']}\" />".PHP_EOL;
- echo "<input type=\"submit\" name=\"cancel\" value=\"{$this->lang['strcancel']}\" />".PHP_EOL;
+ echo "<p><input type=\"checkbox\" id=\"cascade\" name=\"cascade\" /> <label for=\"cascade\">{$this->lang['strcascade']}</label></p>" . PHP_EOL;
+ echo "<input type=\"submit\" name=\"drop\" value=\"{$this->lang['strdrop']}\" />" . PHP_EOL;
+ echo "<input type=\"submit\" name=\"cancel\" value=\"{$this->lang['strcancel']}\" />" . PHP_EOL;
echo "</form>\n"; // END confirm
} else {
//If multi drop
diff --git a/src/controllers/ViewpropertiesController.php b/src/controllers/ViewpropertiesController.php
index 898a1375..1e65546b 100644
--- a/src/controllers/ViewpropertiesController.php
+++ b/src/controllers/ViewpropertiesController.php
@@ -27,10 +27,12 @@ class ViewpropertiesController extends BaseController
if ('tree' == $this->action) {
return $this->doTree();
}
+ $footer_template = 'footer.twig';
+ $header_template = 'header.twig';
- $this->printHeader($this->headerTitle('', '', $_REQUEST[$this->subject]));
- $this->printBody();
+ ob_start();
+ $this->printFooter(true, $footer_template);
switch ($this->action) {
case 'save_edit':
if (isset($_POST['cancel'])) {
@@ -41,6 +43,8 @@ class ViewpropertiesController extends BaseController
break;
case 'edit':
+ $footer_template = 'header_sqledit.twig';
+ $footer_template = 'footer_sqledit.twig';
$this->doEdit();
break;
@@ -89,8 +93,13 @@ class ViewpropertiesController extends BaseController
break;
}
+ $output = ob_get_clean();
+
+ $this->printHeader($this->headerTitle('', '', $_REQUEST[$this->subject]), null, true, $header_template);
+ $this->printBody();
- $this->printFooter();
+ echo $output;
+ $this->printFooter(true, $footer_template);
}
/**
@@ -122,6 +131,7 @@ class ViewpropertiesController extends BaseController
$this->printMsg($msg);
$viewdata = $data->getView($_REQUEST[$this->subject]);
+ $this->printHeader($this->headerTitle(), null, true, 'header_sqledit.twig');
if ($viewdata->recordCount() > 0) {
if (!isset($_POST['formDefinition'])) {
@@ -129,23 +139,49 @@ class ViewpropertiesController extends BaseController
$_POST['formComment'] = $viewdata->fields['relcomment'];
}
- echo '<form action="'.\SUBFOLDER.'/src/views/viewproperties" method="post">'.PHP_EOL;
- echo '<table style="width: 100%">'.PHP_EOL;
- echo "\t<tr>\n\t\t<th class=\"data left required\">{$this->lang['strdefinition']}</th>".PHP_EOL;
- echo "\t\t<td class=\"data1\"><textarea style=\"width: 100%;\" rows=\"20\" cols=\"50\" name=\"formDefinition\">",
- htmlspecialchars($_POST['formDefinition']), "</textarea></td>\n\t</tr>".PHP_EOL;
- echo "\t<tr>\n\t\t<th class=\"data left\">{$this->lang['strcomment']}</th>".PHP_EOL;
- echo "\t\t<td class=\"data1\"><textarea rows=\"3\" cols=\"32\" name=\"formComment\">",
- htmlspecialchars($_POST['formComment']), "</textarea></td>\n\t</tr>".PHP_EOL;
- echo '</table>'.PHP_EOL;
- echo '<p><input type="hidden" name="action" value="save_edit" />'.PHP_EOL;
- echo '<input type="hidden" name="view" value="', htmlspecialchars($_REQUEST[$this->subject]), '" />'.PHP_EOL;
- echo $this->misc->form;
- echo "<input type=\"submit\" value=\"{$this->lang['stralter']}\" />".PHP_EOL;
- echo "<input type=\"submit\" name=\"cancel\" value=\"{$this->lang['strcancel']}\" /></p>".PHP_EOL;
- echo '</form>'.PHP_EOL;
+ $variables = (object) [
+ 'subfolder' => \SUBFOLDER . '/src/views/viewproperties',
+
+ 'formDefinition' => htmlspecialchars($_POST['formDefinition']),
+
+ 'formComment' => htmlspecialchars($_POST['formComment']),
+
+ 'subject' => htmlspecialchars($_REQUEST[$this->subject])];
+
+ $edition_area = <<<EOT
+
+<form action="{$variables->subfolder}" method="post">
+ <table style="width: 100%">
+ <tr>
+ <th class="data left required">{$this->lang['strdefinition']}</th>
+ <td class="data1">
+ <textarea style="width: 100%;" rows="20" cols="50" id="query" name="formDefinition">
+ {$variables->formDefinition}
+ </textarea>
+ </td>
+ </tr>
+ <tr>
+ <th class="data left">{$this->lang['strcomment']}</th>
+ <td class="data1">
+ <textarea rows="3" cols="32" name="formComment">
+ {$variables->formComment}
+ </textarea>
+ </td>
+ </tr>
+ </table>
+ <p>
+ <input type="hidden" name="action" value="save_edit" />
+ <input type="hidden" name="view" value="{$variables->subject}" />
+ {$this->misc->form}
+ <input type="submit" value="{$this->lang['stralter']}" />
+ <input type="submit" name="cancel" value="{$this->lang['strcancel']}" />
+ </p>
+</form>
+EOT;
+ echo $edition_area;
+
} else {
- echo "<p>{$this->lang['strnodata']}</p>".PHP_EOL;
+ echo "<p>{$this->lang['strnodata']}</p>" . PHP_EOL;
}
}
@@ -166,10 +202,10 @@ class ViewpropertiesController extends BaseController
$this->printTitle($this->lang['stralter'], 'pg.column.alter');
$this->printMsg($msg);
- echo '<form action="'.\SUBFOLDER.'/src/views/viewproperties" method="post">'.PHP_EOL;
+ echo '<form action="' . \SUBFOLDER . '/src/views/viewproperties" method="post">' . PHP_EOL;
// Output view header
- echo '<table>'.PHP_EOL;
+ echo '<table>' . PHP_EOL;
echo "<tr><th class=\"data required\">{$this->lang['strname']}</th><th class=\"data required\">{$this->lang['strtype']}</th>";
echo "<th class=\"data\">{$this->lang['strdefault']}</th><th class=\"data\">{$this->lang['strcomment']}</th></tr>";
@@ -190,16 +226,16 @@ class ViewpropertiesController extends BaseController
echo '<td><input name="comment" size="32" value="',
htmlspecialchars($_REQUEST['comment']), '" /></td>';
- echo '</table>'.PHP_EOL;
- echo '<p><input type="hidden" name="action" value="properties" />'.PHP_EOL;
- echo '<input type="hidden" name="stage" value="2" />'.PHP_EOL;
+ echo '</table>' . PHP_EOL;
+ echo '<p><input type="hidden" name="action" value="properties" />' . PHP_EOL;
+ echo '<input type="hidden" name="stage" value="2" />' . PHP_EOL;
echo $this->misc->form;
- echo '<input type="hidden" name="view" value="', htmlspecialchars($_REQUEST[$this->subject]), '" />'.PHP_EOL;
- echo '<input type="hidden" name="column" value="', htmlspecialchars($_REQUEST['column']), '" />'.PHP_EOL;
- echo '<input type="hidden" name="olddefault" value="', htmlspecialchars($_REQUEST['olddefault']), '" />'.PHP_EOL;
- echo "<input type=\"submit\" value=\"{$this->lang['stralter']}\" />".PHP_EOL;
- echo "<input type=\"submit\" name=\"cancel\" value=\"{$this->lang['strcancel']}\" /></p>".PHP_EOL;
- echo '</form>'.PHP_EOL;
+ echo '<input type="hidden" name="view" value="', htmlspecialchars($_REQUEST[$this->subject]), '" />' . PHP_EOL;
+ echo '<input type="hidden" name="column" value="', htmlspecialchars($_REQUEST['column']), '" />' . PHP_EOL;
+ echo '<input type="hidden" name="olddefault" value="', htmlspecialchars($_REQUEST['olddefault']), '" />' . PHP_EOL;
+ echo "<input type=\"submit\" value=\"{$this->lang['stralter']}\" />" . PHP_EOL;
+ echo "<input type=\"submit\" name=\"cancel\" value=\"{$this->lang['strcancel']}\" /></p>" . PHP_EOL;
+ echo '</form>' . PHP_EOL;
break;
case 2:
@@ -237,7 +273,7 @@ class ViewpropertiesController extends BaseController
break;
default:
- echo "<p>{$this->lang['strinvalidparam']}</p>".PHP_EOL;
+ echo "<p>{$this->lang['strinvalidparam']}</p>" . PHP_EOL;
}
}
@@ -262,54 +298,54 @@ class ViewpropertiesController extends BaseController
$this->coalesceArr($_POST, 'comment', $view->fields['relcomment']);
- echo '<form action="'.\SUBFOLDER.'/src/views/viewproperties" method="post">'.PHP_EOL;
- echo '<table>'.PHP_EOL;
- echo "<tr><th class=\"data left required\">{$this->lang['strname']}</th>".PHP_EOL;
+ echo '<form action="' . \SUBFOLDER . '/src/views/viewproperties" method="post">' . PHP_EOL;
+ echo '<table>' . PHP_EOL;
+ echo "<tr><th class=\"data left required\">{$this->lang['strname']}</th>" . PHP_EOL;
echo '<td class="data1">';
echo "<input name=\"name\" size=\"32\" maxlength=\"{$data->_maxNameLen}\" value=\"",
- htmlspecialchars($_POST['name']), '" /></td></tr>'.PHP_EOL;
+ htmlspecialchars($_POST['name']), '" /></td></tr>' . PHP_EOL;
if ($data->isSuperUser()) {
// Fetch all users
$users = $data->getUsers();
- echo "<tr><th class=\"data left required\">{$this->lang['strowner']}</th>".PHP_EOL;
+ echo "<tr><th class=\"data left required\">{$this->lang['strowner']}</th>" . PHP_EOL;
echo '<td class="data1"><select name="owner">';
while (!$users->EOF) {
$uname = $users->fields['usename'];
echo '<option value="', htmlspecialchars($uname), '"',
- ($uname == $_POST['owner']) ? ' selected="selected"' : '', '>', htmlspecialchars($uname), '</option>'.PHP_EOL;
+ ($uname == $_POST['owner']) ? ' selected="selected"' : '', '>', htmlspecialchars($uname), '</option>' . PHP_EOL;
$users->moveNext();
}
- echo '</select></td></tr>'.PHP_EOL;
+ echo '</select></td></tr>' . PHP_EOL;
}
if ($data->hasAlterTableSchema()) {
$schemas = $data->getSchemas();
- echo "<tr><th class=\"data left required\">{$this->lang['strschema']}</th>".PHP_EOL;
+ echo "<tr><th class=\"data left required\">{$this->lang['strschema']}</th>" . PHP_EOL;
echo '<td class="data1"><select name="newschema">';
while (!$schemas->EOF) {
$schema = $schemas->fields['nspname'];
echo '<option value="', htmlspecialchars($schema), '"',
- ($schema == $_POST['newschema']) ? ' selected="selected"' : '', '>', htmlspecialchars($schema), '</option>'.PHP_EOL;
+ ($schema == $_POST['newschema']) ? ' selected="selected"' : '', '>', htmlspecialchars($schema), '</option>' . PHP_EOL;
$schemas->moveNext();
}
- echo '</select></td></tr>'.PHP_EOL;
+ echo '</select></td></tr>' . PHP_EOL;
}
- echo "<tr><th class=\"data left\">{$this->lang['strcomment']}</th>".PHP_EOL;
+ echo "<tr><th class=\"data left\">{$this->lang['strcomment']}</th>" . PHP_EOL;
echo '<td class="data1">';
echo '<textarea rows="3" cols="32" name="comment">',
- htmlspecialchars($_POST['comment']), '</textarea></td></tr>'.PHP_EOL;
- echo '</table>'.PHP_EOL;
- echo '<input type="hidden" name="action" value="alter" />'.PHP_EOL;
- echo '<input type="hidden" name="view" value="', htmlspecialchars($_REQUEST[$this->subject]), '" />'.PHP_EOL;
+ htmlspecialchars($_POST['comment']), '</textarea></td></tr>' . PHP_EOL;
+ echo '</table>' . PHP_EOL;
+ echo '<input type="hidden" name="action" value="alter" />' . PHP_EOL;
+ echo '<input type="hidden" name="view" value="', htmlspecialchars($_REQUEST[$this->subject]), '" />' . PHP_EOL;
echo $this->misc->form;
- echo "<p><input type=\"submit\" name=\"alter\" value=\"{$this->lang['stralter']}\" />".PHP_EOL;
- echo "<input type=\"submit\" name=\"cancel\" value=\"{$this->lang['strcancel']}\" /></p>".PHP_EOL;
- echo '</form>'.PHP_EOL;
+ echo "<p><input type=\"submit\" name=\"alter\" value=\"{$this->lang['stralter']}\" />" . PHP_EOL;
+ echo "<input type=\"submit\" name=\"cancel\" value=\"{$this->lang['strcancel']}\" /></p>" . PHP_EOL;
+ echo '</form>' . PHP_EOL;
} else {
- echo "<p>{$this->lang['strnodata']}</p>".PHP_EOL;
+ echo "<p>{$this->lang['strnodata']}</p>" . PHP_EOL;
}
} else {
// For databases that don't allow owner change