summaryrefslogtreecommitdiff
path: root/modules/comment/comment.module
diff options
context:
space:
mode:
authorNeil Drumm <drumm@3064.no-reply.drupal.org>2006-12-25 22:39:08 +0000
committerNeil Drumm <drumm@3064.no-reply.drupal.org>2006-12-25 22:39:08 +0000
commit8b9a3326c3d478fd267147641d45e91c79a15ad5 (patch)
treed5a0d1424c8131657d6a4e0cff3b4b6d540819a6 /modules/comment/comment.module
parent3111774ef7b38cee50d3de84aa3be9d4aeef87b9 (diff)
downloadbrdo-8b9a3326c3d478fd267147641d45e91c79a15ad5.tar.gz
brdo-8b9a3326c3d478fd267147641d45e91c79a15ad5.tar.bz2
#60664 by Heine. Only check if new comments are duplicates.
Diffstat (limited to 'modules/comment/comment.module')
-rw-r--r--modules/comment/comment.module15
1 files changed, 7 insertions, 8 deletions
diff --git a/modules/comment/comment.module b/modules/comment/comment.module
index d262201be..a6e7f4cd8 100644
--- a/modules/comment/comment.module
+++ b/modules/comment/comment.module
@@ -701,13 +701,6 @@ function comment_save($edit) {
global $user;
if (user_access('post comments') && (user_access('administer comments') || node_comment_mode($edit['nid']) == COMMENT_NODE_READ_WRITE)) {
if (!form_get_errors()) {
- // Check for duplicate comments. Note that we have to use the
- // validated/filtered data to perform such check.
- $duplicate = db_result(db_query("SELECT COUNT(cid) FROM {comments} WHERE pid = %d AND nid = %d AND subject = '%s' AND comment = '%s'", $edit['pid'], $edit['nid'], $edit['subject'], $edit['comment']), 0);
- if ($duplicate != 0) {
- watchdog('content', t('Comment: duplicate %subject.', array('%subject' => $edit['subject'])), WATCHDOG_WARNING);
- }
-
if ($edit['cid']) {
// Update the comment in the database.
db_query("UPDATE {comments} SET status = %d, timestamp = %d, subject = '%s', comment = '%s', format = %d, uid = %d, name = '%s', mail = '%s', homepage = '%s' WHERE cid = %d", $edit['status'], $edit['timestamp'], $edit['subject'], $edit['comment'], $edit['format'], $edit['uid'], $edit['name'], $edit['mail'], $edit['homepage'], $edit['cid']);
@@ -717,11 +710,17 @@ function comment_save($edit) {
// Allow modules to respond to the updating of a comment.
comment_invoke_comment($edit, 'update');
-
// Add an entry to the watchdog log.
watchdog('content', t('Comment: updated %subject.', array('%subject' => $edit['subject'])), WATCHDOG_NOTICE, l(t('view'), 'node/'. $edit['nid'], NULL, NULL, 'comment-'. $edit['cid']));
}
else {
+ // Check for duplicate comments. Note that we have to use the
+ // validated/filtered data to perform such check.
+ $duplicate = db_result(db_query("SELECT COUNT(cid) FROM {comments} WHERE pid = %d AND nid = %d AND subject = '%s' AND comment = '%s'", $edit['pid'], $edit['nid'], $edit['subject'], $edit['comment']), 0);
+ if ($duplicate != 0) {
+ watchdog('content', t('Comment: duplicate %subject.', array('%subject' => $edit['subject'])), WATCHDOG_WARNING);
+ }
+
// Add the comment to database.
$status = user_access('post comments without approval') ? COMMENT_PUBLISHED : COMMENT_NOT_PUBLISHED;
$roles = variable_get('comment_roles', array());