From a58285fd06c8113c45377c655dd43cef6337e815 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Thu, 11 Jan 2007 19:06:07 +0000 Subject: Aktualisierung auf MediaWiki 1.9.0 --- includes/UserMailer.php | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) (limited to 'includes/UserMailer.php') diff --git a/includes/UserMailer.php b/includes/UserMailer.php index 78a8be91..0101f744 100644 --- a/includes/UserMailer.php +++ b/includes/UserMailer.php @@ -39,7 +39,7 @@ class MailAddress { * @param string $name Human-readable name if a string address is given */ function MailAddress( $address, $name=null ) { - if( is_object( $address ) && is_a( $address, 'User' ) ) { + if( is_object( $address ) && $address instanceof User ) { $this->address = $address->getEmail(); $this->name = $address->getName(); } else { @@ -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 ); } @@ -239,7 +248,6 @@ class EmailNotification { } if( $userCondition ) { $dbr =& wfGetDB( DB_MASTER ); - extract( $dbr->tableNames( 'watchlist' ) ); $res = $dbr->select( 'watchlist', array( 'wl_user' ), array( @@ -373,7 +381,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(); -- cgit v1.2.2