From c17499b6fe5e9b388d09151d2c3525976fde065c Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Sun, 12 Aug 2007 16:12:00 +0000 Subject: - Patch #163191 by hswong3i: removed db_num_rows() for compatibility with Oracle and DB2. Also a performance improvement. (Correct version this time.) --- modules/comment/comment.module | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'modules/comment/comment.module') diff --git a/modules/comment/comment.module b/modules/comment/comment.module index 7a534a044..82db5cae0 100644 --- a/modules/comment/comment.module +++ b/modules/comment/comment.module @@ -1019,6 +1019,7 @@ function comment_render($node, $cid = 0) { $divs = 0; $last_depth = 0; + $num_rows = FALSE; $comments = ''; drupal_add_css(drupal_get_path('module', 'comment') .'/comment.css'); while ($comment = db_fetch_object($result)) { @@ -1053,9 +1054,11 @@ function comment_render($node, $cid = 0) { else if ($mode == COMMENT_MODE_THREADED_EXPANDED) { $comments .= theme('comment_thread_expanded', $comment, $node); } + + $num_rows = TRUE; } - if ($comment && (variable_get('comment_controls', COMMENT_CONTROLS_HIDDEN) == COMMENT_CONTROLS_ABOVE || variable_get('comment_controls', COMMENT_CONTROLS_HIDDEN) == COMMENT_CONTROLS_ABOVE_BELOW)) { + if ($num_rows && (variable_get('comment_controls', COMMENT_CONTROLS_HIDDEN) == COMMENT_CONTROLS_ABOVE || variable_get('comment_controls', COMMENT_CONTROLS_HIDDEN) == COMMENT_CONTROLS_ABOVE_BELOW)) { $output .= drupal_get_form('comment_controls', $mode, $order, $comments_per_page); } $output .= $comments; @@ -1065,7 +1068,7 @@ function comment_render($node, $cid = 0) { } $output .= theme('pager', NULL, $comments_per_page, 0); - if ($comment && (variable_get('comment_controls', COMMENT_CONTROLS_HIDDEN) == COMMENT_CONTROLS_BELOW || variable_get('comment_controls', COMMENT_CONTROLS_HIDDEN) == COMMENT_CONTROLS_ABOVE_BELOW)) { + if ($num_rows && (variable_get('comment_controls', COMMENT_CONTROLS_HIDDEN) == COMMENT_CONTROLS_BELOW || variable_get('comment_controls', COMMENT_CONTROLS_HIDDEN) == COMMENT_CONTROLS_ABOVE_BELOW)) { $output .= drupal_get_form('comment_controls', $mode, $order, $comments_per_page); } } -- cgit v1.2.3