mirror of
https://github.com/vrana/adminer.git
synced 2025-08-14 10:34:01 +02:00
Reintegrate sqlite branch
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@1466 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
@@ -1,11 +1,12 @@
|
||||
<?php
|
||||
function connect_error() {
|
||||
global $connection, $VERSION, $token, $error;
|
||||
global $connection, $VERSION, $token, $error, $drivers;
|
||||
$databases = array();
|
||||
if (DB != "") {
|
||||
page_header(lang('Database') . ": " . h(DB), lang('Invalid database.'), false);
|
||||
page_header(lang('Database') . ": " . h(DB), lang('Invalid database.'), true);
|
||||
} else {
|
||||
if ($_POST["db"] && !$error) {
|
||||
unset($_SESSION["databases"][$_GET["server"]]);
|
||||
set_session("databases", null);
|
||||
foreach ($_POST["db"] as $db) {
|
||||
if (!queries("DROP DATABASE " . idf_escape($db))) {
|
||||
break;
|
||||
@@ -14,30 +15,32 @@ function connect_error() {
|
||||
queries_redirect(substr(ME, 0, -1), lang('Database has been dropped.'), !$connection->error);
|
||||
}
|
||||
|
||||
page_header(lang('Select database'), $error, null);
|
||||
echo "<p>";
|
||||
page_header(lang('Select database'), $error, false);
|
||||
echo "<p><a href='" . h(ME) . "database='>" . lang('Create new database') . "</a>\n";
|
||||
foreach (array(
|
||||
'database' => lang('Create new database'),
|
||||
'privileges' => lang('Privileges'),
|
||||
'processlist' => lang('Process list'),
|
||||
'variables' => lang('Variables'),
|
||||
'status' => lang('Status'),
|
||||
) as $key => $val) {
|
||||
echo "<a href='" . h(ME) . "$key='>$val</a>\n";
|
||||
if (support($key)) {
|
||||
echo "<a href='" . h(ME) . "$key='>$val</a>\n";
|
||||
}
|
||||
}
|
||||
echo "<p>" . lang('MySQL version: %s through PHP extension %s', "<b" . ($connection->server_info < 4.1 ? " class='binary'" : "") . ">$connection->server_info</b>", "<b>$connection->extension</b>") . "\n";
|
||||
echo "<p>" . lang('Logged as: %s', "<b>" . h($connection->result($connection->query("SELECT USER()"))) . "</b>") . "\n";
|
||||
echo "<p>" . lang('%s version: %s through PHP extension %s', $drivers[DRIVER], "<b>$connection->server_info</b>", "<b>$connection->extension</b>") . "\n";
|
||||
echo "<p>" . lang('Logged as: %s', "<b>" . h(logged_user()) . "</b>") . "\n";
|
||||
$databases = get_databases();
|
||||
if ($databases) {
|
||||
$collations = collations();
|
||||
echo "<form action='' method='post'>\n";
|
||||
echo "<table cellspacing='0' onclick='tableClick(event);'>\n";
|
||||
echo "<thead><tr><td><input type='hidden' name='token' value='$token'> <th>" . lang('Database') . "<td>" . lang('Collation') . "</thead>\n";
|
||||
echo "<thead><tr><td><input type='hidden' name='token' value='$token'> <th>" . lang('Database') . "<td>" . lang('Collation') . "<td>" . lang('Tables') . "</thead>\n";
|
||||
foreach ($databases as $db) {
|
||||
$root = h(ME) . "db=" . urlencode($db);
|
||||
echo "<tr" . odd() . "><td>" . checkbox("db[]", $db, in_array($db, (array) $_POST["db"]));
|
||||
echo "<th><a href='$root'>" . h($db) . "</a>";
|
||||
echo "<td><a href='$root&database='>" . nbsp(db_collation($db, $collations)) . "</a>";
|
||||
echo "<td align='right'><a href='$root&schema=' id='tables-" . h($db) . "'>?</a>";
|
||||
echo "\n";
|
||||
}
|
||||
echo "</table>\n";
|
||||
@@ -46,6 +49,11 @@ function connect_error() {
|
||||
}
|
||||
}
|
||||
page_footer("db");
|
||||
echo "<script type='text/javascript'>\n";
|
||||
foreach (count_tables($databases) as $db => $val) {
|
||||
echo "setHtml('tables-" . addcslashes($db, "\\'/") . "', '$val');\n";
|
||||
}
|
||||
echo "</script>\n";
|
||||
}
|
||||
|
||||
if (isset($_GET["status"])) {
|
||||
@@ -53,7 +61,7 @@ if (isset($_GET["status"])) {
|
||||
}
|
||||
if (!(DB != "" ? $connection->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 (DB != "") {
|
||||
unset($_SESSION["databases"][$_GET["server"]]);
|
||||
set_session("databases", null);
|
||||
}
|
||||
connect_error(); // separate function to catch SQLite error
|
||||
exit;
|
||||
|
Reference in New Issue
Block a user