diff -ruN wordpress-2.3/wp-admin/edit-post-rows.php wordpress-2.3.1/wp-admin/edit-post-rows.php
--- wordpress-2.3/wp-admin/edit-post-rows.php	2007-09-05 15:17:59.000000000 -0700
+++ wordpress-2.3.1/wp-admin/edit-post-rows.php	2007-10-17 09:51:55.000000000 -0700
@@ -1,3 +1,4 @@
+<?php if ( ! defined('ABSPATH') ) die(); ?>
 <table class="widefat">
 	<thead>
 	<tr>
diff -ruN wordpress-2.3/wp-admin/import/mt.php wordpress-2.3.1/wp-admin/import/mt.php
--- wordpress-2.3/wp-admin/import/mt.php	2007-09-18 09:32:22.000000000 -0700
+++ wordpress-2.3.1/wp-admin/import/mt.php	2007-09-26 16:23:22.000000000 -0700
@@ -30,7 +30,7 @@
 	<input type="hidden" name="upload_type" value="ftp" />
 <?php _e('Or use <code>mt-export.txt</code> in your <code>/wp-content/</code> directory'); ?></p>
 <p class="submit">
-<input type="submit" value="<?php _e(sprintf('Import %s', 'mt-export.txt &raquo;')); ?>" />
+<input type="submit" value="<?php echo attribute_escape(__('Import mt-export.txt &raquo;')); ?>" />
 </p>
 </form>
 <p><?php _e('The importer is smart enough not to import duplicates, so you can run this multiple times without worry if&#8212;for whatever reason&#8212;it doesn\'t finish. If you get an <strong>out of memory</strong> error try splitting up the import file into pieces.'); ?> </p>
diff -ruN wordpress-2.3/wp-admin/import/utw.php wordpress-2.3.1/wp-admin/import/utw.php
--- wordpress-2.3/wp-admin/import/utw.php	2007-09-03 16:19:20.000000000 -0700
+++ wordpress-2.3.1/wp-admin/import/utw.php	2007-09-28 10:37:36.000000000 -0700
@@ -157,7 +157,7 @@
 		// run that funky magic!
 		$tags_added = $this->tag2post();
 
-		echo '<p>' . sprintf( __('Done! <strong>%s</strong> tags where added!'), $tags_added ) . '<br /></p>';
+		echo '<p>' . sprintf( __('Done! <strong>%s</strong> tags were added!'), $tags_added ) . '<br /></p>';
 
 		echo '<form action="admin.php?import=utw&amp;step=4" method="post">';
 		wp_nonce_field('import-utw');
@@ -273,4 +273,4 @@
 // add it to the import page!
 register_importer('utw', 'Ultimate Tag Warrior', __('Import Ultimate Tag Warrior tags into the new native tagging structure.'), array($utw_import, 'dispatch'));
 
-?>
\ No newline at end of file
+?>
diff -ruN wordpress-2.3/wp-admin/import/wp-cat2tag.php wordpress-2.3.1/wp-admin/import/wp-cat2tag.php
--- wordpress-2.3/wp-admin/import/wp-cat2tag.php	2007-09-21 08:04:13.000000000 -0700
+++ wordpress-2.3.1/wp-admin/import/wp-cat2tag.php	2007-10-11 10:52:13.000000000 -0700
@@ -63,7 +63,7 @@
 
 		print '</ul>';
 
-		print '<p class="submit"><input type="submit" name="maybe_convert_all_cats" value="' . __('Convert All Categories') . '" /> <input type="submit" name="submit" value="' . __('Convert &raquo;') . '" /></p>';
+		print '<p class="submit"><input type="submit" name="submit" value="' . __('Convert &raquo;') . '" /></p>';
 		print '</form>';
 	}
 
@@ -140,11 +140,23 @@
 					foreach ( $posts as $post ) {
 						if ( !$wpdb->get_var("SELECT object_id FROM $wpdb->term_relationships WHERE object_id = '$post' AND term_taxonomy_id = '$id'") )						
 							$wpdb->query("INSERT INTO $wpdb->term_relationships (object_id, term_taxonomy_id) VALUES ('$post', '$id')");
+						clean_post_cache($post);
 					}
 				} else {
+					$tt_ids = $wpdb->get_col("SELECT term_taxonomy_id FROM $wpdb->term_taxonomy WHERE term_id = '{$category->term_id}' AND taxonomy = 'category'");
+					if ( $tt_ids ) {
+						$posts = $wpdb->get_col("SELECT object_id FROM $wpdb->term_relationships WHERE term_taxonomy_id IN (" . join(',', $tt_ids) . ") GROUP BY object_id");
+						foreach ( (array) $posts as $post )
+							clean_post_cache($post);
+					}
+
 					// Change the category to a tag.
 					$wpdb->query("UPDATE $wpdb->term_taxonomy SET taxonomy = 'post_tag' WHERE term_id = '{$category->term_id}' AND taxonomy = 'category'");
 
+					$terms = $wpdb->get_col("SELECT term_id FROM $wpdb->term_taxonomy WHERE parent = '{$category->term_id}' AND taxonomy = 'category'");
+					foreach ( (array) $terms as $term )
+						clean_category_cache($term);
+
 					// Set all parents to 0 (root-level) if their parent was the converted tag
 					$wpdb->query("UPDATE $wpdb->term_taxonomy SET parent = 0 WHERE parent = '{$category->term_id}' AND taxonomy = 'category'");
 				}
@@ -160,41 +172,9 @@
 		print '</ul>';
 	}
 
