X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/022dfbbbe3215917d84708eb09acca93b21ae9e0..9441756a895fb4fdc4bcf20e0d228cef622663ca:/wp-admin/edit.php diff --git a/wp-admin/edit.php b/wp-admin/edit.php index df86317e..62c70e2b 100644 --- a/wp-admin/edit.php +++ b/wp-admin/edit.php @@ -1,300 +1,358 @@ true ) ) ) ) { + wp_die( __( 'You are not allowed to edit posts in this post type.' ) ); +} -if ($drafts || $other_drafts) { -?> -
- post_title = stripslashes($draft->post_title); - if ($draft->post_title == '') - $draft->post_title = sprintf(__('Post #%s'), $draft->ID); - echo "$draft->post_title"; - ++$i; - } - ?> - .
- +if ( 'attachment' === $typenow ) { + if ( wp_redirect( admin_url( 'upload.php' ) ) ) { + exit; + } +} - -- post_title = stripslashes($draft->post_title); - if ($draft->post_title == '') - $draft->post_title = sprintf(__('Post #%s'), $draft->ID); - echo "$draft->post_title"; - ++$i; - } - ?> - .
+/** + * @global string $post_type + * @global object $post_type_object + */ +global $post_type, $post_type_object; - +$post_type = $typenow; +$post_type_object = get_post_type_object( $post_type ); -' . __( 'You are not allowed to edit posts in this post type.' ) . '
', + 403 + ); +} -wp(); +$wp_list_table = _get_list_table('WP_Posts_List_Table'); +$pagenum = $wp_list_table->get_pagenum(); -if ( is_month() ) { - single_month_title(' '); -} elseif ( is_search() ) { - printf(__('Search for “%s”'), wp_specialchars($_GET['s']) ); +// Back-compat for viewing comments of an entry +foreach ( array( 'p', 'attachment_id', 'page_id' ) as $_redirect ) { + if ( ! empty( $_REQUEST[ $_redirect ] ) ) { + wp_redirect( admin_url( 'edit-comments.php?p=' . absint( $_REQUEST[ $_redirect ] ) ) ); + exit; + } +} +unset( $_redirect ); + +if ( 'post' != $post_type ) { + $parent_file = "edit.php?post_type=$post_type"; + $submenu_file = "edit.php?post_type=$post_type"; + $post_new_file = "post-new.php?post_type=$post_type"; } else { - if ( is_single() ) - printf(__('Comments on %s'), $post->post_title); - elseif ( ! is_paged() || get_query_var('paged') == 1 ) - _e('Last 15 Posts'); - else - _e('Previous Posts'); + $parent_file = 'edit.php'; + $submenu_file = 'edit.php'; + $post_new_file = 'post-new.php'; } -?> - - - -get_results("SELECT DISTINCT YEAR(post_date) AS yyear, MONTH(post_date) AS mmonth FROM $wpdb->posts WHERE post_date != '0000-00-00 00:00:00' ORDER BY post_date DESC"); - -if ( count($arc_result) ) { ?> - - +$doaction = $wp_list_table->current_action(); - +if ( $doaction ) { + check_admin_referer('bulk-posts'); -- + if ( !wp_trash_post($post_id) ) + wp_die( __('Error in moving to Trash.') ); + + $trashed++; + } + + $sendback = add_query_arg( array('trashed' => $trashed, 'ids' => join(',', $post_ids), 'locked' => $locked ), $sendback ); + break; + case 'untrash': + $untrashed = 0; + foreach ( (array) $post_ids as $post_id ) { + if ( !current_user_can( 'delete_post', $post_id) ) + wp_die( __('You are not allowed to restore this item from the Trash.') ); + + if ( !wp_untrash_post($post_id) ) + wp_die( __('Error in restoring from Trash.') ); + + $untrashed++; + } + $sendback = add_query_arg('untrashed', $untrashed, $sendback); + break; + case 'delete': + $deleted = 0; + foreach ( (array) $post_ids as $post_id ) { + $post_del = get_post($post_id); + + if ( !current_user_can( 'delete_post', $post_id ) ) + wp_die( __('You are not allowed to delete this item.') ); + + if ( $post_del->post_type == 'attachment' ) { + if ( ! wp_delete_attachment($post_id) ) + wp_die( __('Error in deleting.') ); + } else { + if ( !wp_delete_post($post_id) ) + wp_die( __('Error in deleting.') ); + } + $deleted++; + } + $sendback = add_query_arg('deleted', $deleted, $sendback); + break; + case 'edit': + if ( isset($_REQUEST['bulk_edit']) ) { + $done = bulk_edit_posts($_REQUEST); + + if ( is_array($done) ) { + $done['updated'] = count( $done['updated'] ); + $done['skipped'] = count( $done['skipped'] ); + $done['locked'] = count( $done['locked'] ); + $sendback = add_query_arg( $done, $sendback ); + } + } + break; + } - | |||||||||
---|---|---|---|---|---|---|---|---|---|
- - | g:i:s a'); ?> | - -- post_status) _e(' - Private'); ?> | - -- - | - - | - -- - | - - | ID) ) { echo "" . __('Edit') . ""; } ?> | - -ID) ) { echo "ID) . "' class='delete' onclick=\"return deleteSomething( 'post', " . $id . ", '" . sprintf(__("You are about to delete this post "%s".\\n"OK" to delete, "Cancel" to stop."), js_escape(get_the_title())) . "' );\">" . __('Delete') . ""; } ?> | - -- set_screen_reader_content( array( + 'heading_views' => $post_type_object->labels->filter_items_list, + 'heading_pagination' => $post_type_object->labels->items_list_navigation, + 'heading_list' => $post_type_object->labels->items_list, +) ); + +add_screen_option( 'per_page', array( 'default' => 20, 'option' => 'edit_' . $post_type . '_per_page' ) ); + +$bulk_counts = array( + 'updated' => isset( $_REQUEST['updated'] ) ? absint( $_REQUEST['updated'] ) : 0, + 'locked' => isset( $_REQUEST['locked'] ) ? absint( $_REQUEST['locked'] ) : 0, + 'deleted' => isset( $_REQUEST['deleted'] ) ? absint( $_REQUEST['deleted'] ) : 0, + 'trashed' => isset( $_REQUEST['trashed'] ) ? absint( $_REQUEST['trashed'] ) : 0, + 'untrashed' => isset( $_REQUEST['untrashed'] ) ? absint( $_REQUEST['untrashed'] ) : 0, +); + +$bulk_messages = array(); +$bulk_messages['post'] = array( + 'updated' => _n( '%s post updated.', '%s posts updated.', $bulk_counts['updated'] ), + 'locked' => ( 1 == $bulk_counts['locked'] ) ? __( '1 post not updated, somebody is editing it.' ) : + _n( '%s post not updated, somebody is editing it.', '%s posts not updated, somebody is editing them.', $bulk_counts['locked'] ), + 'deleted' => _n( '%s post permanently deleted.', '%s posts permanently deleted.', $bulk_counts['deleted'] ), + 'trashed' => _n( '%s post moved to the Trash.', '%s posts moved to the Trash.', $bulk_counts['trashed'] ), + 'untrashed' => _n( '%s post restored from the Trash.', '%s posts restored from the Trash.', $bulk_counts['untrashed'] ), +); +$bulk_messages['page'] = array( + 'updated' => _n( '%s page updated.', '%s pages updated.', $bulk_counts['updated'] ), + 'locked' => ( 1 == $bulk_counts['locked'] ) ? __( '1 page not updated, somebody is editing it.' ) : + _n( '%s page not updated, somebody is editing it.', '%s pages not updated, somebody is editing them.', $bulk_counts['locked'] ), + 'deleted' => _n( '%s page permanently deleted.', '%s pages permanently deleted.', $bulk_counts['deleted'] ), + 'trashed' => _n( '%s page moved to the Trash.', '%s pages moved to the Trash.', $bulk_counts['trashed'] ), + 'untrashed' => _n( '%s page restored from the Trash.', '%s pages restored from the Trash.', $bulk_counts['untrashed'] ), +); + +/** + * Filter the bulk action updated messages. + * + * By default, custom post types use the messages for the 'post' post type. + * + * @since 3.7.0 + * + * @param array $bulk_messages Arrays of messages, each keyed by the corresponding post type. Messages are + * keyed with 'updated', 'locked', 'deleted', 'trashed', and 'untrashed'. + * @param array $bulk_counts Array of item counts for each message, used to build internationalized strings. + */ +$bulk_messages = apply_filters( 'bulk_post_updated_messages', $bulk_messages, $bulk_counts ); +$bulk_counts = array_filter( $bulk_counts ); + +require_once( ABSPATH . 'wp-admin/admin-header.php' ); ?> - |
- |
- - - ( - - / - - ) (IP: - - ) - - -