Index: wp-includes/query.php
===================================================================
--- wp-includes/query.php	(revision 5555)
+++ wp-includes/query.php	(working copy)
@@ -995,30 +995,39 @@
 		}
 
 		if ( $this->is_attachment ) {
-			$where .= " AND (post_type = 'attachment')";
+			$where .= " AND post_type = 'attachment'";
 		} elseif ($this->is_page) {
-			$where .= " AND (post_type = 'page')";
+			$where .= " AND post_type = 'page'";
 		} elseif ($this->is_single) {
-			$where .= " AND (post_type = 'post')";
+			$where .= " AND post_type = 'post'";
 		} else {
-			$where .= " AND (post_type = '$post_type' AND (post_status = 'publish'";
+			$where .= " AND post_type = '$post_type'";
+		}
 
+		if ( isset($q['post_status']) && '' != $q['post_status'] ) {
+			$q_status = explode(',', $q['post_status']);
+			$r_status = array();
+			if ( in_array( 'draft'  , $q_status ) )
+				$r_status[] = "post_status = 'draft'";
+			if ( in_array( 'future' , $q_status ) )
+				$r_status[] = "post_status = 'future'";
+			if ( in_array( 'inherit' , $q_status ) )
+				$r_status[] = "post_status = 'inherit'";
+			if ( in_array( 'private', $q_status ) )
+				$r_status[] = "post_status = 'private'";
+			if ( in_array( 'publish', $q_status ) )
+				$r_status[] = "post_status = 'publish'";
+			if ( !empty($r_status) )
+				$where .= " AND (" . join( ' OR ', $r_status ) . ")";
+		} elseif ( !$this->is_singular ) {
+			$where .= " AND (post_status = 'publish'";
+
 			if ( is_admin() )
 				$where .= " OR post_status = 'future' OR post_status = 'draft'";
 
-			if ( is_user_logged_in() ) {
-				if ( 'post' == $post_type )
-					$cap = 'read_private_posts';
-				else
-					$cap = 'read_private_pages';
+			$where .= current_user_can( "read_private_{$post_type}s" ) ? " OR post_status = 'private'" : " OR post_author = $user_ID AND post_status = 'private'";
 
-				if ( current_user_can($cap) )
-					$where .= " OR post_status = 'private'";
-				else
-				$where .= " OR post_author = $user_ID AND post_status = 'private'";
-			}
-
-			$where .= '))';
+			$where .= ')';
 		}
 
 		// Apply filters on where and join prior to paging so that any
Index: wp-includes/link-template.php
===================================================================
--- wp-includes/link-template.php	(revision 5555)
+++ wp-includes/link-template.php	(working copy)
@@ -476,9 +476,9 @@
 	$request = preg_replace('|^'. $home_root . '|', '', $request);
 	$request = preg_replace('|^/+|', '', $request);
 	
