summaryrefslogtreecommitdiffstats
path: root/web/lib
diff options
context:
space:
mode:
authorLukas Fleischer <archlinux@cryptocrack.de>2010-05-30 00:20:42 +0200
committerLoui Chang <louipc.ist@gmail.com>2010-06-04 18:22:22 -0400
commitb18fb08ddc7201760112f4492cdcd81961902fa1 (patch)
tree7fab9d26426b54a59652e37c8f8ee20699d42b7f /web/lib
parent290c436046327d9f04b7d12b5fda19f4dc14f574 (diff)
downloadaurweb-b18fb08ddc7201760112f4492cdcd81961902fa1.tar.xz
Add sorting by "Voted" and "Notify" fields
Signed-off-by: Loui Chang <louipc.ist@gmail.com>
Diffstat (limited to 'web/lib')
-rw-r--r--web/lib/pkgfuncs.inc26
1 files changed, 20 insertions, 6 deletions
diff --git a/web/lib/pkgfuncs.inc b/web/lib/pkgfuncs.inc
index 49bedc3..43a7a6f 100644
--- a/web/lib/pkgfuncs.inc
+++ b/web/lib/pkgfuncs.inc
@@ -515,32 +515,46 @@ function pkg_search_page($SID="") {
$order = $_GET["SO"] == 'd' ? 'DESC' : 'ASC';
+ $q_sort = "ORDER BY Name ".$order.", LocationID ASC, CategoryID DESC ";
switch ($_GET["SB"]) {
case 'c':
- $q.= "ORDER BY CategoryID ".$order.", Name ASC, LocationID ASC ";
+ $q_sort = "ORDER BY CategoryID ".$order.", Name ASC, LocationID ASC ";
$_GET["SB"] = 'c';
break;
case 'l':
- $q.= "ORDER BY LocationID ".$order.", Name ASC, CategoryID DESC ";
+ $q_sort = "ORDER BY LocationID ".$order.", Name ASC, CategoryID DESC ";
$_GET["SB"] = 'l';
break;
case 'v':
- $q.= "ORDER BY NumVotes ".$order.", Name ASC, CategoryID DESC ";
+ $q_sort = "ORDER BY NumVotes ".$order.", Name ASC, CategoryID DESC ";
$_GET["SB"] = 'v';
break;
+ case 'w':
+ if ($SID) {
+ $q_sort = "ORDER BY Voted ".$order.", Name ASC, CategoryID DESC ";
+ }
+ $_GET["SB"] = 'w';
+ break;
+ case 'o':
+ if ($SID) {
+ $q_sort = "ORDER BY Notify ".$order.", Name ASC, CategoryID DESC ";
+ }
+ $_GET["SB"] = 'o';
+ break;
case 'm':
- $q.= "ORDER BY Maintainer ".$order.", Name ASC, LocationID ASC ";
+ $q_sort = "ORDER BY Maintainer ".$order.", Name ASC, LocationID ASC ";
$_GET["SB"] = 'm';
break;
case 'a':
- $q.= "ORDER BY GREATEST(SubmittedTS,ModifiedTS) ".$order.", Name ASC, LocationID ASC ";
+ $q_sort = "ORDER BY GREATEST(SubmittedTS,ModifiedTS) ".$order.", Name ASC, LocationID ASC ";
$_GET["SB"] = 'a';
break;
default:
- $q.= "ORDER BY Name ".$order.", LocationID ASC, CategoryID DESC ";
break;
}
+ $q.= $q_sort;
+
$q.= "LIMIT ".$_GET["O"].", ".$_GET["PP"];
$result = db_query($q, $dbh);