Index: trunk/phase3/includes/UserMailer.php |
— | — | @@ -557,18 +557,11 @@ |
558 | 558 | |
559 | 559 | $this->composed_common = true; |
560 | 560 | |
561 | | - $summary = ( $this->summary == '' ) ? ' - ' : $this->summary; |
562 | | - $medit = ( $this->minorEdit ) ? wfMsgForContent( 'minoredit' ) : ''; |
563 | | - |
564 | 561 | # You as the WikiAdmin and Sysops can make use of plenty of |
565 | 562 | # named variables when composing your notification emails while |
566 | 563 | # simply editing the Meta pages |
567 | 564 | |
568 | | - $subject = wfMsgForContent( 'enotif_subject' ); |
569 | | - $body = wfMsgForContent( 'enotif_body' ); |
570 | | - $from = ''; /* fail safe */ |
571 | | - $replyto = ''; /* fail safe */ |
572 | | - $keys = array(); |
| 565 | + $keys = array(); |
573 | 566 | |
574 | 567 | if ( $this->oldid ) { |
575 | 568 | if ( $wgEnotifImpersonal ) { |
— | — | @@ -588,60 +581,54 @@ |
589 | 582 | $keys['$CHANGEDORCREATED'] = wfMsgForContent( 'created' ); |
590 | 583 | } |
591 | 584 | |
592 | | - $body = strtr( $body, $keys ); |
593 | | - $pagetitle = $this->title->getPrefixedText(); |
594 | | - $keys['$PAGETITLE'] = $pagetitle; |
595 | | - $keys['$PAGETITLE_URL'] = $this->title->getCanonicalUrl(); |
| 585 | + $keys['$PAGETITLE'] = $this->title->getPrefixedText(); |
| 586 | + $keys['$PAGETITLE_URL'] = $this->title->getCanonicalUrl(); |
| 587 | + $keys['$PAGEMINOREDIT'] = $this->minorEdit ? wfMsgForContent( 'minoredit' ) : ''; |
| 588 | + $keys['$PAGESUMMARY'] = $this->summary == '' ? ' - ' : $this->summary; |
| 589 | + $keys['$UNWATCHURL'] = $this->title->getCanonicalUrl( 'action=unwatch' ); |
596 | 590 | |
597 | | - $keys['$PAGEMINOREDIT'] = $medit; |
598 | | - $keys['$PAGESUMMARY'] = $summary; |
599 | | - $keys['$UNWATCHURL'] = $this->title->getCanonicalUrl( 'action=unwatch' ); |
| 591 | + if ( $this->editor->isAnon() ) { |
| 592 | + # real anon (user:xxx.xxx.xxx.xxx) |
| 593 | + $keys['$PAGEEDITOR'] = wfMsgForContent( 'enotif_anon_editor', $this->editor->getName() ); |
| 594 | + $keys['$PAGEEDITOR_EMAIL'] = wfMsgForContent( 'noemailtitle' ); |
| 595 | + } else { |
| 596 | + $keys['$PAGEEDITOR'] = $wgEnotifUseRealName ? $this->editor->getRealName() : $this->editor->getName(); |
| 597 | + $emailPage = SpecialPage::getSafeTitleFor( 'Emailuser', $this->editor->getName() ); |
| 598 | + $keys['$PAGEEDITOR_EMAIL'] = $emailPage->getCanonicalUrl(); |
| 599 | + } |
600 | 600 | |
| 601 | + $keys['$PAGEEDITOR_WIKI'] = $this->editor->getUserPage()->getCanonicalUrl(); |
| 602 | + |
| 603 | + # Now build message's subject and body |
| 604 | + |
| 605 | + $subject = wfMsgExt( 'enotif_subject', 'content' ); |
601 | 606 | $subject = strtr( $subject, $keys ); |
| 607 | + $this->subject = MessageCache::singleton()->transform( $subject, false, null, $this->title ); |
602 | 608 | |
| 609 | + $body = wfMsgExt( 'enotif_body', 'content' ); |
| 610 | + $body = strtr( $body, $keys ); |
| 611 | + $body = MessageCache::singleton()->transform( $body, false, null, $this->title ); |
| 612 | + $this->body = wordwrap( $body, 72 ); |
| 613 | + |
603 | 614 | # Reveal the page editor's address as REPLY-TO address only if |
604 | 615 | # the user has not opted-out and the option is enabled at the |
605 | 616 | # global configuration level. |
606 | | - $editor = $this->editor; |
607 | | - $name = $wgEnotifUseRealName ? $editor->getRealName() : $editor->getName(); |
608 | 617 | $adminAddress = new MailAddress( $wgPasswordSender, $wgPasswordSenderName ); |
609 | | - $editorAddress = new MailAddress( $editor ); |
610 | 618 | if ( $wgEnotifRevealEditorAddress |
611 | | - && ( $editor->getEmail() != '' ) |
612 | | - && $editor->getOption( 'enotifrevealaddr' ) ) { |
| 619 | + && ( $this->editor->getEmail() != '' ) |
| 620 | + && $this->editor->getOption( 'enotifrevealaddr' ) ) |
| 621 | + { |
| 622 | + $editorAddress = new MailAddress( $this->editor ); |
613 | 623 | if ( $wgEnotifFromEditor ) { |
614 | | - $from = $editorAddress; |
| 624 | + $this->from = $editorAddress; |
615 | 625 | } else { |
616 | | - $from = $adminAddress; |
617 | | - $replyto = $editorAddress; |
| 626 | + $this->from = $adminAddress; |
| 627 | + $this->replyto = $editorAddress; |
618 | 628 | } |
619 | 629 | } else { |
620 | | - $from = $adminAddress; |
621 | | - $replyto = new MailAddress( $wgNoReplyAddress ); |
| 630 | + $this->from = $adminAddress; |
| 631 | + $this->replyto = new MailAddress( $wgNoReplyAddress ); |
622 | 632 | } |
623 | | - |
624 | | - if ( $editor->isAnon() ) { |
625 | | - # real anon (user:xxx.xxx.xxx.xxx) |
626 | | - $utext = wfMsgForContent( 'enotif_anon_editor', $name ); |
627 | | - $subject = str_replace( '$PAGEEDITOR', $utext, $subject ); |
628 | | - $keys['$PAGEEDITOR'] = $utext; |
629 | | - $keys['$PAGEEDITOR_EMAIL'] = wfMsgForContent( 'noemailtitle' ); |
630 | | - } else { |
631 | | - $subject = str_replace( '$PAGEEDITOR', $name, $subject ); |
632 | | - $keys['$PAGEEDITOR'] = $name; |
633 | | - $emailPage = SpecialPage::getSafeTitleFor( 'Emailuser', $name ); |
634 | | - $keys['$PAGEEDITOR_EMAIL'] = $emailPage->getCanonicalUrl(); |
635 | | - } |
636 | | - $userPage = $editor->getUserPage(); |
637 | | - $keys['$PAGEEDITOR_WIKI'] = $userPage->getCanonicalUrl(); |
638 | | - $body = strtr( $body, $keys ); |
639 | | - $body = wordwrap( $body, 72 ); |
640 | | - |
641 | | - # now save this as the constant user-independent part of the message |
642 | | - $this->from = $from; |
643 | | - $this->replyto = $replyto; |
644 | | - $this->subject = $subject; |
645 | | - $this->body = $body; |
646 | 633 | } |
647 | 634 | |
648 | 635 | /** |