-	if ( !$wp_rewrite->using_permalinks() ) {
+	if ( !$wp_rewrite->using_permalinks() || is_admin() ) {
 		$base = trailingslashit( get_bloginfo( 'home' ) );
-		
+
 		if ( $pagenum > 1 ) {
 			$result = add_query_arg( 'paged', $pagenum, $base . $request );
 		} else {
Index: wp-includes/capabilities.php
===================================================================
--- wp-includes/capabilities.php	(revision 5555)
+++ wp-includes/capabilities.php	(working copy)
@@ -445,12 +445,12 @@
 function current_user_can($capability) {
 	$current_user = wp_get_current_user();
 
+	if ( empty($current_user) )
+		return false;
+
 	$args = array_slice(func_get_args(), 1);
 	$args = array_merge(array($capability), $args);
 
-	if ( empty($current_user) )
-		return false;
-
 	return call_user_func_array(array(&$current_user, 'has_cap'), $args);
 }
 
Index: wp-includes/classes.php
===================================================================
--- wp-includes/classes.php	(revision 5555)
+++ wp-includes/classes.php	(working copy)
@@ -3,7 +3,7 @@
 class WP {
 	var $public_query_vars = array('m', 'p', 'posts', 'w', 'cat', 'withcomments', 'withoutcomments', 's', 'search', 'exact', 'sentence', 'debug', 'calendar', 'page', 'paged', 'more', 'tb', 'pb', 'author', 'order', 'orderby', 'year', 'monthnum', 'day', 'hour', 'minute', 'second', 'name', 'category_name', 'tag', 'feed', 'author_name', 'static', 'pagename', 'page_id', 'error', 'comments_popup', 'attachment', 'attachment_id', 'subpost', 'subpost_id', 'preview', 'robots');
 
-	var $private_query_vars = array('offset', 'posts_per_page', 'posts_per_archive_page', 'what_to_show', 'showposts', 'nopaging', 'post_type');
+	var $private_query_vars = array('offset', 'posts_per_page', 'posts_per_archive_page', 'what_to_show', 'showposts', 'nopaging', 'post_type', 'post_status');
 	var $extra_query_vars = array();
 
 	var $query_vars;
Index: wp-admin/wp-admin.css
===================================================================
--- wp-admin/wp-admin.css	(revision 5555)
+++ wp-admin/wp-admin.css	(working copy)
@@ -790,22 +790,25 @@
 	width: 320px;
 }
 
-#searchform {
+#searchform fieldset {
 	float: left;
-	margin-right: 1em;
-	width: 18em;
+	margin: 0 1.5ex 1em 0;
+	padding: 0;
 }
 
-#viewarc {
-	float: left;
-	width: 23em;
-	margin-bottom: 1em;
+#searchform fieldset legend {
+	padding: 0 0 .2em 1px;
 }
+	
+#searchform #s {
+	padding: 4px 3px;
+}
 
-#viewcat {
+#searchform #post-query-submit {
 	float: left;
-	width: 30em;
-	margin-bottom: 1em;
+	margin: 14px 0 1em;
+	position: relative;
+	top: .35em;
 }
 
 #postcustom .updatemeta, #postcustom .deletemeta {
Index: wp-admin/edit.php
===================================================================
--- wp-admin/edit.php	(revision 5555)
+++ wp-admin/edit.php	(working copy)
@@ -6,62 +6,50 @@
 wp_enqueue_script( 1 == $_GET['c'] ? 'admin-comments' : 'listman' );
 require_once('admin-header.php');
 
-$_GET['m'] = (int) $_GET['m'];
+$_GET['m']   = (int) $_GET['m'];
+$_GET['cat'] = (int) $_GET['cat'];
+$post_stati  = array('draft' => __('Draft'), 'future' => __('Future Dated'), 'private' => __('Private'), 'publish' => __('Published'));
 
-$drafts = get_users_drafts( $user_ID );
-$other_drafts = get_others_drafts( $user_ID);
-
-if ($drafts || $other_drafts) {
+$post_status_q = '';
+$author_q = '';
+if ( isset($_GET['post_status']) && in_array( $_GET['post_status'], array_keys($post_stati) ) ) {
+	$post_status_q = '&post_status=' . $_GET['post_status'];
+	if ( in_array( $_GET['post_status'], array('draft', 'private') ) )
+		$author_q = "&author=$user_ID";
+}
 ?>
+
 <div class="wrap">
-<?php if ($drafts) { ?>
-	<p><strong><?php _e('Your Drafts:') ?></strong>
-	<?php
-	$i = 0;
-	foreach ($drafts as $draft) {
-		if (0 != $i)
-			echo ', ';
-		$draft->post_title = apply_filters('the_title', stripslashes($draft->post_title));
-		if ($draft->post_title == '')
-			$draft->post_title = sprintf(__('Post #%s'), $draft->ID);
-		echo "<a href='post.php?action=edit&amp;post=$draft->ID' title='" . __('Edit this draft') . "'>$draft->post_title</a>";
-		++$i;
-		}
-	?>
-.</p>
-<?php } ?>
 
-<?php if ($other_drafts) { ?>
-	<p><strong><?php _e('Other&#8217;s Drafts:') ?></strong>
-	<?php
-	$i = 0;
-	foreach ($other_drafts as $draft) {
-		if (0 != $i)
-			echo ', ';
-		$draft->post_title = apply_filters('the_title', stripslashes($draft->post_title));
-		if ($draft->post_title == '')
-			$draft->post_title = sprintf(__('Post #%s'), $draft->ID);
-		echo "<a href='post.php?action=edit&amp;post=$draft->ID' title='" . __('Edit this draft') . "'>$draft->post_title</a>";
-		++$i;
-		}
-	?>
-	.</p>
+<?php
 
-<?php } ?>
+wp("what_to_show=posts$author_q$post_status_q&posts_per_page=15&posts_per_archive_page=-1");
 
-</div>
-<?php } ?>
+do_action('restrict_manage_posts');
 
