mirror of
https://github.com/vrana/adminer.git
synced 2025-08-07 15:16:44 +02:00
Define DB
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@1044 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
@@ -112,7 +112,7 @@ if ($_POST) {
|
||||
$row["fields"][] = $field;
|
||||
}
|
||||
if ($dbh->server_info >= 5.1) {
|
||||
$from = "FROM information_schema.PARTITIONS WHERE TABLE_SCHEMA = " . $dbh->quote($_GET["db"]) . " AND TABLE_NAME = " . $dbh->quote($_GET["create"]);
|
||||
$from = "FROM information_schema.PARTITIONS WHERE TABLE_SCHEMA = " . $dbh->quote(DB) . " AND TABLE_NAME = " . $dbh->quote($_GET["create"]);
|
||||
$result = $dbh->query("SELECT PARTITION_METHOD, PARTITION_ORDINAL_POSITION, PARTITION_EXPRESSION $from ORDER BY PARTITION_ORDINAL_POSITION DESC LIMIT 1");
|
||||
list($row["partition_by"], $row["partitions"], $row["partition"]) = $result->fetch_row();
|
||||
$row["partition_names"] = array();
|
||||
|
@@ -2,8 +2,8 @@
|
||||
if ($_POST && !$error && !isset($_POST["add_x"])) { // add is an image and PHP changes add.x to add_x
|
||||
if ($_POST["drop"]) {
|
||||
unset($_SESSION["databases"][$_GET["server"]]);
|
||||
query_redirect("DROP DATABASE " . idf_escape($_GET["db"]), substr(preg_replace('~db=[^&]*&~', '', ME), 0, -1), lang('Database has been dropped.'));
|
||||
} elseif ($_GET["db"] !== $_POST["name"]) {
|
||||
query_redirect("DROP DATABASE " . idf_escape(DB), substr(preg_replace('~db=[^&]*&~', '', ME), 0, -1), lang('Database has been dropped.'));
|
||||
} elseif (DB !== $_POST["name"]) {
|
||||
// create or rename database
|
||||
unset($_SESSION["databases"][$_GET["server"]]); // clear cache
|
||||
$dbs = explode("\n", str_replace("\r", "", $_POST["name"]));
|
||||
@@ -17,7 +17,7 @@ if ($_POST && !$error && !isset($_POST["add_x"])) { // add is an image and PHP c
|
||||
$last = $db;
|
||||
}
|
||||
}
|
||||
if (query_redirect(queries(), ME . "db=" . urlencode($last), lang('Database has been created.'), !strlen($_GET["db"]), false, $failed)) {
|
||||
if (query_redirect(queries(), ME . "db=" . urlencode($last), lang('Database has been created.'), !strlen(DB), false, $failed)) {
|
||||
$result = $dbh->query("SHOW TABLES");
|
||||
while ($row = $result->fetch_row()) {
|
||||
if (!queries("RENAME TABLE " . idf_escape($row[0]) . " TO " . idf_escape($_POST["name"]) . "." . idf_escape($row[0]))) {
|
||||
@@ -25,7 +25,7 @@ if ($_POST && !$error && !isset($_POST["add_x"])) { // add is an image and PHP c
|
||||
}
|
||||
}
|
||||
if (!$row) {
|
||||
queries("DROP DATABASE " . idf_escape($_GET["db"]));
|
||||
queries("DROP DATABASE " . idf_escape(DB));
|
||||
}
|
||||
query_redirect(queries(), preg_replace('~db=[^&]*&~', '', ME) . "db=" . urlencode($_POST["name"]), lang('Database has been renamed.'), !$row, false, $row);
|
||||
}
|
||||
@@ -38,15 +38,15 @@ if ($_POST && !$error && !isset($_POST["add_x"])) { // add is an image and PHP c
|
||||
}
|
||||
}
|
||||
|
||||
page_header(strlen($_GET["db"]) ? lang('Alter database') : lang('Create database'), $error, array(), $_GET["db"]);
|
||||
page_header(strlen(DB) ? lang('Alter database') : lang('Create database'), $error, array(), DB);
|
||||
|
||||
$collations = collations();
|
||||
$name = $_GET["db"];
|
||||
$name = DB;
|
||||
$collate = array();
|
||||
if ($_POST) {
|
||||
$name = $_POST["name"];
|
||||
$collate = $_POST["collation"];
|
||||
} elseif (!strlen($_GET["db"])) {
|
||||
} elseif (!strlen(DB)) {
|
||||
// propose database name with limited privileges
|
||||
$result = $dbh->query("SHOW GRANTS");
|
||||
while ($row = $result->fetch_row()) {
|
||||
@@ -55,7 +55,7 @@ if ($_POST) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
} elseif (($result = $dbh->query("SHOW CREATE DATABASE " . idf_escape($_GET["db"])))) {
|
||||
} elseif (($result = $dbh->query("SHOW CREATE DATABASE " . idf_escape(DB)))) {
|
||||
$create = $dbh->result($result, 1);
|
||||
if (preg_match('~ COLLATE ([^ ]+)~', $create, $match)) {
|
||||
$collate = $match[1];
|
||||
@@ -76,7 +76,7 @@ if ($_POST) {
|
||||
<input type="hidden" name="token" value="<?php echo $token; ?>">
|
||||
<input type="submit" value="<?php echo lang('Save'); ?>">
|
||||
<?php
|
||||
if (strlen($_GET["db"])) {
|
||||
if (strlen(DB)) {
|
||||
echo "<input type='submit' name='drop' value='" . lang('Drop') . "'$confirm>\n";
|
||||
} elseif (!$_POST["add_x"]) {
|
||||
echo "<input type='image' name='add' src='../adminer/plus.gif' alt='+' title='" . lang('Add next') . "'>\n";
|
||||
|
@@ -38,7 +38,7 @@ if ($tables_views && !$error) {
|
||||
query_redirect(queries(), substr(ME, 0, -1), $message, $result, false, !$result);
|
||||
}
|
||||
|
||||
page_header(lang('Database') . ": " . h($_GET["db"]), $error, false);
|
||||
page_header(lang('Database') . ": " . h(DB), $error, false);
|
||||
echo '<p><a href="' . h(ME) . 'database=">' . lang('Alter database') . "</a>\n";
|
||||
echo '<p><a href="' . h(ME) . 'schema=">' . lang('Database schema') . "</a>\n";
|
||||
|
||||
@@ -69,7 +69,7 @@ if (!$table_status) {
|
||||
echo "<p><input type='hidden' name='token' value='$token'><input type='submit' value='" . lang('Analyze') . "'> <input type='submit' name='optimize' value='" . lang('Optimize') . "'> <input type='submit' name='check' value='" . lang('Check') . "'> <input type='submit' name='repair' value='" . lang('Repair') . "'> <input type='submit' name='truncate' value='" . lang('Truncate') . "'$confirm> <input type='submit' name='drop' value='" . lang('Drop') . "'$confirm>\n";
|
||||
$dbs = get_databases();
|
||||
if (count($dbs) != 1) {
|
||||
$db = (isset($_POST["target"]) ? $_POST["target"] : $_GET["db"]);
|
||||
$db = (isset($_POST["target"]) ? $_POST["target"] : DB);
|
||||
echo "<p>" . lang('Move to other database') . ($dbs ? ": <select name='target'>" . optionlist($dbs, $db) . "</select>" : ': <input name="target" value="' . h($db) . '">') . " <input type='submit' name='move' value='" . lang('Move') . "'>\n";
|
||||
}
|
||||
echo "</form>\n";
|
||||
@@ -78,7 +78,7 @@ if (!$table_status) {
|
||||
if ($dbh->server_info >= 5) {
|
||||
echo '<p><a href="' . h(ME) . 'view=">' . lang('Create view') . "</a>\n";
|
||||
echo "<h3>" . lang('Routines') . "</h3>\n";
|
||||
$result = $dbh->query("SELECT * FROM information_schema.ROUTINES WHERE ROUTINE_SCHEMA = " . $dbh->quote($_GET["db"]));
|
||||
$result = $dbh->query("SELECT * FROM information_schema.ROUTINES WHERE ROUTINE_SCHEMA = " . $dbh->quote(DB));
|
||||
if ($result->num_rows) {
|
||||
echo "<table cellspacing='0'>\n";
|
||||
while ($row = $result->fetch_assoc()) {
|
||||
|
@@ -25,7 +25,7 @@ function dump_triggers($table, $style) {
|
||||
}
|
||||
|
||||
if ($_POST) {
|
||||
$ext = dump_headers((strlen($_GET["dump"]) ? $_GET["dump"] : $_GET["db"]), (!strlen($_GET["db"]) || count((array) $_POST["tables"] + (array) $_POST["data"]) > 1));
|
||||
$ext = dump_headers((strlen($_GET["dump"]) ? $_GET["dump"] : DB), (!strlen(DB) || count((array) $_POST["tables"] + (array) $_POST["data"]) > 1));
|
||||
if ($_POST["format"] == "sql") {
|
||||
dump("SET NAMES utf8;
|
||||
SET foreign_key_checks = 0;
|
||||
@@ -36,7 +36,7 @@ SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
|
||||
}
|
||||
|
||||
$style = $_POST["db_style"];
|
||||
foreach ((strlen($_GET["db"]) ? array($_GET["db"]) : (array) $_POST["databases"]) as $db) {
|
||||
foreach ((strlen(DB) ? array(DB) : (array) $_POST["databases"]) as $db) {
|
||||
if ($dbh->select_db($db)) {
|
||||
if ($_POST["format"] == "sql" && ereg('CREATE', $style) && ($result = $dbh->query("SHOW CREATE DATABASE " . idf_escape($db)))) {
|
||||
if ($style == "DROP+CREATE") {
|
||||
@@ -72,8 +72,8 @@ SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
|
||||
if ($_POST["table_style"] || $_POST["data_style"]) {
|
||||
$views = array();
|
||||
foreach (table_status() as $row) {
|
||||
$table = (!strlen($_GET["db"]) || in_array($row["Name"], (array) $_POST["tables"]));
|
||||
$data = (!strlen($_GET["db"]) || in_array($row["Name"], (array) $_POST["data"]));
|
||||
$table = (!strlen(DB) || in_array($row["Name"], (array) $_POST["tables"]));
|
||||
$data = (!strlen(DB) || in_array($row["Name"], (array) $_POST["data"]));
|
||||
if ($table || $data) {
|
||||
if (isset($row["Engine"])) {
|
||||
if ($ext == "tar") {
|
||||
@@ -87,7 +87,7 @@ SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
|
||||
dump_triggers($row["Name"], $_POST["table_style"]);
|
||||
}
|
||||
if ($ext == "tar") {
|
||||
dump(tar_file((strlen($_GET["db"]) ? "" : "$db/") . "$row[Name].csv", ob_get_clean()));
|
||||
dump(tar_file((strlen(DB) ? "" : "$db/") . "$row[Name].csv", ob_get_clean()));
|
||||
} elseif ($_POST["format"] == "sql") {
|
||||
dump("\n");
|
||||
}
|
||||
@@ -150,7 +150,7 @@ DROP PROCEDURE adminer_alter;
|
||||
exit;
|
||||
}
|
||||
|
||||
page_header(lang('Export'), "", (strlen($_GET["export"]) ? array("table" => $_GET["export"]) : array()), $_GET["db"]);
|
||||
page_header(lang('Export'), "", (strlen($_GET["export"]) ? array("table" => $_GET["export"]) : array()), DB);
|
||||
?>
|
||||
|
||||
<form action="" method="post">
|
||||
@@ -166,7 +166,7 @@ if ($dbh->server_info >= 5) {
|
||||
echo "<tr><th>" . lang('Output') . "<td><input type='hidden' name='token' value='$token'>$dump_output\n"; // token is not needed but checked in bootstrap for all POST data
|
||||
echo "<tr><th>" . lang('Format') . "<td>$dump_format\n";
|
||||
echo "<tr><th>" . lang('Compression') . "<td>" . ($dump_compress ? $dump_compress : lang('None of the supported PHP extensions (%s) are available.', 'zlib, bz2')) . "\n";
|
||||
echo "<tr><th>" . lang('Database') . "<td><select name='db_style'>" . optionlist($db_style, (strlen($_GET["db"]) ? '' : 'CREATE')) . "</select>\n";
|
||||
echo "<tr><th>" . lang('Database') . "<td><select name='db_style'>" . optionlist($db_style, (strlen(DB) ? '' : 'CREATE')) . "</select>\n";
|
||||
echo "<tr><th>" . lang('Tables') . "<td><select name='table_style'>" . optionlist($table_style, 'DROP+CREATE') . "</select>\n";
|
||||
echo "<tr><th>" . lang('Data') . "<td><select name='data_style'>" . optionlist($data_style, 'INSERT') . "</select>\n";
|
||||
?>
|
||||
@@ -175,7 +175,7 @@ echo "<tr><th>" . lang('Data') . "<td><select name='data_style'>" . optionlist($
|
||||
|
||||
<table cellspacing="0">
|
||||
<?php
|
||||
if (strlen($_GET["db"])) {
|
||||
if (strlen(DB)) {
|
||||
$checked = (strlen($_GET["dump"]) ? "" : " checked");
|
||||
echo "<thead><tr>";
|
||||
echo "<th style='text-align: left;'><label><input type='checkbox' id='check-tables'$checked onclick='form_check(this, /^tables\\[/);'>" . lang('Tables') . "</label>";
|
||||
|
@@ -29,7 +29,7 @@ $row = array();
|
||||
if ($_POST) {
|
||||
$row = $_POST;
|
||||
} elseif (strlen($_GET["event"])) {
|
||||
$result = $dbh->query("SELECT * FROM information_schema.EVENTS WHERE EVENT_SCHEMA = " . $dbh->quote($_GET["db"]) . " AND EVENT_NAME = " . $dbh->quote($_GET["event"]));
|
||||
$result = $dbh->query("SELECT * FROM information_schema.EVENTS WHERE EVENT_SCHEMA = " . $dbh->quote(DB) . " AND EVENT_NAME = " . $dbh->quote($_GET["event"]));
|
||||
$row = $result->fetch_assoc();
|
||||
}
|
||||
?>
|
||||
|
@@ -22,8 +22,8 @@ class Adminer {
|
||||
* @return string
|
||||
*/
|
||||
function database() {
|
||||
// should be used everywhere instead of $_GET["db"]
|
||||
return $_GET["db"];
|
||||
// should be used everywhere instead of DB
|
||||
return DB;
|
||||
}
|
||||
|
||||
/** Print login form
|
||||
@@ -336,8 +336,8 @@ class Adminer {
|
||||
*/
|
||||
function messageQuery($query) {
|
||||
$id = "sql-" . count($_SESSION["messages"]);
|
||||
$_SESSION["history"][$_GET["server"]][$_GET["db"]][] = $query;
|
||||
return " <a href='#$id' onclick=\"return !toggle('$id');\">" . lang('SQL command') . "</a><div id='$id' class='hidden'><pre class='jush-sql'>" . h($query) . '</pre><a href="' . h(ME . 'sql=&history=' . (count($_SESSION["history"][$_GET["server"]][$_GET["db"]]) - 1)) . '">' . lang('Edit') . '</a></div>';
|
||||
$_SESSION["history"][$_GET["server"]][DB][] = $query;
|
||||
return " <a href='#$id' onclick=\"return !toggle('$id');\">" . lang('SQL command') . "</a><div id='$id' class='hidden'><pre class='jush-sql'>" . h($query) . '</pre><a href="' . h(ME . 'sql=&history=' . (count($_SESSION["history"][$_GET["server"]][DB]) - 1)) . '">' . lang('Edit') . '</a></div>';
|
||||
}
|
||||
|
||||
/** Functions displayed in edit form
|
||||
@@ -427,9 +427,9 @@ class Adminer {
|
||||
<form action="">
|
||||
<p><?php if (strlen($_GET["server"])) { ?><input type="hidden" name="server" value="<?php echo h($_GET["server"]); ?>"><?php } ?>
|
||||
<?php if ($databases) { ?>
|
||||
<select name="db" onchange="this.form.submit();"><option value="">(<?php echo lang('database'); ?>)<?php echo optionlist($databases, $_GET["db"]); ?></select>
|
||||
<select name="db" onchange="this.form.submit();"><option value="">(<?php echo lang('database'); ?>)<?php echo optionlist($databases, DB); ?></select>
|
||||
<?php } else { ?>
|
||||
<input name="db" value="<?php echo h($_GET["db"]); ?>">
|
||||
<input name="db" value="<?php echo h(DB); ?>">
|
||||
<?php } ?>
|
||||
<?php if (isset($_GET["sql"])) { ?><input type="hidden" name="sql" value=""><?php } ?>
|
||||
<?php if (isset($_GET["schema"])) { ?><input type="hidden" name="schema" value=""><?php } ?>
|
||||
@@ -438,7 +438,7 @@ class Adminer {
|
||||
</p>
|
||||
</form>
|
||||
<?php
|
||||
if ($missing != "db" && strlen($_GET["db"])) {
|
||||
if ($missing != "db" && strlen(DB)) {
|
||||
$result = $dbh->query("SHOW TABLES");
|
||||
if (!$result) {
|
||||
echo "<p class='error'>" . lang('No tables.') . "\n";
|
||||
|
@@ -69,7 +69,8 @@ if (get_magic_quotes_gpc()) {
|
||||
set_magic_quotes_runtime(false);
|
||||
@set_time_limit(0); // @ - can be disabled
|
||||
|
||||
define("ME", preg_replace('~^[^?]*/([^?]*).*~', '\\1', $_SERVER["REQUEST_URI"]) . '?' . (strlen($_GET["server"]) ? 'server=' . urlencode($_GET["server"]) . '&' : '') . (strlen($_GET["db"]) ? 'db=' . urlencode($_GET["db"]) . '&' : ''));
|
||||
define("DB", $_GET["db"]); // for the sake of speed and size
|
||||
define("ME", preg_replace('~^[^?]*/([^?]*).*~', '\\1', $_SERVER["REQUEST_URI"]) . '?' . (strlen($_GET["server"]) ? 'server=' . urlencode($_GET["server"]) . '&' : '') . (strlen(DB) ? 'db=' . urlencode(DB) . '&' : ''));
|
||||
$on_actions = array("RESTRICT", "CASCADE", "SET NULL", "NO ACTION"); // used in foreign_keys()
|
||||
|
||||
include "../adminer/include/version.inc.php";
|
||||
|
@@ -1,8 +1,8 @@
|
||||
<?php
|
||||
function connect_error() {
|
||||
global $dbh, $VERSION;
|
||||
if (strlen($_GET["db"])) {
|
||||
page_header(lang('Database') . ": " . h($_GET["db"]), lang('Invalid database.'), false);
|
||||
if (strlen(DB)) {
|
||||
page_header(lang('Database') . ": " . h(DB), lang('Invalid database.'), false);
|
||||
} else {
|
||||
page_header(lang('Select database'), "", null);
|
||||
foreach (array(
|
||||
@@ -19,8 +19,8 @@ function connect_error() {
|
||||
page_footer("db");
|
||||
}
|
||||
|
||||
if (!(strlen($_GET["db"]) ? $dbh->select_db($_GET["db"]) : isset($_GET["sql"]) || isset($_GET["dump"]) || isset($_GET["database"]) || isset($_GET["processlist"]) || isset($_GET["privileges"]) || isset($_GET["user"]) || isset($_GET["variables"]))) {
|
||||
if (strlen($_GET["db"])) {
|
||||
if (!(strlen(DB) ? $dbh->select_db(DB) : isset($_GET["sql"]) || isset($_GET["dump"]) || isset($_GET["database"]) || isset($_GET["processlist"]) || isset($_GET["privileges"]) || isset($_GET["user"]) || isset($_GET["variables"]))) {
|
||||
if (strlen(DB)) {
|
||||
unset($_SESSION["databases"][$_GET["server"]]);
|
||||
}
|
||||
connect_error(); // separate function to catch SQLite error
|
||||
|
@@ -25,8 +25,8 @@ function page_header($title, $error = "", $breadcrumb = array(), $title2 = "") {
|
||||
$link = substr(preg_replace('~db=[^&]*&~', '', ME), 0, -1);
|
||||
echo '<p id="breadcrumb"><a href="' . (strlen($link) ? h($link) : ".") . '">' . (isset($_GET["server"]) ? h($_GET["server"]) : lang('Server')) . '</a> » ';
|
||||
if (is_array($breadcrumb)) {
|
||||
if (strlen($_GET["db"])) {
|
||||
echo '<a href="' . h(substr(ME, 0, -1)) . '">' . h($_GET["db"]) . '</a> » ';
|
||||
if (strlen(DB)) {
|
||||
echo '<a href="' . h(substr(ME, 0, -1)) . '">' . h(DB) . '</a> » ';
|
||||
}
|
||||
foreach ($breadcrumb as $key => $val) {
|
||||
$desc = (is_array($val) ? $val[1] : $val);
|
||||
@@ -43,7 +43,7 @@ function page_header($title, $error = "", $breadcrumb = array(), $title2 = "") {
|
||||
$_SESSION["messages"] = array();
|
||||
}
|
||||
$databases = &$_SESSION["databases"][$_GET["server"]];
|
||||
if (strlen($_GET["db"]) && $databases && !in_array($_GET["db"], $databases, true)) {
|
||||
if (strlen(DB) && $databases && !in_array(DB, $databases, true)) {
|
||||
$databases = null;
|
||||
}
|
||||
if (isset($databases) && !isset($_GET["sql"])) {
|
||||
|
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
page_header(lang('Database schema'), "", array(), $_GET["db"]);
|
||||
page_header(lang('Database schema'), "", array(), DB);
|
||||
|
||||
$table_pos = array();
|
||||
$table_pos_js = array();
|
||||
|
@@ -156,7 +156,7 @@ if (!$columns) {
|
||||
echo "<form action='' id='form'>\n";
|
||||
echo "<div style='display: none;'>";
|
||||
echo (strlen($_GET["server"]) ? '<input type="hidden" name="server" value="' . h($_GET["server"]) . '">' : "");
|
||||
echo (strlen($_GET["db"]) ? '<input type="hidden" name="db" value="' . h($_GET["db"]) . '">' : ""); // not used in Editor
|
||||
echo (strlen(DB) ? '<input type="hidden" name="db" value="' . h(DB) . '">' : ""); // not used in Editor
|
||||
echo '<input type="hidden" name="select" value="' . h($_GET["select"]) . '">';
|
||||
echo "</div>\n";
|
||||
$adminer->selectColumnsPrint($select, $columns);
|
||||
@@ -221,7 +221,7 @@ if (!$columns) {
|
||||
echo ($table_names ? "<th>" . lang('Relations') : "") . "</thead>\n";
|
||||
foreach ($descriptions as $n => $row) {
|
||||
$unique_idf = implode('&', unique_idf($rows[$n], $indexes));
|
||||
echo "<tr" . odd() . "><td><input type='checkbox' name='check[]' value='$unique_idf' onclick=\"this.form['all'].checked = false; form_uncheck('all-page');\">" . (count($select) != count($group) || information_schema($_GET["db"]) ? '' : " <a href='" . h(ME) . "edit=" . urlencode($_GET['select']) . "&$unique_idf'>" . lang('edit') . "</a>");
|
||||
echo "<tr" . odd() . "><td><input type='checkbox' name='check[]' value='$unique_idf' onclick=\"this.form['all'].checked = false; form_uncheck('all-page');\">" . (count($select) != count($group) || information_schema(DB) ? '' : " <a href='" . h(ME) . "edit=" . urlencode($_GET['select']) . "&$unique_idf'>" . lang('edit') . "</a>");
|
||||
foreach ($row as $key => $val) {
|
||||
if (isset($names[$key])) {
|
||||
if (strlen($val) && (!isset($email_fields[$key]) || strlen($email_fields[$key]))) {
|
||||
@@ -297,7 +297,7 @@ if (!$columns) {
|
||||
}
|
||||
echo " (" . lang('%d row(s)', $found_rows) . ') <label><input type="checkbox" name="all" value="1">' . lang('whole result') . "</label>\n";
|
||||
|
||||
echo (information_schema($_GET["db"]) ? "" : "<fieldset><legend>" . lang('Edit') . "</legend><div><input type='submit' name='edit' value='" . lang('Edit') . "'> <input type='submit' name='clone' value='" . lang('Clone') . "'> <input type='submit' name='delete' value='" . lang('Delete') . "'$confirm></div></fieldset>\n");
|
||||
echo (information_schema(DB) ? "" : "<fieldset><legend>" . lang('Edit') . "</legend><div><input type='submit' name='edit' value='" . lang('Edit') . "'> <input type='submit' name='clone' value='" . lang('Clone') . "'> <input type='submit' name='delete' value='" . lang('Delete') . "'$confirm></div></fieldset>\n");
|
||||
echo "<fieldset><legend>" . lang('Export') . "</legend><div>$dump_output $dump_format $dump_compress <input type='submit' name='export' value='" . lang('Export') . "'></div></fieldset>\n";
|
||||
}
|
||||
echo "<fieldset><legend>" . lang('CSV Import') . "</legend><div><input type='hidden' name='token' value='$token'><input type='file' name='csv_file'> <input type='submit' name='import' value='" . lang('Import') . "'></div></fieldset>\n";
|
||||
|
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
$history = &$_SESSION["history"][$_GET["server"]][$_GET["db"]];
|
||||
$history = &$_SESSION["history"][$_GET["server"]][DB];
|
||||
if (!$error && $_POST["clear"]) {
|
||||
$history = array();
|
||||
redirect(remove_from_uri("history"));
|
||||
@@ -30,9 +30,9 @@ if (!$error && $_POST) {
|
||||
$delimiter = ";";
|
||||
$offset = 0;
|
||||
$empty = true;
|
||||
$dbh2 = (strlen($_GET["db"]) ? connect() : null); // connection for exploring indexes (to not replace FOUND_ROWS()) //! PDO - silent error
|
||||
$dbh2 = (strlen(DB) ? connect() : null); // connection for exploring indexes (to not replace FOUND_ROWS()) //! PDO - silent error
|
||||
if (is_object($dbh2)) {
|
||||
$dbh2->select_db($_GET["db"]);
|
||||
$dbh2->select_db(DB);
|
||||
}
|
||||
while (strlen($query)) {
|
||||
if (!$offset && preg_match('~^\\s*DELIMITER\\s+(.+)~i', $query, $match)) {
|
||||
@@ -105,7 +105,7 @@ if (!$error && $_POST) {
|
||||
?>
|
||||
|
||||
<form action="" method="post" enctype="multipart/form-data">
|
||||
<p><textarea name="query" rows="20" cols="80" style="width: 98%;"><?php echo h($_POST ? $_POST["query"] : (strlen($_GET["history"]) ? $_SESSION["history"][$_GET["server"]][$_GET["db"]][$_GET["history"]] : $_GET["sql"])); ?></textarea>
|
||||
<p><textarea name="query" rows="20" cols="80" style="width: 98%;"><?php echo h($_POST ? $_POST["query"] : (strlen($_GET["history"]) ? $_SESSION["history"][$_GET["server"]][DB][$_GET["history"]] : $_GET["sql"])); ?></textarea>
|
||||
<p>
|
||||
<input type="hidden" name="token" value="<?php echo $token; ?>">
|
||||
<input type="submit" value="<?php echo lang('Execute'); ?>">
|
||||
|
@@ -1,3 +1,2 @@
|
||||
<?php
|
||||
$_GET["db"] = ""; // used here and there by Adminer
|
||||
$dbh->select_db($adminer->database());
|
||||
|
Reference in New Issue
Block a user