summaryrefslogtreecommitdiff
path: root/includes/SpecialEmailuser.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2007-01-11 19:06:07 +0000
committerPierre Schmitz <pierre@archlinux.de>2007-01-11 19:06:07 +0000
commita58285fd06c8113c45377c655dd43cef6337e815 (patch)
treedfe31d3d12652352fe44890b4811eda0728faefb /includes/SpecialEmailuser.php
parent20194986f6638233732ba1fc3e838f117d3cc9ea (diff)
Aktualisierung auf MediaWiki 1.9.0
Diffstat (limited to 'includes/SpecialEmailuser.php')
-rw-r--r--includes/SpecialEmailuser.php27
1 files changed, 25 insertions, 2 deletions
diff --git a/includes/SpecialEmailuser.php b/includes/SpecialEmailuser.php
index d711947f..38745a37 100644
--- a/includes/SpecialEmailuser.php
+++ b/includes/SpecialEmailuser.php
@@ -67,6 +67,7 @@ class EmailUserForm {
var $target;
var $text, $subject;
+ var $cc_me; // Whether user requested to be sent a separate copy of their email.
/**
* @param User $target
@@ -76,6 +77,7 @@ class EmailUserForm {
$this->target = $target;
$this->text = $wgRequest->getText( 'wpText' );
$this->subject = $wgRequest->getText( 'wpSubject' );
+ $this->cc_me = $wgRequest->getBool( 'wpCCMe' );
}
function showForm() {
@@ -95,9 +97,10 @@ class EmailUserForm {
$emr = wfMsg( "emailsubject" );
$emm = wfMsg( "emailmessage" );
$ems = wfMsg( "emailsend" );
+ $emc = wfMsg( "emailccme" );
$encSubject = htmlspecialchars( $this->subject );
- $titleObj = Title::makeTitle( NS_SPECIAL, "Emailuser" );
+ $titleObj = SpecialPage::getTitleFor( "Emailuser" );
$action = $titleObj->escapeLocalURL( "target=" .
urlencode( $this->target->getName() ) . "&action=submit" );
$token = $wgUser->editToken();
@@ -120,6 +123,7 @@ class EmailUserForm {
<span id='wpTextLabel'><label for=\"wpText\">{$emm}:</label><br /></span>
<textarea name=\"wpText\" rows='20' cols='80' wrap='virtual' style=\"width: 100%;\">" . htmlspecialchars( $this->text ) .
"</textarea>
+" . wfCheckLabel( $emc, 'wpCCMe', 'wpCCMe', $wgUser->getBoolOption( 'ccmeonemails' ) ) . "<br />
<input type='submit' name=\"wpSend\" value=\"{$ems}\" />
<input type='hidden' name='wpEditToken' value=\"$token\" />
</form>\n" );
@@ -140,7 +144,26 @@ class EmailUserForm {
if( WikiError::isError( $mailResult ) ) {
$wgOut->addHTML( wfMsg( "usermailererror" ) . $mailResult);
} else {
- $titleObj = Title::makeTitle( NS_SPECIAL, "Emailuser" );
+
+ // if the user requested a copy of this mail, do this now,
+ // unless they are emailing themselves, in which case one copy of the message is sufficient.
+ if ($this->cc_me && $to != $from) {
+ $cc_subject = wfMsg('emailccsubject', $this->target->getName(), $subject);
+ if( wfRunHooks( 'EmailUser', array( &$from, &$from, &$cc_subject, &$this->text ) ) ) {
+ $ccResult = userMailer( $from, $from, $cc_subject, $this->text );
+ if( WikiError::isError( $ccResult ) ) {
+ // At this stage, the user's CC mail has failed, but their
+ // original mail has succeeded. It's unlikely, but still, what to do?
+ // We can either show them an error, or we can say everything was fine,
+ // or we can say we sort of failed AND sort of succeeded. Of these options,
+ // simply saying there was an error is probably best.
+ $wgOut->addHTML( wfMsg( "usermailererror" ) . $ccResult);
+ return;
+ }
+ }
+ }
+
+ $titleObj = SpecialPage::getTitleFor( "Emailuser" );
$encTarget = wfUrlencode( $this->target->getName() );
$wgOut->redirect( $titleObj->getFullURL( "target={$encTarget}&action=success" ) );
wfRunHooks( 'EmailUserComplete', array( $to, $from, $subject, $this->text ) );