mirror of
https://github.com/WordPress/WordPress.git
synced 2024-09-24 13:22:49 +02:00
Cast to int.
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@5084 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
5e7cc6634b
commit
efd3bae515
@ -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'
|
||||
");
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,7 @@
|
||||
function get_the_category($id = false) {
|
||||
global $post, $category_cache;
|
||||
|
||||
$id = (int) $id;
|
||||
if ( !$id )
|
||||
$id = $post->ID;
|
||||
|
||||
|
@ -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];
|
||||
|
Loading…
Reference in New Issue
Block a user