Index: modules/statistics.module =================================================================== RCS file: /cvs/drupal/drupal/modules/statistics.module,v retrieving revision 1.196 diff -u -r1.196 statistics.module --- modules/statistics.module 7 Jun 2005 18:54:37 -0000 1.196 +++ modules/statistics.module 13 Jun 2005 12:54:55 -0000 @@ -447,25 +447,26 @@ $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'] = t('Popular content'); - $block['content'] = $output; + if (count($content)) { + $block['content'] = implode($content, '
'); + return $block; + } - return $block; + $block['subject'] = t('Popular content'); } } } Index: modules/blog.module =================================================================== RCS file: /cvs/drupal/drupal/modules/blog.module,v retrieving revision 1.217 diff -u -r1.217 blog.module --- modules/blog.module 31 May 2005 21:14:26 -0000 1.217 +++ modules/blog.module 13 Jun 2005 12:55:16 -0000 @@ -277,11 +277,14 @@ } else if ($op == 'view') { if (user_access('access content')) { - $block['content'] = node_title_list(db_query_range(db_rewrite_sql("SELECT n.nid, n.title, n.created FROM {node} n WHERE n.type = 'blog' AND n.status = 1 ORDER BY n.created DESC"), 0, 10)); - $block['content'] .= ''; - $block['subject'] = t('Recent blog posts'); + $result = db_query_range(db_rewrite_sql("SELECT n.nid, n.title, n.created FROM {node} n WHERE n.type = 'blog' AND n.status = 1 ORDER BY n.created DESC"), 0, 10); + if (db_num_rows($result)) { + $block['content'] = node_title_list($result); + $block['content'] .= ''; + $block['subject'] = t('Recent blog posts'); + return $block; + } } - return $block; } }