From df753940b9964b2239cdb421864b806f7b45b34d Mon Sep 17 00:00:00 2001 From: Alexandre Emsenhuber Date: Mon, 29 Sep 2014 10:08:03 +0200 Subject: [PATCH] Add "returntoquery" URL parameter support in Special:ChangeEmail For consistency with other special pages, e.g. Special:ChangePassword. Change-Id: I97eac516c8a366624413bfcd0f4bd9f1185b6419 --- includes/specials/SpecialChangeEmail.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/includes/specials/SpecialChangeEmail.php b/includes/specials/SpecialChangeEmail.php index f5df54eeec..12bbd2a7ce 100644 --- a/includes/specials/SpecialChangeEmail.php +++ b/includes/specials/SpecialChangeEmail.php @@ -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( "
\n$1\n
", '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 } } -- 2.20.1