Changeset 1964 for trunk/wp-includes/functions-post.php
- Timestamp:
- 12/16/2004 02:57:05 AM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/functions-post.php
r1940 r1964 383 383 384 384 385 function wp_new_comment($commentdata) { 386 global $wpdb; 385 function wp_new_comment( $commentdata ) { 386 global $wpdb; 387 387 388 extract($commentdata); 388 389 389 390 $comment_post_ID = (int) $comment_post_ID; 390 391 391 $comment_author = strip_tags($comment_author); 392 $comment_author = wp_specialchars($comment_author); 393 394 $comment_author_email = preg_replace('/[^a-z+_.@-]/i', '', $comment_author_email); 395 396 $comment_author_url = strip_tags($comment_author_url); 397 $comment_author_url = wp_specialchars($comment_author_url); 398 399 $comment_content = apply_filters('comment_content_presave', $comment_content); 400 401 $user_ip = addslashes($_SERVER['REMOTE_ADDR']); 402 $user_domain = addslashes( gethostbyaddr($user_ip) ); 403 $now = current_time('mysql'); 392 $author = apply_filters('pre_comment_author_name', $comment_author); 393 $email = apply_filters('pre_comment_author_email', $comment_author_email); 394 $url = apply_filters('pre_comment_author_url', $comment_author_url); 395 $comment = apply_filters('pre_comment_content', $comment_content); 396 $comment = apply_filters('post_comment_text', $comment); // Deprecated 397 $comment = apply_filters('comment_content_presave', $comment_content); // Deprecated 398 399 $user_ip = apply_filters('pre_comment_user_ip', $_SERVER['REMOTE_ADDR']); 400 $user_domain = apply_filters('pre_comment_user_domain', gethostbyaddr($user_ip) ); 401 $user_agent = apply_filters('pre_comment_user_agent', $_SERVER['HTTP_USER_AGENT']); 402 403 $now = current_time('mysql'); 404 404 $now_gmt = current_time('mysql', 1); 405 $user_agent = addslashes($_SERVER['HTTP_USER_AGENT']);406 407 if ( (!isset($comment_type)) || (($comment_type != 'trackback') && ($comment_type != 'pingback')) ) {408 $comment_type = '';409 }410 405 411 406 // Simple flood-protection 412 if ( $lasttime = $wpdb->get_var("SELECT comment_date FROM $wpdb->comments WHERE comment_author_IP = '$user_ip' ORDER BY comment_date DESC LIMIT 1") ) {413 $time_lastcomment = mysql2date('U', $lasttime);414 $time_newcomment = mysql2date('U', $now);407 if ( $lasttime = $wpdb->get_var("SELECT comment_date_gmt FROM $wpdb->comments WHERE comment_author_IP = '$user_ip' OR comment_author_email = '$email' ORDER BY comment_date DESC LIMIT 1") ) { 408 $time_lastcomment = mysql2date('U', $lasttime); 409 $time_newcomment = mysql2date('U', $now_gmt); 415 410 if ( ($time_newcomment - $time_lastcomment) < 15 ) 416 411 die( __('Sorry, you can only post a new comment once every 15 seconds. Slow down cowboy.') ); 417 412 } 418 413 419 if( check_comment($ comment_author, $comment_author_email, $comment_author_url, $comment_content, $user_ip, $user_agent) )414 if( check_comment($author, $email, $url, $comment, $user_ip, $user_agent) ) 420 415 $approved = 1; 421 416 else … … 428 423 "); 429 424 430 if ( get_option('comments_notify') ) 431 wp_notify_postauthor($wpdb->insert_id, $comment_type); 425 $comment_id = $wpdb->insert_id; 426 do_action('comment_post', $comment_id); 427 428 if ( !$approved ) 429 wp_notify_moderator($comment_ID); 430 431 if ( get_settings('comments_notify') && $approved ) 432 wp_notify_postauthor($comment_ID, 'comment'); 432 433 433 434 return $result;
Note: See TracChangeset
for help on using the changeset viewer.