Make WordPress Core

Ticket #1265: bug1265_functions-post.php

File bug1265_functions-post.php, 907 bytes (added by coffee2code, 19 years ago)
Line 
1Index: wp-includes/functions-post.php
2===================================================================
3--- wp-includes/functions-post.php      (revision 2557)
4+++ wp-includes/functions-post.php      (working copy)
5@@ -495,6 +495,13 @@
6                }
7        }
8 
9+       // Simple duplicate check
10+       $dupe = "SELECT comment_ID FROM $wpdb->comments WHERE comment_post_ID = '$comment_post_ID' AND ( comment_author = '$author' ";
11+       if ( $email ) $dupe .= "OR comment_author_email = '$email' ";
12+       $dupe .= ") AND comment_content = '$comment' LIMIT 1";
13+       if ( $wpdb->get_var($dupe) )
14+               die( __('Duplicate comment detected; it looks as though you\'ve already said that!') );
15+
16        if ( check_comment($author, $email, $url, $comment, $user_ip, $user_agent, $comment_type) )
17                $approved = 1;
18        else
19@@ -596,4 +603,4 @@
20        return $wpdb->query("UPDATE $wpdb->posts SET pinged = '$new' WHERE ID = $post_id");
21 }
22 
23-?>
24\ No newline at end of file
25+?>