Index: comment_page.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/comment_page/comment_page.info,v
retrieving revision 1.1
diff -u -p -r1.1 comment_page.info
--- comment_page.info	1 May 2007 14:07:10 -0000	1.1
+++ comment_page.info	27 May 2008 04:19:27 -0000
@@ -1,5 +1,6 @@
 ; $Id$
 name = Comment Page
 description = Display comments as individual pages to build your site content.
-dependencies = comment
+dependencies[] = comment
+core = 6.x
 
Index: comment_page.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/comment_page/comment_page.module,v
retrieving revision 1.1
diff -u -p -r1.1 comment_page.module
--- comment_page.module	1 May 2007 14:07:10 -0000	1.1
+++ comment_page.module	27 May 2008 04:19:27 -0000
@@ -12,42 +12,47 @@
 /**
  * Implementation of hook_menu().
  */
-function comment_page_menu($may_cache) {
-  if ($may_cache) {
-    $items[] = array(
-      'path' => 'admin/content/comment_page',
-      'title' => t('Comment page'),
-      'description' => t('Adjust the settings for the comment page module.'),
-      'callback' => 'drupal_get_form',
-      'callback arguments' => array('comment_page_settings'),
-      'access' => user_access('admin comments'),
-      'type' => MENU_NORMAL_ITEM,
-    );
-  }    
-  else {
-    if (arg(0) == 'comment' && intval(arg(1)) > 0) {
-      drupal_add_css(drupal_get_path('module', 'comment_page') .'/comment_page.css');
+function comment_page_menu() {
+  $items['admin/content/comment_page'] = array(
+    'title' => 'Comment page',
+    'description' => 'Adjust the settings for the comment page module.',
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('comment_page_settings'),
+    'access arguments' => array('admin comments'),
+    'type' => MENU_NORMAL_ITEM,
+  );
+
+  $items['comment/%comment_page'] = array(
+    'title' => 'Viewing a comment',
+    'description' => 'View this comment.',
+    'page callback' => 'comment_page_display',
+    'page arguments' => array(1),
+    'access arguments' => array('access comments'),
+    'type' => MENU_CALLBACK,
+  );
 
-      $items[] = array(
-        'path' => 'comment/'. arg(1),
-        'title' => t('Viewing a comment'),
-        'description' => t('View this comment.'),
-        'callback' => 'comment_page_display',
-        'callback arguments' => array(arg(1)),
-        'access' => user_access('access comments'),
-        'type' => MENU_CALLBACK,
-      );
-    }
+  return $items;
+}
+
+/**
+ * Implementation of hook_load()
+ *
+ * This will be called based on the menu definition above to pass back a
+ * comment based on the %comment_page placeholder
+ */
+function comment_page_load($cid) {
+  if (!is_numeric($cid) || $cid < 1) {
+    return FALSE;
   }
 
-  return $items;
+  return _comment_load($cid);
 }
 
 /**
  * Implementation of hook_comment().
  */
 function comment_page_comment($arg1, $op) {
-  switch($op) {
+  switch ($op) {
     case 'insert':
       if (variable_get('default_comment_subject_on', TRUE)) {
         $comment = (object) $arg1;
@@ -203,6 +208,7 @@ function comment_page_settings() {
  * Display a comment as a page.
  */
 function comment_page_display($comment_id) {
+  drupal_add_css(drupal_get_path('module', 'comment_page') .'/comment_page.css');
   $comment = _comment_load($comment_id);
 
   if (variable_get('default_comment_subject_on', TRUE) &&
@@ -279,9 +285,9 @@ function comment_page_cleanstring($strin
   if ($separator) {
     if (ctype_alnum($separator)) {
       $seppattern = $separator;
-    } 
+    }
     else {
-      $seppattern = '\\'.$separator;
+      $seppattern = '\\'. $separator;
     }
     $output = preg_replace("/^$seppattern+|$seppattern+$/", "", $output);
   }
@@ -306,7 +312,7 @@ function comment_page_thread($comment, $
 
   $result = db_query("SELECT cid, pid, uid, subject, thread, name, timestamp FROM "
                     ."{comments} WHERE nid = %d ORDER BY thread DESC", $comment->nid);
-  $node->replies = db_num_rows($result);
+  $node->replies = db_result(db_query("SELECT COUNT(*) FROM {comments} WHERE nid = %d", $comment->nid));
 
   $output = '<div class="comment-thread">';
 
@@ -320,7 +326,7 @@ function comment_page_thread($comment, $
       }
     }
     $output .= '<span class="thread-title">'. l($node->title, $dst) .'</span> ';
-  
+
     // Add the name of the node author if enabled.
     if (variable_get('comment_page_thread_show_names', TRUE)) {
       if ($node->uid) {
@@ -332,14 +338,14 @@ function comment_page_thread($comment, $
       $output .= '<span class="thread-author">'
                . t('By: !name', array('!name' => $name)) .'</span> ';
     }
-  
+
     // Add the reply count if enabled.
     if (variable_get('comment_page_thread_show_count', TRUE)) {
       $output .= '<span class="thread-count">'
                . t('(%count <em>replies</em>)', array('%count' => $node->replies))
                 .'</span> ';
     }
-    
+
     // Add the date beneath the thread title.
     if (variable_get('comment_page_thread_show_date', TRUE)) {
       $output .= '<span class="thread-date">'. format_date($node->created)
@@ -375,7 +381,7 @@ function comment_page_thread($comment, $
     }
 
     $output .= '<li>';
-    
+
     // Add the comment's subject.
     $output .= '<span class="comment-title '. $class .'">'. $subject .'</span> ';
 
