r64289 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r64288‎ | r64289 | r64290 >
Date:13:23, 28 March 2010
Author:catrope
Status:resolved
Tags:
Comment:
ContactPage: Add checkbox for IP address sending, checked by default for anons and unchecked by default for logged-in users. $wgContactIncludeIP = false; (default) still completely disables this feature, hiding the checkbox.
Modified paths:
  • /trunk/extensions/ContactPage/ContactPage.i18n.php (modified) (history)
  • /trunk/extensions/ContactPage/ContactPage.php (modified) (history)
  • /trunk/extensions/ContactPage/SpecialContact.php (modified) (history)

Diff [purge]

Index: trunk/extensions/ContactPage/SpecialContact.php
@@ -108,6 +108,7 @@
109109 $this->text = $wgRequest->getText( 'wpText' );
110110 $this->subject = $wgRequest->getText( 'wpSubject' );
111111 $this->cc_me = $wgRequest->getBool( 'wpCCMe' );
 112+ $this->includeIP = $wgRequest->getBool( 'wpIncludeIP' );
112113
113114 $this->fromname = $wgRequest->getText( 'wpFromName' );
114115 $this->fromaddress = $wgRequest->getText( 'wpFromAddress' );
@@ -165,7 +166,7 @@
166167 }
167168
168169 function showForm() {
169 - global $wgOut, $wgUser, $wgContactRequireAll;
 170+ global $wgOut, $wgUser, $wgContactRequireAll, $wgContactIncludeIP;
170171
171172 #TODO: show captcha
172173
@@ -228,8 +229,17 @@
229230 <td class="mw-input">' .
230231 Xml::textarea( 'wpText', $this->text, 80, 20, array( 'id' => 'wpText' ) ) .
231232 '</td>
232 - </tr>
233 - <tr>
 233+ </tr>';
 234+ if ( $wgContactIncludeIP ) {
 235+ $form .= '<tr>
 236+ <td></td>
 237+ <td class="mw-input">' .
 238+ Xml::checkLabel( wfMsg( 'contactpage-includeip' ), 'wpIncludeIP', 'wpIncludeIP', $wgUser->isAnon() ) .
 239+ '</td>
 240+ </tr>';
 241+ }
 242+
 243+ $form .= '<tr>
234244 <td></td>
235245 <td class="mw-input">' .
236246 Xml::checkLabel( wfMsg( 'emailccme' ), 'wpCCMe', 'wpCCMe', $wgUser->getBoolOption( 'ccmeonemails' ) ) .
@@ -292,7 +302,7 @@
293303 function doSubmit() {
294304 global $wgOut;
295305 global $wgEnableEmail, $wgUserEmailUseReplyTo, $wgEmergencyContact;
296 - global $wgContactUser, $wgContactSender, $wgContactSenderName;
 306+ global $wgContactUser, $wgContactSender, $wgContactSenderName, $wgContactIncludeIP;
297307
298308 $csender = $wgContactSender ? $wgContactSender : $wgEmergencyContact;
299309 $cname = $wgContactSenderName;
@@ -319,19 +329,20 @@
320330 $subject = wfMsgForContent( 'contactpage-defsubject' );
321331 }
322332
 333+ $includeIP = $wgContactIncludeIP && $this->includeIP;
323334 if ( $this->fromname !== '' ) {
324 - if ( $wgContactIncludeIP ) {
 335+ if ( $includeIP ) {
325336 $subject = wfMsgForContent( 'contactpage-subject-and-sender-withip', $subject, $this->fromname, $senderIP );
326337 } else {
327338 $subject = wfMsgForContent( 'contactpage-subject-and-sender', $subject, $this->fromname );
328339 }
329340 } elseif ( $this->fromaddress !== '' ) {
330 - if ( $wgContactIncludeIP ) {
 341+ if ( $includeIP ) {
331342 $subject = wfMsgForContent( 'contactpage-subject-and-sender-withip', $subject, $this->fromaddress, $senderIP );
332343 } else {
333344 $subject = wfMsgForContent( 'contactpage-subject-and-sender', $subject, $this->fromaddress );
334345 }
335 - } else if ( $wgContactIncludeIP ) {
 346+ } else if ( $includeIP ) {
336347 $subject = wfMsgForContent( 'contactpage-subject-and-sender', $subject, $senderIP );
337348 }
338349
Index: trunk/extensions/ContactPage/ContactPage.i18n.php
@@ -33,6 +33,7 @@
3434 'contactpage-formfootnotes-required' => 'All fields are required.',
3535 'contactpage-captcha' => 'To send the message, please solve the captcha ([[Special:Captcha/help|more info]])',
3636 'contactpage-captcha-failed' => 'Captcha test failed! ([[Special:Captcha/help|more info]])',
 37+ 'contactpage-includeip' => 'Include my IP address in this message.',
3738 );
3839
3940 /** Message documentation (Message documentation)
@@ -1344,6 +1345,7 @@
13451346 'contactpage-formfootnotes-required' => 'Alle velden zijn verplicht.',
13461347 'contactpage-captcha' => 'Om het bericht te versturen, moet u eerst de captcha oplossen ([[Special:Captcha/help|meer informatie]])',
13471348 'contactpage-captcha-failed' => 'De captcha-test is mislukt! ([[Special:Captcha/help|meer informatie]])',
 1349+ 'contactpage-includeip' => 'Stuur mijn IP-adres mee met dit bericht.',
13481350 );
13491351
13501352 /** Norwegian Nynorsk (‪Norsk (nynorsk)‬)
Index: trunk/extensions/ContactPage/ContactPage.php
@@ -47,5 +47,5 @@
4848 // on Special:Contact.
4949 $wgContactRequireAll = false;
5050
51 -// If true, the IP address of the submitter will be put in the subject line
 51+// If true, the form will include a checkbox offering to put the IP address of the submitter in the subject line
5252 $wgContactIncludeIP = false;

Status & tagging log