Refuse comments for post IDs that do not exist.
git-svn-id: https://develop.svn.wordpress.org/trunk@1854 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
8a56739dc3
commit
1b3ce357bb
@ -35,8 +35,15 @@ $comment = trim($_POST['comment']);
|
||||
$comment_post_ID = intval($_POST['comment_post_ID']);
|
||||
$user_ip = $_SERVER['REMOTE_ADDR'];
|
||||
|
||||
if ( 'closed' == $wpdb->get_var("SELECT comment_status FROM $wpdb->posts WHERE ID = '$comment_post_ID'") )
|
||||
$post_status = $wpdb->get_var("SELECT comment_status FROM $wpdb->posts WHERE ID = '$comment_post_ID'");
|
||||
|
||||
if ( empty($post_status) ) {
|
||||
// Post does not exist. Someone is trolling. Die silently.
|
||||
// (Perhaps offer pluggable rebukes? Long delays, etc.)
|
||||
die();
|
||||
} else if ( 'closed' == $post_status ) {
|
||||
die( __('Sorry, comments are closed for this item.') );
|
||||
}
|
||||
|
||||
if ( get_settings('require_name_email') && ('' == $email || '' == $author) )
|
||||
die( __('Error: please fill the required fields (name, email).') );
|
||||
|
Loading…
Reference in New Issue
Block a user