From c221f9a3c5508f2b3545fe9131f5c6696e51eec1 Mon Sep 17 00:00:00 2001 From: chriskl Date: Thu, 9 Oct 2003 06:39:10 +0000 Subject: [PATCH] xhtml fixes. make info screen visible. fix missing brackets on check constraints --- classes/Misc.php | 34 ++++---- classes/database/Postgres.php | 7 +- classes/database/Postgres71.php | 4 +- classes/database/Postgres73.php | 4 +- info.php | 145 ++++++++++++++++++++++++++++++++ lang/english.php | 3 +- lang/recoded/english.php | 3 +- 7 files changed, 175 insertions(+), 25 deletions(-) create mode 100644 info.php diff --git a/classes/Misc.php b/classes/Misc.php index d69d0e85..be0603a2 100644 --- a/classes/Misc.php +++ b/classes/Misc.php @@ -2,7 +2,7 @@ /** * Class to hold various commonly used functions * - * $Id: Misc.php,v 1.44 2003/09/30 07:43:08 chriskl Exp $ + * $Id: Misc.php,v 1.45 2003/10/09 06:39:10 chriskl Exp $ */ class Misc { @@ -27,7 +27,7 @@ // If extra security is off, return true if (!$conf['extra_login_security']) return true; - elseif (trim($_SESSION['webdbPassword']) == '') return false; + elseif ($_SESSION['webdbPassword'] == '') return false; else { $username = strtolower($_SESSION['webdbUsername']); return !in_array($username, $bad_usernames); @@ -42,7 +42,7 @@ if (isset($_REQUEST['database'])) { $this->href .= 'database=' . urlencode($_REQUEST['database']); if (isset($_REQUEST['schema'])) - $this->href .= '&schema=' . urlencode($_REQUEST['schema']); + $this->href .= '&schema=' . urlencode($_REQUEST['schema']); } } @@ -224,7 +224,7 @@ // Send XHTML headers, or regular HTML headers if (isset($conf['use_xhtml']) && $conf['use_xhtml']) { echo "\n"; - echo "\n"; + echo "\n"; echo "\n"; } else { echo "\n"; @@ -296,16 +296,17 @@ function printTableNav() { global $lang; - $vars = $this->href . '&table=' . urlencode($_REQUEST['table']); + $vars = $this->href . '&table=' . urlencode($_REQUEST['table']); echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; echo "
{$lang['strcolumns']}{$lang['strindexes']}{$lang['strconstraints']}{$lang['strtriggers']}{$lang['strrules']}{$lang['strprivileges']}{$lang['strexport']}{$lang['strcolumns']}{$lang['strindexes']}{$lang['strconstraints']}{$lang['strtriggers']}{$lang['strrules']}{$lang['strinfo']}{$lang['strprivileges']}{$lang['strexport']}
\n"; } @@ -324,12 +325,11 @@ } // Only show database privs if available if (isset($data->privlist['database'])) { - echo "{$lang['strprivileges']}\n"; + echo "{$lang['strprivileges']}\n"; } - echo "{$lang['strsql']}\n"; - echo "{$lang['strfind']}\n"; - echo "{$lang['stradmin']}\n"; - //echo "{$lang['strexport']}\n"; + echo "{$lang['strsql']}\n"; + echo "{$lang['strfind']}\n"; + echo "{$lang['stradmin']}\n"; echo "\n"; } diff --git a/classes/database/Postgres.php b/classes/database/Postgres.php index c16c9403..4713cecc 100755 --- a/classes/database/Postgres.php +++ b/classes/database/Postgres.php @@ -4,7 +4,7 @@ * A class that implements the DB interface for Postgres * Note: This class uses ADODB and returns RecordSets. * - * $Id: Postgres.php,v 1.151 2003/10/08 02:14:24 chriskl Exp $ + * $Id: Postgres.php,v 1.152 2003/10/09 06:39:10 chriskl Exp $ */ // @@@ THOUGHT: What about inherits? ie. use of ONLY??? @@ -650,6 +650,9 @@ class Postgres extends BaseDB { // End transaction $this->endTransaction(); + // Add a newline to separate data that follows (if any) + $sql .= "\n"; + return $sql; } @@ -2958,7 +2961,7 @@ class Postgres extends BaseDB { $sql = " SELECT rcname AS conname, - 'CHECK ' || rcsrc AS consrc, + 'CHECK (' || rcsrc || ')' AS consrc, 'c' AS contype, NULL::int2vector AS indkey FROM diff --git a/classes/database/Postgres71.php b/classes/database/Postgres71.php index b97dc4d2..6e0bf217 100644 --- a/classes/database/Postgres71.php +++ b/classes/database/Postgres71.php @@ -4,7 +4,7 @@ * A class that implements the DB interface for Postgres * Note: This class uses ADODB and returns RecordSets. * - * $Id: Postgres71.php,v 1.39 2003/10/06 15:26:23 chriskl Exp $ + * $Id: Postgres71.php,v 1.40 2003/10/09 06:39:10 chriskl Exp $ */ // @@@ THOUGHT: What about inherits? ie. use of ONLY??? @@ -243,7 +243,7 @@ class Postgres71 extends Postgres { SELECT conname, consrc, contype, indkey FROM ( SELECT rcname AS conname, - 'CHECK ' || rcsrc AS consrc, + 'CHECK (' || rcsrc || ')' AS consrc, 'c' AS contype, rcrelid AS relid, NULL AS indkey diff --git a/classes/database/Postgres73.php b/classes/database/Postgres73.php index fd1cb4c1..85063d0d 100644 --- a/classes/database/Postgres73.php +++ b/classes/database/Postgres73.php @@ -4,7 +4,7 @@ * A class that implements the DB interface for Postgres * Note: This class uses ADODB and returns RecordSets. * - * $Id: Postgres73.php,v 1.66 2003/10/08 02:14:24 chriskl Exp $ + * $Id: Postgres73.php,v 1.67 2003/10/09 06:39:10 chriskl Exp $ */ // @@@ THOUGHT: What about inherits? ie. use of ONLY??? @@ -914,7 +914,7 @@ class Postgres73 extends Postgres72 { CASE WHEN contype='f' THEN pg_catalog.pg_get_constraintdef(oid) ELSE - 'CHECK ' || consrc + 'CHECK (' || consrc || ')' END AS consrc, contype, conrelid AS relid, diff --git a/info.php b/info.php new file mode 100644 index 00000000..1509eccb --- /dev/null +++ b/info.php @@ -0,0 +1,145 @@ +printTableNav(); + echo "

", $misc->printVal($_REQUEST['database']), ": ", $misc->printVal($_REQUEST['table']), ": {$lang['strinfo']}

\n"; + $misc->printMsg($msg); + + // Fetch info + $referrers = &$localData->getReferrers($_REQUEST['table']); + $parents = &$localData->getTableParents($_REQUEST['table']); + $children = &$localData->getTableChildren($_REQUEST['table']); + + // Check that there is some info + if ($referrers->recordCount() == 0 && $parents->recordCount() == 0 && $children->recordCount() == 0) { + $misc->printMsg($lang['strnoinfo']); + } + else { + // Referring foreign tables + if ($referrers->recordCount() > 0) { + echo "

{$lang['strreferringtables']}

\n"; + echo "\n"; + echo "\t\n\t\t"; + if ($localData->hasSchemas()) { + echo ""; + } + echo ""; + echo ""; + echo "\n"; + echo "\t\n"; + $i = 0; + + while (!$referrers->EOF) { + $id = ( ($i % 2 ) == 0 ? '1' : '2' ); + echo "\t\n\t\t"; + if ($localData->hasSchemas()) { + echo ""; + } + echo ""; + echo ""; + echo ""; + echo "\n"; + echo "\t\n"; + $referrers->movenext(); + $i++; + } + + echo "
{$lang['strschema']}{$lang['strtable']}{$lang['strname']}{$lang['strdefinition']}{$lang['stractions']}
", $misc->printVal($referrers->f['nspname']), "", $misc->printVal($referrers->f['relname']), "", $misc->printVal($referrers->f['conname']), "", $misc->printVal($referrers->f['consrc']), "{$lang['strproperties']}
\n"; + } + + // Parent tables + if ($parents->recordCount() > 0) { + echo "

{$lang['strparenttables']}

\n"; + echo "\n"; + echo "\t\n\t\t"; + if ($localData->hasSchemas()) { + echo ""; + } + echo "\t\t"; + echo "\n"; + echo "\t\n"; + $i = 0; + + while (!$parents->EOF) { + $id = ( ($i % 2 ) == 0 ? '1' : '2' ); + echo "\t\n"; + if ($localData->hasSchemas()) { + echo "\t\t"; + } + echo ""; + echo "\n"; + echo "\t\n"; + $parents->movenext(); + $i++; + } + + echo "
{$lang['strschema']}{$lang['strtable']}{$lang['stractions']}
", $misc->printVal($parents->f['schemaname']), "", $misc->printVal($parents->f['relname']), "{$lang['strproperties']}
\n"; + } + + // Child tables + if ($children->recordCount() > 0) { + echo "

{$lang['strchildtables']}

\n"; + echo "\n"; + echo "\t\n"; + if ($localData->hasSchemas()) { + echo ""; + } + echo "\t\t"; + echo "\n"; + echo "\t\n"; + $i = 0; + + while (!$children->EOF) { + $id = ( ($i % 2 ) == 0 ? '1' : '2' ); + echo "\t\n"; + if ($localData->hasSchemas()) { + echo "\t\t"; + } + echo ""; + echo "\n"; + echo "\t\n"; + $children->movenext(); + $i++; + } + + echo "
{$lang['strschema']}{$lang['strtable']}{$lang['stractions']}
", $misc->printVal($children->f['schemaname']), "", $misc->printVal($children->f['relname']), "{$lang['strproperties']}
\n"; + } + } + } + + $misc->printHeader($lang['strtables'] . ' - ' . $_REQUEST['table'] . ' - ' . $lang['strinfo']); + $misc->printBody(); + + switch ($action) { + default: + doDefault(); + break; + } + + $misc->printFooter(); + +?> diff --git a/lang/english.php b/lang/english.php index 0e21d032..67bf1950 100755 --- a/lang/english.php +++ b/lang/english.php @@ -4,7 +4,7 @@ * English language file for phpPgAdmin. Use this as a basis * for new translations. * - * $Id: english.php,v 1.110 2003/10/08 02:14:24 chriskl Exp $ + * $Id: english.php,v 1.111 2003/10/09 06:39:10 chriskl Exp $ */ // Language and character set @@ -494,6 +494,7 @@ $lang['stroperatordroppedbad'] = 'Operator drop failed.'; // Info + $lang['strnoinfo'] = 'No information available.'; $lang['strreferringtables'] = 'Referring Tables'; $lang['strparenttables'] = 'Parent Tables'; $lang['strchildtables'] = 'Child Tables'; diff --git a/lang/recoded/english.php b/lang/recoded/english.php index c5b5fecb..a95614cf 100644 --- a/lang/recoded/english.php +++ b/lang/recoded/english.php @@ -4,7 +4,7 @@ * English language file for phpPgAdmin. Use this as a basis * for new translations. * - * $Id: english.php,v 1.62 2003/10/08 02:14:24 chriskl Exp $ + * $Id: english.php,v 1.63 2003/10/09 06:39:10 chriskl Exp $ */ // Language and character set @@ -494,6 +494,7 @@ $lang['stroperatordroppedbad'] = 'Operator drop failed.'; // Info + $lang['strnoinfo'] = 'No information available.'; $lang['strreferringtables'] = 'Referring Tables'; $lang['strparenttables'] = 'Parent Tables'; $lang['strchildtables'] = 'Child Tables'; -- 2.39.5