Ticket #11673: 11673.2.against-2.9.diff

File 11673.2.against-2.9.diff, 3.0 KB (added by nacin, 3 years ago)

Better patch against 2.9 branch also checks for EMPTY_TRASH_DAYS.

Line 
1Index: wp-admin/edit-attachment-rows.php
2===================================================================
3--- wp-admin/edit-attachment-rows.php   (revision 12592)
4+++ wp-admin/edit-attachment-rows.php   (working copy)
5@@ -96,8 +96,10 @@
6                                $actions['untrash'] = "<a class='submitdelete' href='" . wp_nonce_url("post.php?action=untrash&amp;post=$post->ID", 'untrash-post_' . $post->ID) . "'>" . __('Restore') . "</a>";
7                        elseif ( EMPTY_TRASH_DAYS && MEDIA_TRASH )
8                                $actions['trash'] = "<a class='submitdelete' href='" . wp_nonce_url("post.php?action=trash&amp;post=$post->ID", 'trash-post_' . $post->ID) . "'>" . __('Trash') . "</a>";
9-                       if ( $is_trash || !EMPTY_TRASH_DAYS || !MEDIA_TRASH )
10-                               $actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url("post.php?action=delete&amp;post=$post->ID", 'delete-post_' . $post->ID) . "'>" . __('Delete Permanently') . "</a>";
11+                       if ( $is_trash || !EMPTY_TRASH_DAYS || !MEDIA_TRASH ) {
12+                               $delete_ays = ( !$is_trash && ( !MEDIA_TRASH || !EMPTY_TRASH_DAYS ) ) ? " onclick='return showNotice.warn();'" : '';
13+                               $actions['delete'] = "<a class='submitdelete'$delete_ays href='" . wp_nonce_url("post.php?action=delete&amp;post=$post->ID", 'delete-post_' . $post->ID) . "'>" . __('Delete Permanently') . "</a>";
14+                       }
15                }
16                if ( !$is_trash )
17                        $actions['view'] = '<a href="' . get_permalink($post->ID) . '" title="' . esc_attr(sprintf(__('View &#8220;%s&#8221;'), $title)) . '" rel="permalink">' . __('View') . '</a>';
18Index: wp-admin/upload.php
19===================================================================
20--- wp-admin/upload.php (revision 12592)
21+++ wp-admin/upload.php (working copy)
22@@ -392,10 +392,12 @@
23                if ( current_user_can('edit_post', $post->ID) )
24                        $actions['edit'] = '<a href="' . get_edit_post_link($post->ID, true) . '">' . __('Edit') . '</a>';
25                if ( current_user_can('delete_post', $post->ID) )
26-                       if ( EMPTY_TRASH_DAYS && MEDIA_TRASH )
27+                       if ( EMPTY_TRASH_DAYS && MEDIA_TRASH ) {
28                                $actions['trash'] = "<a class='submitdelete' href='" . wp_nonce_url("post.php?action=trash&amp;post=$post->ID", 'trash-post_' . $post->ID) . "'>" . __('Trash') . "</a>";
29-                       else
30-                               $actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url("post.php?action=delete&amp;post=$post->ID", 'delete-post_' . $post->ID) . "'>" . __('Delete Permanently') . "</a>";
31+                       } else {
32+                               $delete_ays = ( !MEDIA_TRASH || !EMPTY_TRASH_DAYS ) ? " onclick='return showNotice.warn();'" : '';
33+                               $actions['delete'] = "<a class='submitdelete'$delete_ays href='" . wp_nonce_url("post.php?action=delete&amp;post=$post->ID", 'delete-post_' . $post->ID) . "'>" . __('Delete Permanently') . "</a>";
34+                       }
35                $actions['view'] = '<a href="' . get_permalink($post->ID) . '" title="' . esc_attr(sprintf(__('View &#8220;%s&#8221;'), $title)) . '" rel="permalink">' . __('View') . '</a>';
36                if ( current_user_can('edit_post', $post->ID) )
37                        $actions['attach'] = '<a href="#the-list" onclick="findPosts.open(\'media[]\',\''.$post->ID.'\');return false;" class="hide-if-no-js">'.__('Attach').'</a>';