Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/wp-admin/includes/class-wp-list-table.php
Original file line number Diff line number Diff line change
Expand Up @@ -979,7 +979,7 @@ protected function pagination( $which ) {
$current = $this->get_pagenum();
$removable_query_args = wp_removable_query_args();

$current_url = set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
$current_url = network_home_url( $_SERVER['REQUEST_URI'] );

$current_url = remove_query_arg( $removable_query_args, $current_url );

Expand Down Expand Up @@ -1289,7 +1289,7 @@ public function get_column_count() {
public function print_column_headers( $with_id = true ) {
list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info();

$current_url = set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
$current_url = network_home_url( $_SERVER['REQUEST_URI'] );
$current_url = remove_query_arg( 'paged', $current_url );

if ( isset( $_GET['orderby'] ) ) {
Expand Down
2 changes: 1 addition & 1 deletion src/wp-admin/includes/misc.php
Original file line number Diff line number Diff line change
Expand Up @@ -1396,7 +1396,7 @@ function wp_admin_canonical_url() {
}

// Ensure we're using an absolute URL.
$current_url = set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
$current_url = network_home_url( $_SERVER['REQUEST_URI'] );
$filtered_url = remove_query_arg( $removable_query_args, $current_url );
?>
<link id="wp-admin-canonical" rel="canonical" href="<?php echo esc_url( $filtered_url ); ?>" />
Expand Down
2 changes: 1 addition & 1 deletion src/wp-includes/admin-bar.php
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ function wp_admin_bar_customize_menu( $wp_admin_bar ) {
return;
}

$current_url = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
$current_url = network_home_url( $_SERVER['REQUEST_URI'] );
if ( is_customize_preview() && $wp_customize->changeset_uuid() ) {
$current_url = remove_query_arg( 'customize_changeset_uuid', $current_url );
}
Expand Down
2 changes: 1 addition & 1 deletion src/wp-includes/blocks/loginout.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
function render_block_core_loginout( $attributes ) {

// Build the redirect URL.
$current_url = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
$current_url = network_home_url( $_SERVER['REQUEST_URI'] );

$classes = is_user_logged_in() ? 'logged-in' : 'logged-out';
$contents = wp_loginout(
Expand Down
6 changes: 2 additions & 4 deletions src/wp-includes/canonical.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,9 @@ function redirect_canonical( $requested_url = null, $do_redirect = true ) {
return;
}

if ( ! $requested_url && isset( $_SERVER['HTTP_HOST'] ) ) {
if ( ! $requested_url ) {
// Build the URL in the address bar.
$requested_url = is_ssl() ? 'https://' : 'http://';
$requested_url .= $_SERVER['HTTP_HOST'];
$requested_url .= $_SERVER['REQUEST_URI'];
$requested_url = network_home_url( $_SERVER['REQUEST_URI'] );
}

$original = parse_url( $requested_url );
Expand Down
2 changes: 1 addition & 1 deletion src/wp-includes/class-wp-recovery-mode.php
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ protected function redirect_protected() {

$scheme = is_ssl() ? 'https://' : 'http://';

$url = "{$scheme}{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}";
$url = network_home_url( $_SERVER['REQUEST_URI'] );
wp_safe_redirect( $url );
exit;
}
Expand Down
2 changes: 1 addition & 1 deletion src/wp-includes/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -7182,7 +7182,7 @@ function wp_auth_check_load() {
*/
function wp_auth_check_html() {
$login_url = wp_login_url();
$current_domain = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'];
$current_domain = network_home_url();
$same_domain = ( strpos( $login_url, $current_domain ) === 0 );

/**
Expand Down
2 changes: 1 addition & 1 deletion src/wp-includes/general-template.php
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ function wp_login_form( $args = array() ) {
$defaults = array(
'echo' => true,
// Default 'redirect' value takes the user back to the request URI.
'redirect' => ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'],
'redirect' => network_home_url( $_SERVER['REQUEST_URI'] ),
'form_id' => 'loginform',
'label_username' => __( 'Username or Email Address' ),
'label_password' => __( 'Password' ),
Expand Down
4 changes: 2 additions & 2 deletions src/wp-includes/nav-menu-template.php
Original file line number Diff line number Diff line change
Expand Up @@ -469,15 +469,15 @@ function _wp_menu_item_classes_by_context( &$menu_items ) {
$active_parent_item_ids[] = (int) $menu_item->menu_item_parent;

// If the menu item corresponds to the currently requested URL.
} elseif ( 'custom' === $menu_item->object && isset( $_SERVER['HTTP_HOST'] ) ) {
} elseif ( 'custom' === $menu_item->object ) {
$_root_relative_current = untrailingslashit( $_SERVER['REQUEST_URI'] );

// If it's the customize page then it will strip the query var off the URL before entering the comparison block.
if ( is_customize_preview() ) {
$_root_relative_current = strtok( untrailingslashit( $_SERVER['REQUEST_URI'] ), '?' );
}

$current_url = set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_root_relative_current );
$current_url = network_home_url( $_root_relative_current );
$raw_item_url = strpos( $menu_item->url, '#' ) ? substr( $menu_item->url, 0, strpos( $menu_item->url, '#' ) ) : $menu_item->url;
$item_url = set_url_scheme( untrailingslashit( $raw_item_url ) );
$_indexless_current = untrailingslashit( preg_replace( '/' . preg_quote( $wp_rewrite->index, '/' ) . '$/', '', $current_url ) );
Expand Down
21 changes: 6 additions & 15 deletions src/wp-includes/pluggable.php
Original file line number Diff line number Diff line change
Expand Up @@ -1186,14 +1186,10 @@ function auth_redirect() {
$secure = apply_filters( 'secure_auth_redirect', $secure );

// If https is required and request is http, redirect.
wp_redirect(network_home_url( $_SERVER['REQUEST_URI'] ));
if ( $secure && ! is_ssl() && false !== strpos( $_SERVER['REQUEST_URI'], 'wp-admin' ) ) {
if ( 0 === strpos( $_SERVER['REQUEST_URI'], 'http' ) ) {
wp_redirect( set_url_scheme( $_SERVER['REQUEST_URI'], 'https' ) );
exit;
} else {
wp_redirect( 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
exit;
}
wp_redirect(network_home_url( $_SERVER['REQUEST_URI'] ));
exit;
}

/**
Expand All @@ -1218,13 +1214,8 @@ function auth_redirect() {

// If the user wants ssl but the session is not ssl, redirect.
if ( ! $secure && get_user_option( 'use_ssl', $user_id ) && false !== strpos( $_SERVER['REQUEST_URI'], 'wp-admin' ) ) {
if ( 0 === strpos( $_SERVER['REQUEST_URI'], 'http' ) ) {
wp_redirect( set_url_scheme( $_SERVER['REQUEST_URI'], 'https' ) );
exit;
} else {
wp_redirect( 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
exit;
}
wp_redirect(network_home_url( $_SERVER['REQUEST_URI'] ));
exit;
}

return; // The cookie is good, so we're done.
Expand All @@ -1233,7 +1224,7 @@ function auth_redirect() {
// The cookie is no good, so force login.
nocache_headers();

$redirect = ( strpos( $_SERVER['REQUEST_URI'], '/options.php' ) && wp_get_referer() ) ? wp_get_referer() : set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
$redirect = ( strpos( $_SERVER['REQUEST_URI'], '/options.php' ) && wp_get_referer() ) ? wp_get_referer() : network_home_url( $_SERVER['REQUEST_URI'] );

$login_url = wp_login_url( $redirect, true );

Expand Down
6 changes: 3 additions & 3 deletions src/wp-login.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
// Redirect to HTTPS login if forced to use SSL.
if ( force_ssl_admin() && ! is_ssl() ) {
if ( 0 === strpos( $_SERVER['REQUEST_URI'], 'http' ) ) {
wp_safe_redirect( set_url_scheme( $_SERVER['REQUEST_URI'], 'https' ) );
wp_safe_redirect( network_home_url( $_SERVER['REQUEST_URI'], 'https' ) );
exit;
} else {
wp_safe_redirect( 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
wp_safe_redirect( network_home_url( $_SERVER['REQUEST_URI'] ) );
exit;
}
}
Expand Down Expand Up @@ -475,7 +475,7 @@ function wp_login_viewport_meta() {
$_SERVER['PHP_SELF'] = str_replace( $_SERVER['PATH_INFO'], '', $_SERVER['PHP_SELF'] );
}

$url = dirname( set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'] ) );
$url = dirname( network_home_url( $_SERVER['PHP_SELF'] ) );

if ( get_option( 'siteurl' ) !== $url ) {
update_option( 'siteurl', $url );
Expand Down
1 change: 1 addition & 0 deletions wordpress-importer
Submodule wordpress-importer added at 99462e