Index: modules/comment/comment.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/comment/comment.module,v
retrieving revision 1.520.2.13
diff -u -p -r1.520.2.13 comment.module
--- modules/comment/comment.module	3 Dec 2008 17:55:49 -0000	1.520.2.13
+++ modules/comment/comment.module	1 Feb 2009 16:38:41 -0000
@@ -329,7 +329,7 @@ function comment_link($type, $node = NUL
               );
             }
             else {
-              $links['comment_forbidden']['title'] = theme('comment_post_forbidden', $node->nid);
+              $links['comment_forbidden']['title'] = theme('comment_post_forbidden', $node);
             }
           }
         }
@@ -341,7 +341,7 @@ function comment_link($type, $node = NUL
 
       if ($node->comment == COMMENT_NODE_READ_WRITE) {
         if (user_access('post comments')) {
-          if (variable_get('comment_form_location', COMMENT_FORM_SEPARATE_PAGE) == COMMENT_FORM_SEPARATE_PAGE) {
+          if ($node->comment_form_location == COMMENT_FORM_SEPARATE_PAGE) {
             $links['comment_add'] = array(
               'title' => t('Add new comment'),
               'href' => "comment/reply/$node->nid",
@@ -351,7 +351,7 @@ function comment_link($type, $node = NUL
           }
         }
         else {
-          $links['comment_forbidden']['title'] = theme('comment_post_forbidden', $node->nid);
+          $links['comment_forbidden']['title'] = theme('comment_post_forbidden', $node);
         }
       }
     }
@@ -405,6 +405,10 @@ function comment_form_alter($form_id, &$
 function comment_nodeapi(&$node, $op, $arg = 0) {
   switch ($op) {
     case 'load':
+      if (!isset($node->comment_form_location)) {
+        $node->comment_form_location = variable_get('comment_form_location', COMMENT_FORM_SEPARATE_PAGE);
+      }
+
       return db_fetch_array(db_query("SELECT last_comment_timestamp, last_comment_name, comment_count FROM {node_comment_statistics} WHERE nid = %d", $node->nid));
       break;
 
@@ -784,7 +788,7 @@ function comment_save($edit) {
           $edit['name'] = $user->name;
         }
 
-        db_query("INSERT INTO {comments} (cid, nid, pid, uid, subject, comment, format, hostname, timestamp, status, score, users, thread, name, mail, homepage) VALUES (%d, %d, %d, %d, '%s', '%s', %d, '%s', %d, %d, %d, '%s', '%s', '%s', '%s', '%s')", $edit['cid'], $edit['nid'], $edit['pid'], $edit['uid'], $edit['subject'], $edit['comment'], $edit['format'], $_SERVER['REMOTE_ADDR'], $edit['timestamp'], $edit['status'], $score, $users, $thread, $edit['name'], $edit['mail'], $edit['homepage']);
+        db_query("INSERT INTO {comments} (cid, nid, pid, uid, subject, comment, format, hostname, timestamp, status, score, users, thread, name, mail, homepage) VALUES (%d, %d, %d, %d, '%s', '%s', %d, '%s', %d, %d, %d, '%s', '%s', '%s', '%s', '%s')", $edit['cid'], $edit['nid'], $edit['pid'], $edit['uid'], $edit['subject'], $edit['comment'], $edit['format'], ip_address(), $edit['timestamp'], $edit['status'], $score, $users, $thread, $edit['name'], $edit['mail'], $edit['homepage']);
 
         _comment_update_node_statistics($edit['nid']);
 
@@ -859,7 +863,8 @@ function comment_links($comment, $return
       );
     }
     else {
-      $links['comment_forbidden']['title'] = theme('comment_post_forbidden', $comment->nid);
+      $node = node_load($comment->nid);
+      $links['comment_forbidden']['title'] = theme('comment_post_forbidden', $node);
     }
   }
 
@@ -1057,7 +1062,7 @@ function comment_render($node, $cid = 0)
 
     // If enabled, show new comment form if it's not already being displayed.
     $reply = arg(0) == 'comment' && arg(1) == 'reply';
-    if (user_access('post comments') && node_comment_mode($nid) == COMMENT_NODE_READ_WRITE && (variable_get('comment_form_location', COMMENT_FORM_SEPARATE_PAGE) == COMMENT_FORM_BELOW) && !$reply) {
+    if (user_access('post comments') && node_comment_mode($nid) == COMMENT_NODE_READ_WRITE && ($node->comment_form_location == COMMENT_FORM_BELOW) && !$reply) {
       $output .= comment_form_box(array('nid' => $nid), t('Post new comment'));
     }
 
@@ -1178,10 +1183,11 @@ function comment_admin_overview($type = 
     theme('table_select_header_cell'),
     array('data' => t('Subject'), 'field' => 'subject'),
     array('data' => t('Author'), 'field' => 'name'),
+    array('data' => t('Posted in'), 'field' => 'node_title'),
     array('data' => t('Time'), 'field' => 'timestamp', 'sort' => 'desc'),
     array('data' => t('Operations'))
   ));
-  $result = pager_query('SELECT c.subject, c.nid, c.cid, c.comment, c.timestamp, c.status, c.name, c.homepage, u.name AS registered_name, u.uid FROM {comments} c INNER JOIN {users} u ON u.uid = c.uid WHERE c.status = %d'. tablesort_sql($form['header']['#value']), 50, 0, NULL, $status);
+  $result = pager_query('SELECT c.subject, c.nid, c.cid, c.comment, c.timestamp, c.status, c.name, c.homepage, u.name AS registered_name, u.uid, n.title as node_title FROM {comments} c INNER JOIN {users} u ON u.uid = c.uid INNER JOIN {node} n ON n.nid = c.nid WHERE c.status = %d'. tablesort_sql($form['header']['#value']), 50, 0, NULL, $status);
 
   // build a table listing the appropriate comments
   $destination = drupal_get_destination();
@@ -1190,6 +1196,7 @@ function comment_admin_overview($type = 
     $comment->name = $comment->uid ? $comment->registered_name : $comment->name;
     $form['subject'][$comment->cid] = array('#value' => l($comment->subject, 'node/'. $comment->nid, array('title' => truncate_utf8($comment->comment, 128)), NULL, 'comment-'. $comment->cid));
     $form['username'][$comment->cid] = array('#value' => theme('username', $comment));
+    $form['node_title'][$comment->cid] = array('#value' => l($comment->node_title, 'node/'. $comment->nid));
     $form['timestamp'][$comment->cid] = array('#value' => format_date($comment->timestamp, 'small'));
     $form['operations'][$comment->cid] = array('#value' => l(t('edit'), 'comment/edit/'. $comment->cid, array(), $destination));
   }
@@ -1244,6 +1251,7 @@ function theme_comment_admin_overview($f
       $row[] = drupal_render($form['comments'][$key]);
       $row[] = drupal_render($form['subject'][$key]);
       $row[] = drupal_render($form['username'][$key]);
+      $row[] = drupal_render($form['node_title'][$key]);
       $row[] = drupal_render($form['timestamp'][$key]);
       $row[] = drupal_render($form['operations'][$key]);
       $rows[] = $row;
@@ -1807,7 +1815,7 @@ function theme_comment_thread_expanded($
   return $output;
 }
 
-function theme_comment_post_forbidden($nid) {
+function theme_comment_post_forbidden($node) {
   global $user;
   static $authenticated_post_comments;
 
