From d64c69bcd4602ef28061221055ce93433f83e8fb Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Fri, 23 Mar 2007 02:16:16 +0000 Subject: [PATCH] Castaways on Gilligan's Isle git-svn-id: https://develop.svn.wordpress.org/trunk@5090 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/admin-db.php | 11 +++++++---- wp-includes/bookmark-template.php | 3 +-- wp-includes/category-template.php | 3 +-- wp-includes/post.php | 4 ++-- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/wp-admin/admin-db.php b/wp-admin/admin-db.php index dd6031ecb1..314892a225 100644 --- a/wp-admin/admin-db.php +++ b/wp-admin/admin-db.php @@ -245,7 +245,7 @@ function category_exists($cat_name) { if (!$category_nicename = sanitize_title($cat_name)) return 0; - return $wpdb->get_var("SELECT cat_ID FROM $wpdb->categories WHERE category_nicename = '$category_nicename'"); + return (int) $wpdb->get_var("SELECT cat_ID FROM $wpdb->categories WHERE category_nicename = '$category_nicename'"); } function wp_delete_user($id, $reassign = 'novalue') { @@ -299,6 +299,8 @@ function wp_insert_link($linkdata) { if ( !empty($link_id) ) $update = true; + $link_id = (int) $link_id; + if( trim( $link_name ) == '' ) return 0; $link_name = apply_filters('pre_link_name', $link_name); @@ -443,7 +445,7 @@ function wp_set_link_cats($link_ID = 0, $link_categories = array()) { $old_categories = $wpdb->get_col(" SELECT category_id FROM $wpdb->link2cat - WHERE link_id = $link_ID"); + WHERE link_id = '$link_ID'"); if (!$old_categories) { $old_categories = array(); @@ -456,10 +458,11 @@ function wp_set_link_cats($link_ID = 0, $link_categories = array()) { if ($delete_cats) { foreach ($delete_cats as $del) { + $del = (int) $del; $wpdb->query(" DELETE FROM $wpdb->link2cat - WHERE category_id = $del - AND link_id = $link_ID + WHERE category_id = '$del' + AND link_id = '$link_ID' "); } } diff --git a/wp-includes/bookmark-template.php b/wp-includes/bookmark-template.php index 45846f44cd..e7a84805d0 100644 --- a/wp-includes/bookmark-template.php +++ b/wp-includes/bookmark-template.php @@ -165,8 +165,7 @@ function get_linkcatname($id = 0) { if ( empty($cats) || ! is_array($cats) ) return ''; - $cat_id = (int) - $cats[0]; // Take the first cat. + $cat_id = (int) $cats[0]; // Take the first cat. $cat = get_category($cat_id); return $cat->cat_name; diff --git a/wp-includes/category-template.php b/wp-includes/category-template.php index c1aabf543c..df102b5cdf 100644 --- a/wp-includes/category-template.php +++ b/wp-includes/category-template.php @@ -64,8 +64,7 @@ global $post, $category_cache, $blog_id; $id = (int) $id; if ( !$id ) - $id = (int) - $post->ID; + $id = (int) $post->ID; if ( !isset($category_cache[$blog_id][$id]) ) update_post_category_cache($id); diff --git a/wp-includes/post.php b/wp-includes/post.php index 20ab78bccf..d747695204 100644 --- a/wp-includes/post.php +++ b/wp-includes/post.php @@ -643,7 +643,7 @@ function wp_insert_post($postarr = array()) { (post_author, post_date, post_date_gmt, post_content, post_content_filtered, post_title, post_excerpt, post_status, post_type, comment_status, ping_status, post_password, post_name, to_ping, pinged, post_modified, post_modified_gmt, post_parent, menu_order, post_mime_type) VALUES ('$post_author', '$post_date', '$post_date_gmt', '$post_content', '$post_content_filtered', '$post_title', '$post_excerpt', '$post_status', '$post_type', '$comment_status', '$ping_status', '$post_password', '$post_name', '$to_ping', '$pinged', '$post_date', '$post_date_gmt', '$post_parent', '$menu_order', '$post_mime_type')"); - $post_ID = $wpdb->insert_id; + $post_ID = (int) $wpdb->insert_id; } if ( empty($post_name) && 'draft' != $post_status ) { @@ -1351,7 +1351,7 @@ function wp_insert_attachment($object, $file = false, $post_parent = 0) { (post_author, post_date, post_date_gmt, post_content, post_content_filtered, post_title, post_excerpt, post_status, post_type, comment_status, ping_status, post_password, post_name, to_ping, pinged, post_modified, post_modified_gmt, post_parent, menu_order, post_mime_type, guid) VALUES ('$post_author', '$post_date', '$post_date_gmt', '$post_content', '$post_content_filtered', '$post_title', '$post_excerpt', '$post_status', '$post_type', '$comment_status', '$ping_status', '$post_password', '$post_name', '$to_ping', '$pinged', '$post_date', '$post_date_gmt', '$post_parent', '$menu_order', '$post_mime_type', '$guid')"); - $post_ID = $wpdb->insert_id; + $post_ID = (int) $wpdb->insert_id; } if ( empty($post_name) ) {