diff --git a/adminer/dump.inc.php b/adminer/dump.inc.php
index e8f53dce..a532988f 100644
--- a/adminer/dump.inc.php
+++ b/adminer/dump.inc.php
@@ -196,7 +196,7 @@ if (strlen($_GET["db"])) {
} else {
echo " |
\n";
foreach (get_databases() as $db) {
- if ($db != "information_schema" || $dbh->server_info < 5) {
+ if (!information_schema($db)) {
echo '
|
\n";
}
}
diff --git a/adminer/include/mysql.inc.php b/adminer/include/mysql.inc.php
index cd813764..f0ebe3b4 100644
--- a/adminer/include/mysql.inc.php
+++ b/adminer/include/mysql.inc.php
@@ -331,3 +331,8 @@ function table_comment(&$row) {
$row["Comment"] = preg_replace('~(?:(.+); )?InnoDB free: .*~', '\\1', $row["Comment"]);
}
}
+
+function information_schema($db) {
+ global $dbh;
+ return ($dbh->server_info >= 5 && $db == "information_schema");
+}
diff --git a/adminer/select.inc.php b/adminer/select.inc.php
index 4afba497..960f56d7 100644
--- a/adminer/select.inc.php
+++ b/adminer/select.inc.php
@@ -79,7 +79,6 @@ if ($_POST && !$error) {
// where may not be unique so OR can't be used
$union[] = "(SELECT $from " . ($where ? "AND " : "WHERE ") . implode(" AND ", where_check($val)) . $group_by . " LIMIT 1)";
}
- print_r($union);
dump_data($_GET["select"], "INSERT", implode(" UNION ALL ", $union));
} else {
dump_data($_GET["select"], "INSERT", "SELECT $from$group_by");
@@ -256,7 +255,7 @@ if (!$columns) {
echo "\n";
}
$unique_idf = implode('&', unique_idf($row, $indexes)); //! don't use aggregation functions
- echo '' . (count($select) == count($group) && $_GET["db"] != "information_schema" ? ' ' . lang('edit') . ' | ' : '');
+ echo '
' . (count($select) != count($group) || information_schema($_GET["db"]) ? '' : ' ' . lang('edit') . '') . ' | ';
foreach ($row as $key => $val) {
if (!isset($val)) {
$val = "NULL";
@@ -315,7 +314,7 @@ if (!$columns) {
}
echo " (" . lang('%d row(s)', $found_rows) . ') \n";
- echo ($_GET["db"] != "information_schema" ? "\n" : "");
+ echo (information_schema($_GET["db"]) ? "" : "\n");
echo "\n";
}
$result->free();
diff --git a/adminer/user.inc.php b/adminer/user.inc.php
index 48aa1337..5c59af8c 100644
--- a/adminer/user.inc.php
+++ b/adminer/user.inc.php
@@ -35,7 +35,7 @@ if ($_POST) {
}
$grants = array();
$old_pass = "";
-if (isset($_GET["host"]) && ($result = $dbh->query("SHOW GRANTS FOR " . $dbh->quote($_GET["user"]) . "@" . $dbh->quote($_GET["host"])))) { //! Use information_schema for MySQL 5 - column names in column privileges are not escaped
+if (isset($_GET["host"]) && ($result = $dbh->query("SHOW GRANTS FOR " . $dbh->quote($_GET["user"]) . "@" . $dbh->quote($_GET["host"])))) { //! use information_schema for MySQL 5 - column names in column privileges are not escaped
while ($row = $result->fetch_row()) {
if (preg_match('~GRANT (.*) ON (.*) TO ~', $row[0], $match) && preg_match_all('~ *([^(,]*[^ ,(])( *\\([^)]+\\))?~', $match[1], $matches, PREG_SET_ORDER)) { //! escape the part between ON and TO
foreach ($matches as $val) {