From 2db2c039fb5caabf511c95f15034ec18b39533d4 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Tue, 4 Sep 2007 21:10:45 +0000 Subject: - Patch #172950 by webernet: code style fixes. --- modules/comment/comment.module | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'modules/comment/comment.module') diff --git a/modules/comment/comment.module b/modules/comment/comment.module index 14fb48e4b..59693b29d 100644 --- a/modules/comment/comment.module +++ b/modules/comment/comment.module @@ -324,28 +324,28 @@ function comment_new_page_count($num_comments, $new_replies, $nid) { $mode = _comment_get_display_setting('mode'); $order = _comment_get_display_setting('sort'); $pagenum = NULL; - $flat = in_array($mode, array(COMMENT_MODE_FLAT_COLLAPSED, COMMENT_MODE_FLAT_EXPANDED)); + $flat = in_array($mode, array(COMMENT_MODE_FLAT_COLLAPSED, COMMENT_MODE_FLAT_EXPANDED)); if ($num_comments <= $comments_per_page || ($flat && $order == COMMENT_ORDER_NEWEST_FIRST)) { // Only one page of comments or flat forum and newest first. // First new comment will always be on first page. $pageno = 0; - } + } else { - if ($flat) { + if ($flat) { // Flat comments and oldest first. $count = $num_comments - $new_replies; - } + } else { // Threaded comments. See the documentation for comment_render(). - if ($order == COMMENT_ORDER_NEWEST_FIRST) { + if ($order == COMMENT_ORDER_NEWEST_FIRST) { // Newest first: find the last thread with new comment $result = db_query('(SELECT thread FROM {comments} WHERE nid = %d AND status = 0 ORDER BY timestamp DESC LIMIT %d) ORDER BY thread DESC LIMIT 1', $nid, $new_replies); $thread = db_result($result); $result_count = db_query("SELECT COUNT(*) FROM {comments} WHERE nid = %d AND status = 0 AND thread > '" . $thread . "'", $nid); - } - else { + } + else { // Oldest first: find the first thread with new comment - $result = db_query('(SELECT thread FROM {comments} WHERE nid = %d AND status = 0 ORDER BY timestamp DESC LIMIT %d) ORDER BY SUBSTRING(thread, 1, (LENGTH(thread) - 1)) LIMIT 1', $nid, $new_replies); + $result = db_query('(SELECT thread FROM {comments} WHERE nid = %d AND status = 0 ORDER BY timestamp DESC LIMIT %d) ORDER BY SUBSTRING(thread, 1, (LENGTH(thread) - 1)) LIMIT 1', $nid, $new_replies); $thread = substr(db_result($result), 0, -1); $result_count = db_query("SELECT COUNT(*) FROM {comments} WHERE nid = %d AND status = 0 AND SUBSTRING(thread, 1, (LENGTH(thread) - 1)) < '" . $thread . "'", $nid); } -- cgit v1.2.3