ContactPage: (bug 22741) Add IP address of sender to subject line

This commit is contained in:
Roan Kattouw 2010-03-06 14:00:34 +00:00
parent 2bad8c5a0c
commit c3a2454701
2 changed files with 10 additions and 3 deletions

View File

@ -23,6 +23,7 @@ $messages['en'] = array(
'contactpage-legend' => 'Send e-mail',
'contactpage-defsubject' => 'Contact message',
'contactpage-subject-and-sender' => '$1 (from $2)',
'contactpage-subject-and-sender-withip' => '$1 (from $2 at $3)',
'contactpage-fromname' => 'Your name: *',
'contactpage-fromaddress' => 'Your e-mail: **',
'contactpage-formfootnotes' => '* optional<br />
@ -48,7 +49,9 @@ $messages['qqq'] = array(
'contactpage-desc' => 'Extension description displayed on [[Special:Version]].',
'contactpage-title' => '{{Identical|Contact}}',
'contactpage-legend' => '{{Identical|E-mail}}',
'contactpage-defsubject' => '{{Identical|Contact}}',
'contactpage-defsubject' => 'Default subject for sent e-mail. {{Identical|Contact}}',
'contactpage-subject-and-sender' => 'Subject with sender included. $1 is the original subject, $2 is a user name, e-mail address or IP address.',
'contactpage-subject-and-sender-withip' => 'Subject with sender and IP included. $1 is the original subject, $2 is a user name or e-mail address, $3 is an IP address.',
'contactpage-fromaddress' => '{{Identical|E-mail}}',
'contactpage-fromaddress-required' => '{{Identical|E-mail}}',
);
@ -1311,6 +1314,7 @@ $messages['nl'] = array(
'contactpage-legend' => 'E-mail versturen',
'contactpage-defsubject' => 'Contactbericht',
'contactpage-subject-and-sender' => '$1 (van $2)',
'contactpage-subject-and-sender-withip' => '$1 (van $2 op $3)',
'contactpage-fromname' => 'Uw naam:*',
'contactpage-fromaddress' => 'Uw e-mailadres:**',
'contactpage-formfootnotes' => '* optioneel<br />

View File

@ -296,6 +296,7 @@ class EmailContactForm {
$csender = $wgContactSender ? $wgContactSender : $wgEmergencyContact;
$cname = $wgContactSenderName;
$senderIP = wfGetIP();
wfDebug( __METHOD__ . ": start\n" );
@ -319,9 +320,11 @@ class EmailContactForm {
}
if ( $this->fromname !== '' ) {
$subject = wfMsgForContent( 'contactpage-subject-and-sender', $subject, $this->fromname );
$subject = wfMsgForContent( 'contactpage-subject-and-sender-withip', $subject, $this->fromname, $senderIP );
} elseif ( $this->fromaddress !== '' ) {
$subject = wfMsgForContent( 'contactpage-subject-and-sender', $subject, $this->fromaddress );
$subject = wfMsgForContent( 'contactpage-subject-and-sender-withip', $subject, $this->fromaddress, $senderIP );
} else {
$subject = wfMsgForContent( 'contactpage-subject-and-sender', $subject, $senderIP );
}
if( !wfRunHooks( 'ContactForm', array( &$targetAddress, &$replyto, &$subject, &$this->text ) ) ) {