]> git.joonet.de Git - adminer.git/commitdiff
Order by DESC with grouping
authorJakub Vrana <jakub@vrana.cz>
Sun, 24 Oct 2010 09:52:01 +0000 (11:52 +0200)
committerJakub Vrana <jakub@vrana.cz>
Sun, 24 Oct 2010 09:52:01 +0000 (11:52 +0200)
adminer/select.inc.php

index c97e112d5d40352691f0d2cead848625e520fd85..887ba0f91a48e3781b59d8fce4b0e43403928a03 100644 (file)
@@ -254,7 +254,8 @@ if (!$columns) {
                                if ($name != "") {
                                        $rank++;
                                        $names[$key] = $name;
-                                       echo '<th><a href="' . h(remove_from_uri('(order|desc)[^=]*|page') . '&order%5B0%5D=' . urlencode($key) . ($_GET["order"][0] == $key && !$_GET["desc"][0] ? '&desc%5B0%5D=1' : '')) . '">' . apply_sql_function($val["fun"], $name) . "</a>"; //! columns looking like functions
+                                       $column = idf_escape($key);
+                                       echo '<th><a href="' . h(remove_from_uri('(order|desc)[^=]*|page') . '&order%5B0%5D=' . urlencode($key) . ($order[0] == $column || $order[0] == $key || (!$order && $group[0] == $column) ? '&desc%5B0%5D=1' : '')) . '">' . apply_sql_function($val["fun"], $name) . "</a>"; // $order[0] == $key - COUNT(*) //! columns looking like functions
                                }
                                $functions[$key] = $val["fun"];
                                next($select);