Make WordPress Core

Changeset 12312


Ignore:
Timestamp:
12/01/2009 11:28:20 PM (12 years ago)
Author:
azaozz
Message:

Fix multiple confirmation messages when restoring posts and pages from the trash, props caesarsgrunt, see #4529

Location:
trunk/wp-admin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/page.php

    r12260 r12312  
    7373    $action = 'preview';
    7474
     75$sendback = wp_get_referer();
     76if ( strpos($sendback, 'page.php') !== false || strpos($sendback, 'page-new.php') !== false )
     77    $sendback = admin_url('edit-pages.php');
     78else
     79    $sendback = remove_query_arg( array('trashed', 'untrashed', 'deleted', 'ids'), $sendback );
     80
    7581switch($action) {
    7682case 'post':
     
    157163        wp_die( __('Error in moving to trash...') );
    158164
    159     $sendback = remove_query_arg( array('trashed', 'untrashed', 'deleted', 'ids'), wp_get_referer() );
    160     if ( strpos($sendback, 'page.php') !== false || strpos($sendback, 'page-new.php') !== false )
    161         $sendback = admin_url('edit-pages.php?trashed=1&ids='.$post_id);
    162     else
    163         $sendback = add_query_arg( array('trashed' => 1, 'ids' => $post_id), $sendback );
    164 
    165     wp_redirect($sendback);
     165    wp_redirect( add_query_arg( array('trashed' => 1, 'ids' => $post_id), $sendback ) );
    166166    exit();
    167167    break;
     
    179179        wp_die( __('Error in restoring from trash...') );
    180180
    181     $sendback = wp_get_referer();
    182     if ( strpos($sendback, 'page.php') !== false )
    183         $sendback = admin_url('edit-pages.php?untrashed=1');
    184     else
    185         $sendback = add_query_arg('untrashed', 1, $sendback);
    186 
    187     wp_redirect($sendback);
     181    wp_redirect( add_query_arg('untrashed', 1, $sendback) );
    188182    exit();
    189183    break;
     
    206200    }
    207201
    208     $sendback = wp_get_referer();
    209     if ( strpos($sendback, 'page.php') !== false )
    210         $sendback = admin_url('edit-pages.php?deleted=1');
    211     else
    212         $sendback = add_query_arg('deleted', 1, $sendback);
    213 
    214     wp_redirect($sendback);
     202    wp_redirect( add_query_arg('deleted', 1, $sendback) );
    215203    exit();
    216204    break;
  • trunk/wp-admin/post.php

    r12260 r12312  
    7878    $action = 'preview';
    7979
     80$sendback = wp_get_referer();
     81if ( strpos($sendback, 'post.php') !== false || strpos($sendback, 'post-new.php') !== false )
     82    $sendback = admin_url('edit.php');
     83else
     84    $sendback = remove_query_arg( array('trashed', 'untrashed', 'deleted', 'ids'), $sendback );
     85
    8086switch($action) {
    8187case 'postajaxpost':
     
    197203        wp_die( __('Error in moving to trash...') );
    198204
    199     $sendback = remove_query_arg( array('trashed', 'untrashed', 'deleted', 'ids'), wp_get_referer() );
    200     if ( strpos($sendback, 'post.php') !== false || strpos($sendback, 'post-new.php') !== false )
    201         $sendback = admin_url('edit.php?trashed=1&ids='.$post_id);
    202     else
    203         $sendback = add_query_arg( array('trashed' => 1, 'ids' => $post_id), $sendback );
    204 
    205     wp_redirect($sendback);
     205    wp_redirect( add_query_arg( array('trashed' => 1, 'ids' => $post_id), $sendback ) );
    206206    exit();
    207207    break;
     
    219219        wp_die( __('Error in restoring from trash...') );
    220220
    221     $sendback = wp_get_referer();
    222     if ( strpos($sendback, 'post.php') !== false )
    223         $sendback = admin_url('edit.php?untrashed=1');
    224     else
    225         $sendback = add_query_arg('untrashed', 1, $sendback);
    226 
    227     wp_redirect($sendback);
     221    wp_redirect( add_query_arg('untrashed', 1, $sendback) );
    228222    exit();
    229223    break;
     
    246240    }
    247241
    248     $sendback = wp_get_referer();
    249     if ( strpos($sendback, 'post.php') !== false )
    250         $sendback = admin_url('edit.php?deleted=1');
    251     else
    252         $sendback = add_query_arg('deleted', 1, $sendback);
    253 
    254     wp_redirect($sendback);
     242    wp_redirect( add_query_arg('deleted', 1, $sendback) );
    255243    exit();
    256244    break;
Note: See TracChangeset for help on using the changeset viewer.