r56686 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r56685‎ | r56686 | r56687 >
Date:21:24, 20 September 2009
Author:happy-melon
Status:reverted
Tags:
Comment:
Follow-ups to r56684: add a member function for extensions to add header text cleanly, and tweak variable names in api/ApiLogin.php.
Modified paths:
  • /trunk/extensions/ConfirmAccount/SpecialConfirmAccount.php (modified) (history)
  • /trunk/extensions/ConfirmEdit/ConfirmEdit_body.php (modified) (history)
  • /trunk/extensions/WikimediaIncubator/CreateAccountTestWiki.php (modified) (history)
  • /trunk/phase3/includes/api/ApiLogin.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialCreateAccount.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialUserlogin.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiLogin.php
@@ -68,8 +68,8 @@
6969 wfSetupSession();
7070 }
7171
72 - $loginForm = new Login( $req );
73 - switch ( $authRes = $loginForm->attemptLogin() ) {
 72+ $login = new Login( $req );
 73+ switch ( $authRes = $login->attemptLogin() ) {
7474 case Login::SUCCESS :
7575 global $wgUser, $wgCookiePrefix;
7676
Index: trunk/phase3/includes/specials/SpecialUserlogin.php
@@ -540,6 +540,16 @@
541541 return;
542542 }
543543 }
 544+
 545+ /**
 546+ * Add text to the header. Only write to $mFormHeader directly
 547+ * if you're determined to overwrite anything that other
 548+ * extensions might have added.
 549+ * @param $text String HTML
 550+ */
 551+ public function addFormHeader( $text ){
 552+ $this->mFormHeader .= $text;
 553+ }
544554
545555 /**
546556 * Since the UserLoginForm hook was changed to pass a SpecialPage
Index: trunk/phase3/includes/specials/SpecialCreateAccount.php
@@ -503,6 +503,16 @@
504504 }
505505
506506 /**
 507+ * Add text to the header. Only write to $mFormHeader directly
 508+ * if you're determined to overwrite anything that other
 509+ * extensions might have added.
 510+ * @param $text String HTML
 511+ */
 512+ public function addFormHeader( $text ){
 513+ $this->mFormHeader .= $text;
 514+ }
 515+
 516+ /**
507517 * Since the UserCreateForm hook was changed to pass a SpecialPage
508518 * instead of a QuickTemplate derivative, old extensions might
509519 * easily try calling these methods expecing them to exist. Tempting
Index: trunk/extensions/ConfirmEdit/ConfirmEdit_body.php
@@ -151,11 +151,12 @@
152152 wfDebug( "ConfirmEdit: user group allows skipping captcha on account creation\n" );
153153 return true;
154154 }
155 - $sp->mFormHeader .=
 155+ $sp->addFormHeader(
156156 "<div class='captcha'>" .
157157 $wgOut->parse( $this->getMessage( 'createaccount' ) ) .
158158 $this->getForm() .
159 - "</div>\n";
 159+ "</div>\n"
 160+ );
160161 }
161162 return true;
162163 }
@@ -169,11 +170,12 @@
170171 function injectUserLogin( &$sp ) {
171172 if ( $this->isBadLoginTriggered() ) {
172173 global $wgOut;
173 - $sp->mFormHeader .=
 174+ $sp->addFormHeader(
174175 "<div class='captcha'>" .
175176 $wgOut->parse( $this->getMessage( 'badlogin' ) ) .
176177 $this->getForm() .
177 - "</div>\n";
 178+ "</div>\n"
 179+ );
178180 }
179181 return true;
180182 }
Index: trunk/extensions/WikimediaIncubator/CreateAccountTestWiki.php
@@ -9,9 +9,9 @@
1010 $projectvalue = strtolower( $wgRequest->getVal( 'testwikiproject', '' ) );
1111 $codevalue = strtolower( $wgRequest->getVal( 'testwikicode', '' ) );
1212 if ( preg_match( '/[a-z][a-z][a-z]?/', $codevalue ) && in_array( $projectvalue, array( 'p', 'b', 't', 'q', 'n' ) ) ) {
13 - $sp->mFormHeader .= '<input type="hidden" name="testwiki-project" value="' . $projectvalue . '" />
 13+ $sp->addFormHeader( '<input type="hidden" name="testwiki-project" value="' . $projectvalue . '" />
1414 <input type="hidden" name="testwiki-code" value="' . $codevalue . '" />
15 - ';
 15+ ');
1616 }
1717 return true;
1818 }
Index: trunk/extensions/ConfirmAccount/SpecialConfirmAccount.php
@@ -137,7 +137,7 @@
138138 wfLoadExtensionMessages( 'ConfirmAccount' );
139139 # Add a link to RequestAccount from UserLogin
140140 if ( !$wgUser->isAllowed( 'createaccount' ) ) {
141 - $sp->mFormHeader = wfMsgExt( 'requestaccount-loginnotice', array( 'parse' ) );
 141+ $sp->addFormHeader( wfMsgExt( 'requestaccount-loginnotice', array( 'parse' ) ) );
142142 }
143143 return true;
144144 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r56937Revert broken rewrite of login system; totally broken....brion00:49, 26 September 2009

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r56684Merge in Login rewrite, second time lucky.happy-melon20:28, 20 September 2009

Status & tagging log