Add "returntoquery" URL parameter support in Special:ChangeEmail
authorAlexandre Emsenhuber <mediawiki@emsenhuber.ch>
Mon, 29 Sep 2014 08:08:03 +0000 (10:08 +0200)
committerUmherirrender <umherirrender_de.wp@web.de>
Mon, 29 Sep 2014 17:59:36 +0000 (17:59 +0000)
For consistency with other special pages, e.g. Special:ChangePassword.

Change-Id: I97eac516c8a366624413bfcd0f4bd9f1185b6419

includes/specials/SpecialChangeEmail.php

index f5df54e..12bbd2a 100644 (file)
@@ -112,7 +112,7 @@ class SpecialChangeEmail extends FormSpecialPage {
                $form->setTableId( 'mw-changeemail-table' );
                $form->setWrapperLegend( false );
                $form->setSubmitTextMsg( 'changeemail-submit' );
-               $form->addHiddenField( 'returnto', $this->getRequest()->getVal( 'returnto' ) );
+               $form->addHiddenFields( $this->getRequest()->getValues( 'returnto', 'returntoquery' ) );
        }
 
        public function onSubmit( array $data ) {
@@ -125,18 +125,21 @@ class SpecialChangeEmail extends FormSpecialPage {
        }
 
        public function onSuccess() {
-               $titleObj = Title::newFromText( $this->getRequest()->getVal( 'returnto' ) );
+               $request = $this->getRequest();
+
+               $titleObj = Title::newFromText( $request->getVal( 'returnto' ) );
                if ( !$titleObj instanceof Title ) {
                        $titleObj = Title::newMainPage();
                }
+               $query = $request->getVal( 'returntoquery' );
 
                if ( $this->status->value === true ) {
-                       $this->getOutput()->redirect( $titleObj->getFullURL() );
+                       $this->getOutput()->redirect( $titleObj->getFullURL( $query ) );
                } elseif ( $this->status->value === 'eauth' ) {
                        # Notify user that a confirmation email has been sent...
                        $this->getOutput()->wrapWikiMsg( "<div class='error' style='clear: both;'>\n$1\n</div>",
                                'eauthentsent', $this->getUser()->getName() );
-                       $this->getOutput()->addReturnTo( $titleObj ); // just show the link to go back
+                       $this->getOutput()->addReturnTo( $titleObj, wfCgiToArray( $query ) ); // just show the link to go back
                }
        }