-	function convert_all_confirm() {
-		print '<div class="narrow">';
-
-		print '<h3>' . __('Confirm') . '</h3>';
-
-		print '<p>' . __('You are about to convert all categories to tags. Are you sure you want to continue?') . '</p>';
-
-		print '<form action="admin.php?import=wp-cat2tag" method="post">';
-		wp_nonce_field('import-cat2tag');
-		print '<p style="text-align:center" class="submit"><input type="submit" value="' . __('Yes') . '" name="yes_convert_all_cats" />&nbsp;&nbsp;&nbsp;&nbsp;<input type="submit" value="' . __('No') . '" name="no_dont_do_it" /></p>';
-		print '</form>';
-
-		print '</div>';
-	}
-
-	function convert_all() {
-		global $wpdb;
-
-		$this->populate_all_categories();
-		foreach ( $this->all_categories as $category )
-			$this->categories_to_convert[] = $category->term_id;
-		$this->convert_them();
-	}
-
 	function init() {
 
-		if (isset($_POST['maybe_convert_all_cats'])) {
-			$step = 3;
-		} elseif (isset($_POST['yes_convert_all_cats'])) {
-			$step = 4;
-		} elseif (isset($_POST['no_dont_do_it'])) {
-			die('no_dont_do_it');
-		} else {
-			$step = (isset($_GET['step'])) ? (int) $_GET['step'] : 1;
-		}
+		$step = (isset($_GET['step'])) ? (int) $_GET['step'] : 1;
 
 		$this->header();
 
@@ -214,14 +194,6 @@
 				case 2 :
 					$this->convert_them();
 				break;
-
-				case 3 :
-					$this->convert_all_confirm();
-				break;
-
-				case 4 :
-					$this->convert_all();
-				break;
 			}
 		}
 
diff -ruN wordpress-2.3/wp-admin/includes/template.php wordpress-2.3.1/wp-admin/includes/template.php
--- wordpress-2.3/wp-admin/includes/template.php	2007-09-11 18:08:19.000000000 -0700
+++ wordpress-2.3.1/wp-admin/includes/template.php	2007-10-05 23:23:45.000000000 -0700
@@ -38,6 +38,7 @@
 	if ( current_user_can( 'manage_categories' ) ) {
 		$edit = "<a href='categories.php?action=edit&amp;cat_ID=$category->term_id' class='edit'>".__( 'Edit' )."</a></td>";
 		$default_cat_id = (int) get_option( 'default_category' );
+		$default_link_cat_id = (int) get_option( 'default_link_category' );
 
 		if ( $category->term_id != $default_cat_id )
 			$edit .= "<td><a href='" . wp_nonce_url( "categories.php?action=delete&amp;cat_ID=$category->term_id", 'delete-category_' . $category->term_id ) . "' onclick=\"return deleteSomething( 'cat', $category->term_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->name, get_catname( $default_cat_id ), get_catname( $default_link_cat_id ) )) . "' );\" class='delete'>".__( 'Delete' )."</a>";
@@ -493,7 +494,7 @@
 			else
 				$current = '';
 
-			echo "\n\t<option value='$item->ID'$current>$pad $item->post_title</option>";
+			echo "\n\t<option value='$item->ID'$current>$pad " . wp_specialchars($item->post_title) . "</option>";
 			parent_dropdown( $default, $item->ID, $level +1 );
 		}
 	} else {
diff -ruN wordpress-2.3/wp-admin/includes/upgrade.php wordpress-2.3.1/wp-admin/includes/upgrade.php
--- wordpress-2.3/wp-admin/includes/upgrade.php	2007-09-22 16:14:38.000000000 -0700
+++ wordpress-2.3.1/wp-admin/includes/upgrade.php	2007-10-17 14:09:02.000000000 -0700
@@ -533,6 +533,7 @@
 
 	// Convert categories to terms.
 	$tt_ids = array();
+	$have_tags = false;
 	$categories = $wpdb->get_results("SELECT * FROM $wpdb->categories ORDER BY cat_ID");
 	foreach ($categories as $category) {
 		$term_id = (int) $category->cat_ID;
@@ -579,6 +580,7 @@
 		}
 
 		if ( !empty($category->tag_count) ) {
+			$have_tags = true;
 			$count = (int) $category->tag_count;
 			$taxonomy = 'post_tag';
 			$wpdb->query("INSERT INTO $wpdb->term_taxonomy (term_id, taxonomy, description, parent, count) VALUES ('$term_id', '$taxonomy', '$description', '$parent', '$count')");
@@ -593,7 +595,11 @@
 		}
 	}
 
