Make WordPress Core


Ignore:
File:
1 edited

Legend:

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

    r12308 r12162  
    6363        }
    6464
    65         $location = add_query_arg( array( 'attached' => $attached ) , $location );
     65        $location = add_query_arg( array( 'detached' => 1, 'attached' => $attached ) , $location );
    6666        wp_redirect($location);
    6767        exit;
     
    7777        $post_ids = isset($_GET['media']) ? $_GET['media'] : explode(',', $_GET['ids']);
    7878        $doaction = ($_GET['action'] != -1) ? $_GET['action'] : $_GET['action2'];
    79     } else {
     79    } else
    8080        wp_redirect($_SERVER['HTTP_REFERER']);
    81     }
    8281
    8382    $location = 'upload.php';
    8483    if ( $referer = wp_get_referer() ) {
    8584        if ( false !== strpos($referer, 'upload.php') )
    86             $location = remove_query_arg( array('trashed', 'untrashed', 'deleted', 'message', 'ids', 'posted'), $referer );
     85            $location = remove_query_arg( array('trashed', 'untrashed', 'deleted', 'message', 'ids'), $referer );
    8786    }
    8887
     
    120119    }
    121120
     121    $location = remove_query_arg('posted', $location);
    122122    wp_redirect($location);
    123123    exit;
     
    135135if ( isset($_GET['detached']) ) {
    136136
    137     $media_per_page = (int) get_user_option('upload_per_page');
    138     if ( empty($media_per_page) )
    139         $media_per_page = 20;
    140 
    141137    if ( !empty($lost) ) {
    142         $start = ( (int) $_GET['paged'] - 1 ) * $media_per_page;
    143         $page_links_total = ceil(count($lost) / $media_per_page);
     138        $start = ( $_GET['paged'] - 1 ) * 50;
     139        $page_links_total = ceil(count($lost) / 50);
    144140        $lost = implode(',', $lost);
    145141
    146         $orphans = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->posts WHERE post_type = 'attachment' AND ID IN (%s) LIMIT %d, %d", $lost, $start, $media_per_page ) );
     142        $orphans = $wpdb->get_results( "SELECT * FROM $wpdb->posts WHERE post_type = 'attachment' AND ID IN ($lost) LIMIT $start, 50" );
    147143    } else {
    148         $start = ( (int) $_GET['paged'] - 1 ) * $media_per_page;
    149         $orphans = $wpdb->get_results( $wpdb->prepare( "SELECT SQL_CALC_FOUND_ROWS * FROM $wpdb->posts WHERE post_type = 'attachment' AND post_status != 'trash' AND post_parent < 1 LIMIT %d, %d", $start, $media_per_page ) );
    150         $page_links_total = ceil($wpdb->get_var( "SELECT FOUND_ROWS()" ) / $media_per_page);
     144        $start = ( $_GET['paged'] - 1 ) * 25;
     145        $orphans = $wpdb->get_results( "SELECT SQL_CALC_FOUND_ROWS * FROM $wpdb->posts WHERE post_type = 'attachment' AND post_status != 'trash' AND post_parent < 1 LIMIT $start, 25" );
     146        $page_links_total = ceil($wpdb->get_var( "SELECT FOUND_ROWS()" ) / 25);
    151147    }
    152148
     
    171167<div class="wrap">
    172168<?php screen_icon(); ?>
    173 <h2><?php echo esc_html( $title ); ?> <a href="media-new.php" class="button add-new-h2"><?php echo esc_html_x('Add New', 'file'); ?></a> <?php
     169<h2><?php echo esc_html( $title ); ?> <a href="media-new.php" class="button add-new-h2"><?php esc_html_e('Add New'); ?></a> <?php
    174170if ( isset($_GET['s']) && $_GET['s'] )
    175171    printf( '<span class="subtitle">' . __('Search results for &#8220;%s&#8221;') . '</span>', esc_html( get_search_query() ) ); ?>
     
    207203$messages[2] = __('Media permanently deleted.');
    208204$messages[3] = __('Error saving media attachment.');
    209 $messages[4] = __('Media moved to the trash.') . ' <a href="' . esc_url( wp_nonce_url( 'upload.php?doaction=undo&action=untrash&ids='.(isset($_GET['ids']) ? $_GET['ids'] : ''), "bulk-media" ) ) . '">' . __('Undo') . '</a>';
     205$messages[4] = __('Media moved to the trash.') . ' <a href="' . esc_url( wp_nonce_url( 'upload.php?doaction=undo&action=untrash&ids='.$_GET['ids'], "bulk-media" ) ) . '">' . __('Undo?') . '</a>';
    210206$messages[5] = __('Media restored from the trash.');
    211207
     
    309305    if ( $month_count && !( 1 == $month_count && 0 == $arc_result[0]->mmonth ) ) : ?>
    310306<select name='m'>
    311 <option value='0'><?php _e('Show all dates'); ?></option>
     307<option<?php selected( @$_GET['m'], 0 ); ?> value='0'><?php _e('Show all dates'); ?></option>
    312308<?php
    313309foreach ($arc_result as $arc_row) {
     
    434430</table>
    435431
    436 <?php
     432<?php find_posts_div();
    437433
    438434} else {
     
    471467<br class="clear" />
    472468</div>
    473 <?php find_posts_div(); ?>
    474469</form>
    475470<br class="clear" />
Note: See TracChangeset for help on using the changeset viewer.