From 494a7d716adcc09c3aa78ffb13d92c8ad5fc2ba1 Mon Sep 17 00:00:00 2001 From: Matt Mullenweg Date: Wed, 4 Jun 2003 18:17:48 +0000 Subject: [PATCH] Check for comment status. git-svn-id: https://develop.svn.wordpress.org/trunk@159 602fd350-edb4-49c9-b593-d223f7449a82 --- b2comments.post.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/b2comments.post.php b/b2comments.post.php index 795c836282..8a853413c7 100644 --- a/b2comments.post.php +++ b/b2comments.post.php @@ -34,6 +34,11 @@ $original_comment = $comment; $comment_autobr = $HTTP_POST_VARS["comment_autobr"]; $comment_post_ID = $HTTP_POST_VARS["comment_post_ID"]; +$commentstatus = $wpdb->get_var("SELECT comment_status FROM $tableposts WHERE ID = $comment_post_ID"); + +if ('closed' == $commentstatus) + die('Sorry, comments are closed for this item.'); + if ($require_name_email && ($email == "" || $email == "@" || $author == "" || $author == "name")) { //original fix by Dodo, and then Drinyth echo "Error: please fill the required fields (name, email)"; exit; @@ -82,6 +87,8 @@ if (!empty($lasttime)) { } /* end flood-protection */ + + if ($ok) { $wpdb->query("INSERT INTO $tablecomments VALUES ('0','$comment_post_ID','$author','$email','$url','$user_ip','$now','$comment','0')");