WordPress.org

Make WordPress Core

Changeset 19272


Ignore:
Timestamp:
11/14/2011 04:59:45 PM (7 years ago)
Author:
ryan
Message:

Fix edit.php row action redirects when referrers are not sent. Return false from wp_get_referer() when no referrer found. Props mitchoyoshitaka. fixes #17628

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/edit.php

    r19259 r19272  
    5252
    5353    $sendback = remove_query_arg( array('trashed', 'untrashed', 'deleted', 'ids'), wp_get_referer() );
     54    if ( ! $sendback )
     55        $sendback = admin_url( $parent_file );
    5456    $sendback = add_query_arg( 'paged', $pagenum, $sendback );
    5557    if ( strpos($sendback, 'post.php') !== false )
  • trunk/wp-admin/post.php

    r19093 r19272  
    8383
    8484$sendback = wp_get_referer();
    85 if ( strpos($sendback, 'post.php') !== false || strpos($sendback, 'post-new.php') !== false ) {
    86     $sendback = admin_url('edit.php');
    87     $sendback .= ( !empty( $post_type ) ) ? '?post_type=' . $post_type : '';
     85if ( ! $sendback ||
     86     strpos( $sendback, 'post.php' ) !== false ||
     87     strpos( $sendback, 'post-new.php' ) !== false ) {
     88    $sendback = admin_url( 'edit.php' );
     89    $sendback .= ( ! empty( $post_type ) ) ? '?post_type=' . $post_type : '';
    8890} else {
    8991    $sendback = remove_query_arg( array('trashed', 'untrashed', 'deleted', 'ids'), $sendback );
  • trunk/wp-includes/functions.php

    r19203 r19272  
    20382038
    20392039/**
    2040  * Retrieve referer from '_wp_http_referer', HTTP referer, or current page respectively.
     2040 * Retrieve referer from '_wp_http_referer' or HTTP referer. If it's the same
     2041 * as the current request URL, will return false.
    20412042 *
    20422043 * @package WordPress
     
    20472048 */
    20482049function wp_get_referer() {
    2049     $ref = '';
     2050    $ref = false;
    20502051    if ( ! empty( $_REQUEST['_wp_http_referer'] ) )
    20512052        $ref = $_REQUEST['_wp_http_referer'];
     
    20532054        $ref = $_SERVER['HTTP_REFERER'];
    20542055
    2055     if ( $ref !== $_SERVER['REQUEST_URI'] )
     2056    if ( $ref && $ref !== $_SERVER['REQUEST_URI'] )
    20562057        return $ref;
    20572058    return false;
Note: See TracChangeset for help on using the changeset viewer.