summaryrefslogtreecommitdiff
path: root/includes/UserMailer.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2007-05-16 20:58:53 +0000
committerPierre Schmitz <pierre@archlinux.de>2007-05-16 20:58:53 +0000
commitcecb985bee3bdd252e1b8dc0bd500b37cd52be01 (patch)
tree17266aa237742640aabee7856f0202317a45d540 /includes/UserMailer.php
parent0bac06c301f2a83edb0236e4c2434da16848d549 (diff)
Aktualisierung auf MediaWiki 1.10.0
Plugins angepasst und verbessert kleine Korrekturen am Design
Diffstat (limited to 'includes/UserMailer.php')
-rw-r--r--includes/UserMailer.php42
1 files changed, 26 insertions, 16 deletions
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 <brion@pobox.com>
* @author <mail@tgries.de>
*
- * @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 ) ) {