/**
* Creates a single string from an associative array
*
- * @param $header Associative Array: keys are header field names,
- * values are ... values.
+ * @param $headers array Associative Array: keys are header field names,
+ * values are ... values.
* @param $endl String: The end of line character. Defaults to "\n"
* @return String
*/
$ret = wfRunHooks( 'AlternateUserMailer', array( $headers, $to, $from, $subject, $body ) );
if ( $ret === false ) {
return Status::newGood();
- } else if ( $ret !== true ) {
+ } elseif ( $ret !== true ) {
return Status::newFatal( 'php-mail-error', $ret );
}
/**
* Converts a string into quoted-printable format
* @since 1.17
+ * @return string
*/
public static function quotedPrintable( $string, $charset = '' ) {
# Probably incomplete; see RFC 2045
*
*/
class EmailNotification {
- protected $to, $subject, $body, $replyto, $from;
+ protected $subject, $body, $replyto, $from;
protected $timestamp, $summary, $minorEdit, $oldid, $composed_common;
protected $mailTargets = array();
/**
* @var User
*/
- protected $user, $editor;
+ protected $editor;
/**
* Send emails corresponding to the user $editor editing the page $title.
global $wgUsersNotifiedOnAllChanges;
foreach ( $wgUsersNotifiedOnAllChanges as $name ) {
+ if ( $editor->getName() == $name ) {
+ // No point notifying the user that actually made the change!
+ continue;
+ }
$user = User::newFromName( $name );
$this->compose( $user );
}
wfDebug( __METHOD__ . ": talk page owner doesn't want notifications\n" );
}
}
- return false;
+ return false;
}
/**
$keys = array();
if ( $this->oldid ) {
- if ( $wgEnotifImpersonal ) {
- // For impersonal mail, show a diff link to the last revision.
- $keys['$NEWPAGE'] = wfMsgForContent( 'enotif_lastdiff',
- $this->title->getCanonicalUrl( 'diff=next&oldid=' . $this->oldid ) );
- } else {
- $keys['$NEWPAGE'] = wfMsgForContent( 'enotif_lastvisited',
+ // Always show a link to the diff which triggered the mail. See bug 32210.
+ $keys['$NEWPAGE'] = wfMsgForContent( 'enotif_lastdiff',
+ $this->title->getCanonicalUrl( 'diff=next&oldid=' . $this->oldid ) );
+ if ( !$wgEnotifImpersonal ) {
+ // For personal mail, also show a link to the diff of all changes
+ // since last visited.
+ $keys['$NEWPAGE'] .= " \n" . wfMsgForContent( 'enotif_lastvisited',
$this->title->getCanonicalUrl( 'diff=0&oldid=' . $this->oldid ) );
}
$keys['$OLDID'] = $this->oldid;
/**
* Same as sendPersonalised but does impersonal mail suitable for bulk
* mailing. Takes an array of MailAddress objects.
+ * @return Status
*/
function sendImpersonal( $addresses ) {
global $wgContLang;