]> git.joonet.de Git - adminer.git/commitdiff
Escape order by function (thanks to Kajman)
authorjakubvrana <jakubvrana@7c3ca157-0c34-0410-bff1-cbf682f78f5c>
Tue, 16 Sep 2008 14:49:22 +0000 (14:49 +0000)
committerjakubvrana <jakubvrana@7c3ca157-0c34-0410-bff1-cbf682f78f5c>
Tue, 16 Sep 2008 14:49:22 +0000 (14:49 +0000)
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@487 7c3ca157-0c34-0410-bff1-cbf682f78f5c

select.inc.php

index ccf75a68f4d7dcbc93ae102409e9722d291ee814..9b378f6334fcbbe5ed3630c220c4434b757085a0 100644 (file)
@@ -49,10 +49,8 @@ foreach ((array) $_GET["where"] as $val) {
 }
 $order = array();
 foreach ((array) $_GET["order"] as $key => $val) {
-       if (in_array($val, $columns, true)) {
+       if (in_array($val, $columns, true) || preg_match('(^(COUNT\\(\\*\\)|(' . strtoupper(implode('|', $functions) . '|' . implode('|', $grouping)) . ')\\((' . implode('|', array_map('preg_quote', array_map('idf_escape', $columns))) . ')\\))$)', $val)) {
                $order[] = idf_escape($val) . (isset($_GET["desc"][$key]) ? " DESC" : "");
-       } elseif (preg_match('(^(COUNT\\(\\*\\)|(' . strtoupper(implode('|', $functions) . '|' . implode('|', $grouping)) . ')\\((' . implode('|', array_map('preg_quote', array_map('idf_escape', $columns))) . ')\\))$)', $val)) {
-               $order[] = $val . (isset($_GET["desc"][$key]) ? " DESC" : "");
        }
 }
 $limit = (isset($_GET["limit"]) ? $_GET["limit"] : "30");