Ticket #2603: 2603.diff

File 2603.diff, 1.9 kB (added by Nazgul, 2 years ago)
  • wp-includes/pluggable.php

    old new  
    160160 
    161161if ( !function_exists('wp_mail') ) : 
    162162function wp_mail($to, $subject, $message, $headers = '') { 
     163        global $is_Windows, $is_Mac; 
     164         
     165        if ($is_Windows) { 
     166                $s_eol = "\r\n"; 
     167                $bad_eol_sequences = array("'\r[^\n]'","'[^\r]\n'");  
     168        } elseif ($is_Mac) { 
     169                $s_eol = "\r"; 
     170                $bad_eol_sequences = array("'\r\n'","'[^\r]\n'");  
     171        } else { 
     172                $s_eol = "\n"; 
     173                $bad_eol_sequences = array("'\r\n'","'\r[^\n]'");  
     174        } 
     175         
    163176        if( $headers == '' ) { 
    164                 $headers = "MIME-Version: 1.0\n"
    165                         "From: wordpress@" . preg_replace('#^www\.#', '', strtolower($_SERVER['SERVER_NAME'])) . "\n" .  
    166                         "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n"
     177                $headers = "MIME-Version: 1.0" . $s_eol
     178                        "From: wordpress@" . preg_replace('#^www\.#', '', strtolower($_SERVER['SERVER_NAME'])) . $s_eol .  
     179                        "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"" . $s_eol
    167180        } 
     181        else 
     182                $headers = preg_replace($bad_eol_sequences, $s_eol, $headers); 
     183         
     184        $message = preg_replace($bad_eol_sequences, $s_eol, $message); 
    168185 
    169186        return @mail($to, $subject, $message, $headers); 
    170187} 
  • wp-includes/vars.php

    old new  
    3434$is_apache = ( strstr($_SERVER['SERVER_SOFTWARE'], 'Apache') || strstr($_SERVER['SERVER_SOFTWARE'], 'LiteSpeed') ) ? 1 : 0; 
    3535$is_IIS = strstr($_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS') ? 1 : 0; 
    3636 
     37$is_Windows = 'WIN' == strtoupper(substr(PHP_OS, 0, 3) ? 1 : 0; 
     38$is_Mac = 'MAC' == strtoupper(substr(PHP_OS, 0, 3) ? 1 : 0; 
     39 
    3740// if the config file does not provide the smilies array, let's define it here 
    3841if (!isset($wpsmiliestrans)) { 
    3942        $wpsmiliestrans = array(