From bb07c58477aff943147083bc8757aedd983e4872 Mon Sep 17 00:00:00 2001 From: ryan Date: Sun, 25 Mar 2007 23:12:38 +0000 Subject: [PATCH] More int casts git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@5100 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/comment-functions.php | 4 ++-- wp-includes/functions-post.php | 2 +- wp-includes/functions.php | 2 +- wp-includes/pluggable-functions.php | 4 ++-- wp-includes/registration-functions.php | 4 ++-- wp-includes/template-functions-author.php | 2 +- wp-includes/template-functions-category.php | 2 +- wp-includes/template-functions-links.php | 4 ++-- 8 files changed, 12 insertions(+), 12 deletions(-) diff --git a/wp-includes/comment-functions.php b/wp-includes/comment-functions.php index b59c992a44..3f2ab8df08 100644 --- a/wp-includes/comment-functions.php +++ b/wp-includes/comment-functions.php @@ -90,7 +90,7 @@ function wp_insert_comment($commentdata) { ('$comment_post_ID', '$comment_author', '$comment_author_email', '$comment_author_url', '$comment_author_IP', '$comment_date', '$comment_date_gmt', '$comment_content', '$comment_approved', '$comment_agent', '$comment_type', '$comment_parent', '$user_id') "); - $id = $wpdb->insert_id; + $id = (int) $wpdb->insert_id; if ( $comment_approved == 1) { $count = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_post_ID = '$comment_post_ID' AND comment_approved = '1'"); @@ -224,7 +224,7 @@ function get_comments_number( $post_id = 0 ) { $post_id = (int) $post_id; if ( !$post_id ) - $post_id = $id; + $post_id = (int) $id; if ( !isset($comment_count_cache[$post_id]) ) $comment_count_cache[$id] = $wpdb->get_var("SELECT comment_count FROM $wpdb->posts WHERE ID = '$post_id'"); diff --git a/wp-includes/functions-post.php b/wp-includes/functions-post.php index 1cd1458fcd..2176ef0e4d 100644 --- a/wp-includes/functions-post.php +++ b/wp-includes/functions-post.php @@ -47,7 +47,7 @@ function wp_insert_post($postarr = array()) { // Get the post ID. if ( $update ) - $post_ID = $ID; + $post_ID = (int) $ID; // Create a valid post name. Drafts are allowed to have an empty // post name. diff --git a/wp-includes/functions.php b/wp-includes/functions.php index 42f2531bf4..54010d74d3 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -2022,7 +2022,7 @@ function get_home_template() { function get_page_template() { global $wp_query; - $id = $wp_query->post->ID; + $id = (int) $wp_query->post->ID; $template = get_post_meta($id, '_wp_page_template', true); if ( 'default' == $template ) diff --git a/wp-includes/pluggable-functions.php b/wp-includes/pluggable-functions.php index e3ed1fd59b..5bb97e7b24 100644 --- a/wp-includes/pluggable-functions.php +++ b/wp-includes/pluggable-functions.php @@ -466,7 +466,7 @@ endif; if ( !function_exists('wp_verify_nonce') ) : function wp_verify_nonce($nonce, $action = -1) { $user = wp_get_current_user(); - $uid = $user->id; + $uid = (int) $user->id; $i = ceil(time() / 43200); @@ -480,7 +480,7 @@ endif; if ( !function_exists('wp_create_nonce') ) : function wp_create_nonce($action = -1) { $user = wp_get_current_user(); - $uid = $user->id; + $uid = (int) $user->id; $i = ceil(time() / 43200); diff --git a/wp-includes/registration-functions.php b/wp-includes/registration-functions.php index dcf81f5093..56a433fd46 100644 --- a/wp-includes/registration-functions.php +++ b/wp-includes/registration-functions.php @@ -77,7 +77,7 @@ function wp_insert_user($userdata) { $query = "UPDATE $wpdb->users SET user_pass='$user_pass', user_email='$user_email', user_url='$user_url', user_nicename = '$user_nicename', display_name = '$display_name' WHERE ID = '$ID'"; $query = apply_filters('update_user_query', $query); $wpdb->query( $query ); - $user_id = $ID; + $user_id = (int) $ID; } else { $query = "INSERT INTO $wpdb->users (user_login, user_pass, user_email, user_url, user_registered, user_nicename, display_name) @@ -85,7 +85,7 @@ function wp_insert_user($userdata) { ('$user_login', '$user_pass', '$user_email', '$user_url', '$user_registered', '$user_nicename', '$display_name')"; $query = apply_filters('create_user_query', $query); $wpdb->query( $query ); - $user_id = $wpdb->insert_id; + $user_id = (int) $wpdb->insert_id; } update_usermeta( $user_id, 'first_name', $first_name); diff --git a/wp-includes/template-functions-author.php b/wp-includes/template-functions-author.php index 4206d69212..1107e03444 100644 --- a/wp-includes/template-functions-author.php +++ b/wp-includes/template-functions-author.php @@ -136,7 +136,7 @@ function the_author_posts_link($deprecated = '') { function get_author_link($echo = false, $author_id, $author_nicename = '') { global $wpdb, $wp_rewrite, $post, $cache_userdata; - $auth_ID = $author_id; + $auth_ID = (int) $author_id; $link = $wp_rewrite->get_author_permastruct(); if ( empty($link) ) { diff --git a/wp-includes/template-functions-category.php b/wp-includes/template-functions-category.php index aaf7d0f9c2..00eadc0e65 100644 --- a/wp-includes/template-functions-category.php +++ b/wp-includes/template-functions-category.php @@ -5,7 +5,7 @@ global $post, $category_cache; $id = (int) $id; if ( !$id ) - $id = $post->ID; + $id = (int) $post->ID; if ( !isset($category_cache[$id]) ) update_post_category_cache($id); diff --git a/wp-includes/template-functions-links.php b/wp-includes/template-functions-links.php index ec233c8057..cf9a29672b 100644 --- a/wp-includes/template-functions-links.php +++ b/wp-includes/template-functions-links.php @@ -89,7 +89,7 @@ function get_page_link($id = false) { $id = (int) $id; if ( !$id ) - $id = $post->ID; + $id = (int) $post->ID; $pagestruct = $wp_rewrite->get_page_permastruct(); @@ -110,7 +110,7 @@ function get_attachment_link($id = false) { $link = false; if (! $id) { - $id = $post->ID; + $id = (int) $post->ID; } $object = get_post($id);