WordPress.org

Make WordPress Core


Ignore:
Timestamp:
03/27/2008 01:48:22 AM (14 years ago)
Author:
ryan
Message:

Media edit and delete redirect fixes. WIP.

File:
1 edited

Legend:

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

    r7485 r7542  
    1919    }
    2020
    21     $sendback = wp_get_referer();
    22     if (strpos($sendback, 'media.php') !== false) $sendback = get_option('siteurl') .'/wp-admin/media.php';
    23     $sendback = preg_replace('|[^a-z0-9-~+_.?#=&;,/:]|i', '', $sendback);
    24 
    25     wp_redirect($sendback);
    26     exit();
     21    $location = 'upload.php';
     22    if ( $referer = wp_get_referer() ) {
     23        if ( false !== strpos($referer, 'upload.php') )
     24            $location = $referer;
     25    }
     26
     27    $location = add_query_arg('message', 2, $location);
     28    $location = remove_query_arg('posted', $location);
     29    wp_redirect($location);
     30    exit;
    2731} elseif ( !empty($_GET['_wp_http_referer']) ) {
    2832    wp_redirect(remove_query_arg(array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI'])));
     
    108112<?php
    109113if ( isset($_GET['posted']) && $_GET['posted'] ) : $_GET['posted'] = (int) $_GET['posted']; ?>
    110 <div id="message" class="updated fade"><p><strong><?php _e('Your post has been saved.'); ?></strong> <a href="<?php echo get_permalink( $_GET['posted'] ); ?>"><?php _e('View post'); ?></a> | <a href="post.php?action=edit&amp;post=<?php echo $_GET['posted']; ?>"><?php _e('Edit post'); ?></a></p></div>
     114<div id="message" class="updated fade"><p><strong><?php _e('Your media has been saved.'); ?></strong> <a href="<?php echo get_permalink( $_GET['posted'] ); ?>"><?php _e('View media'); ?></a> | <a href="media.php?action=edit&amp;attachment_id=<?php echo $_GET['posted']; ?>"><?php _e('Edit media'); ?></a></p></div>
    111115<?php $_SERVER['REQUEST_URI'] = remove_query_arg(array('posted'), $_SERVER['REQUEST_URI']);
     116endif;
     117
     118$messages[1] = __('Media updated.');
     119$messages[2] = __('Media deleted.');
     120
     121if (isset($_GET['message'])) : ?>
     122<div id="message" class="updated fade"><p><?php echo $messages[$_GET['message']]; ?></p></div>
     123<?php $_SERVER['REQUEST_URI'] = remove_query_arg(array('message'), $_SERVER['REQUEST_URI']);
    112124endif;
    113125?>
Note: See TracChangeset for help on using the changeset viewer.