]> git.joonet.de Git - adminer.git/commitdiff
Fix LIKE backslash escaping
authorJakub Vrana <jakub@vrana.cz>
Sat, 27 Apr 2013 02:24:07 +0000 (19:24 -0700)
committerJakub Vrana <jakub@vrana.cz>
Sat, 27 Apr 2013 02:34:15 +0000 (19:34 -0700)
adminer/drivers/mysql.inc.php
adminer/user.inc.php

index 493eee4dfdece633d781e27956d0cbbe30ebd5d9..eca33c48418a37d05e40a9ca1e1822253bbcfa69 100644 (file)
@@ -370,7 +370,7 @@ if (!defined("DRIVER")) {
        */
        function table_status($name = "") {
                $return = array();
-               foreach (get_rows("SHOW TABLE STATUS" . ($name != "" ? " LIKE " . q(addcslashes($name, "%_")) : "")) as $row) {
+               foreach (get_rows("SHOW TABLE STATUS" . ($name != "" ? " LIKE " . q(addcslashes($name, "%_\\")) : "")) as $row) {
                        if ($row["Engine"] == "InnoDB") {
                                // ignore internal comment, unnecessary since MySQL 5.1.21
                                $row["Comment"] = preg_replace('~(?:(.+); )?InnoDB free: .*~', '\\1', $row["Comment"]);
@@ -733,7 +733,7 @@ if (!defined("DRIVER")) {
        */
        function triggers($table) {
                $return = array();
-               foreach (get_rows("SHOW TRIGGERS LIKE " . q(addcslashes($table, "%_"))) as $row) {
+               foreach (get_rows("SHOW TRIGGERS LIKE " . q(addcslashes($table, "%_\\"))) as $row) {
                        $return[$row["Trigger"]] = array($row["Timing"], $row["Event"]);
                }
                return $return;
@@ -924,7 +924,7 @@ if (!defined("DRIVER")) {
        */
        function trigger_sql($table, $style) {
                $return = "";
-               foreach (get_rows("SHOW TRIGGERS LIKE " . q(addcslashes($table, "%_")), null, "-- ") as $row) {
+               foreach (get_rows("SHOW TRIGGERS LIKE " . q(addcslashes($table, "%_\\")), null, "-- ") as $row) {
                        $return .= "\n" . ($style == 'CREATE+ALTER' ? "DROP TRIGGER IF EXISTS " . idf_escape($row["Trigger"]) . ";;\n" : "")
                        . "CREATE TRIGGER " . idf_escape($row["Trigger"]) . " $row[Timing] $row[Event] ON " . table($row["Table"]) . " FOR EACH ROW\n$row[Statement];;\n";
                }
index fff17dccfaf195963514187dcbe67157d9f2b15f..873bf42737ec35085539ec871f1dfce0d91bd46b 100644 (file)
@@ -120,7 +120,7 @@ if ($_POST) {
        if ($old_pass != "") {
                $row["hashed"] = true;
        }
-       $grants[(DB == "" || $grants ? "" : idf_escape(addcslashes(DB, "%_"))) . ".*"] = array();
+       $grants[(DB == "" || $grants ? "" : idf_escape(addcslashes(DB, "%_\\"))) . ".*"] = array();
 }
 
 ?>