-	$posts = $wpdb->get_results("SELECT * FROM $wpdb->post2cat");
+	$select = 'post_id, category_id';
+	if ( $have_tags )
+		$select .= ', rel_type';
+
+	$posts = $wpdb->get_results("SELECT $select FROM $wpdb->post2cat GROUP BY post_id, category_id");
 	foreach ( $posts as $post ) {
 		$post_id = (int) $post->post_id;
 		$term_id = (int) $post->category_id;
@@ -658,7 +664,7 @@
 		// Set default to the last category we grabbed during the upgrade loop.
 		update_option('default_link_category', $default_link_cat);
 	} else {
-		$links = $wpdb->get_results("SELECT * FROM $wpdb->link2cat");
+		$links = $wpdb->get_results("SELECT link_id, category_id FROM $wpdb->link2cat GROUP BY link_id, category_id");
 		foreach ( $links as $link ) {
 			$link_id = (int) $link->link_id;
 			$term_id = (int) $link->category_id;
@@ -1002,7 +1008,6 @@
 						}
 						// Add the column list to the index create string
 						$index_string .= ' ('.$index_columns.')';
-						error_log("Index string: $index_string", 0);
 						if(!(($aindex = array_search($index_string, $indices)) === false)) {
 							unset($indices[$aindex]);
 							//echo "<pre style=\"border:1px solid #ccc;margin-top:5px;\">{$table}:<br />Found index:".$index_string."</pre>\n";
diff -ruN wordpress-2.3/wp-admin/includes/upload.php wordpress-2.3.1/wp-admin/includes/upload.php
--- wordpress-2.3/wp-admin/includes/upload.php	2007-08-28 16:23:38.000000000 -0700
+++ wordpress-2.3.1/wp-admin/includes/upload.php	2007-10-12 15:15:32.000000000 -0700
@@ -31,6 +31,9 @@
 	$src = wp_make_link_relative( $src_base );
 	$src_base = str_replace($src, '', $src_base);
 
+	if ( !trim($post_title) )
+		$post_title = basename($src);
+
 	$r = '';
 
 	if ( $href )
@@ -39,7 +42,9 @@
 		$r .= "\t\t\t$innerHTML";
 	if ( $href )
 		$r .= "</a>\n";
-	$r .= "\t\t\t\t<span class='upload-file-size'>".size_format(filesize($filesystem_path))."</span>\n";
+	$size = @filesize($filesystem_path);
+	if ( !empty($size) )
+		$r .= "\t\t\t\t<span class='upload-file-size'>".size_format($size)."</span>\n";
 	$r .= "\n\t\t<div class='upload-file-data'>\n\t\t\t<p>\n";
 	$r .= "\t\t\t\t<input type='hidden' name='attachment-url-$id' id='attachment-url-$id' value='$src' />\n";
 	$r .= "\t\t\t\t<input type='hidden' name='attachment-url-base-$id' id='attachment-url-base-$id' value='$src_base' />\n";
diff -ruN wordpress-2.3/wp-admin/link-import.php wordpress-2.3.1/wp-admin/link-import.php
--- wordpress-2.3/wp-admin/link-import.php	2007-09-03 16:32:58.000000000 -0700
+++ wordpress-2.3.1/wp-admin/link-import.php	2007-10-12 14:24:08.000000000 -0700
@@ -45,10 +45,10 @@
 <p style="clear: both; margin-top: 1em;"><?php _e('Now select a category you want to put these links in.') ?><br />
 <?php _e('Category:') ?> <select name="cat_id">
 <?php
-$categories = get_categories('hide_empty=0');
+$categories = get_terms('link_category', 'get=all');
 foreach ($categories as $category) {
 ?>
-<option value="<?php echo $category->cat_ID; ?>"><?php echo wp_specialchars(apply_filters('link_category', $category->cat_name)); ?></option>
+<option value="<?php echo $category->term_id; ?>"><?php echo wp_specialchars(apply_filters('link_category', $category->name)); ?></option>
 <?php
 } // end foreach
 ?>
diff -ruN wordpress-2.3/wp-admin/link.php wordpress-2.3.1/wp-admin/link.php
--- wordpress-2.3/wp-admin/link.php	2007-06-01 19:53:09.000000000 -0700
+++ wordpress-2.3.1/wp-admin/link.php	2007-10-16 09:09:37.000000000 -0700
@@ -3,6 +3,9 @@
 
 wp_reset_vars(array('action', 'cat_id', 'linkurl', 'name', 'image', 'description', 'visible', 'target', 'category', 'link_id', 'submit', 'order_by', 'links_show_cat_id', 'rating', 'rel', 'notes', 'linkcheck[]'));
 
+if ( ! current_user_can('manage_links') )
+	wp_die( __('You do not have sufficient permissions to edit the links for this blog.') );
+
 if ('' != $_POST['deletebookmarks'])
 	$action = 'deletebookmarks';
 if ('' != $_POST['move'])
@@ -13,13 +16,9 @@
 $this_file = 'link-manager.php';
 
 switch ($action) {
-		case 'deletebookmarks' :
+	case 'deletebookmarks' :
 		check_admin_referer('bulk-bookmarks');
 
-		// check the current user's level first.
-		if (!current_user_can('manage_links'))
-			wp_die(__('Cheatin&#8217; uh?'));
-
 		//for each link id (in $linkcheck[]) change category to selected value
 		if (count($linkcheck) == 0) {
 			wp_redirect($this_file);
@@ -41,10 +40,6 @@
 	case 'move' :
 		check_admin_referer('bulk-bookmarks');
 
-		// check the current user's level first.
-		if (!current_user_can('manage_links'))
-			wp_die(__('Cheatin&#8217; uh?'));
-
 		//for each link id (in $linkcheck[]) change category to selected value
 		if (count($linkcheck) == 0) {
 			wp_redirect($this_file);
@@ -63,7 +58,7 @@
 
 		add_link();
 
-		wp_redirect(wp_get_referer().'?added=true');
+		wp_redirect( wp_get_referer() . '?added=true' );
 		exit;
 		break;
 
@@ -81,9 +76,6 @@
 		$link_id = (int) $_GET['link_id'];
 		check_admin_referer('delete-bookmark_' . $link_id);
 
-		if (!current_user_can('manage_links'))
-			wp_die(__('Cheatin&#8217; uh?'));
-
 		wp_delete_link($link_id);
 
 		wp_redirect($this_file);
@@ -97,21 +89,18 @@
 		$parent_file = 'link-manager.php';
 		$submenu_file = 'link-manager.php';
 		$title = __('Edit Link');
-		include_once ('admin-header.php');
-		if (!current_user_can('manage_links'))
-			wp_die(__('You do not have sufficient permissions to edit the links for this blog.'));
 
 		$link_id = (int) $_GET['link_id'];
 
 		if (!$link = get_link_to_edit($link_id))
 			wp_die(__('Link not found.'));
 
+		include_once ('admin-header.php');
 		include ('edit-link-form.php');
+		include ('admin-footer.php');
 		break;
 
 	default :
 		break;
 }
-
-include ('admin-footer.php');
-?>
+?>
\ No newline at end of file
diff -ruN wordpress-2.3/wp-includes/bookmark.php wordpress-2.3.1/wp-includes/bookmark.php
--- wordpress-2.3/wp-includes/bookmark.php	2007-09-03 16:32:58.000000000 -0700
+++ wordpress-2.3.1/wp-includes/bookmark.php	2007-10-15 13:14:56.000000000 -0700
@@ -113,7 +113,7 @@
 	}
 	if (!empty($category_query)) {
 		$category_query .= ") AND taxonomy = 'link_category'";
-		$join = " LEFT JOIN $wpdb->term_relationships AS tr ON ($wpdb->links.link_id = tr.object_id) LEFT JOIN $wpdb->term_taxonomy as tt ON tt.term_taxonomy_id = tr.term_taxonomy_id";
+		$join = " INNER JOIN $wpdb->term_relationships AS tr ON ($wpdb->links.link_id = tr.object_id) INNER JOIN $wpdb->term_taxonomy as tt ON tt.term_taxonomy_id = tr.term_taxonomy_id";
 	}
 
 	if (get_option('links_recently_updated_time')) {
diff -ruN wordpress-2.3/wp-includes/canonical.php wordpress-2.3.1/wp-includes/canonical.php
--- wordpress-2.3/wp-includes/canonical.php	2007-09-20 13:25:43.000000000 -0700
+++ wordpress-2.3.1/wp-includes/canonical.php	2007-10-17 13:15:18.000000000 -0700
@@ -4,7 +4,7 @@
 function redirect_canonical($requested_url=NULL, $do_redirect=true) {
 	global $wp_rewrite, $posts, $is_IIS;
 
-	if ( is_feed() || is_trackback() || is_search() || is_comments_popup() || is_admin() || $is_IIS || ( isset($_POST) && count($_POST) ) )
+	if ( is_feed() || is_trackback() || is_search() || is_comments_popup() || is_admin() || $is_IIS || ( isset($_POST) && count($_POST) ) || is_preview() )
 		return;
 
 	if ( !$requested_url ) {
diff -ruN wordpress-2.3/wp-includes/default-filters.php wordpress-2.3.1/wp-includes/default-filters.php
--- wordpress-2.3/wp-includes/default-filters.php	2007-09-20 11:23:33.000000000 -0700
+++ wordpress-2.3.1/wp-includes/default-filters.php	2007-10-09 14:09:49.000000000 -0700
@@ -25,9 +25,18 @@
 	add_filter($filter, 'wp_filter_kses');
 }
 
-// URL
+// Save URL
 $filters = array('pre_comment_author_url', 'pre_user_url', 'pre_link_url', 'pre_link_image',
-	'pre_link_rss', 'comment_url');
+	'pre_link_rss');
+foreach ( $filters as $filter ) {
+	add_filter($filter, 'strip_tags');
+	add_filter($filter, 'trim');
+	add_filter($filter, 'sanitize_url');
+	add_filter($filter, 'wp_filter_kses');
+}
+
+// Display URL
+$filters = array('user_url', 'link_url', 'link_image', 'link_rss', 'comment_url');
 foreach ( $filters as $filter ) {
 	add_filter($filter, 'strip_tags');
 	add_filter($filter, 'trim');
@@ -127,6 +136,7 @@
 
 // Actions
 add_action('wp_head', 'rsd_link');
+add_action('wp_head', 'wlwmanifest_link');
 add_action('wp_head', 'locale_stylesheet');
 add_action('publish_future_post', 'wp_publish_post', 10, 1);
 add_action('wp_head', 'noindex', 1);
@@ -156,4 +166,4 @@
 add_action('edit_post', 'wp_check_for_changed_slugs');
 add_action('edit_form_advanced', 'wp_remember_old_slug');
 
-?>
\ No newline at end of file
+?>
diff -ruN wordpress-2.3/wp-includes/formatting.php wordpress-2.3.1/wp-includes/formatting.php
--- wordpress-2.3/wp-includes/formatting.php	2007-09-21 12:36:12.000000000 -0700
+++ wordpress-2.3.1/wp-includes/formatting.php	2007-10-03 09:17:54.000000000 -0700
@@ -1087,7 +1087,7 @@
 	return apply_filters('richedit_pre', $output);
 }
 
-function clean_url( $url, $protocols = null ) {
+function clean_url( $url, $protocols = null, $context = 'display' ) {
 	$original_url = $url;
 
 	if ('' == $url) return $url;
@@ -1103,13 +1103,20 @@
 		substr( $url, 0, 1 ) != '/' && !preg_match('/^[a-z0-9-]+?\.php/i', $url) )
 		$url = 'http://' . $url;
 
-	$url = preg_replace('/&([^#])(?![a-z]{2,8};)/', '&#038;$1', $url);
+	// Replace ampersands ony when displaying.
+	if ( 'display' == $context )
+		$url = preg_replace('/&([^#])(?![a-z]{2,8};)/', '&#038;$1', $url);
+
 	if ( !is_array($protocols) )
 		$protocols = array('http', 'https', 'ftp', 'ftps', 'mailto', 'news', 'irc', 'gopher', 'nntp', 'feed', 'telnet');
 	if ( wp_kses_bad_protocol( $url, $protocols ) != $url )
 		return '';
 
-	return apply_filters('clean_url', $url, $original_url);
+	return apply_filters('clean_url', $url, $original_url, $context);
+}
+
+function sanitize_url( $url, $protocols = null ) {
+	return clean_url( $url, $protocols, 'db');
 }
 
 // Borrowed from the PHP Manual user notes. Convert entities, while
diff -ruN wordpress-2.3/wp-includes/functions.php wordpress-2.3.1/wp-includes/functions.php
--- wordpress-2.3/wp-includes/functions.php	2007-09-21 23:11:48.000000000 -0700
+++ wordpress-2.3.1/wp-includes/functions.php	2007-10-12 14:46:32.000000000 -0700
@@ -726,9 +726,12 @@
 }
 
 function wp($query_vars = '') {
-	global $wp;
+	global $wp, $wp_query, $wp_the_query;
 
 	$wp->main($query_vars);
+
+	if( !isset($wp_the_query) )
+		$wp_the_query = $wp_query;
 }
 
 function get_status_header_desc( $code ) {
diff -ruN wordpress-2.3/wp-includes/general-template.php wordpress-2.3.1/wp-includes/general-template.php
--- wordpress-2.3/wp-includes/general-template.php	2007-09-21 08:51:00.000000000 -0700
+++ wordpress-2.3.1/wp-includes/general-template.php	2007-10-09 14:09:49.000000000 -0700
@@ -829,6 +829,11 @@
 	echo '	<link rel="EditURI" type="application/rsd+xml" title="RSD" href="' . get_bloginfo('wpurl') . "/xmlrpc.php?rsd\" />\n";
 }
 
+function wlwmanifest_link() {
+	echo ' <link rel="wlwmanifest" type="application/wlwmanifest+xml" href="'
+		. get_bloginfo('wpurl') . '/wp-includes/wlwmanifest.xml" /> ';
+}
+
 function noindex() {
 	// If the blog is not public, tell robots to go away.
 	if ( '0' == get_option('blog_public') )
Binary files wordpress-2.3/wp-includes/images/wlw/wp-comments.png and wordpress-2.3.1/wp-includes/images/wlw/wp-comments.png differ
Binary files wordpress-2.3/wp-includes/images/wlw/WpComments.png and wordpress-2.3.1/wp-includes/images/wlw/WpComments.png differ
Binary files wordpress-2.3/wp-includes/images/wlw/wp-icon.png and wordpress-2.3.1/wp-includes/images/wlw/wp-icon.png differ
Binary files wordpress-2.3/wp-includes/images/wlw/WpIcon.png and wordpress-2.3.1/wp-includes/images/wlw/WpIcon.png differ
Binary files wordpress-2.3/wp-includes/images/wlw/wp-watermark.png and wordpress-2.3.1/wp-includes/images/wlw/wp-watermark.png differ
Binary files wordpress-2.3/wp-includes/images/wlw/WpWatermark.png and wordpress-2.3.1/wp-includes/images/wlw/WpWatermark.png differ
diff -ruN wordpress-2.3/wp-includes/pluggable.php wordpress-2.3.1/wp-includes/pluggable.php
--- wordpress-2.3/wp-includes/pluggable.php	2007-09-20 14:53:42.000000000 -0700
+++ wordpress-2.3.1/wp-includes/pluggable.php	2007-10-17 13:19:01.000000000 -0700
@@ -225,6 +225,7 @@
 
 	// Set the from name and email
 	$phpmailer->From = apply_filters( 'wp_mail_from', $from_email );
+	$phpmailer->Sender = apply_filters( 'wp_mail_from', $from_email );
 	$phpmailer->FromName = apply_filters( 'wp_mail_from_name', $from_name );
 
 	// Set destination address
@@ -436,7 +437,7 @@
 
 	$allowed_hosts = (array) apply_filters('allowed_redirect_hosts', array($wpp['host']), $lp['host']);
 
-	if ( isset($lp['host']) && !in_array($lp['host'], $allowed_hosts) )
+	if ( isset($lp['host']) && ( !in_array($lp['host'], $allowed_hosts) && $lp['host'] != strtolower($wpp['host'])) )
 		$location = get_option('siteurl') . '/wp-admin/';
 
 	wp_redirect($location, $status);
diff -ruN wordpress-2.3/wp-includes/post.php wordpress-2.3.1/wp-includes/post.php
--- wordpress-2.3/wp-includes/post.php	2007-09-22 09:30:40.000000000 -0700
+++ wordpress-2.3.1/wp-includes/post.php	2007-10-08 15:26:19.000000000 -0700
@@ -102,7 +102,7 @@
 			$_post = null;
 	} elseif ( is_object($post) ) {
 		if ( 'page' == $post->post_type )
-			return get_page($post, $output);
+			return get_page($post, $output, $filter);
 		if ( !isset($post_cache[$blog_id][$post->ID]) )
 			$post_cache[$blog_id][$post->ID] = &$post;
 		$_post = & $post_cache[$blog_id][$post->ID];
@@ -111,12 +111,12 @@
 		if ( isset($post_cache[$blog_id][$post]) )
 			$_post = & $post_cache[$blog_id][$post];
 		elseif ( $_post = wp_cache_get($post, 'pages') )
-			return get_page($_post, $output);
+			return get_page($_post, $output, $filter);
 		else {
 			$query = "SELECT * FROM $wpdb->posts WHERE ID = '$post' LIMIT 1";
 			$_post = & $wpdb->get_row($query);
 			if ( 'page' == $_post->post_type )
-				return get_page($_post, $output);
+				return get_page($_post, $output, $filter);
 			$post_cache[$blog_id][$post] = & $_post;
 		}
 	}
@@ -972,7 +972,7 @@
 
 // Retrieves page data given a page ID or page object.
 // Handles page caching.
-function &get_page(&$page, $output = OBJECT) {
+function &get_page(&$page, $output = OBJECT, $filter = 'raw') {
 	global $wpdb, $blog_id;
 
 	if ( empty($page) ) {
@@ -985,7 +985,7 @@
 		}
 	} elseif ( is_object($page) ) {
 		if ( 'post' == $page->post_type )
-			return get_post($page, $output);
+			return get_post($page, $output, $filter);
 		wp_cache_add($page->ID, $page, 'pages');
 		$_page = $page;
 	} else {
@@ -998,12 +998,12 @@
 				$_page = & $GLOBALS['page'];
 				wp_cache_add($_page->ID, $_page, 'pages');
 			} elseif ( isset($GLOBALS['post_cache'][$blog_id][$page]) ) { // it's actually a page, and is cached
-				return get_post($page, $output);
+				return get_post($page, $output, $filter);
 			} else { // it's not in any caches, so off to the DB we go
 				// Why are we using assignment for this query?
 				$_page = & $wpdb->get_row("SELECT * FROM $wpdb->posts WHERE ID= '$page' LIMIT 1");
 				if ( 'post' == $_page->post_type )
-					return get_post($_page, $output);
+					return get_post($_page, $output, $filter);
 				// Potential issue: we're not checking to see if the post_type = 'page'
 				// So all non-'post' posts will get cached as pages.
 				wp_cache_add($_page->ID, $_page, 'pages');
@@ -1011,6 +1011,8 @@
 		}
 	}
 
+	$_page = sanitize_post($_page, $filter);
+
 	// at this point, one way or another, $_post contains the page object
 
 	if ( $output == OBJECT ) {
@@ -1201,7 +1203,7 @@
 	$pages = $wpdb->get_results($query);
 
 	if ( empty($pages) )
-		return array();
+		return apply_filters('get_pages', array(), $r);
 
 	// Update cache.
 	update_page_cache($pages);
diff -ruN wordpress-2.3/wp-includes/query.php wordpress-2.3.1/wp-includes/query.php
--- wordpress-2.3/wp-includes/query.php	2007-09-18 09:32:22.000000000 -0700
+++ wordpress-2.3.1/wp-includes/query.php	2007-10-15 13:14:56.000000000 -0700
@@ -932,7 +932,7 @@
 		}
 
 		if ( !empty($q['category__in']) ) {
-			$join = " LEFT JOIN $wpdb->term_relationships ON ($wpdb->posts.ID = $wpdb->term_relationships.object_id) LEFT JOIN $wpdb->term_taxonomy ON ($wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id) ";
+			$join = " INNER JOIN $wpdb->term_relationships ON ($wpdb->posts.ID = $wpdb->term_relationships.object_id) INNER JOIN $wpdb->term_taxonomy ON ($wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id) ";
 			$whichcat .= " AND $wpdb->term_taxonomy.taxonomy = 'category' ";
 			$include_cats = "'" . implode("', '", $q['category__in']) . "'";
 			$whichcat .= " AND $wpdb->term_taxonomy.term_id IN ($include_cats) ";
@@ -948,15 +948,6 @@
 			}
 		}
 
-		if ( !empty($q['category__and']) ) {
-			$count = 0;
-			foreach ( $q['category__and'] as $category_and ) {
-				$join .= " LEFT JOIN $wpdb->term_relationships AS tr$count ON ($wpdb->posts.ID = tr$count.object_id) LEFT JOIN $wpdb->term_taxonomy AS tt$count ON (tr$count.term_taxonomy_id = tt$count.term_taxonomy_id) ";
-				$whichcat .= " AND tt$count.term_id = '$category_and' ";
-				$count++;
-			}
-		}
-
 		// Category stuff for nice URLs
 		if ( '' != $q['category_name'] ) {
 			$reqcat = get_category_by_path($q['category_name']);
@@ -982,7 +973,7 @@
 
 			$q['cat'] = $reqcat;
 
-			$join = " LEFT JOIN $wpdb->term_relationships ON ($wpdb->posts.ID = $wpdb->term_relationships.object_id) LEFT JOIN $wpdb->term_taxonomy ON ($wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id) ";
+			$join = " INNER JOIN $wpdb->term_relationships ON ($wpdb->posts.ID = $wpdb->term_relationships.object_id) INNER JOIN $wpdb->term_taxonomy ON ($wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id) ";
 			$whichcat = " AND $wpdb->term_taxonomy.taxonomy = 'category' ";
 			$in_cats = array($q['cat']);
 			$in_cats = array_merge($in_cats, get_term_children($q['cat'], 'category'));
@@ -1024,7 +1015,7 @@
 		}
 
 		if ( !empty($q['tag__in']) ) {
-			$join = " LEFT JOIN $wpdb->term_relationships ON ($wpdb->posts.ID = $wpdb->term_relationships.object_id) LEFT JOIN $wpdb->term_taxonomy ON ($wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id) ";
+			$join = " INNER JOIN $wpdb->term_relationships ON ($wpdb->posts.ID = $wpdb->term_relationships.object_id) INNER JOIN $wpdb->term_taxonomy ON ($wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id) ";
 			$whichcat .= " AND $wpdb->term_taxonomy.taxonomy = 'post_tag' ";
 			$include_tags = "'" . implode("', '", $q['tag__in']) . "'";
 			$whichcat .= " AND $wpdb->term_taxonomy.term_id IN ($include_tags) ";
@@ -1034,7 +1025,7 @@
 		}
 
 		if ( !empty($q['tag_slug__in']) ) {
-			$join = " LEFT JOIN $wpdb->term_relationships ON ($wpdb->posts.ID = $wpdb->term_relationships.object_id) LEFT JOIN $wpdb->term_taxonomy ON ($wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id) LEFT JOIN $wpdb->terms ON ($wpdb->term_taxonomy.term_id = $wpdb->terms.term_id) ";
+			$join = " INNER JOIN $wpdb->term_relationships ON ($wpdb->posts.ID = $wpdb->term_relationships.object_id) INNER JOIN $wpdb->term_taxonomy ON ($wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id) INNER JOIN $wpdb->terms ON ($wpdb->term_taxonomy.term_id = $wpdb->terms.term_id) ";
 			$whichcat .= " AND $wpdb->term_taxonomy.taxonomy = 'post_tag' ";
 			$include_tags = "'" . implode("', '", $q['tag_slug__in']) . "'";
 			$whichcat .= " AND $wpdb->terms.slug IN ($include_tags) ";
@@ -1051,28 +1042,32 @@
 			}
 		}
 
-		if ( !empty($q['tag__and']) ) {
-			$count = 0;
-			foreach ( $q['tag__and'] as $tag_and ) {
-				$join .= " LEFT JOIN $wpdb->term_relationships AS tr$count ON ($wpdb->posts.ID = tr$count.object_id) LEFT JOIN $wpdb->term_taxonomy AS tt$count ON (tr$count.term_taxonomy_id = tt$count.term_taxonomy_id) ";
-				$whichcat .= " AND tt$count.term_id = '$tag_and' ";
-				$count++;
+		// Tag and slug intersections.
+		$intersections = array('category__and' => 'category', 'tag__and' => 'post_tag', 'tag_slug__and' => 'post_tag');
+		foreach ($intersections as $item => $taxonomy) {
+			if ( empty($q[$item]) ) continue;
+
+			if ( $item != 'category__and' ) {
+				$reqtag = is_term( $q[$item][0], 'post_tag' );
+				if ( !empty($reqtag) )
+					$q['tag_id'] = $reqtag['term_id'];
 			}
-			$reqtag = is_term( $q['tag__and'][0], 'post_tag' );
-			if ( !empty($reqtag) )
-				$q['tag_id'] = $reqtag['term_id'];
-		}
 
-		if ( !empty($q['tag_slug__and']) ) {
-			$count = 0;
-			foreach ( $q['tag_slug__and'] as $tag_and ) {
-				$join .= " LEFT JOIN $wpdb->term_relationships AS tr$count ON ($wpdb->posts.ID = tr$count.object_id) LEFT JOIN $wpdb->term_taxonomy AS tt$count ON (tr$count.term_taxonomy_id = tt$count.term_taxonomy_id) LEFT JOIN $wpdb->terms AS term$count ON (tt$count.term_id = term$count.term_id) ";
-				$whichcat .= " AND term$count.slug = '$tag_and' ";
-				$count++;
+			$taxonomy_field = $item == 'tag_slug__and' ? 'slug' : 'term_id';
+
+			$q[$item] = array_unique($q[$item]);
+			$tsql = "SELECT p.ID FROM $wpdb->posts p INNER JOIN $wpdb->term_relationships tr ON (p.ID = tr.object_id) INNER JOIN $wpdb->term_taxonomy tt ON (tr.term_taxonomy_id = tt.term_taxonomy_id) INNER JOIN $wpdb->terms t ON (tt.term_id = t.term_id)";
+			$tsql .= " WHERE tt.taxonomy = '$taxonomy' AND t.$taxonomy_field IN ('" . implode("', '", $q[$item]) . "')";
+			$tsql .= " GROUP BY p.ID HAVING count(p.ID) = " . count($q[$item]);
+
+			$post_ids = $wpdb->get_col($tsql);
+
+			if ( count($post_ids) )
+				$whichcat .= " AND $wpdb->posts.ID IN (" . implode(', ', $post_ids) . ") ";
+			else {
+				$whichcat = " AND 0 = 1";
+				break;
 			}
-			$reqtag = is_term( $q['tag_slug__and'][0], 'post_tag' );
-			if ( !empty($reqtag) )
-				$q['tag_id'] = $reqtag['term_id'];
 		}
 
 		// Author/user stuff
diff -ruN wordpress-2.3/wp-includes/script-loader.php wordpress-2.3.1/wp-includes/script-loader.php
--- wordpress-2.3/wp-includes/script-loader.php	2007-09-18 17:51:21.000000000 -0700
+++ wordpress-2.3.1/wp-includes/script-loader.php	2007-10-09 14:04:40.000000000 -0700
@@ -421,4 +421,24 @@
 	}
 	$wp_scripts->enqueue( $handle );
 }
+
+function wp_prototype_before_jquery( $js_array ) {
+	if ( false === $jquery = array_search( 'jquery', $js_array ) )
+		return $js_array;
+
+	if ( false === $prototype = array_search( 'prototype', $js_array ) )
+		return $js_array;
+
+	if ( $prototype < $jquery )
+		return $js_array;
+
+	unset($js_array[$prototype]);
+
+	array_splice( $js_array, $jquery, 0, 'prototype' );
+
+	return $js_array;
+}
+
+add_filter( 'print_scripts_array', 'wp_prototype_before_jquery' );
+
 ?>
diff -ruN wordpress-2.3/wp-includes/taxonomy.php wordpress-2.3.1/wp-includes/taxonomy.php
--- wordpress-2.3/wp-includes/taxonomy.php	2007-09-22 17:35:59.000000000 -0700
+++ wordpress-2.3.1/wp-includes/taxonomy.php	2007-10-15 13:14:56.000000000 -0700
@@ -1357,7 +1357,7 @@
 	}
 
 	// Get the object and term ids and stick them in a lookup table
-	$results = $wpdb->get_results("SELECT object_id, term_taxonomy_id FROM $wpdb->term_relationships LEFT JOIN $wpdb->posts ON object_id = ID WHERE term_taxonomy_id IN (".join(',', array_keys($term_ids)).") AND post_type = 'post' AND post_status = 'publish'");
+	$results = $wpdb->get_results("SELECT object_id, term_taxonomy_id FROM $wpdb->term_relationships INNER JOIN $wpdb->posts ON object_id = ID WHERE term_taxonomy_id IN (".join(',', array_keys($term_ids)).") AND post_type = 'post' AND post_status = 'publish'");
 	foreach ( $results as $row ) {
 		$id = $term_ids[$row->term_taxonomy_id];
 		++$term_items[$id][$row->object_id];
diff -ruN wordpress-2.3/wp-includes/version.php wordpress-2.3.1/wp-includes/version.php
--- wordpress-2.3/wp-includes/version.php	2007-09-24 17:34:43.000000000 -0700
+++ wordpress-2.3.1/wp-includes/version.php	2007-10-26 09:08:17.000000000 -0700
@@ -2,7 +2,7 @@
 
 // This holds the version number in a separate file so we can bump it without cluttering the SVN
 
-$wp_version = '2.3';
+$wp_version = '2.3.1';
 $wp_db_version = 6124;
 
 ?>
diff -ruN wordpress-2.3/wp-includes/widgets.php wordpress-2.3.1/wp-includes/widgets.php
--- wordpress-2.3/wp-includes/widgets.php	2007-09-12 22:33:54.000000000 -0700
+++ wordpress-2.3.1/wp-includes/widgets.php	2007-10-03 09:17:54.000000000 -0700
@@ -786,7 +786,7 @@
 	}
 
 	$dims = array( 'width' => 350, 'height' => 170 );
-	$class = array( 'classname' => 'widget_catgories' );
+	$class = array( 'classname' => 'widget_categories' );
 
 	for ( $i = 1; $i <= 9; $i++ ) {
 		$name = sprintf( __( 'Categories %d' ), $i );
@@ -1001,7 +1001,7 @@
 	$options = $newoptions = get_option('widget_rss');
 	if ( $_POST["rss-submit-$number"] ) {
 		$newoptions[$number]['items'] = (int) $_POST["rss-items-$number"];
-		$url = clean_url(strip_tags(stripslashes($_POST["rss-url-$number"])));
+		$url = sanitize_url(strip_tags(stripslashes($_POST["rss-url-$number"])));
 		$newoptions[$number]['title'] = trim(strip_tags(stripslashes($_POST["rss-title-$number"])));
 		if ( $url !== $options[$number]['url'] ) {
 			require_once(ABSPATH . WPINC . '/rss.php');
diff -ruN wordpress-2.3/wp-includes/wlwmanifest.xml wordpress-2.3.1/wp-includes/wlwmanifest.xml
--- wordpress-2.3/wp-includes/wlwmanifest.xml	1969-12-31 16:00:00.000000000 -0800
+++ wordpress-2.3.1/wp-includes/wlwmanifest.xml	2007-10-09 14:09:49.000000000 -0700
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="utf-8" ?>
+
+<manifest xmlns="http://schemas.microsoft.com/wlw/manifest/weblog">
+
+  <options>
+    <clientType>WordPress</clientType>
+	<supportsKeywords>Yes</supportsKeywords>
+  </options>
+  
+  <weblog>
+    <serviceName>WordPress</serviceName>
+    <imageUrl>images/wlw/wp-icon.png</imageUrl>
+    <watermarkImageUrl>images/wlw/wp-watermark.png</watermarkImageUrl>
+    <homepageLinkText>View site</homepageLinkText>
+    <adminLinkText>Dashboard</adminLinkText>
+    <adminUrl>
+      <![CDATA[ 
+			{blog-postapi-url}/../wp-admin/ 
+		]]>
+    </adminUrl>
+    <postEditingUrl>
+      <![CDATA[ 
+			{blog-postapi-url}/../wp-admin/post.php?action=edit&post={post-id} 
+		]]>
+    </postEditingUrl>
+  </weblog>
+
+  <buttons>
+    <button>
+      <id>0</id>
+      <text>Manage Comments</text>
+      <imageUrl>images/wlw/wp-comments.png</imageUrl>
+      <clickUrl>
+        <![CDATA[ 
+				{blog-postapi-url}/../wp-admin/edit-comments.php
+			]]>
+      </clickUrl>
+    </button>
+
+  </buttons>
+
+</manifest>
+
diff -ruN wordpress-2.3/wp-login.php wordpress-2.3.1/wp-login.php
--- wordpress-2.3/wp-login.php	2007-09-18 15:23:16.000000000 -0700
+++ wordpress-2.3.1/wp-login.php	2007-09-25 16:17:30.000000000 -0700
@@ -22,6 +22,8 @@
 
 //Set a cookie now to see if they are supported by the browser.
 setcookie(TEST_COOKIE, 'WP Cookie check', 0, COOKIEPATH, COOKIE_DOMAIN);
+if ( SITECOOKIEPATH != COOKIEPATH )
+	setcookie(TEST_COOKIE, 'WP Cookie check', 0, SITECOOKIEPATH, COOKIE_DOMAIN);
 
 // Rather than duplicating this HTML all over the place, we'll stick it in function
 function login_header($title = 'Login', $message = '') {
diff -ruN wordpress-2.3/wp-mail.php wordpress-2.3.1/wp-mail.php
--- wordpress-2.3/wp-mail.php	2007-09-18 09:32:22.000000000 -0700
+++ wordpress-2.3.1/wp-mail.php	2007-10-20 23:18:08.000000000 -0700
@@ -60,12 +60,15 @@
 				$subject = $subject[0];
 			}
 
-			// Set the author using the email address (To or Reply-To, the last used)
+			// Set the author using the email address (From or Reply-To, the last used)
 			// otherwise use the site admin
-			if (preg_match('/From: /', $line) | preg_match('/Reply-To: /', $line))  {
-				$author=trim($line);
-				if ( ereg("([a-zA-Z0-9\_\-\.]+@[\a-zA-z0-9\_\-\.]+)", $author , $regs) ) {
-					$author = $regs[1];
+			if ( preg_match('/(From|Reply-To): /', $line) )  {
+				if ( preg_match('|[a-z0-9_.-]+@[a-z0-9_.-]+(?!.*<)|i', $line, $matches) )
+					$author = $matches[0];
+				else
+					$author = trim($line);
+				$author = sanitize_email($author);
+				if ( is_email($author) ) {
 					echo "Author = {$author} <p>";
 					$author = $wpdb->escape($author);
 					$result = $wpdb->get_row("SELECT ID FROM $wpdb->users WHERE user_email='$author' LIMIT 1");
