X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/7688c6ba71852cd89123b62b2d57683535e4702a..d3b1ea255664edd2deef17f900a655613d20820d:/wp-admin/edit.php diff --git a/wp-admin/edit.php b/wp-admin/edit.php index ba4cc04a..eb6b9f1c 100644 --- a/wp-admin/edit.php +++ b/wp-admin/edit.php @@ -1,223 +1,300 @@ post_type == 'attachment' ) { + if ( ! wp_delete_attachment($post_id_del) ) + wp_die( __('Error in deleting...') ); + } else { + if ( !wp_delete_post($post_id_del) ) + wp_die( __('Error in deleting...') ); + } + $deleted++; + } + } + break; + case 'edit': + if ( isset($_GET['post']) && isset($_GET['bulk_edit']) ) { + check_admin_referer('bulk-posts'); + + if ( -1 == $_GET['_status'] ) { + $_GET['post_status'] = null; + unset($_GET['_status'], $_GET['post_status']); + } else { + $_GET['post_status'] = $_GET['_status']; + } + + $done = bulk_edit_posts($_GET); + } + break; + } + + $sendback = wp_get_referer(); + if ( strpos($sendback, 'post.php') !== false ) $sendback = admin_url('post-new.php'); + elseif ( strpos($sendback, 'attachments.php') !== false ) $sendback = admin_url('attachments.php'); + if ( isset($done) ) { + $done['updated'] = count( $done['updated'] ); + $done['skipped'] = count( $done['skipped'] ); + $done['locked'] = count( $done['locked'] ); + $sendback = add_query_arg( $done, $sendback ); + } + if ( isset($deleted) ) + $sendback = add_query_arg('deleted', $deleted, $sendback); + wp_redirect($sendback); + exit(); +} elseif ( isset($_GET['_wp_http_referer']) && ! empty($_GET['_wp_http_referer']) ) { + wp_redirect( remove_query_arg( array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI']) ) ); + exit; +} + +if ( empty($title) ) + $title = __('Edit Posts'); $parent_file = 'edit.php'; -wp_enqueue_script( 1 == $_GET['c'] ? 'admin-comments' : 'listman' ); +wp_enqueue_script('inline-edit-post'); + +list($post_stati, $avail_post_stati) = wp_edit_posts_query(); + require_once('admin-header.php'); -$_GET['m'] = (int) $_GET['m']; -$_GET['cat'] = (int) $_GET['cat']; -$post_stati = array( // array( adj, noun ) - 'publish' => array(__('Published'), __('Published posts')), - 'future' => array(__('Scheduled'), __('Scheduled posts')), - 'pending' => array(__('Pending Review'), __('Pending posts')), - 'draft' => array(__('Draft'), _c('Drafts|manage posts header')), - 'private' => array(__('Private'), __('Private posts')) - ); - -$avail_post_stati = $wpdb->get_col("SELECT DISTINCT post_status FROM $wpdb->posts WHERE post_type = 'post'"); - -$post_status_q = ''; -$post_status_label = __('Posts'); -if ( isset($_GET['post_status']) && in_array( $_GET['post_status'], array_keys($post_stati) ) ) { - $post_status_label = $post_stati[$_GET['post_status']][1]; - $post_status_q = '&post_status=' . $_GET['post_status']; -} -?> +if ( !isset( $_GET['paged'] ) ) + $_GET['paged'] = 1; + +if ( empty($_GET['mode']) ) + $mode = 'list'; +else + $mode = esc_attr($_GET['mode']); ?>
+ +

' . __('Search results for “%s”') . '', esc_html( get_search_query() ) ); ?> +

+

|

+ + + +

+ 'display name' -$posts_columns = array(); -$posts_columns['id'] = '

' . __('ID') . '
'; -if ( 'draft' === $_GET['post_status'] ) - $posts_columns['modified'] = __('Modified'); -elseif ( 'pending' === $_GET['post_status'] ) - $posts_columns['modified'] = __('Submitted'); -else - $posts_columns['date'] = __('When'); -$posts_columns['title'] = __('Title'); -$posts_columns['categories'] = __('Categories'); -if ( !in_array($_GET['post_status'], array('pending', 'draft', 'future')) ) - $posts_columns['comments'] = '
' . __('Comments') . '
'; -$posts_columns['author'] = __('Author'); +if ( isset($_GET['skipped']) && (int) $_GET['skipped'] ) + unset($_GET['skipped']); -$posts_columns = apply_filters('manage_posts_columns', $posts_columns); +if ( isset($_GET['locked']) && (int) $_GET['locked'] ) { + printf( _n( '%s post not updated, somebody is editing it.', '%s posts not updated, somebody is editing them.', $_GET['locked'] ), number_format_i18n( $_GET['locked'] ) ); + unset($_GET['locked']); +} -// you can not edit these at the moment -$posts_columns['control_view'] = ''; -$posts_columns['control_edit'] = ''; -$posts_columns['control_delete'] = ''; +if ( isset($_GET['deleted']) && (int) $_GET['deleted'] ) { + printf( _n( 'Post deleted.', '%s posts deleted.', $_GET['deleted'] ), number_format_i18n( $_GET['deleted'] ) ); + unset($_GET['deleted']); +} +$_SERVER['REQUEST_URI'] = remove_query_arg( array('locked', 'skipped', 'updated', 'deleted'), $_SERVER['REQUEST_URI'] ); ?> +

+ -

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_author = ''; - $_GET['author'] = (int) $_GET['author']; - if ( $_GET['author'] != 0 ) { - if ( $_GET['author'] == '-' . $user_ID ) { // author exclusion - $h2_author = ' ' . __('by other authors'); - } else { - $author_user = get_userdata( get_query_var( 'author' ) ); - $h2_author = ' ' . sprintf(__('by %s'), wp_specialchars( $author_user->display_name )); - } - } - $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%5$s|You can reorder these: 1: Posts, 2: by {s}, 3: matching {s}, 4: in {s}, 5: during {s}' ), $h2_noun, $h2_author, $h2_search, $h2_cat, $h2_month ); -} -?>

- -
-
- -
- -
- -
+ + + + + + + + + + + +
add_query_arg( 'paged', '%#%' ), + 'format' => '', + 'prev_text' => __('«'), + 'next_text' => __('»'), + 'total' => $wp_query->max_num_pages, + 'current' => $_GET['paged'] +)); +?> + +
+ + + + +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 ) ) { ?> - -
- -
+if ( $month_count && !( 1 == $month_count && 0 == $arc_result[0]->mmonth ) ) { +$m = isset($_GET['m']) ? (int)$_GET['m'] : 0; +?> + - + echo ""; + echo $wp_locale->get_month($arc_row->mmonth) . " $arc_row->yyear"; + echo "\n"; +} +?> + + - + __('View all categories'), 'hide_empty' => 0, 'hierarchical' => 1, + 'show_count' => 0, 'orderby' => 'name', 'selected' => $cat); +wp_dropdown_categories($dropdown_options); +do_action('restrict_manage_posts'); +?> + -
+ +
- + +
' . __( 'Displaying %s–%s of %s' ) . '%s', + number_format_i18n( ( $_GET['paged'] - 1 ) * $wp_query->query_vars['posts_per_page'] + 1 ), + number_format_i18n( min( $_GET['paged'] * $wp_query->query_vars['posts_per_page'], $wp_query->found_posts ) ), + number_format_i18n( $wp_query->found_posts ), + $page_links +); echo $page_links_text; ?>
+ -
+ - -
+ + -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"); - if ($comments) { - update_comment_cache($comments); - ?> -

-
    comment_post_ID); - $authordata = get_userdata($post->post_author); - $comment_status = wp_get_comment_status($comment->comment_ID); - if ('unapproved' == $comment_status) - $class .= ' unapproved'; - if ($i % 2) - $class .= ' alternate'; - echo "
  1. "; +if ( $page_links ) + echo "
    $page_links_text
    "; ?> -

    comment_author_email) { ?>| comment_author_url && 'http://' != $comment->comment_author_url) { ?> | |

    - - -

    — [ -comment_post_ID) ) { - 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') . " "; -} -?> ] -

    -
  2. +
    + + +
    +
    +
    +
-'; - }//end if comments - ?> + +
+

+ + + + + +
+ +
+
- +