Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2019-02-18 21:34:07 +0100
committerErich Eckner <git@eckner.net>2019-02-18 21:34:07 +0100
commit28f074140370a8c2a11b995271e4c135b2cc1c7f (patch)
treea78653ef597ae690f57f9b8b31514bdecb34655d /lib
parentad8b318c1eaddbc2043b9a7cbaa6332177db491c (diff)
extracting of ORDER BY info from $_GET moved from packages/index.php to function in lib/style.php
Diffstat (limited to 'lib')
-rw-r--r--lib/style.php24
1 files changed, 24 insertions, 0 deletions
diff --git a/lib/style.php b/lib/style.php
index ff2d364..99d9840 100644
--- a/lib/style.php
+++ b/lib/style.php
@@ -124,6 +124,30 @@ $pkglist_sorts = array(
)
);
+function package_listing_query_order_by() {
+ global $pkglist_sorts;
+ if (!array_key_exists('sort', $_GET))
+ return;
+ $criterium = $_GET['sort'];
+ if (
+ array_key_exists($criterium, $pkglist_sorts) &&
+ array_key_exists('mysql', $pkglist_sorts[$criterium])
+ )
+ return $pkglist_sorts[$criterium]['mysql'] . ',';
+
+ if (substr($criterium, 0, 1) != '-')
+ return;
+ $criterium = substr($criterium, 1);
+
+ if (
+ array_key_exists($criterium, $pkglist_sorts) &&
+ array_key_exists('mysql', $pkglist_sorts[$criterium])
+ )
+ return $pkglist_sorts[$criterium]['mysql'] . ' DESC,';
+
+ return;
+}
+
function query_package_listing($filter_and_order, $float_columns, $count_only) {
if ($count_only)
$columns = "COUNT(DISTINCT `binary_packages`.`id`)";