Make WordPress Core

Ticket #21194: 21194_just_use_postv2.patch

File 21194_just_use_postv2.patch, 9.6 KB (added by c3mdigital, 12 years ago)
  • wp-admin/includes/class-wp-posts-list-table.php

     
    540540                                }
    541541                                if ( current_user_can( $post_type_object->cap->delete_post, $post->ID ) ) {
    542542                                        if ( 'trash' == $post->post_status )
    543                                                 $actions['untrash'] = "<a title='" . esc_attr( __( 'Restore this item from the Trash' ) ) . "' href='" . wp_nonce_url( admin_url( sprintf( $post_type_object->_edit_link . '&amp;action=untrash', $post->ID ) ), 'untrash-' . $post->post_type . '_' . $post->ID ) . "'>" . __( 'Restore' ) . "</a>";
     543                                                $actions['untrash'] = "<a title='" . esc_attr( __( 'Restore this item from the Trash' ) ) . "' href='" . wp_nonce_url( admin_url( sprintf( $post_type_object->_edit_link . '&amp;action=untrash', $post->ID ) ), 'untrash-post_' . $post->ID ) . "'>" . __( 'Restore' ) . "</a>";
    544544                                        elseif ( EMPTY_TRASH_DAYS )
    545545                                                $actions['trash'] = "<a class='submitdelete' title='" . esc_attr( __( 'Move this item to the Trash' ) ) . "' href='" . get_delete_post_link( $post->ID ) . "'>" . __( 'Trash' ) . "</a>";
    546546                                        if ( 'trash' == $post->post_status || !EMPTY_TRASH_DAYS )
  • wp-admin/includes/class-wp-media-list-table.php

     
    359359                                $actions['edit'] = '<a href="' . get_edit_post_link( $post->ID, true ) . '">' . __( 'Edit' ) . '</a>';
    360360                        if ( current_user_can( 'delete_post', $post->ID ) )
    361361                                if ( EMPTY_TRASH_DAYS && MEDIA_TRASH ) {
    362                                         $actions['trash'] = "<a class='submitdelete' href='" . wp_nonce_url( "post.php?action=trash&amp;post=$post->ID", 'trash-attachment_' . $post->ID ) . "'>" . __( 'Trash' ) . "</a>";
     362                                        $actions['trash'] = "<a class='submitdelete' href='" . wp_nonce_url( "post.php?action=trash&amp;post=$post->ID", 'trash-post_' . $post->ID ) . "'>" . __( 'Trash' ) . "</a>";
    363363                                } else {
    364364                                        $delete_ays = !MEDIA_TRASH ? " onclick='return showNotice.warn();'" : '';
    365                                         $actions['delete'] = "<a class='submitdelete'$delete_ays href='" . wp_nonce_url( "post.php?action=delete&amp;post=$post->ID", 'delete-attachment_' . $post->ID ) . "'>" . __( 'Delete Permanently' ) . "</a>";
     365                                        $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>";
    366366                                }
    367367                        $actions['view'] = '<a href="' . get_permalink( $post->ID ) . '" title="' . esc_attr( sprintf( __( 'View &#8220;%s&#8221;' ), $att_title ) ) . '" rel="permalink">' . __( 'View' ) . '</a>';
    368368                        if ( current_user_can( 'edit_post', $post->ID ) )
     
    373373                                $actions['edit'] = '<a href="' . get_edit_post_link( $post->ID, true ) . '">' . __( 'Edit' ) . '</a>';
    374374                        if ( current_user_can( 'delete_post', $post->ID ) ) {
    375375                                if ( $this->is_trash )
    376                                         $actions['untrash'] = "<a class='submitdelete' href='" . wp_nonce_url( "post.php?action=untrash&amp;post=$post->ID", 'untrash-attachment_' . $post->ID ) . "'>" . __( 'Restore' ) . "</a>";
     376                                        $actions['untrash'] = "<a class='submitdelete' href='" . wp_nonce_url( "post.php?action=untrash&amp;post=$post->ID", 'untrash-post_' . $post->ID ) . "'>" . __( 'Restore' ) . "</a>";
    377377                                elseif ( EMPTY_TRASH_DAYS && MEDIA_TRASH )
    378                                         $actions['trash'] = "<a class='submitdelete' href='" . wp_nonce_url( "post.php?action=trash&amp;post=$post->ID", 'trash-attachment_' . $post->ID ) . "'>" . __( 'Trash' ) . "</a>";
     378                                        $actions['trash'] = "<a class='submitdelete' href='" . wp_nonce_url( "post.php?action=trash&amp;post=$post->ID", 'trash-post_' . $post->ID ) . "'>" . __( 'Trash' ) . "</a>";
    379379                                if ( $this->is_trash || !EMPTY_TRASH_DAYS || !MEDIA_TRASH ) {
    380380                                        $delete_ays = ( !$this->is_trash && !MEDIA_TRASH ) ? " onclick='return showNotice.warn();'" : '';
    381                                         $actions['delete'] = "<a class='submitdelete'$delete_ays href='" . wp_nonce_url( "post.php?action=delete&amp;post=$post->ID", 'delete-attachment_' . $post->ID ) . "'>" . __( 'Delete Permanently' ) . "</a>";
     381                                        $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>";
    382382                                }
    383383                        }
    384384                        if ( !$this->is_trash ) {
  • wp-admin/includes/ajax-actions.php

     
    17271727        elseif ( isset( $_POST['post_type'] ) && post_type_exists( $_POST['post_type'] ) )
    17281728                $post_type = $_POST['post_type'];
    17291729
    1730         check_ajax_referer('update-' . $post_type . '_' . $post_id, '_wpnonce');
     1730        check_ajax_referer('update-post_' . $post_id, '_wpnonce');
    17311731
    17321732        $post_id = edit_post();
    17331733
     
    17691769        if ( ! $post = get_post( $post_id ) )
    17701770                wp_die( 0 );
    17711771
    1772         check_ajax_referer( 'update-' . $post->post_type . '_' . $post_id );
     1772        check_ajax_referer( 'update-post_' . $post_id );
    17731773
    17741774        if ( ! current_user_can( 'edit_post', $post_id ) )
    17751775                wp_die( -1 );
  • wp-admin/includes/media.php

     
    11591159        if ( $send )
    11601160                $send = get_submit_button( __( 'Insert into Post' ), 'button', "send[$attachment_id]", false );
    11611161        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&amp;post=$attachment_id", 'delete-attachment_' . $attachment_id ) . "' id='del[$attachment_id]' class='delete'>" . __( 'Delete Permanently' ) . '</a>';
    1164                 } elseif ( !MEDIA_TRASH ) {
     1162                if ( !MEDIA_TRASH ) {
    11651163                        $delete = "<a href='#' class='del-link' onclick=\"document.getElementById('del_attachment_$attachment_id').style.display='block';return false;\">" . __( 'Delete' ) . "</a>
    11661164                         <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                          <a href='" . wp_nonce_url( "post.php?action=delete&amp;post=$attachment_id", 'delete-attachment_' . $attachment_id ) . "' id='del[$attachment_id]' class='button'>" . __( 'Continue' ) . "</a>
     1165                         <a href='" . wp_nonce_url( "post.php?action=delete&amp;post=$attachment_id", 'delete-post_' . $attachment_id ) . "' id='del[$attachment_id]' class='button'>" . __( 'Continue' ) . "</a>
    11681166                         <a href='#' class='button' onclick=\"this.parentNode.style.display='none';return false;\">" . __( 'Cancel' ) . "</a>
    11691167                         </div>";
    11701168                } else {
    1171                         $delete = "<a href='" . wp_nonce_url( "post.php?action=trash&amp;post=$attachment_id", 'trash-attachment_' . $attachment_id ) . "' id='del[$attachment_id]' class='delete'>" . __( 'Move to Trash' ) . "</a>
    1172                         <a href='" . wp_nonce_url( "post.php?action=untrash&amp;post=$attachment_id", 'untrash-attachment_' . $attachment_id ) . "' id='undo[$attachment_id]' class='undo hidden'>" . __( 'Undo' ) . "</a>";
     1169                        $delete = "<a href='" . wp_nonce_url( "post.php?action=trash&amp;post=$attachment_id", 'trash-post_' . $attachment_id ) . "' id='del[$attachment_id]' class='delete'>" . __( 'Move to Trash' ) . "</a>
     1170                        <a href='" . wp_nonce_url( "post.php?action=untrash&amp;post=$attachment_id", 'untrash-post_' . $attachment_id ) . "' id='undo[$attachment_id]' class='undo hidden'>" . __( 'Undo' ) . "</a>";
    11731171                }
    11741172        } else {
    11751173                $delete = '';
  • wp-admin/post.php

     
    177177        break;
    178178
    179179case 'editattachment':
    180         check_admin_referer('update-attachment_' . $post_id);
     180        check_admin_referer('update-post_' . $post_id);
    181181
    182182        // Don't let these be changed
    183183        unset($_POST['guid']);
     
    190190        wp_update_attachment_metadata( $post_id, $newmeta );
    191191
    192192case 'editpost':
    193         check_admin_referer('update-' . $post_type . '_' . $post_id);
     193        check_admin_referer('update-post_' . $post_id);
    194194
    195195        $post_id = edit_post();
    196196
     
    200200        break;
    201201
    202202case 'trash':
    203         check_admin_referer('trash-' . $post_type . '_' . $post_id);
     203        check_admin_referer('trash-post_' . $post_id);
    204204
    205205        $post = & get_post($post_id);
    206206
     
    215215        break;
    216216
    217217case 'untrash':
    218         check_admin_referer('untrash-' . $post_type . '_' . $post_id);
     218        check_admin_referer('untrash-post_' . $post_id);
    219219
    220220        if ( !current_user_can($post_type_object->cap->delete_post, $post_id) )
    221221                wp_die( __('You are not allowed to move this item out of the Trash.') );
     
    228228        break;
    229229
    230230case 'delete':
    231         check_admin_referer('delete-' . $post_type . '_' . $post_id);
     231        check_admin_referer('delete-post_' . $post_id);
    232232
    233233        if ( !current_user_can($post_type_object->cap->delete_post, $post_id) )
    234234                wp_die( __('You are not allowed to delete this item.') );
  • wp-admin/edit-form-advanced.php

     
    8383}
    8484
    8585$form_action = 'editpost';
    86 $nonce_action = 'update-' . $post_type . '_' . $post_ID;
     86$nonce_action = 'update-post_' . $post_ID;
    8787$form_extra .= "<input type='hidden' id='post_ID' name='post_ID' value='" . esc_attr($post_ID) . "' />";
    8888
    8989// Detect if there exists an autosave newer than the post and if that autosave is different than the post