From 2e96b99ceb195735a641e299f3209840cc101052 Mon Sep 17 00:00:00 2001 From: donncha Date: Fri, 23 Mar 2007 17:46:02 +0000 Subject: Ryan casts an int and catches a fish, someone buy him a pint! merge to 5092 git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@933 7be80a69-a1ef-0310-a953-fb0f7c49ff36 --- wp-admin/admin-functions.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'wp-admin/admin-functions.php') diff --git a/wp-admin/admin-functions.php b/wp-admin/admin-functions.php index 732d146..7b9507c 100644 --- a/wp-admin/admin-functions.php +++ b/wp-admin/admin-functions.php @@ -114,7 +114,7 @@ function wp_write_post() { // Reunite any orphaned attachments with their parent if ( !$draft_ids = get_user_option( 'autosave_draft_ids' ) ) $draft_ids = array(); - if ( $draft_temp_id = array_search( $post_ID, $draft_ids ) ) + if ( $draft_temp_id = (int) array_search( $post_ID, $draft_ids ) ) relocate_children( $draft_temp_id, $post_ID ); if ( $temp_id && $temp_id != $draft_temp_id ) relocate_children( $temp_id, $post_ID ); @@ -157,7 +157,7 @@ function fix_attachment_links( $post_ID ) { if ( 0 == preg_match( $search, $anchor, $id_matches ) ) continue; - $id = $id_matches[3]; + $id = (int) $id_matches[3]; // While we have the attachment ID, let's adopt any orphans. $attachment = & get_post( $id, ARRAY_A ); @@ -290,7 +290,7 @@ function edit_post() { // Reunite any orphaned attachments with their parent if ( !$draft_ids = get_user_option( 'autosave_draft_ids' ) ) $draft_ids = array(); - if ( $draft_temp_id = array_search( $post_ID, $draft_ids ) ) + if ( $draft_temp_id = (int) array_search( $post_ID, $draft_ids ) ) relocate_children( $draft_temp_id, $post_ID ); // Now that we have an ID we can fix any attachment anchor hrefs @@ -447,7 +447,7 @@ function get_user_to_edit( $user_id ) { function add_user() { if ( func_num_args() ) { // The hackiest hack that ever did hack global $current_user, $wp_roles; - $user_id = func_get_arg( 0 ); + $user_id = (int) func_get_arg( 0 ); if ( isset( $_POST['role'] ) ) { if( $user_id != $current_user->id || $wp_roles->role_objects[$_POST['role']]->has_cap( 'edit_users' ) ) { @@ -465,7 +465,7 @@ function edit_user( $user_id = 0 ) { global $current_user, $wp_roles, $wpdb; if ( $user_id != 0 ) { $update = true; - $user->ID = $user_id; + $user->ID = (int) $user_id; $userdata = get_userdata( $user_id ); $user->user_login = $wpdb->escape( $userdata->user_login ); } else { @@ -803,8 +803,8 @@ function _cat_row( $category, $level, $name_override = false ) { $pad = str_repeat( '— ', $level ); if ( current_user_can( 'manage_categories' ) ) { $edit = "".__( 'Edit' ).""; - $default_cat_id = get_option( 'default_category' ); - $default_link_cat_id = get_option( 'default_link_category' ); + $default_cat_id = (int) get_option( 'default_category' ); + $default_link_cat_id = (int) get_option( 'default_link_category' ); if ( ($category->cat_ID != $default_cat_id ) && ($category->cat_ID != $default_link_cat_id ) ) $edit .= "cat_ID ) . "' onclick=\"return deleteSomething( 'cat', $category->cat_ID, '" . js_escape(sprintf( __("You are about to delete the category '%s'.\nAll posts that were only assigned to this category will be assigned to the '%s' category.\nAll links that were only assigned to this category will be assigned to the '%s' category.\n'OK' to delete, 'Cancel' to stop." ), $category->cat_name, get_catname( $default_cat_id ), get_catname( $default_link_cat_id ) )) . "' );\" class='delete'>".__( 'Delete' ).""; @@ -843,7 +843,7 @@ function page_rows( $parent = 0, $level = 0, $pages = 0, $hierarchy = true ) { $post->post_title = wp_specialchars( $post->post_title ); $pad = str_repeat( '— ', $level ); - $id = $post->ID; + $id = (int) $post->ID; $class = ('alternate' == $class ) ? '' : 'alternate'; ?> -- cgit