Ticket #11286: fix-http-status-in-comments.4.patch
| File fix-http-status-in-comments.4.patch, 3.7 KB (added by , 16 years ago) |
|---|
-
wp-comments-post.php
23 23 24 24 if ( empty($post->comment_status) ) { 25 25 do_action('comment_id_not_found', $comment_post_ID); 26 exit;26 wp_die( __('Error: Request not understood. Please go back and try again.'), '', array('response' => 400) ); 27 27 } 28 28 29 29 // get_post_status() will get the parent status for attachments. … … 33 33 34 34 if ( !comments_open($comment_post_ID) ) { 35 35 do_action('comment_closed', $comment_post_ID); 36 wp_die( __('Sorry, comments are closed for this item.') );36 wp_die( __('Sorry, comments are closed for this item.'), '', array('response' => 403) ); 37 37 } elseif ( 'trash' == $status ) { 38 38 do_action('comment_on_trash', $comment_post_ID); 39 exit;39 wp_die( __('Sorry, comments are closed for this item.'), '', array('response' => 403) ); 40 40 } elseif ( !$status_obj->public ) { 41 41 do_action('comment_on_draft', $comment_post_ID); 42 exit;42 wp_die( __('Sorry, comments are closed for this item.'), '', array('response' => 403) ); 43 43 } elseif ( post_password_required($comment_post_ID) ) { 44 44 do_action('comment_on_password_protected', $comment_post_ID); 45 exit;45 wp_die( __('Sorry, you must enter the password for this item.'), '', array('response' => 403) ); 46 46 } else { 47 47 do_action('pre_comment_on_post', $comment_post_ID); 48 48 } … … 68 68 } 69 69 } else { 70 70 if ( get_option('comment_registration') || 'private' == $status ) 71 wp_die( __('Sorry, you must be logged in to post a comment.') );71 wp_die( __('Sorry, you must be logged in to post a comment.'), '', array('response' => 403) ); 72 72 } 73 73 74 74 $comment_type = ''; 75 75 76 76 if ( get_option('require_name_email') && !$user->ID ) { 77 77 if ( 6 > strlen($comment_author_email) || '' == $comment_author ) 78 wp_die( __('Error: please fill the required fields (name, email).') );78 wp_die( __('Error: please fill the required fields (name, email).'), '', array('response' => 400) ); 79 79 elseif ( !is_email($comment_author_email)) 80 wp_die( __('Error: please enter a valid email address.') );80 wp_die( __('Error: please enter a valid email address.'), '', array('response' => 400) ); 81 81 } 82 82 83 if ( '' == $comment_content ) 84 wp_die( __('Error: please type a comment.') ); 83 if ( '' == $comment_content ) { 84 // User did not submit anything, bounce back to post. 85 $comment = NULL; 86 $location = empty($_POST['redirect_to']) ? get_permalink($comment_post_ID) : $_POST['redirect_to']; 87 $location = apply_filters('comment_post_redirect', $location, $comment); 88 wp_redirect($location); 89 exit; 90 } 85 91 86 92 $comment_parent = isset($_POST['comment_parent']) ? absint($_POST['comment_parent']) : 0; 87 93 -
wp-includes/comment.php
557 557 if ( defined('DOING_AJAX') ) 558 558 die( __('Duplicate comment detected; it looks as though you’ve already said that!') ); 559 559 560 wp_die( __('Duplicate comment detected; it looks as though you’ve already said that!') );560 wp_die( __('Duplicate comment detected; it looks as though you’ve already said that!'), '', array('response' => 400) ); 561 561 } 562 562 563 563 do_action( 'check_comment_flood', $comment_author_IP, $comment_author_email, $comment_date_gmt ); … … 617 617 if ( defined('DOING_AJAX') ) 618 618 die( __('You are posting comments too quickly. Slow down.') ); 619 619 620 wp_die( __('You are posting comments too quickly. Slow down.'), '', array('response' => 40 3) );620 wp_die( __('You are posting comments too quickly. Slow down.'), '', array('response' => 400) ); 621 621 } 622 622 } 623 623 }