diff options
author | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2008-04-04 16:44:15 +0000 |
---|---|---|
committer | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2008-04-04 16:44:15 +0000 |
commit | 7740e89de3e1bc0cc636120e3ca8ab9e97e4d3cc (patch) | |
tree | c6fd23b598f3994eddb18cb1c0f2e8d95ff054fa /wp-admin/media.php | |
parent | f650f48c048bfbbb2ae702b6425d87e39358d748 (diff) | |
download | wordpress-mu-7740e89de3e1bc0cc636120e3ca8ab9e97e4d3cc.tar.gz wordpress-mu-7740e89de3e1bc0cc636120e3ca8ab9e97e4d3cc.tar.xz wordpress-mu-7740e89de3e1bc0cc636120e3ca8ab9e97e4d3cc.zip |
Merged with WordPress 2.5, unstable, only for testing
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@1218 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-admin/media.php')
-rw-r--r-- | wp-admin/media.php | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/wp-admin/media.php b/wp-admin/media.php index bd64104..b280d3a 100644 --- a/wp-admin/media.php +++ b/wp-admin/media.php @@ -8,15 +8,25 @@ $submenu_file = 'upload.php'; wp_reset_vars(array('action')); switch( $action ) : -case 'upload' : -case 'delete' : break; // stubs case 'editattachment' : $errors = media_upload_form_handler(); + $attachment_id = (int) $_POST['attachment_id']; if ( empty($errors) ) { - wp_redirect( add_query_arg( 'message', 'updated' ) ); + $location = 'media.php'; + if ( $referer = wp_get_original_referer() ) { + if ( false !== strpos($referer, 'upload.php') || ( url_to_postid($referer) == $attachment_id ) ) + $location = $referer; + } + if ( false !== strpos($location, 'upload.php') ) { + $location = remove_query_arg('message', $location); + $location = add_query_arg('posted', $attachment_id, $location); + } elseif ( false !== strpos($location, 'media.php') ) { + $location = add_query_arg('message', 'updated', $location); + } + wp_redirect($location); exit; - break; } + // no break case 'edit' : $title = __('Edit Media'); @@ -67,7 +77,9 @@ case 'edit' : <p class="submit"> <input type="submit" class="button" name="save" value="<?php _e('Save Changes'); ?>" /> <input type="hidden" name="post_id" id="post_id" value="<?php echo $post_id; ?>" /> +<input type="hidden" name="attachment_id" id="attachment_id" value="<?php echo $att_id; ?>" /> <input type="hidden" name="action" value="editattachment" /> +<?php wp_original_referer_field(true, 'previous'); ?> <?php wp_nonce_field('media-form'); ?> </p> @@ -78,10 +90,13 @@ case 'edit' : require( 'admin-footer.php' ); - break; + exit; + +default: + wp_redirect( 'upload.php' ); + exit; + endswitch; -wp_redirect( 'upload.php' ); -exit; ?> |