| 194 | | // Simple flood-protection |
|---|
| 195 | | 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") ) { |
|---|
| 196 | | $time_lastcomment = mysql2date('U', $lasttime); |
|---|
| 197 | | $time_newcomment = mysql2date('U', $comment_date_gmt); |
|---|
| 198 | | $flood_die = apply_filters('comment_flood_filter', false, $time_lastcomment, $time_newcomment); |
|---|
| 199 | | if ( $flood_die ) { |
|---|
| 200 | | do_action('comment_flood_trigger', $time_lastcomment, $time_newcomment); |
|---|
| 201 | | wp_die( __('You are posting comments too quickly. Slow down.') ); |
|---|
| 202 | | } |
|---|
| 203 | | } |
|---|
| | 194 | do_action( 'check_comment_flood', $comment_author_IP, $comment_author_email, $comment_date_gmt ); |
|---|
| | 219 | function check_comment_flood_db( $ip, $email, $date ) { |
|---|
| | 220 | global $wpdb; |
|---|
| | 221 | if ( $lasttime = $wpdb->get_var("SELECT comment_date_gmt FROM $wpdb->comments WHERE comment_author_IP = '$ip' OR comment_author_email = '$email' ORDER BY comment_date DESC LIMIT 1") ) { |
|---|
| | 222 | $time_lastcomment = mysql2date('U', $lasttime); |
|---|
| | 223 | $time_newcomment = mysql2date('U', $date); |
|---|
| | 224 | $flood_die = apply_filters('comment_flood_filter', false, $time_lastcomment, $time_newcomment); |
|---|
| | 225 | if ( $flood_die ) { |
|---|
| | 226 | do_action('comment_flood_trigger', $time_lastcomment, $time_newcomment); |
|---|
| | 227 | wp_die( __('You are posting comments too quickly. Slow down.') ); |
|---|
| | 228 | } |
|---|
| | 229 | } |
|---|
| | 230 | } |
|---|