/**
* 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 {
// 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);
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']);
}
}
// Send XHTML headers, or regular HTML headers
if (isset($conf['use_xhtml']) && $conf['use_xhtml']) {
echo "<?xml version=\"1.0\" encoding=\"", htmlspecialchars($lang['appcharset']), "\"?>\n";
- echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n";\r
+ echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-Transitional.dtd\">\n";\r
echo "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\">\n";
} else {
echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n";
function printTableNav() {
global $lang;
- $vars = $this->href . '&table=' . urlencode($_REQUEST['table']);
+ $vars = $this->href . '&table=' . urlencode($_REQUEST['table']);
echo "<table class=\"navbar\" border=\"0\" width=\"100%\" cellpadding=\"5\" cellspacing=\"3\"><tr>\n";
- echo "<td width=\"14%\"><a href=\"tblproperties.php?{$vars}\">{$lang['strcolumns']}</a></td>\n";
- echo "<td width=\"14%\"><a href=\"indexes.php?{$vars}\">{$lang['strindexes']}</a></td>\n";
- echo "<td width=\"14%\"><a href=\"constraints.php?{$vars}\">{$lang['strconstraints']}</a></td>\n";
- echo "<td width=\"14%\"><a href=\"triggers.php?{$vars}\">{$lang['strtriggers']}</a></td>\n";
- echo "<td width=\"14%\"><a href=\"rules.php?{$vars}\">{$lang['strrules']}</a></td>\n";
- echo "<td width=\"14%\"><a href=\"privileges.php?{$vars}&type=table&object=", urlencode($_REQUEST['table']), "\">{$lang['strprivileges']}</a></td>\n";
- echo "<td width=\"14%\"><a href=\"tblproperties.php?{$vars}&action=export\">{$lang['strexport']}</a></td>\n";
+ echo "<td width=\"12%\"><a href=\"tblproperties.php?{$vars}\">{$lang['strcolumns']}</a></td>\n";
+ echo "<td width=\"13%\"><a href=\"indexes.php?{$vars}\">{$lang['strindexes']}</a></td>\n";
+ echo "<td width=\"12%\"><a href=\"constraints.php?{$vars}\">{$lang['strconstraints']}</a></td>\n";
+ echo "<td width=\"13%\"><a href=\"triggers.php?{$vars}\">{$lang['strtriggers']}</a></td>\n";
+ echo "<td width=\"12%\"><a href=\"rules.php?{$vars}\">{$lang['strrules']}</a></td>\n";
+ echo "<td width=\"13%\"><a href=\"info.php?{$vars}\">{$lang['strinfo']}</a></td>\n";
+ echo "<td width=\"12%\"><a href=\"privileges.php?{$vars}&type=table&object=", urlencode($_REQUEST['table']), "\">{$lang['strprivileges']}</a></td>\n";
+ echo "<td width=\"13%\"><a href=\"tblproperties.php?{$vars}&action=export\">{$lang['strexport']}</a></td>\n";
echo "</tr></table>\n";
}
}
// Only show database privs if available
if (isset($data->privlist['database'])) {
- echo "<td width=\"20%\"><a href=\"privileges.php?{$vars}&type=database&object=", urlencode($_REQUEST['database']), "\">{$lang['strprivileges']}</a></td>\n";
+ echo "<td width=\"20%\"><a href=\"privileges.php?{$vars}&type=database&object=", urlencode($_REQUEST['database']), "\">{$lang['strprivileges']}</a></td>\n";
}
- echo "<td width=\"20%\"><a href=\"database.php?{$vars}&action=sql\">{$lang['strsql']}</a></td>\n";
- echo "<td width=\"20%\"><a href=\"database.php?{$vars}&action=find\">{$lang['strfind']}</a></td>\n";
- echo "<td width=\"20%\"><a href=\"database.php?{$vars}&action=admin\">{$lang['stradmin']}</a></td>\n";
- //echo "<td width=\"20%\"><a href=\"database.php?{$vars}&action=export\">{$lang['strexport']}</a></td></tr>\n";
+ echo "<td width=\"20%\"><a href=\"database.php?{$vars}&action=sql\">{$lang['strsql']}</a></td>\n";
+ echo "<td width=\"20%\"><a href=\"database.php?{$vars}&action=find\">{$lang['strfind']}</a></td>\n";
+ echo "<td width=\"20%\"><a href=\"database.php?{$vars}&action=admin\">{$lang['stradmin']}</a></td>\n";
echo "</tr></table>\n";
}
* 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???
// End transaction
$this->endTransaction();
+ // Add a newline to separate data that follows (if any)
+ $sql .= "\n";
+
return $sql;
}
$sql = "
SELECT
rcname AS conname,
- 'CHECK ' || rcsrc AS consrc,
+ 'CHECK (' || rcsrc || ')' AS consrc,
'c' AS contype,
NULL::int2vector AS indkey
FROM
* 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???
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
* 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???
CASE WHEN contype='f' THEN
pg_catalog.pg_get_constraintdef(oid)
ELSE
- 'CHECK ' || consrc
+ 'CHECK (' || consrc || ')'
END AS consrc,
contype,
conrelid AS relid,
--- /dev/null
+<?php
+
+ /**
+ * List extra information on a table
+ *
+ * $Id: info.php,v 1.1 2003/10/09 06:39:10 chriskl Exp $
+ */
+
+ // Include application functions
+ include_once('libraries/lib.inc.php');
+
+ $action = (isset($_REQUEST['action'])) ? $_REQUEST['action'] : '';
+ $PHP_SELF = $_SERVER['PHP_SELF'];
+
+ /**
+ * List all the information on the table
+ */
+ function doDefault($msg = '') {
+ global $localData, $misc;
+ global $lang;
+
+ $misc->printTableNav();
+ echo "<h2>", $misc->printVal($_REQUEST['database']), ": ", $misc->printVal($_REQUEST['table']), ": {$lang['strinfo']}</h2>\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 "<h3>{$lang['strreferringtables']}</h3>\n";
+ echo "<table>\n";
+ echo "\t<tr>\n\t\t";
+ if ($localData->hasSchemas()) {
+ echo "<th class=\"data\">{$lang['strschema']}</th>";
+ }
+ echo "<th class=\"data\">{$lang['strtable']}</th>";
+ echo "<th class=\"data\">{$lang['strname']}</th><th class=\"data\">{$lang['strdefinition']}</th>";
+ echo "<th class=\"data\">{$lang['stractions']}</th>\n";
+ echo "\t</tr>\n";
+ $i = 0;
+
+ while (!$referrers->EOF) {
+ $id = ( ($i % 2 ) == 0 ? '1' : '2' );
+ echo "\t<tr>\n\t\t";
+ if ($localData->hasSchemas()) {
+ echo "<td class=\"data{$id}\">", $misc->printVal($referrers->f['nspname']), "</td>";
+ }
+ echo "<td class=\"data{$id}\">", $misc->printVal($referrers->f['relname']), "</td>";
+ echo "<td class=\"data{$id}\">", $misc->printVal($referrers->f['conname']), "</td>";
+ echo "<td class=\"data{$id}\">", $misc->printVal($referrers->f['consrc']), "</td>";
+ echo "<td class=\"opbutton{$id}\"><a href=\"constraints.php?database=", urlencode($_REQUEST['database']),
+ "&schema=", urlencode($referrers->f['nspname']),
+ "&table=", urlencode($referrers->f['relname']), "\">{$lang['strproperties']}</a></td>\n";
+ echo "\t</tr>\n";
+ $referrers->movenext();
+ $i++;
+ }
+
+ echo "</table>\n";
+ }
+
+ // Parent tables
+ if ($parents->recordCount() > 0) {
+ echo "<h3>{$lang['strparenttables']}</h3>\n";
+ echo "<table>\n";
+ echo "\t<tr>\n\t\t";
+ if ($localData->hasSchemas()) {
+ echo "<th class=\"data\">{$lang['strschema']}</th>";
+ }
+ echo "\t\t<th class=\"data\">{$lang['strtable']}</th>";
+ echo "<th class=\"data\">{$lang['stractions']}</th>\n";
+ echo "\t</tr>\n";
+ $i = 0;
+
+ while (!$parents->EOF) {
+ $id = ( ($i % 2 ) == 0 ? '1' : '2' );
+ echo "\t<tr>\n";
+ if ($localData->hasSchemas()) {
+ echo "\t\t<td class=\"data{$id}\">", $misc->printVal($parents->f['schemaname']), "</td>";
+ }
+ echo "<td class=\"data{$id}\">", $misc->printVal($parents->f['relname']), "</td>";
+ echo "<td class=\"opbutton{$id}\"><a href=\"tblproperties.php?database=", urlencode($_REQUEST['database']),
+ "&schema=", urlencode($parents->f['schemaname']),
+ "&table=", urlencode($parents->f['relname']), "\">{$lang['strproperties']}</a></td>\n";
+ echo "\t</tr>\n";
+ $parents->movenext();
+ $i++;
+ }
+
+ echo "</table>\n";
+ }
+
+ // Child tables
+ if ($children->recordCount() > 0) {
+ echo "<h3>{$lang['strchildtables']}</h3>\n";
+ echo "<table>\n";
+ echo "\t<tr>\n";
+ if ($localData->hasSchemas()) {
+ echo "<th class=\"data\">{$lang['strschema']}</th>";
+ }
+ echo "\t\t<th class=\"data\">{$lang['strtable']}</th>";
+ echo "<th class=\"data\">{$lang['stractions']}</th>\n";
+ echo "\t</tr>\n";
+ $i = 0;
+
+ while (!$children->EOF) {
+ $id = ( ($i % 2 ) == 0 ? '1' : '2' );
+ echo "\t<tr>\n";
+ if ($localData->hasSchemas()) {
+ echo "\t\t<td class=\"data{$id}\">", $misc->printVal($children->f['schemaname']), "</td>";
+ }
+ echo "<td class=\"data{$id}\">", $misc->printVal($children->f['relname']), "</td>";
+ echo "<td class=\"opbutton{$id}\"><a href=\"tblproperties.php?database=", urlencode($_REQUEST['database']),
+ "&schema=", urlencode($children->f['schemaname']),
+ "&table=", urlencode($children->f['relname']), "\">{$lang['strproperties']}</a></td>\n";
+ echo "\t</tr>\n";
+ $children->movenext();
+ $i++;
+ }
+
+ echo "</table>\n";
+ }
+ }
+ }
+
+ $misc->printHeader($lang['strtables'] . ' - ' . $_REQUEST['table'] . ' - ' . $lang['strinfo']);
+ $misc->printBody();
+
+ switch ($action) {
+ default:
+ doDefault();
+ break;
+ }
+
+ $misc->printFooter();
+
+?>
* 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
$lang['stroperatordroppedbad'] = 'Operator drop failed.';
// Info
+ $lang['strnoinfo'] = 'No information available.';
$lang['strreferringtables'] = 'Referring Tables';
$lang['strparenttables'] = 'Parent Tables';
$lang['strchildtables'] = 'Child Tables';
* 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
$lang['stroperatordroppedbad'] = 'Operator drop failed.';
// Info
+ $lang['strnoinfo'] = 'No information available.';
$lang['strreferringtables'] = 'Referring Tables';
$lang['strparenttables'] = 'Parent Tables';
$lang['strchildtables'] = 'Child Tables';