diff --git a/ContactPage.i18n.php b/ContactPage.i18n.php index b4ac9ff..66782bf 100644 --- a/ContactPage.i18n.php +++ b/ContactPage.i18n.php @@ -16,14 +16,15 @@ $messages['en'] = array( 'contactpage-desc' => '[[Special:Contact|Contact form for visitors]]', 'contactpage-title' => 'Contact', 'contactpage-pagetext' => 'Please use the form below to contact us.', - 'contactpage-defsubject' => 'Contact Message', + 'contactpage-legend' => 'Send e-mail', + 'contactpage-defsubject' => 'Contact message', 'contactpage-subject-and-sender' => '$1 (from $2)', - 'contactpage-fromname' => 'your name *', - 'contactpage-fromaddress' => 'your e-mail **', + 'contactpage-fromname' => 'Your name: *', + 'contactpage-fromaddress' => 'Your e-mail: **', 'contactpage-formfootnotes' => '* optional
** optional but needed if you want an answer', - 'contactpage-fromname-required' => 'your name', - 'contactpage-fromaddress-required' => 'your e-mail', + 'contactpage-fromname-required' => 'Your name:', + 'contactpage-fromaddress-required' => 'Your e-mail:', 'contactpage-formfootnotes-required' => 'All fields are required.', 'contactpage-captcha' => 'To send the message, please solve the captcha ([[Special:Captcha/help|more info]])', 'contactpage-captcha-failed' => 'Captcha test failed! ([[Special:Captcha/help|more info]])', diff --git a/SpecialContact.php b/SpecialContact.php index 13e8bf8..c9b774a 100644 --- a/SpecialContact.php +++ b/SpecialContact.php @@ -6,7 +6,7 @@ * @addtogroup SpecialPage * @author Daniel Kinzler, brightbyte.de * @copyright © 2007 Daniel Kinzler - * @licence GNU General Public Licence 2.0 or later + * @license GNU General Public Licence 2.0 or later */ if( !defined( 'MEDIAWIKI' ) ) { @@ -161,58 +161,71 @@ class EmailContactForm { $msgSuffix = $wgContactRequireAll ? '-required' : ''; - $emt = wfMsg( "emailto" ); - $rcpt = $this->target->getName(); - $emr = wfMsg( "emailsubject" ); - $emm = wfMsg( "emailmessage" ); - $ems = wfMsg( "emailsend" ); - $emc = wfMsg( "emailccme" ); - $emfn = wfMsg( "contactpage-fromname$msgSuffix" ); - $emfa = wfMsg( "contactpage-fromaddress$msgSuffix" ); - $encSubject = htmlspecialchars( $this->subject ); - $encFromName = htmlspecialchars( $this->fromname ); - $encFromAddress = htmlspecialchars( $this->fromaddress ); - - $titleObj = SpecialPage::getTitleFor( "Contact" ); - $action = $titleObj->escapeLocalURL( "action=submit" ); + $titleObj = SpecialPage::getTitleFor( 'Contact' ); + $action = $titleObj->getLocalURL( 'action=submit' ); $token = $wgUser->isAnon() ? EDIT_TOKEN_SUFFIX : $wgUser->editToken(); //this kind of sucks, really... - $token = htmlspecialchars( $token ); - - $wgOut->addHTML( " -
- - - - - - - - - - - - - - - -
{$emr}: - -
{$emfn}: - -
{$emfa}: - -
-".wfMsg( "contactpage-formfootnotes$msgSuffix" )." -
-
- -" . wfCheckLabel( $emc, 'wpCCMe', 'wpCCMe', $wgUser->getBoolOption( 'ccmeonemails' ) ) . "
-" . $this->getCaptcha() . " - - -
\n" ); + $wgOut->addHTML( + Xml::openElement( 'form', array( 'method' => 'post', 'action' => $action, 'id' => 'emailuser' ) ) . + Xml::openElement( 'fieldset' ) . + Xml::element( 'legend', null, wfMsg( 'contactpage-legend' ) ) . + Xml::openElement( 'table', array( 'id' => 'mailheader' ) ) . + " + " . + Xml::label( wfMsg( 'emailsubject' ), 'wpSubject' ) . + " + " . + Xml::input( 'wpSubject', 60, $this->subject, array( 'type' => 'text', 'maxlength' => 200 ) ) . + " + + + " . + Xml::label( wfMsg( "contactpage-fromname$msgSuffix" ), 'wpFromName' ) . + " + " . + Xml::input( 'wpFromName', 60, $this->fromname, array( 'type' => 'text', 'maxlength' => 200 ) ) . + " + + + " . + Xml::label( wfMsg( "contactpage-fromaddress$msgSuffix" ), 'wpFromAddress' ) . + " + " . + Xml::input( 'wpFromAddress', 60, $this->fromaddress, array( 'type' => 'text', 'maxlength' => 200 ) ) . + " + + + + + " . wfMsg( "contactpage-formfootnotes$msgSuffix" ) . " + + + + " . + Xml::label( wfMsg( 'emailmessage' ), 'wpText' ) . + " + " . + Xml::textarea( 'wpText', $this->text, 80, 20, array( 'id' => 'wpText' ) ) . + " + + + + " . + Xml::checkLabel( wfMsg( 'emailccme' ), 'wpCCMe', 'wpCCMe', $wgUser->getBoolOption( 'ccmeonemails' ) ) . + "
" . $this->getCaptcha() . + " + + + + " . + Xml::submitButton( wfMsg( 'emailsend' ), array( 'name' => 'wpSend', 'accesskey' => 's' ) ) . + " + " . + Xml::hidden( 'wpEditToken', $token ) . + Xml::closeElement( 'table' ) . + Xml::closeElement( 'fieldset' ) . + Xml::closeElement( 'form' ) + ); } function useCaptcha() {