From 23c0a299ada091cdeece968ad5cd3bdd20f5ef3c Mon Sep 17 00:00:00 2001 From: donncha Date: Tue, 3 Oct 2006 10:52:54 +0000 Subject: WP Merge to rev 4273 git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@788 7be80a69-a1ef-0310-a953-fb0f7c49ff36 --- wp-includes/comment.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'wp-includes/comment.php') diff --git a/wp-includes/comment.php b/wp-includes/comment.php index 3189b14..6ffcfcc 100644 --- a/wp-includes/comment.php +++ b/wp-includes/comment.php @@ -187,9 +187,10 @@ function wp_allow_comment($commentdata) { if ( $lasttime = $wpdb->get_var("SELECT comment_date_gmt FROM $wpdb->comments WHERE comment_author_IP = '$comment_author_IP' OR comment_author_email = '$comment_author_email' ORDER BY comment_date DESC LIMIT 1") ) { $time_lastcomment = mysql2date('U', $lasttime); $time_newcomment = mysql2date('U', $comment_date_gmt); - if ( ($time_newcomment - $time_lastcomment) < 15 ) { + $flood_die = apply_filters('comment_flood_filter', false, $time_lastcomment, $time_newcomment); + if ( $flood_die ) { do_action('comment_flood_trigger', $time_lastcomment, $time_newcomment); - wp_die( __('Sorry, you can only post a new comment once every 15 seconds. Slow down cowboy.') ); + wp_die( __('You are posting comments too quickly. Slow down.') ); } } @@ -355,6 +356,14 @@ function wp_filter_comment($commentdata) { return $commentdata; } +function wp_throttle_comment_flood($block, $time_lastcomment, $time_newcomment) { + if ( $block ) // a plugin has already blocked... we'll let that decision stand + return $block; + if ( ($time_newcomment - $time_lastcomment) < 15 ) + return true; + return false; +} + function wp_new_comment( $commentdata ) { $commentdata = apply_filters('preprocess_comment', $commentdata); -- cgit