X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/banques/?a=blobdiff_plain;f=includes%2FUserMailer.php;h=8953d7abb88621c2351099a81a8b665cfe571a7c;hb=a3b490d2c4dfc25d7e0594eae8ee27ba69f6afea;hp=78a8be91efd7e31c10e56a95345424b368277021;hpb=b31d2a51cf930e18b2f6c4f9f9e5d96e4a76cee0;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/UserMailer.php b/includes/UserMailer.php index 78a8be91ef..8953d7abb8 100644 --- a/includes/UserMailer.php +++ b/includes/UserMailer.php @@ -125,14 +125,23 @@ function userMailer( $to, $from, $subject, $body, $replyto=false ) { } else { # In the following $headers = expression we removed "Reply-To: {$from}\r\n" , because it is treated differently # (fifth parameter of the PHP mail function, see some lines below) + + # Line endings need to be different on Unix and Windows due to + # the bug described at http://trac.wordpress.org/ticket/2603 + if ( wfIsWindows() ) { + $body = str_replace( "\n", "\r\n", $body ); + $endl = "\r\n"; + } else { + $endl = "\n"; + } $headers = - "MIME-Version: 1.0\n" . - "Content-type: text/plain; charset={$wgOutputEncoding}\n" . - "Content-Transfer-Encoding: 8bit\n" . - "X-Mailer: MediaWiki mailer\n". - 'From: ' . $from->toString() . "\n"; + "MIME-Version: 1.0$endl" . + "Content-type: text/plain; charset={$wgOutputEncoding}$endl" . + "Content-Transfer-Encoding: 8bit$endl" . + "X-Mailer: MediaWiki mailer$endl". + 'From: ' . $from->toString(); if ($replyto) { - $headers .= "Reply-To: $replyto\n"; + $headers .= "{$endl}Reply-To: $replyto"; } $dest = $to->toString(); @@ -158,7 +167,7 @@ function userMailer( $to, $from, $subject, $body, $replyto=false ) { */ function mailErrorHandler( $code, $string ) { global $wgErrorString; - $wgErrorString = preg_replace( "/^mail\(\): /", '', $string ); + $wgErrorString = preg_replace( '/^mail\(\)(\s*\[.*?\])?: /', '', $string ); } @@ -373,7 +382,7 @@ class EmailNotification { } else { $subject = str_replace('$PAGEEDITOR', $name, $subject); $keys['$PAGEEDITOR'] = $name; - $emailPage = Title::makeTitle( NS_SPECIAL, 'Emailuser/' . $name ); + $emailPage = SpecialPage::getSafeTitleFor( 'Emailuser', $name ); $keys['$PAGEEDITOR_EMAIL'] = $emailPage->getFullUrl(); } $userPage = $wgUser->getUserPage();