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:
@@ -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) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user