WordPress.org

Make WordPress Core

Ticket #25239: 25239.diff

File 25239.diff, 3.4 KB (added by jesin, 6 years ago)

Refreshed server_name.diff and corrected minor errors

  • wp-includes/ms-functions.php

     
    828828
    829829        $activate_url = esc_url($activate_url);
    830830        $admin_email = get_site_option( 'admin_email' );
    831         if ( $admin_email == '' )
    832                 $admin_email = 'support@' . $_SERVER['SERVER_NAME'];
     831        if ( $admin_email == '' ) {
     832                global $current_site;
     833                $admin_email = 'support@' . $current_site->domain;
     834        }
    833835        $from_name = get_site_option( 'site_name' ) == '' ? 'WordPress' : esc_html( get_site_option( 'site_name' ) );
    834836        $message_headers = "From: \"{$from_name}\" <{$admin_email}>\n" . "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n";
    835837        $message = sprintf(
     
    921923
    922924        // Send email with activation link.
    923925        $admin_email = get_site_option( 'admin_email' );
    924         if ( $admin_email == '' )
    925                 $admin_email = 'support@' . $_SERVER['SERVER_NAME'];
     926        if ( $admin_email == '' ) {
     927                global $current_site;
     928                $admin_email = 'support@' . $current_site->domain;
     929        }
    926930        $from_name = get_site_option( 'site_name' ) == '' ? 'WordPress' : esc_html( get_site_option( 'site_name' ) );
    927931        $message_headers = "From: \"{$from_name}\" <{$admin_email}>\n" . "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n";
    928932        $message = sprintf(
     
    15041508        $admin_email = get_site_option( 'admin_email' );
    15051509
    15061510        if ( $admin_email == '' )
    1507                 $admin_email = 'support@' . $_SERVER['SERVER_NAME'];
     1511                $admin_email = 'support@' . $current_site->domain;
    15081512
    15091513        $from_name = get_site_option( 'site_name' ) == '' ? 'WordPress' : esc_html( get_site_option( 'site_name' ) );
    15101514        $message_headers = "From: \"{$from_name}\" <{$admin_email}>\n" . "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n";
     
    15821586        $admin_email = get_site_option( 'admin_email' );
    15831587
    15841588        if ( $admin_email == '' )
    1585                 $admin_email = 'support@' . $_SERVER['SERVER_NAME'];
     1589                $admin_email = 'support@' . $current_site->domain;
    15861590
    15871591        $from_name = get_site_option( 'site_name' ) == '' ? 'WordPress' : esc_html( get_site_option( 'site_name' ) );
    15881592        $message_headers = "From: \"{$from_name}\" <{$admin_email}>\n" . "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n";
  • wp-includes/pluggable.php

     
    365365
    366366        if ( !isset( $from_email ) ) {
    367367                // Get the site domain and get rid of www.
    368                 $sitename = strtolower( $_SERVER['SERVER_NAME'] );
     368                if ( is_multisite() ) {
     369                        global $current_blog;
     370                        $sitename = $current_blog->domain;
     371                } else {
     372                        $sitename = parse_url( home_url(), PHP_URL_HOST );
     373                }
    369374                if ( substr( $sitename, 0, 4 ) == 'www.' ) {
    370375                        $sitename = substr( $sitename, 4 );
    371376                }
     
    13901395                $notify_message .= sprintf( __('Spam it: %s'), admin_url("comment.php?action=spam&c=$comment_id") ) . "\r\n";
    13911396        }
    13921397
    1393         $wp_email = 'wordpress@' . preg_replace('#^www\.#', '', strtolower($_SERVER['SERVER_NAME']));
     1398        if ( is_multisite() ) {
     1399                global $current_blog;
     1400                $sitename = $current_blog->domain;
     1401        } else {
     1402                $sitename = parse_url( home_url(), PHP_URL_HOST );
     1403        }
     1404        $wp_email = 'wordpress@' . preg_replace( '#^www\.#', '', $sitename );
    13941405
    13951406        if ( '' == $comment->comment_author ) {
    13961407                $from = "From: \"$blogname\" <$wp_email>";