Fix autosave redirects

git-svn-id: https://develop.svn.wordpress.org/trunk@4088 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren
2006-08-11 19:13:00 +00:00
parent 89c450981a
commit 8988c209e9
4 changed files with 75 additions and 31 deletions

View File

@@ -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