mirror of
https://github.com/vrana/adminer.git
synced 2025-08-18 04:11:27 +02:00
Schema support for PostgreSQL
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@1521 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
@@ -506,32 +506,40 @@ document.getElementById('username').focus();
|
||||
<p>
|
||||
<?php hidden_fields_get(); ?>
|
||||
<?php echo ($databases ? html_select("db", array("" => "(" . lang('database') . ")") + $databases, DB, "this.form.submit();") : '<input name="db" value="' . h(DB) . '">'); ?>
|
||||
<?php if (isset($_GET["sql"])) { ?><input type="hidden" name="sql" value=""><?php } ?>
|
||||
<?php if (isset($_GET["schema"])) { ?><input type="hidden" name="schema" value=""><?php } ?>
|
||||
<?php if (isset($_GET["dump"])) { ?><input type="hidden" name="dump" value=""><?php } ?>
|
||||
<input type="submit" value="<?php echo lang('Use'); ?>"<?php echo ($databases ? " class='hidden'" : ""); ?>>
|
||||
</p>
|
||||
</form>
|
||||
<?php
|
||||
if ($missing != "db" && DB != "" && $connection->select_db(DB)) {
|
||||
$tables = tables_list();
|
||||
if (!$tables) {
|
||||
echo "<p class='message'>" . lang('No tables.') . "\n";
|
||||
} else {
|
||||
$this->tablesPrint($tables);
|
||||
$links = array();
|
||||
foreach ($tables as $table => $type) {
|
||||
$links[] = preg_quote($table, '/');
|
||||
if (support("scheme")) {
|
||||
echo "<br>" . html_select("ns", array("" => "(" . lang('schema') . ")") + schemas(), $_GET["ns"], "this.form.submit();");
|
||||
if ($_GET["ns"] != "") {
|
||||
set_schema($_GET["ns"]);
|
||||
}
|
||||
echo "<script type='text/javascript'>\n";
|
||||
echo "var jushLinks = { $driver: [ '" . addcslashes(h(ME), "\\'/") . "table=\$&', /\\b(" . implode("|", $links) . ")\\b/g ] };\n";
|
||||
foreach (array("bac", "bra", "sqlite_quo", "mssql_bra") as $val) {
|
||||
echo "jushLinks.$val = jushLinks.$driver;\n";
|
||||
}
|
||||
echo "</script>\n";
|
||||
}
|
||||
echo '<p><a href="' . h(ME) . 'create=">' . bold(lang('Create new table'), $_GET["create"] === "") . "</a>\n";
|
||||
if ($_GET["ns"] !== "") {
|
||||
$tables = tables_list();
|
||||
if (!$tables) {
|
||||
echo "<p class='message'>" . lang('No tables.') . "\n";
|
||||
} else {
|
||||
$this->tablesPrint($tables);
|
||||
$links = array();
|
||||
foreach ($tables as $table => $type) {
|
||||
$links[] = preg_quote($table, '/');
|
||||
}
|
||||
echo "<script type='text/javascript'>\n";
|
||||
echo "var jushLinks = { $driver: [ '" . addcslashes(h(ME), "\\'/") . "table=\$&', /\\b(" . implode("|", $links) . ")\\b/g ] };\n";
|
||||
foreach (array("bac", "bra", "sqlite_quo", "mssql_bra") as $val) {
|
||||
echo "jushLinks.$val = jushLinks.$driver;\n";
|
||||
}
|
||||
echo "</script>\n";
|
||||
}
|
||||
echo '<p><a href="' . h(ME) . 'create=">' . bold(lang('Create new table'), $_GET["create"] === "") . "</a>\n";
|
||||
}
|
||||
}
|
||||
echo (isset($_GET["sql"]) ? '<input type="hidden" name="sql" value="">'
|
||||
: (isset($_GET["schema"]) ? '<input type="hidden" name="schema" value="">'
|
||||
: (isset($_GET["dump"]) ? '<input type="hidden" name="dump" value="">'
|
||||
: "")));
|
||||
echo "</form>\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -46,7 +46,7 @@ if (isset($_POST["server"])) {
|
||||
set_session($key, null);
|
||||
}
|
||||
cookie("adminer_permanent", "");
|
||||
redirect(substr(preg_replace('~(username|db)=[^&]*&~', '', ME), 0, -1), lang('Logout successful.'));
|
||||
redirect(substr(preg_replace('~(username|db|ns)=[^&]*&~', '', ME), 0, -1), lang('Logout successful.'));
|
||||
}
|
||||
} elseif ($_COOKIE["adminer_permanent"]) {
|
||||
list($server, $username, $cipher, $system) = array_map('base64_decode', explode(":", $_COOKIE["adminer_permanent"])); // $driver is a global variable
|
||||
|
@@ -71,7 +71,7 @@ define("ME", preg_replace('~^[^?]*/([^?]*).*~', '\\1', $_SERVER["REQUEST_URI"])
|
||||
. (SID && !$_COOKIE ? SID . '&' : '') // !$_COOKIE - don't pass SID with permanent login
|
||||
. (SERVER !== null ? DRIVER . "=" . urlencode(SERVER) . '&' : '')
|
||||
. (isset($_GET["username"]) ? "username=" . urlencode($_GET["username"]) . '&' : '')
|
||||
. (DB != "" ? 'db=' . urlencode(DB) . '&' : '')
|
||||
. (DB != "" ? 'db=' . urlencode(DB) . '&' . (isset($_GET["ns"]) ? "ns=" . urlencode($_GET["ns"]) . "&" : "") : '')
|
||||
);
|
||||
|
||||
include "../adminer/include/version.inc.php";
|
||||
|
@@ -61,3 +61,7 @@ if (!(DB != "" ? $connection->select_db(DB) : isset($_GET["sql"]) || isset($_GET
|
||||
connect_error(); // separate function to catch SQLite error
|
||||
exit;
|
||||
}
|
||||
|
||||
if (support("scheme") && DB != "" && $_GET["ns"] !== "" && (!isset($_GET["ns"]) || !set_schema($_GET["ns"]))) {
|
||||
redirect(preg_replace('~ns=[^&]*&~', '', ME) . "ns=" . get_schema());
|
||||
}
|
||||
|
@@ -31,17 +31,20 @@ function page_header($title, $error = "", $breadcrumb = array(), $title2 = "") {
|
||||
<div id="content">
|
||||
<?php
|
||||
if (isset($breadcrumb)) {
|
||||
$link = substr(preg_replace('~(username|db)=[^&]*&~', '', ME), 0, -1);
|
||||
$link = substr(preg_replace('~(username|db|ns)=[^&]*&~', '', ME), 0, -1);
|
||||
echo '<p id="breadcrumb"><a href="' . ($link ? h($link) : ".") . '">' . $drivers[DRIVER] . '</a> » ';
|
||||
$link = substr(preg_replace('~db=[^&]*&~', '', ME), 0, -1);
|
||||
$link = substr(preg_replace('~(db|ns)=[^&]*&~', '', ME), 0, -1);
|
||||
$server = (SERVER != "" ? h(SERVER) : lang('Server'));
|
||||
if ($breadcrumb === false) {
|
||||
echo "$server\n";
|
||||
} else {
|
||||
echo "<a href='" . ($link ? h($link) : ".") . "'>$server</a> » ";
|
||||
if ($_GET["ns"] != "" || (DB != "" && is_array($breadcrumb))) {
|
||||
echo '<a href="' . h($link . "&db=" . urlencode(DB) . (support("scheme") ? "&ns=" : "")) . '">' . h(DB) . '</a> » ';
|
||||
}
|
||||
if (is_array($breadcrumb)) {
|
||||
if (DB != "") {
|
||||
echo '<a href="' . h(substr(ME, 0, -1)) . '">' . h(DB) . '</a> » ';
|
||||
if ($_GET["ns"] != "") {
|
||||
echo '<a href="' . h(substr(ME, 0, -1)) . '">' . h($_GET["ns"]) . '</a> » ';
|
||||
}
|
||||
foreach ($breadcrumb as $key => $val) {
|
||||
$desc = (is_array($val) ? $val[1] : $val);
|
||||
|
Reference in New Issue
Block a user