From efd3bae515c3143513e357781b1f7063ea145cfc Mon Sep 17 00:00:00 2001 From: ryan Date: Thu, 22 Mar 2007 23:02:20 +0000 Subject: [PATCH] Cast to int. git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@5084 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/functions-post.php | 10 +++++++--- wp-includes/template-functions-category.php | 1 + xmlrpc.php | 4 ++-- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/wp-includes/functions-post.php b/wp-includes/functions-post.php index 31e83fdf6e..1cd1458fcd 100644 --- a/wp-includes/functions-post.php +++ b/wp-includes/functions-post.php @@ -406,6 +406,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"; } @@ -476,6 +477,9 @@ function wp_get_post_cats($blogid = '1', $post_ID = 0) { function wp_set_post_cats($blogid = '1', $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)) $post_categories = array(get_option('default_category')); @@ -486,7 +490,7 @@ function wp_set_post_cats($blogid = '1', $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(); @@ -501,8 +505,8 @@ function wp_set_post_cats($blogid = '1', $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' "); } } diff --git a/wp-includes/template-functions-category.php b/wp-includes/template-functions-category.php index ea446786ec..aaf7d0f9c2 100644 --- a/wp-includes/template-functions-category.php +++ b/wp-includes/template-functions-category.php @@ -3,6 +3,7 @@ function get_the_category($id = false) { global $post, $category_cache; + $id = (int) $id; if ( !$id ) $id = $post->ID; diff --git a/xmlrpc.php b/xmlrpc.php index bd1ffed425..efa5769f3f 100644 --- a/xmlrpc.php +++ b/xmlrpc.php @@ -409,7 +409,7 @@ class wp_xmlrpc_server extends IXR_Server { $this->escape($args); - $post_ID = $args[1]; + $post_ID = (int) $args[1]; $user_login = $args[2]; $user_pass = $args[3]; $content = $args[4]; @@ -582,7 +582,7 @@ class wp_xmlrpc_server extends IXR_Server { $this->escape($args); - $post_ID = $args[0]; + $post_ID = (int) $args[0]; $user_login = $args[1]; $user_pass = $args[2]; $content_struct = $args[3];