From cecb985bee3bdd252e1b8dc0bd500b37cd52be01 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Wed, 16 May 2007 20:58:53 +0000 Subject: Aktualisierung auf MediaWiki 1.10.0 Plugins angepasst und verbessert kleine Korrekturen am Design --- includes/UserMailer.php | 42 ++++++++++++++++++++++++++---------------- 1 file changed, 26 insertions(+), 16 deletions(-) (limited to 'includes/UserMailer.php') diff --git a/includes/UserMailer.php b/includes/UserMailer.php index 0101f744..9f5f178c 100644 --- a/includes/UserMailer.php +++ b/includes/UserMailer.php @@ -22,7 +22,6 @@ * @author * @author * - * @package MediaWiki */ /** @@ -33,12 +32,17 @@ function wfRFC822Phrase( $phrase ) { return '"' . $phrase . '"'; } +/** + * Stores a single person's name and email address. + * These are passed in via the constructor, and will be returned in SMTP + * header format when requested. + */ class MailAddress { /** * @param mixed $address String with an email address, or a User object * @param string $name Human-readable name if a string address is given */ - function MailAddress( $address, $name=null ) { + function __construct( $address, $name=null ) { if( is_object( $address ) && $address instanceof User ) { $this->address = $address->getEmail(); $this->name = $address->getName(); @@ -78,9 +82,9 @@ class MailAddress { * @param $from MailAddress: sender's email * @param $subject String: email's subject. * @param $body String: email's text. - * @param $replyto String: optional reply-to email (default: false). + * @param $replyto String: optional reply-to email (default: null). */ -function userMailer( $to, $from, $subject, $body, $replyto=false ) { +function userMailer( $to, $from, $subject, $body, $replyto=null ) { global $wgUser, $wgSMTP, $wgOutputEncoding, $wgErrorString; if (is_array( $wgSMTP )) { @@ -92,7 +96,7 @@ function userMailer( $to, $from, $subject, $body, $replyto=false ) { $headers['From'] = $from->toString(); $headers['To'] = $to->toString(); if ( $replyto ) { - $headers['Reply-To'] = $replyto; + $headers['Reply-To'] = $replyto->toString(); } $headers['Subject'] = wfQuotedPrintable( $subject ); $headers['Date'] = date( 'r' ); @@ -141,7 +145,7 @@ function userMailer( $to, $from, $subject, $body, $replyto=false ) { "X-Mailer: MediaWiki mailer$endl". 'From: ' . $from->toString(); if ($replyto) { - $headers .= "{$endl}Reply-To: $replyto"; + $headers .= "{$endl}Reply-To: " . $replyto->toString(); } $dest = $to->toString(); @@ -189,7 +193,6 @@ function mailErrorHandler( $code, $string ) { * * Visit the documentation pages under http://meta.wikipedia.com/Enotif * - * @package MediaWiki * */ class EmailNotification { @@ -226,6 +229,13 @@ class EmailNotification { $enotifusertalkpage = ($isUserTalkPage && $wgEnotifUserTalk); $enotifwatchlistpage = $wgEnotifWatchlist; + $this->title =& $title; + $this->timestamp = $timestamp; + $this->summary = $summary; + $this->minorEdit = $minorEdit; + $this->oldid = $oldid; + $this->composeCommonMailtext(); + if ( (!$minorEdit || $wgEnotifMinorEdits) ) { if( $wgEnotifWatchlist ) { // Send updates to watchers other than the current editor @@ -247,7 +257,7 @@ class EmailNotification { $userCondition = false; } if( $userCondition ) { - $dbr =& wfGetDB( DB_MASTER ); + $dbr = wfGetDB( DB_MASTER ); $res = $dbr->select( 'watchlist', array( 'wl_user' ), array( @@ -260,13 +270,7 @@ class EmailNotification { # if anyone is watching ... set up the email message text which is # common for all receipients ... if ( $dbr->numRows( $res ) > 0 ) { - $this->title =& $title; - $this->timestamp = $timestamp; - $this->summary = $summary; - $this->minorEdit = $minorEdit; - $this->oldid = $oldid; - $this->composeCommonMailtext(); $watchingUser = new User(); # ... now do for all watching users ... if the options fit @@ -291,10 +295,16 @@ class EmailNotification { } # if anyone is watching } # if $wgEnotifWatchlist = true + global $wgUsersNotifedOnAllChanges; + foreach ( $wgUsersNotifedOnAllChanges as $name ) { + $user = User::newFromName( $name ); + $this->composeAndSendPersonalisedMail( $user ); + } + if ( $wgShowUpdatedMarker || $wgEnotifWatchlist ) { # mark the changed watch-listed page with a timestamp, so that the page is # listed with an "updated since your last visit" icon in the watch list, ... - $dbw =& wfGetDB( DB_MASTER ); + $dbw = wfGetDB( DB_MASTER ); $success = $dbw->update( 'watchlist', array( /* SET */ 'wl_notificationtimestamp' => $dbw->timestamp($timestamp) @@ -370,7 +380,7 @@ class EmailNotification { } } else { $from = $adminAddress; - $replyto = $wgNoReplyAddress; + $replyto = new MailAddress( $wgNoReplyAddress ); } if( $wgUser->isIP( $name ) ) { -- cgit v1.2.2