]> git.joonet.de Git - adminer.git/commitdiff
Order by function results
authorjakubvrana <jakubvrana@7c3ca157-0c34-0410-bff1-cbf682f78f5c>
Fri, 8 Aug 2008 11:52:36 +0000 (11:52 +0000)
committerjakubvrana <jakubvrana@7c3ca157-0c34-0410-bff1-cbf682f78f5c>
Fri, 8 Aug 2008 11:52:36 +0000 (11:52 +0000)
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@439 7c3ca157-0c34-0410-bff1-cbf682f78f5c

select.inc.php

index b4d796f26d9cb310a16ab87cdaf3eecb55b600bf..f5075103b2b9b038ece7b8ae0900e4ecb822c539 100644 (file)
@@ -49,8 +49,10 @@ foreach ((array) $_GET["where"] as $val) {
 }
 $order = array();
 foreach ((array) $_GET["order"] as $key => $val) {
-       if (in_array($val, $columns, true)) { //! respect functions
+       if (in_array($val, $columns, true)) {
                $order[] = idf_escape($val) . (isset($_GET["desc"][$key]) ? " DESC" : "");
+       } elseif (preg_match('(^(' . 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");