Add some prophylactic int casts and quoting.

git-svn-id: https://develop.svn.wordpress.org/trunk@3740 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren
2006-04-22 00:02:00 +00:00
parent 0b402ca120
commit 54f3ab72d5
4 changed files with 16 additions and 10 deletions

View File

@@ -60,7 +60,9 @@ function check_comment($author, $email, $url, $comment, $user_ip, $user_agent, $
function get_approved_comments($post_id) {
global $wpdb;
return $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = $post_id AND comment_approved = '1' ORDER BY comment_date");
$post_id = (int) $post_id;
return $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = '$post_id' AND comment_approved = '1' ORDER BY comment_date");
}
// Retrieves comment data given a comment ID or comment object.