Index: comment.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/comment.module,v
retrieving revision 1.350
diff -u -r1.350 comment.module
--- comment.module 24 Apr 2005 16:34:33 -0000 1.350
+++ comment.module 25 Apr 2005 18:44:08 -0000
@@ -10,6 +10,12 @@
* a forum topic, weblog post, story, collaborative book page, etc.
*/
+/*
+ * Constants
+ */
+ define('COMMENT_PUBLISHED', 0);
+ define('COMMENT_NOT_PUBLISHED', 1);
+
/**
* Implementation of hook_help().
*/
@@ -164,7 +170,7 @@
return $blocks;
}
else if ($op == 'view' && user_access('access comments')) {
- $result = db_query_range(db_rewrite_sql('SELECT c.nid, c.* FROM {comments} c WHERE c.status = 0 ORDER BY c.timestamp DESC', 'c'), 0, 10);
+ $result = db_query_range(db_rewrite_sql('SELECT c.nid, c.* FROM {comments} c WHERE c.status = %d ORDER BY c.timestamp DESC', 'c'), COMMENT_PUBLISHED, 0, 10);
$items = array();
while ($comment = db_fetch_object($result)) {
$items[] = l($comment->subject, 'node/'. $comment->nid, NULL, NULL, 'comment-'. $comment->cid) .'
'. t('%time ago', array('%time' => format_interval(time() - $comment->timestamp)));
@@ -272,7 +278,7 @@
case 'update index':
$text = '';
- $comments = db_query('SELECT subject, comment, format FROM {comments} WHERE nid = %d AND status = 0', $node->nid);
+ $comments = db_query('SELECT subject, comment, format FROM {comments} WHERE nid = %d AND status = %d', $node->nid, COMMENT_PUBLISHED);
while ($comment = db_fetch_object($comments)) {
$text .= '