Index: modules/blog.module =================================================================== RCS file: /cvs/drupal/drupal/modules/blog.module,v retrieving revision 1.174 diff -u -r1.174 blog.module --- modules/blog.module 17 May 2004 22:00:06 -0000 1.174 +++ modules/blog.module 19 May 2004 18:03:00 -0000 @@ -288,9 +288,11 @@ } else { if (user_access('access content')) { - $block['content'] = node_title_list(db_query_range("SELECT n.title, n.nid FROM {node} n WHERE n.type = 'blog' AND n.status = 1 ORDER BY n.nid DESC", 0, 10)); - $block['content'] .= ''; - $block['subject'] = t('Blogs'); + $result = db_query_range("SELECT n.title, n.nid FROM {node} n WHERE n.type = 'blog' AND n.status = 1 ORDER BY n.nid DESC", 0, 10); + if (db_num_rows($result)) { + $block['content'] = node_title_list($result); + } + $block['subject'] = l(t('Blogs'), 'blog', array('title' => t('Read the latest blog entries.'))); } return $block; } Index: modules/forum.module =================================================================== RCS file: /cvs/drupal/drupal/modules/forum.module,v retrieving revision 1.173 diff -u -r1.173 forum.module --- modules/forum.module 20 Mar 2004 13:23:33 -0000 1.173 +++ modules/forum.module 19 May 2004 18:03:03 -0000 @@ -103,16 +103,13 @@ } else { if (user_access('access content')) { - $content = node_title_list(db_query_range("SELECT n.nid, n.title, GREATEST(n.created, MAX(c.timestamp)) AS sort FROM {node} n LEFT JOIN {comments} c ON n.nid = c.nid WHERE n.type = 'forum' AND n.status = 1 GROUP BY n.nid, n.title, n.created ORDER BY sort DESC", 0, variable_get('forum_block_num', '5')), t('Active forum topics:')); - - $content .= node_title_list(db_query_range("SELECT nid, title FROM {node} WHERE type = 'forum' AND status = 1 ORDER BY nid DESC", 0, variable_get('forum_block_num', '5')), t('New forum topics:')); - - if ($content) { - $content .= "
". l(t('more'), 'forum', array('title' => t('Read the latest forum topics.'))) .'
'; + $result = db_query_range("SELECT n.nid, n.title, GREATEST(n.created, MAX(c.timestamp)) AS sort FROM {node} n LEFT JOIN {comments} c ON n.nid = c.nid WHERE n.type = 'forum' AND n.status = 1 GROUP BY n.nid, n.title, n.created ORDER BY sort DESC", 0, $forum_block_num = variable_get('forum_block_num', '5')); + if (db_num_rows($result)) { + $blocks['content'] = node_title_list($result, t('Active forum topics:')); + $blocks['content'] .= node_title_list(db_query_range("SELECT nid, title FROM {node} WHERE type = 'forum' AND status = 1 ORDER BY nid DESC", 0, $forum_block_num), t('New forum topics:')); } - $blocks['subject'] = t('Forum topics'); - $blocks['content'] = $content; + $blocks['subject'] = l(t('Forum topics'), 'forum', array('title' => t('Go to the forums.'))); } } Index: modules/statistics.module =================================================================== RCS file: /cvs/drupal/drupal/modules/statistics.module,v retrieving revision 1.147 diff -u -r1.147 statistics.module --- modules/statistics.module 17 May 2004 22:00:06 -0000 1.147 +++ modules/statistics.module 19 May 2004 18:03:05 -0000 @@ -444,23 +444,24 @@ $content = array(); $daytop = variable_get('statistics_block_top_day_num', 0); - if ($daytop) { - $content[] = node_title_list(statistics_title_list('daycount', $daytop), t("Today's:")); + if ($daytop && ($result = statistics_title_list('daycount', $daytop)) && db_num_rows($result)) { + $content[] = node_title_list($result, t("Today's:")); } $alltimetop = variable_get('statistics_block_top_all_num', 0); - if ($alltimetop) { - $content[] = node_title_list(statistics_title_list('totalcount', $alltimetop), t('All time:')); + if ($alltimetop && ($result = statistics_title_list('totalcount', $alltimetop)) && db_num_rows($result)) { + $content[] = node_title_list($result, t('All time:')); } $lasttop = variable_get('statistics_block_top_last_num', 0); - if ($lasttop) { - $content[] = node_title_list(statistics_title_list('timestamp', $lasttop), t('Last viewed:')); + if ($lasttop && ($result = statistics_title_list('timestamp', $lasttop)) && db_num_rows($result)) { + $content[] = node_title_list($result, t('Last viewed:')); } - $output = implode($content, '
'); - - $block['subject'] = variable_get('statistics_block_top_title', t('Popular content')); - $block['content'] = $output; + + if (count($content)) { + $block['content'] = implode($content, '
'); + } + $block['subject'] = l(t(variable_get('statistics_block_top_title', 'Popular content')), 'statistics', array ('title' => t('View the most popular content'))); break; }