Fix autosave redirects
git-svn-id: http://svn.automattic.com/wordpress/trunk@4088 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
83665b2bf5
commit
a458715afa
|
@ -52,6 +52,7 @@ if (empty($post->post_status)) $post->post_status = 'draft';
|
|||
|
||||
<input type="hidden" name="user_ID" value="<?php echo $user_ID ?>" />
|
||||
<input type="hidden" id="hiddenaction" name="action" value="<?php echo $form_action ?>" />
|
||||
<input type="hidden" id="originalaction" name="originalaction" value="<?php echo $form_action ?>" />
|
||||
<input type="hidden" name="post_author" value="<?php echo $post->post_author ?>" />
|
||||
<input type="hidden" id="post_type" name="post_type" value="post" />
|
||||
|
||||
|
|
|
@ -33,6 +33,7 @@ if (isset($mode) && 'bookmarklet' == $mode) {
|
|||
?>
|
||||
<input type="hidden" name="user_ID" value="<?php echo $user_ID ?>" />
|
||||
<input type="hidden" id="hiddenaction" name="action" value='<?php echo $form_action ?>' />
|
||||
<input type="hidden" id="originalaction" name="originalaction" value="<?php echo $form_action ?>" />
|
||||
<?php echo $form_extra ?>
|
||||
<input type="hidden" id="post_type" name="post_type" value="page" />
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue