Prepare DB queries in more places. Props filosofo. see #6644

git-svn-id: http://svn.automattic.com/wordpress/trunk@7645 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan
2008-04-14 16:13:25 +00:00
parent 796ae7104e
commit 248a0c06e2
24 changed files with 153 additions and 166 deletions

View File

@@ -13,7 +13,7 @@ if(!function_exists('get_comment_count'))
function get_comment_count($post_ID)
{
global $wpdb;
return $wpdb->get_var('SELECT count(*) FROM '.$wpdb->comments.' WHERE comment_post_ID = '.$post_ID);
return $wpdb->get_var( $wpdb->prepare("SELECT count(*) FROM $wpdb->comments WHERE comment_post_ID = %d", $post_ID) );
}
}
@@ -22,7 +22,7 @@ if(!function_exists('link_exists'))
function link_exists($linkname)
{
global $wpdb;
return $wpdb->get_var('SELECT link_id FROM '.$wpdb->links.' WHERE link_name = "'.$linkname.'"');
return $wpdb->get_var( $wpdb->prepare("SELECT link_id FROM $wpdb->links WHERE link_name = %s", $linkname) );
}
}