Alexander Nicolaysen Sørnes : comment: Show newest threads first

Chris Morgan cmorgan at winehq.org
Sun Nov 11 14:16:26 CST 2007


Module: appdb
Branch: master
Commit: 3aef9df655569a1bba7a75fe17aebd1ec6dfd40f
URL:    http://source.winehq.org/git/appdb.git/?a=commit;h=3aef9df655569a1bba7a75fe17aebd1ec6dfd40f

Author: Alexander Nicolaysen Sørnes <alex at thehandofagony.com>
Date:   Sat Nov 10 19:19:23 2007 +0100

comment: Show newest threads first

---

 include/comment.php |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/include/comment.php b/include/comment.php
index 0a85529..38d419e 100644
--- a/include/comment.php
+++ b/include/comment.php
@@ -294,15 +294,21 @@ class Comment {
 
         $sExtra = "";
 
+        $sOrderingMode = "DESC";
+
         /* NOTE: we must compare against NULL here because $iParentId of 0 is valid */
-        if($iParentId != NULL)
+        if($iParentId)
+        {
             $sExtra = "AND parentId = '".$iParentId."' ";
+            $sOrderingMode = "ASC";
+        }
 
         $sQuery = "SELECT from_unixtime(unix_timestamp(appComments.time), \"%W %M %D %Y, %k:%i\") as time, ".
             "appComments.commentId, appComments.parentId, appComments.versionId, appComments.userId, appComments.subject, appComments.body, appVersion.appId ".
             "FROM appComments, appVersion WHERE appComments.versionId = appVersion.versionId AND appComments.versionId = '".$iVersionId."' ".
             $sExtra.
-            "ORDER BY appComments.time ASC";
+            "ORDER BY appComments.time $sOrderingMode";
+
         $hResult = query_appdb($sQuery);
 
         return $hResult;




More information about the wine-cvs mailing list