Make WordPress Core


Ignore:
Timestamp:
08/12/2010 11:21:05 PM (16 years ago)
Author:
scribu
Message:

Introduce WP_List_Table::check_permissions() and WP_List_Table::prepare_items(). Fixes #14596; See #14579

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/upload.php

    r15491 r15496  
    1010require_once( './admin.php' );
    1111
    12 if ( !current_user_can('upload_files') )
    13         wp_die(__('You do not have permission to upload files.'));
     12require_once( './includes/default-list-tables.php' );
     13
     14$table = new WP_Media_Table;
     15$table->check_permissions();
    1416
    1517// Handle bulk actions
    16 if ( isset( $_REQUEST['found_post_id'] ) && isset( $_REQUEST['media'] ) ) {
     18if ( isset($_REQUEST['find_detached']) ) {
     19        check_admin_referer('bulk-media');
     20
     21        if ( !current_user_can('edit_posts') )
     22                wp_die( __('You are not allowed to scan for lost attachments.') );
     23
     24        $lost = $wpdb->get_col( "
     25                SELECT ID FROM $wpdb->posts
     26                WHERE post_type = 'attachment' AND post_parent > '0'
     27                AND post_parent NOT IN (
     28                        SELECT ID FROM $wpdb->posts
     29                        WHERE post_type NOT IN ( 'attachment', '" . join( "', '", get_post_types( array( 'public' => false ) ) ) . "' )
     30                )
     31        " );
     32
     33        $_REQUEST['detached'] = 1;
     34
     35} elseif ( isset( $_REQUEST['found_post_id'] ) && isset( $_REQUEST['media'] ) ) {
    1736        check_admin_referer( 'bulk-media' );
    1837
    … …  
    112131}
    113132
    114 require_once( './includes/default-list-tables.php' );
    115 
    116 $table = new WP_Media_Table;
     133$table->prepare_items();
    117134
    118135$title = __('Media Library');
Note: See TracChangeset for help on using the changeset viewer.