-<div class="wrap">
-<h2>
-<?php
+// define the columns to display, the syntax is 'internal name' => 'display name'
+$posts_columns = array(
+	'id'         => '<div style="text-align: center">' . __('ID') . '</div>',
+	'date'       => __('When'),
+	'title'      => __('Title'),
+	'categories' => __('Categories'),
+	'comments'   => '<div style="text-align: center">' . __('Comments') . '</div>',
+	'author'     => __('Author')
+);
+$posts_columns = apply_filters('manage_posts_columns', $posts_columns);
 
-wp('what_to_show=posts&posts_per_page=15&posts_per_archive_page=-1');
+// you can not edit these at the moment
+$posts_columns['control_view']   = '';
+$posts_columns['control_edit']   = '';
+$posts_columns['control_delete'] = '';
 
+?>
+
+<h2><?php
 if ( is_month() ) {
 	single_month_title(' ');
 } elseif ( is_search() ) {
-	printf(__('Search for &#8220;%s&#8221;'), wp_specialchars($_GET['s']) );
+	printf(__('Search for &#8220;%s&#8221;'), wp_specialchars( get_search_query() ) );
 } else {
 	if ( is_single() )
 		printf(__('Comments on %s'), apply_filters( "the_title", $post->post_title));
@@ -70,182 +58,90 @@
 	else
 		_e('Previous Posts');
 }
-?>
-</h2>
+?></h2>
 
 <form name="searchform" id="searchform" action="" method="get">
-  <fieldset> 
-  <legend><?php _e('Search Posts&hellip;') ?></legend> 
-  <input type="text" name="s" id="s" value="<?php if (isset($s)) echo attribute_escape($s); ?>" size="17" /> 
-  <input type="submit" name="submit" value="<?php _e('Search') ?>" class="button" /> 
-  </fieldset>
-</form>
+	<fieldset><legend><?php _e('Search terms&hellip;'); ?></legend> 
+		<input type="text" name="s" id="s" value="<?php the_search_query(); ?>" size="17" /> 
+	</fieldset>
 
-<?php $arc_result = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS yyear, MONTH(post_date) AS mmonth FROM $wpdb->posts WHERE post_type = 'post' ORDER BY post_date DESC");
+	<fieldset><legend><?php _e('Post Type&hellip;'); ?></legend> 
+		<select name='post_status'>
+			<option<?php selected( @$_GET['post_status'], 0 ); ?> value='0'><?php _e('Any'); ?></option>
+<?php	foreach ( $post_stati as $status => $label ) : ?>
+			<option<?php selected( @$_GET['post_status'], $status ); ?> value='<?php echo $status; ?>'><?php echo $label; ?></option>
+<?php	endforeach; ?>
+		</select>
+	</fieldset>
 
