diff options
author | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2006-10-03 10:52:54 +0000 |
---|---|---|
committer | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2006-10-03 10:52:54 +0000 |
commit | 23c0a299ada091cdeece968ad5cd3bdd20f5ef3c (patch) | |
tree | 9bdf04e7880e6188eca43a3bd161320568f205e4 /wp-includes/comment.php | |
parent | 081300d1c11041e8b678f9cb0736468aa11e94f1 (diff) | |
download | wordpress-mu-23c0a299ada091cdeece968ad5cd3bdd20f5ef3c.tar.gz wordpress-mu-23c0a299ada091cdeece968ad5cd3bdd20f5ef3c.tar.xz wordpress-mu-23c0a299ada091cdeece968ad5cd3bdd20f5ef3c.zip |
WP Merge to rev 4273
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@788 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-includes/comment.php')
-rw-r--r-- | wp-includes/comment.php | 13 |
1 files changed, 11 insertions, 2 deletions
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); |