php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #52472
Patch fix-relevance-sort.patch revision 2010-07-28 14:15 UTC by mail_ben_schmidt at yahoo dot com dot au

Patch fix-relevance-sort.patch for Website problem Bug #52472

Patch version 2010-07-28 14:15 UTC

Return to Bug #52472 | Download this patch
Patch Revisions:

Developer: mail_ben_schmidt@yahoo.com.au

Index: include/query.php
===================================================================
--- include/query.php	(revision 301001)
+++ include/query.php	(working copy)
@@ -36,7 +36,7 @@
 	$limit = ($_GET['limit'] == 'All') ? 'All' : (($_GET['limit'] > 0) ? (int) $_GET['limit'] : $limit);
 }
 $direction = (!empty($_GET['direction']) && $_GET['direction'] != 'DESC') ? 'ASC' : 'DESC';
-$order_by = (!empty($_GET['order_by']) && array_key_exists($_GET['order_by'], $order_options)) ? $_GET['order_by'] : 'id';
+$order_by = (!empty($_GET['order_by']) && array_key_exists($_GET['order_by'], $order_options)) ? $_GET['order_by'] : '';
 $reorder_by = (!empty($_GET['reorder_by']) && array_key_exists($_GET['reorder_by'], $order_options)) ? $_GET['reorder_by'] : '';
 $assign = !empty($_GET['assign']) ? $_GET['assign'] : '';
 $author_email = (!empty($_GET['author_email']) && is_valid_email($_GET['author_email'])) ? $_GET['author_email'] : '';
@@ -183,11 +183,12 @@
 		}
 	}
 
-	$query .= " ORDER BY $order_by $direction";
-
-	// if status Feedback then sort also after last updated time.
-	if ($status == 'Feedback') {
-		$query .= ", bugdb.ts2 $direction";
+	if ($order_by != '') {
+		$query .= " ORDER BY $order_by $direction";
+		// if status Feedback then sort also after last updated time.
+		if ($status == 'Feedback') {
+			$query .= ", bugdb.ts2 $direction";
+		}
 	}
 
 	if ($limit != 'All' && $limit > 0) {
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 26 10:01:29 2024 UTC