Fix autosave redirects

git-svn-id: http://svn.automattic.com/wordpress/trunk@4088 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2006-08-11 19:13:00 +00:00
parent 83665b2bf5
commit a458715afa
4 changed files with 75 additions and 31 deletions

View File

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

View File

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

View File

@ -85,6 +85,26 @@ case 'editpost':
$page_ID = edit_post();
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 {
if ($_POST['save']) {
$location = "page.php?action=edit&post=$page_ID";
} elseif ($_POST['updatemeta']) {
@ -100,6 +120,7 @@ case 'editpost':
} else {
$location = 'page-new.php';
}
}
wp_redirect($location); // Send user on their way while we keep working
exit();

View File

@ -92,6 +92,26 @@ case 'editpost':
$post_ID = edit_post();
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 {
$referredby = '';
if ( !empty($_POST['referredby']) )
$referredby = preg_replace('|https?://[^/]+|i', '', $_POST['referredby']);
@ -112,6 +132,7 @@ case 'editpost':
} else {
$location = 'post-new.php';
}
}
wp_redirect($location); // Send user on their way while we keep working