Ticket #21194: 21194v3.patch
File 21194v3.patch, 2.1 KB (added by , 12 years ago) |
---|
-
wp-admin/includes/ajax-actions.php
475 475 } 476 476 477 477 function wp_ajax_trash_post( $action ) { 478 if ( empty( $action ) ) 478 $id = isset( $_POST['id'] ) ? (int)$_POST['id'] : 0; 479 if ( empty( $action ) && 'attachment' == get_post_type( $id ) ) 480 $action = 'trash-attachment'; 481 elseif ( empty( $action ) ) 479 482 $action = 'trash-post'; 480 $id = isset( $_POST['id'] ) ? (int) $_POST['id'] : 0;481 483 482 484 check_ajax_referer( "{$action}_$id" ); 483 485 if ( !current_user_can( 'delete_post', $id ) ) … … 486 488 if ( !get_post( $id ) ) 487 489 wp_die( 1 ); 488 490 489 if ( 'trash-post' == $action )491 if ( 'trash-post' == $action || 'trash-attachment' == $action ) 490 492 $done = wp_trash_post( $id ); 491 493 else 492 494 $done = wp_untrash_post( $id ); -
wp-admin/includes/media.php
1159 1159 if ( $send ) 1160 1160 $send = get_submit_button( __( 'Insert into Post' ), 'button', "send[$attachment_id]", false ); 1161 1161 if ( $delete && current_user_can( 'delete_post', $attachment_id ) ) { 1162 if ( !EMPTY_TRASH_DAYS ) { 1163 $delete = "<a href='" . wp_nonce_url( "post.php?action=delete&post=$attachment_id", 'delete-attachment_' . $attachment_id ) . "' id='del[$attachment_id]' class='delete'>" . __( 'Delete Permanently' ) . '</a>'; 1164 } elseif ( !MEDIA_TRASH ) { 1162 if ( !MEDIA_TRASH ) { 1165 1163 $delete = "<a href='#' class='del-link' onclick=\"document.getElementById('del_attachment_$attachment_id').style.display='block';return false;\">" . __( 'Delete' ) . "</a> 1166 1164 <div id='del_attachment_$attachment_id' class='del-attachment' style='display:none;'><p>" . sprintf( __( 'You are about to delete <strong>%s</strong>.' ), $filename ) . "</p> 1167 1165 <a href='" . wp_nonce_url( "post.php?action=delete&post=$attachment_id", 'delete-attachment_' . $attachment_id ) . "' id='del[$attachment_id]' class='button'>" . __( 'Continue' ) . "</a>