+
+<div class="alignleft actions">
+<select name="action" class="select-action">
+<option value="-1" selected="selected"><?php _e('Bulk Actions'); ?></option>
+<option value="delete"><?php _e('Delete'); ?></option>
+<?php if ( isset($orphans) ) { ?>
+<option value="attach"><?php _e('Attach to a post'); ?></option>
+<?php } ?>
+</select>
+<input type="submit" value="<?php esc_attr_e('Apply'); ?>" name="doaction" id="doaction" class="button-secondary action" />
+<?php wp_nonce_field('bulk-media'); ?>
+
+<?php
+if ( ! is_singular() && ! isset($_GET['detached']) ) {
+ $arc_query = "SELECT DISTINCT YEAR(post_date) AS yyear, MONTH(post_date) AS mmonth FROM $wpdb->posts WHERE post_type = 'attachment' 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 ) ) : ?>
+<select name='m'>
+<option<?php selected( @$_GET['m'], 0 ); ?> value='0'><?php _e('Show all dates'); ?></option>
+<?php
+foreach ($arc_result as $arc_row) {
+ if ( $arc_row->yyear == 0 )
+ continue;
+ $arc_row->mmonth = zeroise( $arc_row->mmonth, 2 );
+
+ if ( $arc_row->yyear . $arc_row->mmonth == $_GET['m'] )
+ $default = ' selected="selected"';
+ else
+ $default = '';
+
+ echo "<option$default value='" . esc_attr("$arc_row->yyear$arc_row->mmonth") . "'>";
+ echo $wp_locale->get_month($arc_row->mmonth) . " $arc_row->yyear";
+ echo "</option>\n";
+}
+?>
+</select>
+<?php endif; // month_count ?>
+
+<input type="submit" id="post-query-submit" value="<?php esc_attr_e('Filter'); ?>" class="button-secondary" />
+
+<?php } // ! is_singular ?>
+
+<?php if ( isset($_GET['detached']) ) { ?>
+ <input type="submit" id="find_detached" name="find_detached" value="<?php esc_attr_e('Scan for lost attachments'); ?>" class="button-secondary" />
+<?php } ?>
+
+</div>
+
+<br class="clear" />
+</div>
+
+<div class="clear"></div>
+
+<?php if ( isset($orphans) ) { ?>
+<table class="widefat" cellspacing="0">
+<thead>
+<tr>
+ <th scope="col" class="check-column"><input type="checkbox" /></th>
+ <th scope="col"></th>
+ <th scope="col"><?php /* translators: column name in media */ echo _x('Media', 'media column name'); ?></th>
+ <th scope="col"><?php /* translators: column name in media */ echo _x('Author', 'media column name'); ?></th>
+ <th scope="col"><?php /* translators: column name in media */ echo _x('Date Added', 'media column name'); ?></th>
+</tr>
+</thead>
+
+<tfoot>
+<tr>
+ <th scope="col" class="check-column"><input type="checkbox" /></th>
+ <th scope="col"></th>
+ <th scope="col"><?php /* translators: column name in media */ echo _x('Media', 'media column name'); ?></th>
+ <th scope="col"><?php /* translators: column name in media */ echo _x('Author', 'media column name'); ?></th>
+ <th scope="col"><?php /* translators: column name in media */ echo _x('Date Added', 'media column name'); ?></th>
+</tr>
+</tfoot>
+
+<tbody id="the-list" class="list:post">
+<?php
+ if ( $orphans ) {
+ foreach ( $orphans as $post ) {
+ $class = 'alternate' == $class ? '' : 'alternate';
+ $att_title = esc_html( _draft_or_post_title($post->ID) );
+?>
+ <tr id='post-<?php echo $post->ID; ?>' class='<?php echo $class; ?>' valign="top">
+ <th scope="row" class="check-column"><input type="checkbox" name="media[]" value="<?php echo esc_attr($post->ID); ?>" /></th>
+
+ <td class="media-icon"><?php
+ if ( $thumb = wp_get_attachment_image( $post->ID, array(80, 60), true ) ) { ?>
+ <a href="media.php?action=edit&attachment_id=<?php echo $post->ID; ?>" title="<?php echo esc_attr(sprintf(__('Edit “%s”'), $att_title)); ?>"><?php echo $thumb; ?></a>
+<?php } ?></td>
+
+ <td class="media column-media"><strong><a href="<?php echo get_edit_post_link( $post->ID ); ?>" title="<?php echo esc_attr(sprintf(__('Edit “%s”'), $att_title)); ?>"><?php echo $att_title; ?></a></strong><br />
+ <?php echo strtoupper(preg_replace('/^.*?\.(\w+)$/', '$1', get_attached_file($post->ID))); ?>
+
+ <div class="row-actions">
+ <?php
+ $actions = array();
+ if ( current_user_can('edit_post', $post->ID) )
+ $actions['edit'] = '<a href="' . get_edit_post_link($post->ID, true) . '">' . __('Edit') . '</a>';
+ if ( current_user_can('delete_post', $post->ID) )
+ $actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url("post.php?action=delete&post=$post->ID", 'delete-post_' . $post->ID) . "' onclick=\"if ( confirm('" . esc_js(sprintf( ('draft' == $post->post_status) ? __("You are about to delete this attachment '%s'\n 'Cancel' to stop, 'OK' to delete.") : __("You are about to delete this attachment '%s'\n 'Cancel' to stop, 'OK' to delete."), $post->post_title )) . "') ) { return true;}return false;\">" . __('Delete') . "</a>";
+ $actions['view'] = '<a href="' . get_permalink($post->ID) . '" title="' . esc_attr(sprintf(__('View “%s”'), $title)) . '" rel="permalink">' . __('View') . '</a>';
+ if ( current_user_can('edit_post', $post->ID) )
+ $actions['attach'] = '<a href="#the-list" onclick="findPosts.open(\'media[]\',\''.$post->ID.'\');return false;">'.__('Attach').'</a>';
+ $actions = apply_filters( 'media_row_actions', $actions, $post );
+ $action_count = count($actions);
+ $i = 0;
+ foreach ( $actions as $action => $link ) {
+ ++$i;
+ ( $i == $action_count ) ? $sep = '' : $sep = ' | ';
+ echo "<span class='$action'>$link$sep</span>";
+ } ?>
+ </div></td>
+ <td class="author column-author"><?php $author = get_userdata($post->post_author); echo $author->display_name; ?></td>
+<?php if ( '0000-00-00 00:00:00' == $post->post_date && 'date' == $column_name ) {
+ $t_time = $h_time = __('Unpublished');
+ } else {
+ $t_time = get_the_time(__('Y/m/d g:i:s A'));
+ $m_time = $post->post_date;
+ $time = get_post_time( 'G', true );
+ if ( ( abs($t_diff = time() - $time) ) < 86400 ) {
+ if ( $t_diff < 0 )
+ $h_time = sprintf( __('%s from now'), human_time_diff( $time ) );
+ else
+ $h_time = sprintf( __('%s ago'), human_time_diff( $time ) );
+ } else {
+ $h_time = mysql2date(__('Y/m/d'), $m_time);
+ }
+ } ?>
+ <td class="date column-date"><?php echo $h_time ?></td>
+ </tr>
+<?php }
+
+ } else { ?>
+ <tr><td colspan="5"><?php _e('No media attachments found.') ?></td></tr>
+<?php } ?>
+</tbody>
+</table>
+
+<?php find_posts_div();
+
+} else {
+ include( 'edit-attachment-rows.php' );
+} ?>
+
+<div id="ajax-response"></div>
+
+<div class="tablenav">
+
+<?php
+if ( $page_links )
+ echo "<div class='tablenav-pages'>$page_links_text</div>";
+?>
+
+<div class="alignleft actions">
+<select name="action2" class="select-action">
+<option value="-1" selected="selected"><?php _e('Bulk Actions'); ?></option>
+<option value="delete"><?php _e('Delete'); ?></option>
+<?php if ( isset($orphans) ) { ?>
+<option value="attach"><?php _e('Attach to a post'); ?></option>
+<?php } ?>
+</select>
+<input type="submit" value="<?php esc_attr_e('Apply'); ?>" name="doaction2" id="doaction2" class="button-secondary action" />
+</div>
+
+<br class="clear" />
+</div>
+</form>
+<br class="clear" />
+
+</div>
+
+<?php
+include('admin-footer.php');