X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/177fd6fefd2e3d5a0ea6591c71d660cabdb3c1a4..refs/tags/wordpress-2.9:/wp-trackback.php diff --git a/wp-trackback.php b/wp-trackback.php index 26f8763e..864da720 100644 --- a/wp-trackback.php +++ b/wp-trackback.php @@ -1,10 +1,21 @@ escape($blog_name); if ( is_single() || is_page() ) $tb_id = $posts[0]->ID; -if ( !intval( $tb_id ) ) +if ( !isset($tb_id) || !intval( $tb_id ) ) trackback_response(1, 'I really need an ID for this to work.'); if (empty($title) && empty($tb_url) && empty($blog_name)) { @@ -86,7 +97,7 @@ if ( !empty($tb_url) && !empty($title) ) { $comment_content = "$title\n\n$excerpt"; $comment_type = 'trackback'; - $dupe = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = '$comment_post_ID' AND comment_author_url = '$comment_author_url'"); + $dupe = $wpdb->get_results( $wpdb->prepare("SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_author_url = %s", $comment_post_ID, $comment_author_url) ); if ( $dupe ) trackback_response(1, 'We already have a ping from that URL for this post.'); @@ -97,4 +108,4 @@ if ( !empty($tb_url) && !empty($title) ) { do_action('trackback_post', $wpdb->insert_id); trackback_response(0); } -?> +?> \ No newline at end of file