Changes in trunk/wp-admin/upload.php [12162:12308]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/upload.php
r12162 r12308 63 63 } 64 64 65 $location = add_query_arg( array( ' detached' => 1, 'attached' => $attached ) , $location );65 $location = add_query_arg( array( 'attached' => $attached ) , $location ); 66 66 wp_redirect($location); 67 67 exit; … … 77 77 $post_ids = isset($_GET['media']) ? $_GET['media'] : explode(',', $_GET['ids']); 78 78 $doaction = ($_GET['action'] != -1) ? $_GET['action'] : $_GET['action2']; 79 } else 79 } else { 80 80 wp_redirect($_SERVER['HTTP_REFERER']); 81 } 81 82 82 83 $location = 'upload.php'; 83 84 if ( $referer = wp_get_referer() ) { 84 85 if ( false !== strpos($referer, 'upload.php') ) 85 $location = remove_query_arg( array('trashed', 'untrashed', 'deleted', 'message', 'ids' ), $referer );86 $location = remove_query_arg( array('trashed', 'untrashed', 'deleted', 'message', 'ids', 'posted'), $referer ); 86 87 } 87 88 … … 119 120 } 120 121 121 $location = remove_query_arg('posted', $location);122 122 wp_redirect($location); 123 123 exit; … … 135 135 if ( isset($_GET['detached']) ) { 136 136 137 $media_per_page = (int) get_user_option('upload_per_page'); 138 if ( empty($media_per_page) ) 139 $media_per_page = 20; 140 137 141 if ( !empty($lost) ) { 138 $start = ( $_GET['paged'] - 1 ) * 50;139 $page_links_total = ceil(count($lost) / 50);142 $start = ( (int) $_GET['paged'] - 1 ) * $media_per_page; 143 $page_links_total = ceil(count($lost) / $media_per_page); 140 144 $lost = implode(',', $lost); 141 145 142 $orphans = $wpdb->get_results( "SELECT * FROM $wpdb->posts WHERE post_type = 'attachment' AND ID IN ($lost) LIMIT $start, 50");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 ) ); 143 147 } else { 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);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); 147 151 } 148 152 … … 167 171 <div class="wrap"> 168 172 <?php screen_icon(); ?> 169 <h2><?php echo esc_html( $title ); ?> <a href="media-new.php" class="button add-new-h2"><?php e sc_html_e('Add New'); ?></a> <?php173 <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 170 174 if ( isset($_GET['s']) && $_GET['s'] ) 171 175 printf( '<span class="subtitle">' . __('Search results for “%s”') . '</span>', esc_html( get_search_query() ) ); ?> … … 203 207 $messages[2] = __('Media permanently deleted.'); 204 208 $messages[3] = __('Error saving media attachment.'); 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>';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>'; 206 210 $messages[5] = __('Media restored from the trash.'); 207 211 … … 305 309 if ( $month_count && !( 1 == $month_count && 0 == $arc_result[0]->mmonth ) ) : ?> 306 310 <select name='m'> 307 <option <?php selected( @$_GET['m'], 0 ); ?>value='0'><?php _e('Show all dates'); ?></option>311 <option value='0'><?php _e('Show all dates'); ?></option> 308 312 <?php 309 313 foreach ($arc_result as $arc_row) { … … 430 434 </table> 431 435 432 <?php find_posts_div();436 <?php 433 437 434 438 } else { … … 467 471 <br class="clear" /> 468 472 </div> 473 <?php find_posts_div(); ?> 469 474 </form> 470 475 <br class="clear" />
Note: See TracChangeset
for help on using the changeset viewer.