r76694 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r76693‎ | r76694 | r76695 >
Date:18:48, 15 November 2010
Author:raymond
Status:ok
Tags:
Comment:
Follow-up r76660: Add formType to the object which is passed to 'ContactFormBeforeMessage' hook
Pass formType to 'ContactForm' hook
Modified paths:
  • /trunk/extensions/ContactPage/SpecialContact.php (modified) (history)

Diff [purge]

Index: trunk/extensions/ContactPage/SpecialContact.php
@@ -121,11 +121,11 @@
122122 function __construct( $target, $par ) {
123123 global $wgRequest, $wgUser;
124124
125 - $formType = $wgRequest->getText( 'type', $par );
 125+ $this->formType = $wgRequest->getText( 'formtype', $par );
126126
127127 # Check for type in [[Special:Contact/type]]: change pagetext and prefill form fields
128 - if ( $formType != '' ) {
129 - $message = 'contactpage-pagetext-' . $formType;
 128+ if ( $this->formType != '' ) {
 129+ $message = 'contactpage-pagetext-' . $this->formType;
130130 $text = wfMsgExt( $message, 'parse' );
131131 if ( !wfEmptyMsg( $message, $text ) ) {
132132 $this->formularText = $text;
@@ -133,7 +133,7 @@
134134 $this->formularText = wfMsgExt( 'contactpage-pagetext', 'parse' );
135135 }
136136
137 - $message = 'contactpage-subject-' . $formType;
 137+ $message = 'contactpage-subject-' . $this->formType;
138138 $text = wfMsgForContentNoTrans( $message );
139139 if ( !wfEmptyMsg( $message, $text ) ) {
140140 $this->subject = $wgRequest->getText( 'wpSubject', $text );
@@ -141,7 +141,7 @@
142142 $this->subject = $wgRequest->getText( 'wpSubject' );
143143 }
144144
145 - $message = 'contactpage-text-' . $formType;
 145+ $message = 'contactpage-text-' . $this->formType;
146146 $text = wfMsgForContentNoTrans( $message );
147147 if ( !wfEmptyMsg( $message, $text ) ) {
148148 $this->text = $wgRequest->getText( 'wpText', $text );
@@ -301,6 +301,7 @@
302302 '</td>
303303 </tr>' .
304304 Html::hidden( 'wpEditToken', $token ) .
 305+ Html::hidden( 'formtype', $this->formType ) .
305306 Xml::closeElement( 'table' ) .
306307 Xml::closeElement( 'fieldset' ) .
307308 Xml::closeElement( 'form' );
@@ -394,7 +395,7 @@
395396 $subject = wfMsgForContent( 'contactpage-subject-and-sender', $subject, $senderIP );
396397 }
397398
398 - if( !wfRunHooks( 'ContactForm', array( &$targetAddress, &$replyto, &$subject, &$this->text ) ) ) {
 399+ if( !wfRunHooks( 'ContactForm', array( &$targetAddress, &$replyto, &$subject, &$this->text, $this->formType ) ) ) {
399400 wfDebug( __METHOD__ . ": aborted by hook\n" );
400401 return;
401402 }
@@ -415,7 +416,7 @@
416417 // unless they are emailing themselves, in which case one copy of the message is sufficient.
417418 if( $this->cc_me && $this->fromaddress ) {
418419 $cc_subject = wfMsg( 'emailccsubject', $this->target->getName(), $subject );
419 - if( wfRunHooks( 'ContactForm', array( &$submitterAddress, &$contactSender, &$cc_subject, &$this->text ) ) ) {
 420+ if( wfRunHooks( 'ContactForm', array( &$submitterAddress, &$contactSender, &$cc_subject, &$this->text, $this->formType ) ) ) {
420421 wfDebug( __METHOD__ . ": sending cc mail from " . $contactSender->toString() .
421422 " to " . $submitterAddress->toString() . "\n" );
422423 $ccResult = UserMailer::send( $submitterAddress, $contactSender, $cc_subject, $this->text );

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r76660Add possibility to use customized contage pages via [[Special:Contact/typename]]...raymond17:08, 14 November 2010

Status & tagging log