diff --git a/wp-admin/edit-pages.php b/wp-admin/edit-pages.php index 3218a1f0a9..c866759897 100644 --- a/wp-admin/edit-pages.php +++ b/wp-admin/edit-pages.php @@ -4,24 +4,59 @@ $title = __('Pages'); $parent_file = 'edit.php'; wp_enqueue_script( 'listman' ); require_once('admin-header.php'); + +$post_stati = array( // array( adj, noun ) + 'draft' => array(__('Draft'), __('Draft pages')), + 'future' => array(__('Future dated'), __('Future dated pages')), + 'private' => array(__('Private'), __('Private pages')), + 'publish' => array(__('Published'), __('Published pages')) + ); + + +$post_status_label = _c('Pages|manage pages header'); +$post_listing_pageable = true; +if ( isset($_GET['post_status']) && in_array( $_GET['post_status'], array_keys($post_stati) ) ) { + $post_status_label = $post_stati[$_GET['post_status']][1]; + $post_listing_pageable = false; + $post_status_q = '&post_status=' . $_GET['post_status']; + if ( 'publish' == $_GET['post_status'] ); + $post_listing_pageable = true; +} + ?>
-

+ +

+

-
- - - +
+
+ + +
+ +
+ +
- + @@ -52,7 +85,7 @@ page_rows(0, 0, $posts, $all); -

+

diff --git a/wp-admin/edit-post-rows.php b/wp-admin/edit-post-rows.php new file mode 100644 index 0000000000..4af1a5beff --- /dev/null +++ b/wp-admin/edit-post-rows.php @@ -0,0 +1,103 @@ + + + + + + + + + + + + + + +$column_display_name) { + + switch($column_name) { + + case 'id': + ?> + + + + + + + + + + + + + + + + + + + + + + + + + + + +
post_modified ) _e('Unpublished'); else the_time(__('Y-m-d \<\b\r \/\> g:i:s a')); ?> + post_status) _e(' - Private'); ?> + " . __('0') . '', "" . __('1') . '', "" . __('%') . '') ?> + ID) ) { echo "" . __('Edit') . ""; } ?>ID) ) { echo "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') . ""; } ?>
diff --git a/wp-admin/edit.php b/wp-admin/edit.php index fcb01a1219..d35c502cda 100644 --- a/wp-admin/edit.php +++ b/wp-admin/edit.php @@ -6,125 +6,38 @@ $parent_file = 'edit.php'; 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( // array( adj, noun ) + 'draft' => array(__('Draft'), _c('Drafts|manage posts header')), + 'future' => array(__('Future dated'), __('Future dated posts')), + 'private' => array(__('Private'), __('Private posts')), + 'publish' => array(__('Published'), __('Published posts')) + ); -$drafts = get_users_drafts( $user_ID ); -$other_drafts = get_others_drafts( $user_ID); - -if ($drafts || $other_drafts) { -?> -
- -

- post_title = apply_filters('the_title', stripslashes($draft->post_title)); - if ($draft->post_title == '') - $draft->post_title = sprintf(__('Post #%s'), $draft->ID); - echo "$draft->post_title"; - ++$i; - } - ?> -.

- - - -

- post_title = apply_filters('the_title', stripslashes($draft->post_title)); - if ($draft->post_title == '') - $draft->post_title = sprintf(__('Post #%s'), $draft->ID); - echo "$draft->post_title"; - ++$i; - } - ?> - .

- - - -
- - -
-

-post_title)); - elseif ( ! is_paged() || get_query_var('paged') == 1 ) - _e('Last 15 Posts'); - else - _e('Previous Posts'); +$post_status_q = ''; +$author_q = ''; +$post_status_label = _c('Posts|manage posts header'); +$post_listing_pageable = true; +if ( isset($_GET['post_status']) && in_array( $_GET['post_status'], array_keys($post_stati) ) ) { + $post_status_label = $post_stati[$_GET['post_status']][1]; + $post_listing_pageable = false; + $post_status_q = '&post_status=' . $_GET['post_status']; + if ( in_array( $_GET['post_status'], array('draft', 'private') ) ) + $author_q = "&author=$user_ID"; + elseif ( 'publish' == $_GET['post_status'] ); + $post_listing_pageable = true; } ?> -

