Post and page edit redirect fixes. fixes #6720 for trunk

git-svn-id: http://svn.automattic.com/wordpress/trunk@7759 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2008-04-21 17:54:56 +00:00
parent 8d6d1af393
commit 23fd331b4a
2 changed files with 7 additions and 2 deletions

View File

@ -8,8 +8,10 @@ wp_reset_vars(array('action'));
function redirect_page($page_ID) {
$referredby = '';
if ( !empty($_POST['referredby']) )
if ( !empty($_POST['referredby']) ) {
$referredby = preg_replace('|https?://[^/]+|i', '', $_POST['referredby']);
$referredby = remove_query_arg('_wp_original_http_referer', $referredby);
}
$referer = preg_replace('|https?://[^/]+|i', '', wp_get_referer());
if ( 'post' == $_POST['originalaction'] && !empty($_POST['mode']) && 'bookmarklet' == $_POST['mode'] ) {
@ -31,6 +33,7 @@ function redirect_page($page_ID) {
$location = $location[0] . '#postcustom';
} elseif (!empty($referredby) && $referredby != $referer) {
$location = $_POST['referredby'];
$location = remove_query_arg('_wp_original_http_referer', $location);
if ( $_POST['referredby'] == 'redo' )
$location = get_permalink( $page_ID );
elseif ( false !== strpos($location, 'edit-pages.php') )

View File

@ -10,8 +10,10 @@ function redirect_post($post_ID = '') {
global $action;
$referredby = '';
if ( !empty($_POST['referredby']) )
if ( !empty($_POST['referredby']) ) {
$referredby = preg_replace('|https?://[^/]+|i', '', $_POST['referredby']);
$referredby = remove_query_arg('_wp_original_http_referer', $referredby);
}
$referer = preg_replace('|https?://[^/]+|i', '', wp_get_referer());
if ( !empty($_POST['mode']) && 'bookmarklet' == $_POST['mode'] ) {