From f8efc5c8376a1df750166c0202ccd1bf9fb4d60e Mon Sep 17 00:00:00 2001 From: saxmatt Date: Mon, 14 Feb 2005 09:46:08 +0000 Subject: [PATCH] Redirect to the right place - http://mosquito.wordpress.org/view.php?id=510 git-svn-id: http://svn.automattic.com/wordpress/trunk@2333 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/edit-page-form.php | 9 ++++++++- wp-admin/post.php | 32 +++++++++++++++++--------------- 2 files changed, 25 insertions(+), 16 deletions(-) diff --git a/wp-admin/edit-page-form.php b/wp-admin/edit-page-form.php index b2fa722140..dcd6119e28 100644 --- a/wp-admin/edit-page-form.php +++ b/wp-admin/edit-page-form.php @@ -9,6 +9,13 @@ if (0 == $post_ID) { $form_action = 'editpost'; $form_extra = ""; } + +$sendto = $_SERVER['HTTP_REFERER']; + +if ( $sendto == get_permalink($post) ) + $sendto = 'redo'; +$sendto = wp_specialchars( $sendto ); + ?>
@@ -79,7 +86,7 @@ edCanvas = document.getElementById('content');

- +

diff --git a/wp-admin/post.php b/wp-admin/post.php index 0f63d87505..568a4b22fe 100644 --- a/wp-admin/post.php +++ b/wp-admin/post.php @@ -342,21 +342,8 @@ case 'editpost': $datemodif_gmt = ''; } - if ($_POST['save']) { - $location = $_SERVER['HTTP_REFERER']; - } elseif ($_POST['updatemeta']) { - $location = $_SERVER['HTTP_REFERER'] . '&message=2#postcustom'; - } elseif ($_POST['deletemeta']) { - $location = $_SERVER['HTTP_REFERER'] . '&message=3#postcustom'; - } elseif (isset($_POST['referredby']) && $_POST['referredby'] != $_SERVER['HTTP_REFERER']) { - $location = $_POST['referredby']; - } else { - $location = 'post.php'; - } - header ('Location: ' . $location); // Send user on their way while we keep working - - $now = current_time('mysql'); - $now_gmt = current_time('mysql', 1); + $now = current_time('mysql'); + $now_gmt = current_time('mysql', 1); $result = $wpdb->query(" UPDATE $wpdb->posts SET @@ -378,6 +365,21 @@ case 'editpost': post_parent = '$post_parent' WHERE ID = $post_ID "); + if ($_POST['save']) { + $location = $_SERVER['HTTP_REFERER']; + } elseif ($_POST['updatemeta']) { + $location = $_SERVER['HTTP_REFERER'] . '&message=2#postcustom'; + } elseif ($_POST['deletemeta']) { + $location = $_SERVER['HTTP_REFERER'] . '&message=3#postcustom'; + } elseif (isset($_POST['referredby']) && $_POST['referredby'] != $_SERVER['HTTP_REFERER']) { + $location = $_POST['referredby']; + if ( $_POST['referredby'] == 'redo' ) + $location = get_permalink( $post_ID ); + } else { + $location = 'post.php'; + } + header ('Location: ' . $location); // Send user on their way while we keep working + // Meta Stuff if ($_POST['meta']) : foreach ($_POST['meta'] as $key => $value) :