-
-
- - - -
-
- -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"); - -if ( count($arc_result) ) { ?> - -
-
- - - -
-
- - - -
-
- - - -
-
- - - -
+
'display name' $posts_columns = array( 'id' => '
' . __('ID') . '
', @@ -143,109 +56,104 @@ $posts_columns['control_delete'] = ''; ?> - - - +

post_title)); +} else { + if ( $post_listing_pageable && !is_archive() && !is_search() ) + $h2_noun = is_paged() ? sprintf(__( 'Previous %s' ), $post_status_label) : sprintf(__('Latest %s'), $post_status_label); + else + $h2_noun = $post_status_label; + // Use $_GET instead of is_ since they can override each other + $h2_search = isset($_GET['s']) && $_GET['s'] ? ' ' . sprintf(__('matching “%s”'), wp_specialchars( get_search_query() ) ) : ''; + $h2_cat = isset($_GET['cat']) && $_GET['cat'] ? ' ' . sprintf( __('in “%s”'), single_cat_title('', false) ) : ''; + $h2_month = isset($_GET['m']) && $_GET['m'] ? ' ' . sprintf( __('during %s'), single_month_title(' ', false) ) : ''; + printf( _c( '%1$s%2$s%3$s%4$s|manage posts header' ), $h2_noun, $h2_search, $h2_cat, $h2_month ); +} +?>

+ + +
+ +
+ +
+ +
+ +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 ) ) { ?> + +
+ +
- - - - - - - +
+ +
+ + + +
' . __('Your Posts') . "\n"; + include( 'edit-post-rows.php' ); -foreach($posts_columns as $column_name=>$column_display_name) { + $editable_ids = get_editable_user_ids( $user_ID ); - switch($column_name) { + if ( $editable_ids && count($editable_ids) > 1 ) { + $_editable_ids = join(',', array_diff($editable_ids, array($user_ID))); - case 'id': - ?> - - - - - - - - - - - - - - - - - - - - ' . __("Others' Posts") . "\n"; + include( 'edit-post-rows.php' ); + } } + +} else { + include( 'edit-post-rows.php' ); } ?> - - - - - - - -
post_modified ) _e('Unpublished'); else the_time(__('Y-m-d \<\b\r \/\> g:i:s a')); ?> - post_status) _e(' - Private'); ?> - " . __('0') . '', "" . __('1') . '', "" . __('%') . '') ?> - ID) ) { echo "" . __('Edit') . ""; } ?>ID) ) { echo "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') . ""; } ?>
@@ -255,6 +163,7 @@ endwhile;
get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = $id AND comment_approved != 'spam' ORDER BY comment_date"); @@ -279,16 +188,16 @@ foreach ($comments as $comment) { -

— [ +

— [ comment_post_ID) ) { - echo " " . __('Edit') . ''; + echo " " . __('Edit') . ''; echo ' | comment_author)) . "', theCommentList );\">" . __('Delete') . ' '; if ( ('none' != $comment_status) && ( current_user_can('moderate_comments') ) ) { echo ' | ' . __('Unapprove') . ' '; echo ' | ' . __('Approve') . ' '; } - echo " | comment_post_ID . "&c=" . $comment->comment_ID, 'delete-comment_' . $comment->comment_ID) . "\" onclick=\"return deleteSomething( 'comment-as-spam', $comment->comment_ID, '" . js_escape(sprintf(__("You are about to mark as spam this comment by '%s'.\n'Cancel' to stop, 'OK' to mark as spam."), $comment->comment_author)) . "', theCommentList );\">" . __('Spam') . " "; + echo " | comment_post_ID . "&c=" . $comment->comment_ID, 'delete-comment_' . $comment->comment_ID) . "\" onclick=\"return deleteSomething( 'comment-as-spam', $comment->comment_ID, '" . js_escape(sprintf(__("You are about to mark as spam this comment by '%s'.\n'Cancel' to stop, 'OK' to mark as spam."), $comment->comment_author)) . "', theCommentList );\">" . __('Spam') . " "; } ?>

@@ -301,6 +210,5 @@ if ( current_user_can('edit_post', $comment->comment_post_ID) ) { ?>
- + + diff --git a/wp-admin/wp-admin.css b/wp-admin/wp-admin.css index 14c93a2d55..9f53879b48 100644 --- a/wp-admin/wp-admin.css +++ b/wp-admin/wp-admin.css @@ -790,22 +790,25 @@ input.delete:hover { 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 { diff --git a/wp-includes/capabilities.php b/wp-includes/capabilities.php index eccde9701d..eaccf2dcd4 100644 --- a/wp-includes/capabilities.php +++ b/wp-includes/capabilities.php @@ -445,12 +445,12 @@ function map_meta_cap($cap, $user_id) { function current_user_can($capability) { $current_user = wp_get_current_user(); - $args = array_slice(func_get_args(), 1); - $args = array_merge(array($capability), $args); - if ( empty($current_user) ) return false; + $args = array_slice(func_get_args(), 1); + $args = array_merge(array($capability), $args); + return call_user_func_array(array(&$current_user, 'has_cap'), $args); } diff --git a/wp-includes/classes.php b/wp-includes/classes.php index 0a285de5b5..e8cc5f4fc3 100644 --- a/wp-includes/classes.php +++ b/wp-includes/classes.php @@ -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; diff --git a/wp-includes/link-template.php b/wp-includes/link-template.php index bc5c2294cb..ec1b6ff9a4 100644 --- a/wp-includes/link-template.php +++ b/wp-includes/link-template.php @@ -471,9 +471,9 @@ function get_pagenum_link($pagenum = 1) { $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 { diff --git a/wp-includes/query.php b/wp-includes/query.php index 167a1a7814..174691f9dc 100644 --- a/wp-includes/query.php +++ b/wp-includes/query.php @@ -995,30 +995,39 @@ class WP_Query { } 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