]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-comments-post.php
Wordpress 2.6.2
[autoinstalls/wordpress.git] / wp-comments-post.php
index f7d7c4f5c8a1f8b069f6562a757c18e501b64e20..96ab8947a9c8e07a3a8acb63a4562415ece6d7a0 100644 (file)
@@ -1,17 +1,25 @@
 <?php
+/**
+ * Handles Comment Post to WordPress and prevents duplicate comment posting.
+ *
+ * @package WordPress
+ */
+
 if ( 'POST' != $_SERVER['REQUEST_METHOD'] ) {
        header('Allow: POST');
        header('HTTP/1.1 405 Method Not Allowed');
        header('Content-Type: text/plain');
        exit;
 }
-require( dirname(__FILE__) . '/wp-config.php' );
+
+/** Sets up the WordPress Environment. */
+require( dirname(__FILE__) . '/wp-load.php' );
 
 nocache_headers();
 
 $comment_post_ID = (int) $_POST['comment_post_ID'];
 
-$status = $wpdb->get_row("SELECT post_status, comment_status FROM $wpdb->posts WHERE ID = '$comment_post_ID'");
+$status = $wpdb->get_row( $wpdb->prepare("SELECT post_status, comment_status FROM $wpdb->posts WHERE ID = %d", $comment_post_ID) );
 
 if ( empty($status->comment_status) ) {
        do_action('comment_id_not_found', $comment_post_ID);