Permalink
Browse files

Allow % in view definer (thanks to Tomas Votruba)

  • Loading branch information...
1 parent 70066b3 commit 021e1e319c3b37c4db8f8c87b574ea321721cc9b @vrana committed Mar 14, 2011
Showing with 1 addition and 1 deletion.
  1. +1 −1 adminer/include/adminer.inc.php
View
2 adminer/include/adminer.inc.php
@@ -521,7 +521,7 @@ function dumpTable($table, $style, $is_view = false) {
}
if ($is_view) {
// remove DEFINER with current user
- $create = preg_replace('~^([A-Z =]+) DEFINER=`' . str_replace("@", "`@`", logged_user()) . '`~', '\\1', $create); //! proper escaping of user
+ $create = preg_replace('~^([A-Z =]+) DEFINER=`' . preg_replace('~@(.*)~', '`@`(%|\\1)', logged_user()) . '`~', '\\1', $create); //! proper escaping of user
}
echo ($style != "CREATE+ALTER" ? $create : ($is_view ? substr_replace($create, " OR REPLACE", 6, 0) : substr_replace($create, " IF NOT EXISTS", 12, 0))) . ";\n\n";
}

0 comments on commit 021e1e3

Please sign in to comment.