From 46fa88baf1730999bc2a6638f7d331c547dbd04d Mon Sep 17 00:00:00 2001 From: ryan Date: Thu, 22 Mar 2007 23:03:07 +0000 Subject: [PATCH] Cast to int git-svn-id: http://svn.automattic.com/wordpress/trunk@5086 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/post.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/wp-includes/post.php b/wp-includes/post.php index aa5b7ef91..a3c50f428 100644 --- a/wp-includes/post.php +++ b/wp-includes/post.php @@ -460,6 +460,7 @@ function wp_get_recent_posts($num = 10) { global $wpdb; // Set the limit clause, if we got a limit + $num = (int) $num; if ($num) { $limit = "LIMIT $num"; } @@ -770,6 +771,8 @@ function wp_publish_post($post_id) { function wp_set_post_categories($post_ID = 0, $post_categories = array()) { global $wpdb; + + $post_ID = (int) $post_ID; // If $post_categories isn't already an array, make it one: if (!is_array($post_categories) || 0 == count($post_categories) || empty($post_categories)) $post_categories = array(get_option('default_category')); @@ -780,7 +783,7 @@ function wp_set_post_categories($post_ID = 0, $post_categories = array()) { $old_categories = $wpdb->get_col(" SELECT category_id FROM $wpdb->post2cat - WHERE post_id = $post_ID"); + WHERE post_id = '$post_ID'"); if (!$old_categories) { $old_categories = array(); @@ -795,8 +798,8 @@ function wp_set_post_categories($post_ID = 0, $post_categories = array()) { foreach ($delete_cats as $del) { $wpdb->query(" DELETE FROM $wpdb->post2cat - WHERE category_id = $del - AND post_id = $post_ID + WHERE category_id = '$del' + AND post_id = '$post_ID' "); } }