Tweak for r39314: don't add a line break before the "Go" button on the watchlist...
[lhc/web/wiklou.git] / includes / UserMailer.php
index 8e576bb..ad550dc 100644 (file)
@@ -29,8 +29,8 @@
  */
 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
+        * @param $address Mixed: string with an email address, or a User object
+        * @param $name String: human-readable name if a string address is given
         */
        function __construct( $address, $name=null ) {
                if( is_object( $address ) && $address instanceof User ) {
@@ -126,10 +126,12 @@ class UserMailer {
 
                        $headers['From'] = $from->toString();
 
-                       if ($wgEnotifImpersonal)
+                       if ($wgEnotifImpersonal) {
                                $headers['To'] = 'undisclosed-recipients:;';
-                       else
-                               $headers['To'] = $to->toString();
+                       }
+                       else {
+                               $headers['To'] = implode( ", ", (array )$dest );
+                       }
 
                        if ( $replyto ) {
                                $headers['Reply-To'] = $replyto->toString();
@@ -312,7 +314,7 @@ class EmailNotification {
         */
        function actuallyNotifyOnPageChange($editor, $title, $timestamp, $summary, $minorEdit, $oldid=false) {
 
-               # we use $wgEmergencyContact as sender's address
+               # we use $wgPasswordSender as sender's address
                global $wgEnotifWatchlist;
                global $wgEnotifMinorEdits, $wgEnotifUserTalk, $wgShowUpdatedMarker;
                global $wgEnotifImpersonal;
@@ -345,9 +347,13 @@ class EmailNotification {
                                } elseif ( $targetUser->getId() == $editor->getId() ) {
                                        wfDebug( __METHOD__.": user edited their own talk page, no notification sent\n" );
                                } elseif( $targetUser->getOption( 'enotifusertalkpages' ) ) {
-                                       wfDebug( __METHOD__.": sending talk page update notification\n" );
-                                       $this->compose( $targetUser );
-                                       $userTalkId = $targetUser->getId();
+                                       if( $targetUser->isEmailConfirmed() ) {
+                                               wfDebug( __METHOD__.": sending talk page update notification\n" );
+                                               $this->compose( $targetUser );
+                                               $userTalkId = $targetUser->getId();
+                                       } else {
+                                               wfDebug( __METHOD__.": talk page owner doesn't have validated email\n" );
+                                       }
                                } else {
                                        wfDebug( __METHOD__.": talk page owner doesn't want notifications\n" );
                                }
@@ -418,7 +424,7 @@ class EmailNotification {
         * @private
         */
        function composeCommonMailtext() {
-               global $wgEmergencyContact, $wgNoReplyAddress;
+               global $wgPasswordSender, $wgNoReplyAddress;
                global $wgEnotifFromEditor, $wgEnotifRevealEditorAddress;
                global $wgEnotifImpersonal;
 
@@ -475,7 +481,7 @@ class EmailNotification {
                # global configuration level.
                $editor = $this->editor;
                $name    = $editor->getName();
-               $adminAddress = new MailAddress( $wgEmergencyContact, 'WikiAdmin' );
+               $adminAddress = new MailAddress( $wgPasswordSender, 'WikiAdmin' );
                $editorAddress = new MailAddress( $editor );
                if( $wgEnotifRevealEditorAddress
                    && ( $editor->getEmail() != '' )