-if ( count($arc_result) ) { ?>
+<?php
 
-<form name="viewarc" id="viewarc" action="" method="get">
-	<fieldset>
-	<legend><?php _e('Browse Month&hellip;') ?></legend>
-	<select name='m'>
-	<?php
+
+$arc_query = "SELECT DISTINCT YEAR(post_date) AS yyear, MONTH(post_date) AS mmonth FROM $wpdb->posts WHERE post_type = 'post' ORDER BY post_date DESC";
+
+$arc_result = $wpdb->get_results( $arc_query );
+
+$month_count = count($arc_result);
+
+if ( $month_count && !( 1 == $month_count && 0 == $arc_result[0]->mmonth ) ) { ?>
+
+	<fieldset><legend><?php _e('Month&hellip;') ?></legend>
+		<select name='m'>
+			<option<?php selected( @$_GET['m'], 0 ); ?> value='0'><?php _e('Any'); ?></option>
+		<?php
 		foreach ($arc_result as $arc_row) {
 			if ( $arc_row->yyear == 0 )
 				continue;
 			$arc_row->mmonth = zeroise($arc_row->mmonth, 2);
 
-			if( isset($_GET['m']) && $arc_row->yyear . $arc_row->mmonth == (int) $_GET['m'] )
-				$default = 'selected="selected"';
+			if ( $arc_row->yyear . $arc_row->mmonth == $_GET['m'] )
+				$default = ' selected="selected"';
 			else
-				$default = null;
+				$default = '';
 
-			echo "<option $default value='$arc_row->yyear$arc_row->mmonth'>";
+			echo "<option$default value='$arc_row->yyear$arc_row->mmonth'>";
 			echo $wp_locale->get_month($arc_row->mmonth) . " $arc_row->yyear";
 			echo "</option>\n";
 		}
-	?>
-	</select>
-		<input type="submit" name="submit" value="<?php _e('Show Month') ?>" class="button" /> 
+		?>
+		</select>
 	</fieldset>
-</form>
 
 <?php } ?>
 
-<form name="viewcat" id="viewcat" action="" method="get">
-	<fieldset>
-	<legend><?php _e('Browse Category&hellip;') ?></legend>
-	<?php wp_dropdown_categories('show_option_all='.__('All').'&hide_empty=1&hierarchical=1&show_count=1&selected='.$cat);?>
-	<input type="submit" name="submit" value="<?php _e('Show Category') ?>" class="button" /> 
+	<fieldset><legend><?php _e('Category&hellip;') ?></legend>
+		<?php wp_dropdown_categories('show_option_all='.__('All').'&hide_empty=1&hierarchical=1&show_count=1&selected='.$cat);?>
 	</fieldset>
+	<input type="submit" id="post-query-submit" value="<?php _e('Go &#187;'); ?>" class="button" /> 
 </form>
 
-<?php do_action('restrict_manage_posts'); ?>
-
 <br style="clear:both;" />
 
 <?php
-// define the columns to display, the syntax is 'internal name' => 'display name'
-$posts_columns = array(
-	'id'         => '<div style="text-align: center">' . __('ID') . '</div>',
-	'date'       => __('When'),
-	'title'      => __('Title'),
-	'categories' => __('Categories'),
-	'comments'   => '<div style="text-align: center">' . __('Comments') . '</div>',
-	'author'     => __('Author')
-);
-$posts_columns = apply_filters('manage_posts_columns', $posts_columns);
+if ( $post_status_q && ( false !== strpos($post_status_q, 'draft') || false !== strpos($post_status_q, 'private') ) ) {
+	echo '<h3>' . __('Your Posts') . "</h3>\n";
+	include( 'edit-post-rows.php' );
 
-// you can not edit these at the moment
-$posts_columns['control_view']   = '';
-$posts_columns['control_edit']   = '';
-$posts_columns['control_delete'] = '';
+	$editable_ids = get_editable_user_ids( $user_ID );
 
-?>
+	if ( $editable_ids && count($editable_ids) > 1 ) {
+		$_editable_ids = join(',', array_diff($editable_ids, array($user_ID)));
 
-<table class="widefat">
-	<thead>
-	<tr>
+		$post_status_q = "&post_status=" . $_GET['post_status'];
 
-<?php foreach($posts_columns as $column_display_name) { ?>
-	<th scope="col"><?php echo $column_display_name; ?></th>
-<?php } ?>
+		unset($GLOBALS['day']); // setup_postdata does this
+		wp("what_to_show=posts&author=$_editable_ids$post_status_q&posts_per_page=-1&posts_per_archive_page=-1");
 
-	</tr>
-	</thead>
-	<tbody id="the-list">
-<?php
-if ($posts) {
-$bgcolor = '';
-while (have_posts()) : the_post();
-add_filter('the_title','wp_specialchars');
-$class = ('alternate' == $class) ? '' : 'alternate';
-?>
-	<tr id='post-<?php echo $id; ?>' class='<?php echo $class; ?>'>
-
-<?php
-
-foreach($posts_columns as $column_name=>$column_display_name) {
-
-	switch($column_name) {
-
-	case 'id':
-		?>
-		<th scope="row" style="text-align: center"><?php echo $id ?></th>
-		<?php
-		break;
-
-	case 'date':
-		?>
-		<td><?php if ( '0000-00-00 00:00:00' ==$post->post_modified ) _e('Unpublished'); else the_time(__('Y-m-d \<\b\r \/\> g:i:s a')); ?></td>
-		<?php
-		break;
-	case 'title':
-		?>
-		<td><?php the_title() ?>
-		<?php if ('private' == $post->post_status) _e(' - <strong>Private</strong>'); ?></td>
-		<?php
-		break;
-
-	case 'categories':
-		?>
-		<td><?php the_category(','); ?></td>
-		<?php
-		break;
-
-	case 'comments':
-		?>
-		<td style="text-align: center">
-			<?php comments_number("<a href='edit.php?p=$id&amp;c=1'>" . __('0') . '</a>', "<a href='edit.php?p=$id&amp;c=1'>" . __('1') . '</a>', "<a href='edit.php?p=$id&amp;c=1'>" . __('%') . '</a>') ?>
-			</td>
-		<?php
-		break;
-
-	case 'author':
-		?>
-		<td><?php the_author() ?></td>
-		<?php
-		break;
-
-	case 'control_view':
-		?>
-		<td><a href="<?php the_permalink(); ?>" rel="permalink" class="edit"><?php _e('View'); ?></a></td>
-		<?php
-		break;
-
-	case 'control_edit':
-		?>
-		<td><?php if ( current_user_can('edit_post',$post->ID) ) { echo "<a href='post.php?action=edit&amp;post=$id' class='edit'>" . __('Edit') . "</a>"; } ?></td>
-		<?php
-		break;
-
-	case 'control_delete':
-		?>
-		<td><?php if ( current_user_can('delete_post',$post->ID) ) { echo "<a href='" . wp_nonce_url("post.php?action=delete&amp;post=$id", 'delete-post_' . $post->ID) . "' class='delete' onclick=\"return deleteSomething( 'post', " . $id . ", '" . js_escape(sprintf(__("You are about to delete this post '%s'.\n'OK' to delete, 'Cancel' to stop."), get_the_title())) . "' );\">" . __('Delete') . "</a>"; } ?></td>
-		<?php
-		break;
-
-	default:
-		?>
-		<td><?php do_action('manage_posts_custom_column', $column_name, $id); ?></td>
-		<?php
-		break;
+		if ( have_posts() ) {
+			echo '<h3>' . __("Others' Posts") . "</h3>\n";
+			include( 'edit-post-rows.php' );
+		}
 	}
+
+} else {
+	include( 'edit-post-rows.php' );
 }
 ?>
-	</tr> 
-<?php
-endwhile;
-} else {
-?>
-  <tr style='background-color: <?php echo $bgcolor; ?>'> 
-    <td colspan="8"><?php _e('No posts found.') ?></td> 
-  </tr> 
-<?php
-} // end if ($posts)
-?>
-	</tbody>
-</table>
 
 <div id="ajax-response"></div>
 
@@ -255,6 +151,7 @@
 </div>
 
 <?php
+
 if ( 1 == count($posts) ) {
 
 	$comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = $id AND comment_approved != 'spam' ORDER BY comment_date");
@@ -301,6 +198,5 @@
 	?>
 <?php } ?>
 </div>
-<?php
- include('admin-footer.php');
-?>
+
+<?php include('admin-footer.php'); ?>
Index: wp-admin/edit-pages.php
===================================================================
--- wp-admin/edit-pages.php	(revision 5555)
+++ wp-admin/edit-pages.php	(working copy)
@@ -4,6 +4,13 @@
 $parent_file = 'edit.php';
 wp_enqueue_script( 'listman' );
 require_once('admin-header.php');
+
+$post_stati  = array('draft' => __('Draft'), 'future' => __('Future Dated'), 'private' => __('Private'), 'publish' => __('Published'));
+
+$post_status_q = '';
+if ( isset($_GET['post_status']) && in_array( $_GET['post_status'], array_keys($post_stati) ) )
+	$post_status_q = '&post_status=' . $_GET['post_status'];
+
 ?>
 
 <div class="wrap">
@@ -11,17 +18,27 @@
 <p><?php _e('Pages are like posts except they live outside of the normal blog chronology and can be hierarchical. You can use pages to organize and manage any amount of content.'); ?> <a href="page-new.php"><?php _e('Create a new page &raquo;'); ?></a></p>
 
 <form name="searchform" id="searchform" action="" method="get">
-	<fieldset>
-	<legend><?php _e('Search Pages&hellip;') ?></legend>
-	<input type="text" name="s" id="s" value="<?php if (isset($_GET['s'])) echo attribute_escape($_GET['s']); ?>" size="17" />
-	<input type="submit" name="submit" value="<?php _e('Search') ?>"  />
+	<fieldset><legend><?php _e('Search Terms&hellip;') ?></legend>
+		<input type="text" name="s" id="s" value="<?php the_search_query(); ?>" size="17" />
 	</fieldset>
+
+        
+	<fieldset><legend><?php _e('Page Type&hellip;'); ?></legend>
+		<select name='post_status'>
+			<option<?php selected( @$_GET['post_status'], 0 ); ?> value='0'><?php _e('Any'); ?></option>
+<?php	foreach ( $post_stati as $status => $label ) : ?>
+			<option<?php selected( @$_GET['post_status'], $status ); ?> value='<?php echo $status; ?>'><?php echo $label; ?></option>
+<?php	endforeach; ?>
+		</select>
+	</fieldset>
+
+	<input type="submit" id="post-query-submit" value="<?php _e('Go &#187;'); ?>" class="button" />
 </form>
 
 <br style="clear:both;" />
 
 <?php
-wp('post_type=page&orderby=menu_order&what_to_show=posts&posts_per_page=-1&posts_per_archive_page=-1&order=asc');
+wp("post_type=page&orderby=menu_order&what_to_show=posts$post_status_q&posts_per_page=-1&posts_per_archive_page=-1&order=asc");
 
 if ( $_GET['s'] )
 	$all = false;
@@ -41,9 +58,7 @@
   </tr>
   </thead>
   <tbody id="the-list">
-<?php
-page_rows(0, 0, $posts, $all);
-?>
+<?php page_rows(0, 0, $posts, $all); ?>
   </tbody>
 </table>
 
@@ -52,7 +67,7 @@
 <?php
 } else {
 ?>
-<p><?php _e('No pages yet.') ?></p>
+<p><?php _e('No pages found.') ?></p>
 <?php
 } // end if ($posts)
 ?>
