--- /Library/WebServer/Documents/drupal/modules/comment.module	2006-04-24 14:42:53.000000000 -0400
+++ comment.module	2006-04-27 09:20:39.000000000 -0400
@@ -1,5 +1,5 @@
 <?php
-// $Id: comment.module,v 1.454 2006/04/24 18:42:53 dries Exp $
+// $Id: comment.module,v 1.451 2006/04/15 04:07:17 unconed Exp $
 
 /**
  * @file
@@ -120,7 +120,7 @@
 
     $items[] = array('path' => 'admin/comment/configure/settings', 'title' => t('settings'),
       'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -10);
-
+      
     $items[] = array('path' => 'comment/delete', 'title' => t('delete comment'),
       'callback' => 'comment_delete', 'access' => $access, 'type' => MENU_CALLBACK);
 
@@ -710,12 +710,12 @@
       $nid = 0;
     }
 
-    if (!isset($mode)) {
-      $mode = isset($user->mode) ? $user->mode : (isset($_SESSION['comment_mode']) ? $_SESSION['comment_mode'] : variable_get('comment_default_mode', COMMENT_MODE_THREADED_EXPANDED));
+    if (empty($mode)) {
+      $mode = $user->mode ? $user->mode : ($_SESSION['comment_mode'] ? $_SESSION['comment_mode'] : variable_get('comment_default_mode', COMMENT_MODE_THREADED_EXPANDED));
     }
 
-    if (!isset($order)) {
-      $order = isset($user->sort) ? $user->sort : (isset($_SESSION['comment_sort']) ? $_SESSION['comment_sort'] : variable_get('comment_default_order', COMMENT_ORDER_NEWEST_FIRST));
+    if (empty($order)) {
+      $order = $user->sort ? $user->sort : ($_SESSION['comment_sort'] ? $_SESSION['comment_sort'] : variable_get('comment_default_order', COMMENT_ORDER_NEWEST_FIRST));
     }
 
     if (empty($comments_per_page)) {
@@ -732,7 +732,7 @@
         $query .= ' AND c.status = %d';
         $query_args[] = COMMENT_PUBLISHED;
       }
-      $query .= ' GROUP BY c.cid, c.pid, c.nid, c.subject, c.comment, c.format, c.timestamp, c.name, c.mail, u.picture, c.homepage, u.uid, u.name, u.picture, u.data, c.score, c.users, c.status';
+      $query .= ' GROUP BY c.cid, c.pid, c.nid, c.subject, c.comment, c.format, c.timestamp, c.name, c.mail, u.picture, c.homepage, u.uid, u.name, u.picture, u.data, c.score, c.users';
       $result = db_query($query, $query_args);
 
       if ($comment = db_fetch_object($result)) {
@@ -752,7 +752,7 @@
         $query_args[] = COMMENT_PUBLISHED;
       }
 
-      $query .= ' GROUP BY c.cid, c.pid, c.nid, c.subject, c.comment, c.format, c.timestamp, c.name, c.mail, u.picture, c.homepage, u.uid, u.name, u.picture, u.data, c.score, c.users, c.thread, c.status';
+      $query .= ' GROUP BY c.cid, c.pid, c.nid, c.subject, c.comment, c.format, c.timestamp, c.name, c.mail, u.picture, c.homepage, u.uid, u.name, u.picture, u.data, c.score, c.users, c.thread';
 
       /*
       ** We want to use the standard pager, but threads would need every
@@ -880,6 +880,9 @@
       $output .= comment_form(array('nid' => $nid), t('Post new comment'));
     }
   }
+  
+   $output = theme('comment_wrapper', $output );
+  
   return $output;
 }
 
@@ -1355,7 +1358,7 @@
   }
 
   if ($op == t('Preview comment')) {
-    $form['#after_build'] = array('comment_form_add_preview');
+    $form['#after_build'] = 'comment_form_add_preview';
   }
 
   if ($_REQUEST['destination']) {
