X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fspecials%2FSpecialPermanentLink.php;h=b1772b78e32d988864fc5cb291a6657479f44c6a;hb=74426f3cf796b149f1ae445e41815bbe148640b2;hp=2bd3ab7d7650b894126dae335b604b1c1456f785;hpb=b5906606e1aa1a795231fb813b766818b1dd6c25;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/specials/SpecialPermanentLink.php b/includes/specials/SpecialPermanentLink.php index 2bd3ab7d76..b1772b78e3 100644 --- a/includes/specials/SpecialPermanentLink.php +++ b/includes/specials/SpecialPermanentLink.php @@ -39,11 +39,44 @@ class SpecialPermanentLink extends RedirectSpecialPage { public function getRedirect( $subpage ) { $subpage = intval( $subpage ); if ( $subpage === 0 ) { - # throw an error page when no subpage was given - throw new ErrorPageError( 'nopagetitle', 'nopagetext' ); + return false; } $this->mAddedRedirectParams['oldid'] = $subpage; return true; } + + protected function showNoRedirectPage() { + $this->setHeaders(); + $this->outputHeader(); + $this->showForm(); + } + + private function showForm() { + $form = HTMLForm::factory( 'ooui', [ + 'revid' => [ + 'type' => 'int', + 'name' => 'revid', + 'label-message' => 'permanentlink-revid', + ], + ], $this->getContext(), 'permanentlink' ); + $form->setSubmitTextMsg( 'permanentlink-submit' ); + $form->setSubmitCallback( [ $this, 'onFormSubmit' ] ); + $form->show(); + } + + public function onFormSubmit( $formData ) { + $revid = $formData['revid']; + $title = $this->getPageTitle( $revid ?: null ); + $url = $title->getFullUrlForRedirect(); + $this->getOutput()->redirect( $url ); + } + + public function isListed() { + return true; + } + + protected function getGroupName() { + return 'redirects'; + } }