From 891e7548b1f94b7728e2b6b267770b728b721e47 Mon Sep 17 00:00:00 2001 From: Raimond Spekking Date: Wed, 23 Jan 2008 15:16:06 +0000 Subject: [PATCH] (bug 11897) Add alias [[Special:CreateAccount]] & [[Special:Userlogin/signup]] for Special:Userlogin?type=signup --- RELEASE-NOTES | 2 ++ includes/SpecialPage.php | 15 +++++++++++++++ includes/SpecialUserlogin.php | 8 ++++---- languages/messages/MessagesEn.php | 1 + 4 files changed, 22 insertions(+), 4 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index f8b88c6d67..ec17326a89 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -140,6 +140,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN address in Reply-To instead of From for user-to-user emails. This protects against SPF problems and privacy-leaking bounce messages when using mailers that set the envelope sender to the From header value. +* (bug 11897) Add alias [[Special:CreateAccount]] & [[Special:Userlogin/signup]] + for Special:Userlogin?type=signup === Bug fixes in 1.12 === diff --git a/includes/SpecialPage.php b/includes/SpecialPage.php index f5a43b4468..8b7e0c5945 100644 --- a/includes/SpecialPage.php +++ b/includes/SpecialPage.php @@ -80,6 +80,7 @@ class SpecialPage 'Userlogin' => array( 'SpecialPage', 'Userlogin' ), 'Userlogout' => array( 'UnlistedSpecialPage', 'Userlogout' ), + 'CreateAccount' => array( 'SpecialCreateAccount' ), 'Preferences' => array( 'SpecialPage', 'Preferences' ), 'Watchlist' => array( 'SpecialPage', 'Watchlist' ), @@ -846,3 +847,17 @@ class SpecialMycontributions extends UnlistedSpecialPage { return SpecialPage::getTitleFor( 'Contributions', $wgUser->getName() ); } } +/** + * Shortcut to construct a special page pointing to create account form. + * @addtogroup SpecialPage + */ +class SpecialCreateAccount extends SpecialPage { + function __construct() { + parent::__construct( 'CreateAccount' ); + $this->mAllowedRedirectParams = array( 'uselang' ); + } + + function getRedirect() { + return SpecialPage::getTitleFor( 'Userlogin', 'signup' ); + } +} diff --git a/includes/SpecialUserlogin.php b/includes/SpecialUserlogin.php index f131ddefbb..8ee0f36b83 100644 --- a/includes/SpecialUserlogin.php +++ b/includes/SpecialUserlogin.php @@ -7,13 +7,13 @@ /** * constructor */ -function wfSpecialUserlogin() { +function wfSpecialUserlogin( $par = '' ) { global $wgRequest; if( session_id() == '' ) { wfSetupSession(); } - $form = new LoginForm( $wgRequest ); + $form = new LoginForm( $wgRequest, $par ); $form->execute(); } @@ -41,11 +41,11 @@ class LoginForm { * Constructor * @param WebRequest $request A WebRequest object passed by reference */ - function LoginForm( &$request ) { + function LoginForm( &$request, $par = '' ) { global $wgLang, $wgAllowRealName, $wgEnableEmail; global $wgAuth; - $this->mType = $request->getText( 'type' ); + $this->mType = ( $par == 'signup' ) ? $par : $request->getText( 'type' ); # Check for [[Special:Userlogin/signup]] $this->mName = $request->getText( 'wpName' ); $this->mPassword = $request->getText( 'wpPassword' ); $this->mRetype = $request->getText( 'wpRetype' ); diff --git a/languages/messages/MessagesEn.php b/languages/messages/MessagesEn.php index b83045f6b0..235107d5e9 100644 --- a/languages/messages/MessagesEn.php +++ b/languages/messages/MessagesEn.php @@ -353,6 +353,7 @@ $specialPageAliases = array( 'Disambiguations' => array( 'Disambiguations' ), 'Userlogin' => array( 'Userlogin' ), 'Userlogout' => array( 'Userlogout' ), + 'CreateAccount' => array( 'CreateAccount' ), 'Preferences' => array( 'Preferences' ), 'Watchlist' => array( 'Watchlist' ), 'Recentchanges' => array( 'Recentchanges' ), -- 2.20.1