]> git.joonet.de Git - adminer.git/commitdiff
Create information_schema function
authorjakubvrana <jakubvrana@7c3ca157-0c34-0410-bff1-cbf682f78f5c>
Mon, 22 Jun 2009 09:58:58 +0000 (09:58 +0000)
committerjakubvrana <jakubvrana@7c3ca157-0c34-0410-bff1-cbf682f78f5c>
Mon, 22 Jun 2009 09:58:58 +0000 (09:58 +0000)
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@751 7c3ca157-0c34-0410-bff1-cbf682f78f5c

adminer/dump.inc.php
adminer/include/mysql.inc.php
adminer/select.inc.php
adminer/user.inc.php

index e8f53dce8fd325ecac0c919070235e4203591387..a532988fbc061b21831515184377a9da0f7d7e8d 100644 (file)
@@ -196,7 +196,7 @@ if (strlen($_GET["db"])) {
 } else {
        echo "<thead><tr><th align='left'><label><input type='checkbox' id='check-databases' checked='checked' onclick='form_check(this, /^databases\\[/);' />" . lang('Database') . "</label></th></tr></thead>\n";
        foreach (get_databases() as $db) {
-               if ($db != "information_schema" || $dbh->server_info < 5) {
+               if (!information_schema($db)) {
                        echo '<tr><td><label><input type="checkbox" name="databases[]" value="' . htmlspecialchars($db) . '" checked="checked" onclick="form_uncheck(\'check-databases\');" />' . htmlspecialchars($db) . "</label></td></tr>\n";
                }
        }
index cd813764d881f2fab084537f2b49f5adb4109087..f0ebe3b40a0405663364270a7b2d70d60770b238 100644 (file)
@@ -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");
+}
index 4afba497f5d05ddfa9cefa68a78eaeebf89a3197..960f56d7f6ecb4cce1069fd8e0c7f107e3e2e2ee 100644 (file)
@@ -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 "</tr></thead>\n";
                                }
                                $unique_idf = implode('&amp;', unique_idf($row, $indexes)); //! don't use aggregation functions
-                               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) && $_GET["db"] != "information_schema" ? ' <a href="' . htmlspecialchars($SELF) . 'edit=' . urlencode($_GET['select']) . '&amp;' . $unique_idf . '">' . lang('edit') . '</a></td>' : '');
+                               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="' . htmlspecialchars($SELF) . 'edit=' . urlencode($_GET['select']) . '&amp;' . $unique_idf . '">' . lang('edit') . '</a>') . '</td>';
                                foreach ($row as $key => $val) {
                                        if (!isset($val)) {
                                                $val = "<i>NULL</i>";
@@ -315,7 +314,7 @@ if (!$columns) {
                        }
                        echo " (" . lang('%d row(s)', $found_rows) . ') <label><input type="checkbox" name="all" value="1" />' . lang('whole result') . "</label></p>\n";
                        
-                       echo ($_GET["db"] != "information_schema" ? "<fieldset><legend>" . lang('Edit') . "</legend><div><input type='submit' 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($_GET["db"]) ? "" : "<fieldset><legend>" . lang('Edit') . "</legend><div><input type='submit' 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 <input type='submit' name='export' value='" . lang('Export') . "' /></div></fieldset>\n";
                }
                $result->free();
index 48aa1337ed0f63aca2690c4b72d24e8666c17151..5c59af8cfd1b0b26834eca64f2ac1f39044eae4b 100644 (file)
@@ -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) {