tu.php: Sort votes by descending date.

Also make syntax more straightforward.
'asc' is ascending, rather than 'up'.

Signed-off-by: Loui Chang <louipc.ist@gmail.com>
This commit is contained in:
Loui Chang 2009-12-26 14:30:14 -05:00
parent 4b109cacc1
commit 55dcf5ce87

View file

@ -106,7 +106,7 @@ if ($atype == "Trusted User" OR $atype == "Developer") {
if (isset($_GET['by'])) if (isset($_GET['by']))
$by = $_GET['by']; $by = $_GET['by'];
else else
$by = 'up'; $by = 'desc';
if (!empty($offset) AND is_numeric($offset)) { if (!empty($offset) AND is_numeric($offset)) {
if ($offset >= 1) { if ($offset >= 1) {
@ -118,9 +118,9 @@ if ($atype == "Trusted User" OR $atype == "Developer") {
$off = 0; $off = 0;
} }
$order = ($by == 'down') ? 'DESC' : 'ASC'; $order = ($by == 'asc') ? 'ASC' : 'DESC';
$lim = ($limit > 0) ? " LIMIT " . $off . ", " . $limit : ""; $lim = ($limit > 0) ? " LIMIT $off, $limit" : "";
$by_next = ($by == "down") ? "up" : "down"; $by_next = ($by == 'desc') ? 'asc' : 'desc';
$q = "SELECT * FROM TU_VoteInfo WHERE End > " . time() . " ORDER BY Submitted " . $order; $q = "SELECT * FROM TU_VoteInfo WHERE End > " . time() . " ORDER BY Submitted " . $order;
$result = db_query($q, $dbh); $result = db_query($q, $dbh);