Index: modules/comment.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/comment.module,v
retrieving revision 1.353
diff -u -r1.353 comment.module
--- modules/comment.module	22 May 2005 21:14:59 -0000	1.353
+++ modules/comment.module	25 May 2005 22:26:46 -0000
@@ -707,11 +707,11 @@
 function comment_render($node, $cid = 0) {
   global $user;
 
-  $mode = $_GET['mode'];
-  $order = $_GET['order'];
-  $threshold = $_GET['threshold'];
+  $mode              = $_GET['mode'];
+  $order             = $_GET['order'];
+  $threshold         = $_GET['threshold'];
   $comments_per_page = $_GET['comments_per_page'];
-  $comment_page = $_GET['comment_page'];
+  $comment_page      = $_GET['comment_page'];
 
   $output = '';
 
@@ -1288,10 +1288,11 @@
 }
 
 function comment_save_settings() {
-  $mode              = db_escape_string($_POST['mode']);
-  $order             = db_escape_string($_POST['order']);
-  $threshold         = db_escape_string($_POST['threshold']);
-  $comments_per_page = db_escape_string($_POST['comments_per_page']);
+  $edit = $_POST['edit'];
+  $mode              = $edit['mode'];
+  $order             = $edit['order'];
+  $threshold         = $edit['threshold'];
+  $comments_per_page = $edit['comments_per_page'];
 
   global $user;
-  $edit = $_POST['edit'];
@@ -1458,44 +1458,31 @@
 }
 
 function theme_comment_mode_form($mode) {
-
-  $modes = _comment_get_modes();
-  foreach ($modes as $key => $value) {
-    $options .= " <option value=\"$key\"". ($mode == $key ? ' selected="selected"' : '') .">$value</option>\n";
-  }
-
-  return "<select name=\"mode\">$options</select>\n";
+  return form_select(NULL, 'mode', $mode, _comment_get_modes());
 }
 
 function theme_comment_order_form($order) {
-
-  $orders = _comment_get_orders();
-  foreach ($orders as $key=>$value) {
-    $options .= " <option value=\"$key\"". ($order == $key ? ' selected="selected"' : '') .">$value</option>\n";
-  }
-
-  return "<select name=\"order\">$options</select>\n";
+  return form_select(NULL, 'order', $order, _comment_get_orders());
 }
 
 function theme_comment_per_page_form($comments_per_page) {
+  $options = array();
   foreach (_comment_per_page() as $i) {
-    $options .= " <option value=\"$i\"". ($comments_per_page == $i ? ' selected="selected"' : '') .'>'. t('%a comments per page', array('%a' => $i)) .'</option>';
+    $options[] = t('%a comments per page', array('%a' => $i));
   }
-  return "<select name=\"comments_per_page\">$options</select>\n";
+  return form_select(NULL, 'comments_per_page', $comments_per_page, $options);
 }
 
 function theme_comment_threshold($threshold) {
-  $result = db_query('SELECT fid, filter FROM {moderation_filters} ');
-  $options .= ' <option value="0">'. t('-- threshold --') .'</option>';
-  while ($filter = db_fetch_object($result)) {
-    $filters .= " <option value=\"$filter->fid\"". ($threshold == $filter->fid ? ' selected="selected"' : '') .'>'. $filter->filter .'</option>';
-  }
+  $result    = db_query('SELECT fid, filter FROM {moderation_filters} ');
+  $filter    = db_fetch_array($result);
+  $filter[0] = t('-- threshold --');
 
   if ($filters) {
-    return "<select name=\"threshold\">$filters</select>\n";
+    return form_select(NULL, 'threshold', $threshold, $filter);
   }
   else {
-    return "<input type=\"hidden\" name=\"threshold\" value=\"$threshold\" />\n";
+    return form_hidden('threshold', $threshold);
   }
 }
 
@@ -1503,12 +1490,14 @@
   static $output;
 
   if (!$output) {
+    $output .= '<div class="container-inline">';
     $output .= theme('comment_mode_form', $mode);
     $output .= theme('comment_order_form', $order);
     $output .= theme('comment_per_page_form', $comments_per_page);
     $output .= theme('comment_threshold', $threshold);
 
     $output .= ' '. form_submit(t('Save settings'));
+    $output .= '</div>';
 
     $output = form_item(NULL, $output, t('Select your preferred way to display the comments and click "Save settings" to activate your changes.'));
   }
