From 8988c209e92502b79a5e19f54bbb164c6dbd40b5 Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Fri, 11 Aug 2006 19:13:00 +0000 Subject: [PATCH] Fix autosave redirects git-svn-id: https://develop.svn.wordpress.org/trunk@4088 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/edit-form-advanced.php | 1 + wp-admin/edit-page-form.php | 1 + wp-admin/page.php | 47 +++++++++++++++++++-------- wp-admin/post.php | 57 ++++++++++++++++++++++----------- 4 files changed, 75 insertions(+), 31 deletions(-) diff --git a/wp-admin/edit-form-advanced.php b/wp-admin/edit-form-advanced.php index 29ac70b7ac..c01b59f9e7 100644 --- a/wp-admin/edit-form-advanced.php +++ b/wp-admin/edit-form-advanced.php @@ -52,6 +52,7 @@ if (empty($post->post_status)) $post->post_status = 'draft'; + diff --git a/wp-admin/edit-page-form.php b/wp-admin/edit-page-form.php index 3999276921..24b402a6ff 100644 --- a/wp-admin/edit-page-form.php +++ b/wp-admin/edit-page-form.php @@ -33,6 +33,7 @@ if (isset($mode) && 'bookmarklet' == $mode) { ?> + diff --git a/wp-admin/page.php b/wp-admin/page.php index 018295150c..79fc6e7c6f 100644 --- a/wp-admin/page.php +++ b/wp-admin/page.php @@ -85,20 +85,41 @@ case 'editpost': $page_ID = edit_post(); - if ($_POST['save']) { - $location = "page.php?action=edit&post=$page_ID"; - } elseif ($_POST['updatemeta']) { - $location = wp_get_referer() . '&message=2#postcustom'; - } elseif ($_POST['deletemeta']) { - $location = wp_get_referer() . '&message=3#postcustom'; - } elseif (!empty($_POST['referredby']) && $_POST['referredby'] != wp_get_referer()) { - $location = $_POST['referredby']; - if ( $_POST['referredby'] == 'redo' ) - $location = get_permalink( $page_ID ); - } elseif ($action == 'editattachment') { - $location = 'attachments.php'; + if ( 'post' == $_POST['originalaction'] ) { + if (!empty($_POST['mode'])) { + switch($_POST['mode']) { + case 'bookmarklet': + $location = $_POST['referredby']; + break; + case 'sidebar': + $location = 'sidebar.php?a=b'; + break; + default: + $location = 'page-new.php'; + break; + } + } else { + $location = 'page-new.php?posted=true'; + } + + if ( isset($_POST['save']) ) + $location = "page.php?action=edit&post=$page_ID"; } else { - $location = 'page-new.php'; + if ($_POST['save']) { + $location = "page.php?action=edit&post=$page_ID"; + } elseif ($_POST['updatemeta']) { + $location = wp_get_referer() . '&message=2#postcustom'; + } elseif ($_POST['deletemeta']) { + $location = wp_get_referer() . '&message=3#postcustom'; + } elseif (!empty($_POST['referredby']) && $_POST['referredby'] != wp_get_referer()) { + $location = $_POST['referredby']; + if ( $_POST['referredby'] == 'redo' ) + $location = get_permalink( $page_ID ); + } elseif ($action == 'editattachment') { + $location = 'attachments.php'; + } else { + $location = 'page-new.php'; + } } wp_redirect($location); // Send user on their way while we keep working diff --git a/wp-admin/post.php b/wp-admin/post.php index bc998c7a9f..0ba14e4a76 100644 --- a/wp-admin/post.php +++ b/wp-admin/post.php @@ -92,25 +92,46 @@ case 'editpost': $post_ID = edit_post(); - $referredby = ''; - if ( !empty($_POST['referredby']) ) - $referredby = preg_replace('|https?://[^/]+|i', '', $_POST['referredby']); - $referer = preg_replace('|https?://[^/]+|i', '', wp_get_referer()); - - if ($_POST['save']) { - $location = "post.php?action=edit&post=$post_ID"; - } elseif ($_POST['updatemeta']) { - $location = wp_get_referer() . '&message=2#postcustom'; - } elseif ($_POST['deletemeta']) { - $location = wp_get_referer() . '&message=3#postcustom'; - } elseif (!empty($referredby) && $referredby != $referer) { - $location = $_POST['referredby']; - if ( $_POST['referredby'] == 'redo' ) - $location = get_permalink( $post_ID ); - } elseif ($action == 'editattachment') { - $location = 'attachments.php'; + if ( 'post' == $_POST['originalaction'] ) { + if (!empty($_POST['mode'])) { + switch($_POST['mode']) { + case 'bookmarklet': + $location = $_POST['referredby']; + break; + case 'sidebar': + $location = 'sidebar.php?a=b'; + break; + default: + $location = 'post-new.php'; + break; + } + } else { + $location = 'post-new.php?posted=true'; + } + + if ( isset($_POST['save']) ) + $location = "post.php?action=edit&post=$post_ID"; } else { - $location = 'post-new.php'; + $referredby = ''; + if ( !empty($_POST['referredby']) ) + $referredby = preg_replace('|https?://[^/]+|i', '', $_POST['referredby']); + $referer = preg_replace('|https?://[^/]+|i', '', wp_get_referer()); + + if ($_POST['save']) { + $location = "post.php?action=edit&post=$post_ID"; + } elseif ($_POST['updatemeta']) { + $location = wp_get_referer() . '&message=2#postcustom'; + } elseif ($_POST['deletemeta']) { + $location = wp_get_referer() . '&message=3#postcustom'; + } elseif (!empty($referredby) && $referredby != $referer) { + $location = $_POST['referredby']; + if ( $_POST['referredby'] == 'redo' ) + $location = get_permalink( $post_ID ); + } elseif ($action == 'editattachment') { + $location = 'attachments.php'; + } else { + $location = 'post-new.php'; + } } wp_redirect($location); // Send user on their way while we keep working