? modules/comment.module.sbm ? modules/contact.module.sbm ? modules/search.module.sbm ? modules/statistics.module.sbm ? modules/user.module.sbm Index: modules/comment.module =================================================================== RCS file: /cvs/drupal/drupal/modules/comment.module,v retrieving revision 1.364 diff -u -r1.364 comment.module --- modules/comment.module 1 Aug 2005 05:14:05 -0000 1.364 +++ modules/comment.module 10 Aug 2005 13:41:03 -0000 @@ -1281,13 +1281,13 @@ } 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']; // this functions perform doubletime: it either saves the // user's comment viewing options, or it handles comment // moderation. let's figure out which one we're using, eh? @@ -1468,58 +1468,36 @@ return $output; } -function theme_comment_mode_form($mode) { - - $modes = _comment_get_modes(); - foreach ($modes as $key => $value) { - $options .= " \n"; - } - - return "\n"; -} - -function theme_comment_order_form($order) { - - $orders = _comment_get_orders(); - foreach ($orders as $key=>$value) { - $options .= " \n"; - } - - return "\n"; -} - -function theme_comment_per_page_form($comments_per_page) { - foreach (_comment_per_page() as $i) { - $options .= " '; - } - return "\n"; -} - -function theme_comment_threshold($threshold) { - $result = db_query('SELECT fid, filter FROM {moderation_filters} '); - $options .= ' '; - while ($filter = db_fetch_object($result)) { - $filters .= " '; - } - - if ($filters) { - return "\n"; - } - else { - return "\n"; - } -} - function theme_comment_controls($threshold = 1, $mode = 3, $order = 1, $comments_per_page = 50) { static $output; + $options = array(); + $result = db_query('SELECT fid, filter FROM {moderation_filters} '); + $filters = array(); + $filters[0] = t('-- threshold --'); + + while($filter = db_fetch_object($result)) { + $filters[$filter->fid] = $filter->filter; + } if (!$output) { - $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 .= '
'; + $output .= form_select(NULL, 'mode', $mode, _comment_get_modes()); + $output .= form_select(NULL, 'order', $order, _comment_get_orders()); + + foreach (_comment_per_page() as $i) { + $options[] = t('%a comments per page', array('%a' => $i)); + } + $output .= form_select(NULL, 'comments_per_page', $comments_per_page, $options); + + if ($filters) { + $output .= form_select(NULL, 'threshold', $threshold, $filters); + } + else { + $output .= form_hidden('threshold', $threshold); + } $output .= ' '. form_submit(t('Save settings')); + $output .= '
'; $output = form_item(NULL, $output, t('Select your preferred way to display the comments and click "Save settings" to activate your changes.')); } @@ -1685,4 +1663,4 @@ db_query("UPDATE {node_comment_statistics} SET comment_count = %d, last_comment_timestamp = %d, last_comment_name = '%s', last_comment_uid = %d WHERE nid = %d", 0, NULL, 0, 0, $nid); } } -?> +?> \ No newline at end of file