Index: wp-admin/edit-form-advanced.php
===================================================================
--- wp-admin/edit-form-advanced.php	(revision 9707)
+++ wp-admin/edit-form-advanced.php	(working copy)
@@ -166,7 +166,6 @@
 } elseif ( is_sticky( $post->ID ) ) {
 	$visibility = 'public';
 	$visibility_trans = __('Public, Sticky');
-	$sticky = 'sticky';
 } else {
 	$visibility = 'public';
 	$visibility_trans = __('Public');
Index: wp-admin/edit-link-form.php
===================================================================
--- wp-admin/edit-link-form.php	(revision 9707)
+++ wp-admin/edit-link-form.php	(working copy)
@@ -87,7 +87,7 @@
 <div id="delete-action">
 <?php
 if ( !empty($_GET['action']) && 'edit' == $_GET['action'] && current_user_can('manage_links') ) { ?>
-	<a class="submitdelete deletion" href="<?php echo wp_nonce_url("link.php?action=delete&amp;link_id=$link->link_id", 'delete-bookmark_' . $link->link_id); ?>" onclick="if ( confirm('<?php echo js_escape(sprintf( ('draft' == $post->post_status) ? __("You are about to delete this draft '%s'\n  'Cancel' to stop, 'OK' to delete.") : __("You are about to delete this link '%s'\n  'Cancel' to stop, 'OK' to delete."), $link->link_name )); ?>') ) {return true;}return false;"><?php _e('Delete'); ?></a>
+	<a class="submitdelete deletion" href="<?php echo wp_nonce_url("link.php?action=delete&amp;link_id=$link->link_id", 'delete-bookmark_' . $link->link_id); ?>" onclick="if ( confirm('<?php echo js_escape(sprintf(__("You are about to delete this link '%s'\n  'Cancel' to stop, 'OK' to delete."), $link->link_name )); ?>') ) {return true;}return false;"><?php _e('Delete'); ?></a>
 <?php } ?>
 </div>
 
Index: wp-admin/import/blogger.php
===================================================================
--- wp-admin/import/blogger.php	(revision 9707)
+++ wp-admin/import/blogger.php	(working copy)
@@ -522,7 +522,7 @@
 	}
 
 	function import_post( $entry ) {
-		global $wpdb, $importing_blog;
+		global $importing_blog;
 
 		// The old permalink is all Blogger gives us to link comments to their posts.
 		if ( isset( $entry->draft ) )
@@ -659,7 +659,7 @@
 	}
 
 	function get_user_options($current) {
-		global $wpdb, $importer_users;
+		global $importer_users;
 		if ( ! isset( $importer_users ) )
 			$importer_users = (array) get_users_of_blog();
 
Index: wp-admin/import/mt.php
===================================================================
--- wp-admin/import/mt.php	(revision 9707)
+++ wp-admin/import/mt.php	(working copy)
@@ -55,7 +55,7 @@
 	}
 
 	function users_form($n) {
-		global $wpdb, $testing;
+		global $wpdb;
 		$users = $wpdb->get_results("SELECT * FROM $wpdb->users ORDER BY ID");
 ?><select name="userselect[<?php echo $n; ?>]">
 	<option value="#NONE#"><?php _e('- Select -') ?></option>
@@ -101,7 +101,6 @@
 
 	//function to check the authorname and do the mapping
 	function checkauthor($author) {
-		global $wpdb;
 		//mtnames is an array with the names in the mt import file
 		$pass = wp_generate_password();
 		if (!(in_array($author, $this->mtnames))) { //a new mt author name is found
@@ -109,7 +108,7 @@
 			$this->mtnames[$this->j] = $author; //add that new mt author name to an array
 			$user_id = username_exists($this->newauthornames[$this->j]); //check if the new author name defined by the user is a pre-existing wp user
 			if (!$user_id) { //banging my head against the desk now.
-				if ($newauthornames[$this->j] == 'left_blank') { //check if the user does not want to change the authorname
+				if ($this->newauthornames[$this->j] == 'left_blank') { //check if the user does not want to change the authorname
 					$user_id = wp_create_user($author, $pass);
 					$this->newauthornames[$this->j] = $author; //now we have a name, in the place of left_blank.
 				} else {
Index: wp-admin/includes/dashboard.php
===================================================================
--- wp-admin/includes/dashboard.php	(revision 9707)
+++ wp-admin/includes/dashboard.php	(working copy)
@@ -353,7 +353,6 @@
 }
 
 function wp_dashboard_recent_drafts( $drafts = false ) {
-	global $post;
 	if ( !$drafts ) {
 		$drafts_query = new WP_Query( array(
 			'post_type' => 'post',
Index: wp-admin/includes/file.php
===================================================================
--- wp-admin/includes/file.php	(revision 9707)
+++ wp-admin/includes/file.php	(working copy)
@@ -330,6 +330,9 @@
 	// You may define your own function and pass the name in $overrides['upload_error_handler']
 	$upload_error_handler = 'wp_handle_upload_error';
 
+	// You may define your own function and pass the name in $overrides['unique_filename_callback']
+	$unique_filename_callback = null;
+
 	// $_POST['action'] must be set and its value must equal $overrides['action'] or this:
 	$action = 'wp_handle_sideload';
 
Index: wp-admin/includes/media.php
===================================================================
--- wp-admin/includes/media.php	(revision 9707)
+++ wp-admin/includes/media.php	(working copy)
@@ -262,7 +262,7 @@
 	), $post_data );
 
 	// Save the data
-	$id = wp_insert_attachment($attachment, $file, $post_parent);
+	$id = wp_insert_attachment($attachment, $file, $post_id);
 	if ( !is_wp_error($id) ) {
 		wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $file ) );
 		return $url;
@@ -905,8 +905,6 @@
 		$post = (object) $post;
 
 	$edit_post = sanitize_post($post, 'edit');
-	$file = wp_get_attachment_url($post->ID);
-	$link = get_attachment_link($post->ID);
 
 	$form_fields = array(
 		'post_title'   => array(
@@ -1019,10 +1017,6 @@
 	else
 		return false;
 
-	$title_label = __('Title');
-	$description_label = __('Description');
-	$tags_label = __('Tags');
-
 	$toggle_on = __('Show');
 	$toggle_off = __('Hide');
 
@@ -1030,7 +1024,7 @@
 
 	$filename = basename($post->guid);
 	$title = attribute_escape($post->post_title);
-	$description = attribute_escape($post->post_content);
+
 	if ( $_tags = get_the_tags($attachment_id) ) {
 		foreach ( $_tags as $tag )
 			$tags[] = $tag->name;
Index: wp-admin/includes/plugin-install.php
===================================================================
--- wp-admin/includes/plugin-install.php	(revision 9707)
+++ wp-admin/includes/plugin-install.php	(working copy)
@@ -27,7 +27,6 @@
  * @return mixed
  */
 function plugins_api($action, $args = null) {
-	global $wp_version;
 
 	if( is_array($args) )
 		$args = (object)$args;
@@ -247,8 +246,6 @@
  * @param int $totalpages Number of pages.
  */
 function display_plugins_table($plugins, $page = 1, $totalpages = 1){
-	global $tab;
-
 	$type = isset($_REQUEST['type']) ? stripslashes( $_REQUEST['type'] ) : '';
 	$term = isset($_REQUEST['s']) ? stripslashes( $_REQUEST['s'] ) : '';
 
@@ -674,7 +671,7 @@
 		$install_actions = apply_filters('install_plugin_complete_actions', array(
 							'activate_plugin' => '<a href="' . wp_nonce_url('plugins.php?action=activate&amp;plugin=' . $plugin_file, 'activate-plugin_' . $plugin_file) . '" title="' . __('Activate this plugin') . '" target="_parent">' . __('Activate Plugin') . '</a>',
 							'plugins_page' => '<a href="' . admin_url('plugins.php') . '" title="' . __('Goto plugins page') . '" target="_parent">' . __('Return to Plugins page') . '</a>'
-							), $plugin_information, $plugin_file);
+							), array(), $plugin_file);
 		if ( ! empty($install_actions) )
 			show_message('<strong>' . __('Actions:') . '</strong> ' . implode(' | ', (array)$install_actions));
 	}
Index: wp-admin/includes/post.php
===================================================================
--- wp-admin/includes/post.php	(revision 9707)
+++ wp-admin/includes/post.php	(working copy)
@@ -769,7 +769,6 @@
  * @return unknown
  */
 function wp_edit_posts_query( $q = false ) {
-	global $wpdb;
 	if ( false === $q )
 		$q = $_GET;
 	$q['m']   = isset($q['m']) ? (int) $q['m'] : 0;
@@ -832,7 +831,6 @@
  * @return unknown
  */
 function wp_edit_attachments_query( $q = false ) {
-	global $wpdb;
 	if ( false === $q )
 		$q = $_GET;
 
Index: wp-admin/includes/template.php
===================================================================
--- wp-admin/includes/template.php	(revision 9707)
+++ wp-admin/includes/template.php	(working copy)
@@ -207,7 +207,7 @@
 	$columns = $is_tag ? get_column_headers('tag') : get_column_headers('category');
 	$hidden = array_intersect( array_keys( $columns ), array_filter( (array) get_user_option( "manage-$type-columns-hidden" ) ) );
 	$col_count = count($columns) - count($hidden);
-	$output = ''; ?>
+	?>
 
 <form method="get" action=""><table style="display: none"><tbody id="inlineedit">
 	<tr id="inline-edit" class="inline-edit-row" style="display: none"><td colspan="<?php echo $col_count; ?>">
@@ -659,7 +659,6 @@
 
 	// convert it to table rows
 	$out = '';
-	$class = '';
 	$count = 0;
 	foreach( $tags as $tag )
 		$out .= _tag_row( $tag, ++$count % 2 ? ' class="iedit alternate"' : ' class="iedit"' );
@@ -1878,7 +1877,6 @@
 	global $comment, $post;
 	$comment = get_comment( $comment_id );
 	$post = get_post($comment->comment_post_ID);
-	$authordata = get_userdata($post->post_author);
 	$the_comment_status = wp_get_comment_status($comment->comment_ID);
 
 	if ( current_user_can( 'edit_post', $post->ID ) ) {
Index: wp-admin/page.php
===================================================================
--- wp-admin/page.php	(revision 9707)
+++ wp-admin/page.php	(working copy)
@@ -22,6 +22,8 @@
  * @param int $page_ID Page ID.
  */
 function redirect_page($page_ID) {
+	global $action;
+
 	$referredby = '';
 	if ( !empty($_POST['referredby']) ) {
 		$referredby = preg_replace('|https?://[^/]+|i', '', $_POST['referredby']);
Index: wp-includes/bookmark.php
===================================================================
--- wp-includes/bookmark.php	(revision 9707)
+++ wp-includes/bookmark.php	(working copy)
@@ -29,7 +29,7 @@
 		wp_cache_add($bookmark->link_id, $bookmark, 'bookmark');
 		$_bookmark = $bookmark;
 	} else {
-		if ( isset($GLOBALS['link']) && ($GLOBALS['link']->link_id == $link) ) {
+		if ( isset($GLOBALS['link']) && ($GLOBALS['link']->link_id == $bookmark) ) {
 			$_bookmark = & $GLOBALS['link'];
 		} elseif ( ! $_bookmark = wp_cache_get($bookmark, 'bookmark') ) {
 			$_bookmark = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->links WHERE link_id = %d LIMIT 1", $bookmark));
Index: wp-includes/cron.php
===================================================================
--- wp-includes/cron.php	(revision 9707)
+++ wp-includes/cron.php	(working copy)
@@ -158,7 +158,6 @@
  * @return null Cron could not be spawned, because it is not needed to run.
  */
 function spawn_cron( $local_time ) {
-	global $current_blog;
 
 	/*
 	 * do not even start the cron if local server timer has drifted
Index: wp-includes/http.php
===================================================================
--- wp-includes/http.php	(revision 9707)
+++ wp-includes/http.php	(working copy)
@@ -411,7 +411,7 @@
 				$length = hexdec( $match[1] );
 				$chunkLength = strlen( $match[0] );
 
-				$strBody = substr($body, strlen( $match[0] ), $length);
+				$strBody = substr($body, $chunkLength, $length);
 				$parsedBody .= $strBody;
 
 				$body = ltrim(str_replace(array($match[0], $strBody), '', $body), "\n");
Index: wp-includes/pluggable.php
===================================================================
--- wp-includes/pluggable.php	(revision 9707)
+++ wp-includes/pluggable.php	(working copy)
@@ -1512,9 +1512,7 @@
 			$default = $avatar_default;
 	}
 
-	if ( 'custom' == $default )
-		$default = add_query_arg( 's', $size, $defaults[$avatar_default][1] );
-	elseif ( 'mystery' == $default )
+	if ( 'mystery' == $default )
 		$default = "http://www.gravatar.com/avatar/ad516503a11cd5ca435acc9bb6523536?s={$size}"; // ad516503a11cd5ca435acc9bb6523536 == md5('unknown@gravatar.com')
 	elseif ( 'blank' == $default )
 		$default = includes_url('images/blank.gif');
@@ -1524,6 +1522,8 @@
 		$default = "http://www.gravatar.com/avatar/s={$size}";
 	elseif ( empty($email) )
 		$default = "http://www.gravatar.com/avatar/?d=$default&amp;s={$size}";
+	else
+		$default = add_query_arg( 's', $size, $default );
 
 	if ( !empty($email) ) {
 		$out = 'http://www.gravatar.com/avatar/';
Index: wp-includes/plugin.php
===================================================================
--- wp-includes/plugin.php	(revision 9707)
+++ wp-includes/plugin.php	(working copy)
@@ -123,7 +123,7 @@
  * @subpackage Plugin
  * @since 0.71
  * @global array $wp_filter Stores all of the filters
- * @global array $merge_filters Merges the filter hooks using this function.
+ * @global array $merged_filters Merges the filter hooks using this function.
  * @global array $wp_current_filter stores the list of current filters with the current one last
  *
  * @param string $tag The name of the filter hook.
@@ -219,7 +219,7 @@
  * @return bool True when finished.
  */
 function remove_all_filters($tag, $priority = false) {
-	global $wp_filter, $merge_filters;
+	global $wp_filter, $merged_filters;
 
 	if( isset($wp_filter[$tag]) ) {
 		if( false !== $priority && isset($$wp_filter[$tag][$priority]) )
Index: wp-includes/post.php
===================================================================
--- wp-includes/post.php	(revision 9707)
+++ wp-includes/post.php	(working copy)
@@ -2160,7 +2160,7 @@
 	$pages = $wpdb->get_results($query);
 
 	if ( empty($pages) ) {
-		$page = apply_filters('get_pages', array(), $r);
+		$pages = apply_filters('get_pages', array(), $r);
 		return $pages;
 	}
 
@@ -3321,7 +3321,7 @@
  * @return object|bool The autosaved data or false on failure or when no autosave exists.
  */
 function wp_get_post_autosave( $post_id ) {
-	global $wpdb;
+
 	if ( !$post = get_post( $post_id ) )
 		return false;
 
Index: wp-includes/theme.php
===================================================================
--- wp-includes/theme.php	(revision 9707)
+++ wp-includes/theme.php	(working copy)
@@ -186,7 +186,7 @@
 	if ( preg_match( '|Author URI:(.*)$|mi', $theme_data, $author_uri ) )
 		$author_uri = clean_url( trim( $author_uri[1]) );
 	else
-		$author_uti = '';
+		$author_uri = '';
 
 	if ( preg_match( '|Template:(.*)$|mi', $theme_data, $template ) )
 		$template = wp_kses( trim( $template[1] ), $themes_allowed_tags );
Index: wp-includes/user.php
===================================================================
--- wp-includes/user.php	(revision 9707)
+++ wp-includes/user.php	(working copy)
@@ -259,7 +259,7 @@
 	$meta_value = trim( $meta_value );
 
 	if ( ! empty($meta_value) )
-		$wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s AND meta_value = %s", $userid, $meta_key, $meta_value) );
+		$wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s AND meta_value = %s", $user_id, $meta_key, $meta_value) );
 	else
 		$wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $meta_key) );
 

