]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-comments-post.php
Wordpress 2.9.2-scripts
[autoinstalls/wordpress.git] / wp-comments-post.php
index 8289bb44147b307d86ffe7913c196c87f6541da9..e60d159ddcf0b3a5556648b5ef249e6f54af6383 100644 (file)
@@ -17,7 +17,7 @@ require( dirname(__FILE__) . '/wp-load.php' );
 
 nocache_headers();
 
-$comment_post_ID = (int) $_POST['comment_post_ID'];
+$comment_post_ID = isset($_POST['comment_post_ID']) ? (int) $_POST['comment_post_ID'] : 0;
 
 $status = $wpdb->get_row( $wpdb->prepare("SELECT post_status, comment_status FROM $wpdb->posts WHERE ID = %d", $comment_post_ID) );
 
@@ -27,9 +27,15 @@ if ( empty($status->comment_status) ) {
 } elseif ( !comments_open($comment_post_ID) ) {
        do_action('comment_closed', $comment_post_ID);
        wp_die( __('Sorry, comments are closed for this item.') );
-} elseif ( in_array($status->post_status, array('draft', 'pending') ) ) {
+} elseif ( in_array($status->post_status, array('draft', 'future', 'pending') ) ) {
        do_action('comment_on_draft', $comment_post_ID);
        exit;
+} elseif ( 'trash' == $status->post_status ) {
+       do_action('comment_on_trash', $comment_post_ID);
+       exit;
+} elseif ( post_password_required($comment_post_ID) ) {
+       do_action('comment_on_password_protected', $comment_post_ID);
+       exit;
 } else {
        do_action('pre_comment_on_post', $comment_post_ID);
 }