r86969 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r86968‎ | r86969 | r86970 >
Date:19:05, 26 April 2011
Author:nimishg
Status:ok
Tags:
Comment:
rolled back to r81457
Modified paths:
  • /branches/wmf/1.17wmf1/includes/specials/SpecialUserlogin.php (modified) (history)

Diff [purge]

Index: branches/wmf/1.17wmf1/includes/specials/SpecialUserlogin.php
@@ -22,11 +22,24 @@
2323 */
2424
2525 /**
 26+ * Constructor
 27+ */
 28+function wfSpecialUserlogin( $par = '' ) {
 29+ global $wgRequest;
 30+ if( session_id() == '' ) {
 31+ wfSetupSession();
 32+ }
 33+
 34+ $form = new LoginForm( $wgRequest, $par );
 35+ $form->execute();
 36+}
 37+
 38+/**
2639 * Implements Special:UserLogin
2740 *
2841 * @ingroup SpecialPage
2942 */
30 -class LoginForm extends SpecialPage {
 43+class LoginForm {
3144
3245 const SUCCESS = 0;
3346 const NO_NAME = 1;
@@ -43,42 +56,23 @@
4457 const NEED_TOKEN = 12;
4558 const WRONG_TOKEN = 13;
4659
47 - var $mUsername, $mPassword, $mRetype, $mReturnTo, $mCookieCheck, $mPosted;
48 - var $mAction, $mCreateaccount, $mCreateaccountMail;
 60+ var $mName, $mPassword, $mRetype, $mReturnTo, $mCookieCheck, $mPosted;
 61+ var $mAction, $mCreateaccount, $mCreateaccountMail, $mMailmypassword;
4962 var $mLoginattempt, $mRemember, $mEmail, $mDomain, $mLanguage;
5063 var $mSkipCookieCheck, $mReturnToQuery, $mToken, $mStickHTTPS;
51 - var $mType, $mReason, $mRealName;
52 - var $mAbortLoginErrorMsg = 'login-abort-generic';
5364
54 - /**
55 - * @var ExternalUser
56 - */
5765 private $mExtUser = null;
5866
5967 /**
60 - * @param WebRequest $request
 68+ * Constructor
 69+ * @param $request WebRequest: a WebRequest object passed by reference
 70+ * @param $par String: subpage parameter
6171 */
62 - public function __construct( $request = null ) {
63 - parent::__construct( 'Userlogin' );
64 -
65 - if ( $request === null ) {
66 - global $wgRequest;
67 - $this->load( $wgRequest );
68 - } else {
69 - $this->load( $request );
70 - }
71 - }
72 -
73 - /**
74 - * Loader
75 - *
76 - * @param $request WebRequest object
77 - */
78 - function load( $request ) {
 72+ function __construct( &$request, $par = '' ) {
7973 global $wgAuth, $wgHiddenPrefs, $wgEnableEmail, $wgRedirectOnLogin;
8074
81 - $this->mType = $request->getText( 'type' );
82 - $this->mUsername = $request->getText( 'wpName' );
 75+ $this->mType = ( $par == 'signup' ) ? $par : $request->getText( 'type' ); # Check for [[Special:Userlogin/signup]]
 76+ $this->mName = $request->getText( 'wpName' );
8377 $this->mPassword = $request->getText( 'wpPassword' );
8478 $this->mRetype = $request->getText( 'wpRetype' );
8579 $this->mDomain = $request->getText( 'wpDomain' );
@@ -89,7 +83,9 @@
9084 $this->mPosted = $request->wasPosted();
9185 $this->mCreateaccount = $request->getCheck( 'wpCreateaccount' );
9286 $this->mCreateaccountMail = $request->getCheck( 'wpCreateaccountMail' )
93 - && $wgEnableEmail;
 87+ && $wgEnableEmail;
 88+ $this->mMailmypassword = $request->getCheck( 'wpMailmypassword' )
 89+ && $wgEnableEmail;
9490 $this->mLoginattempt = $request->getCheck( 'wpLoginattempt' );
9591 $this->mAction = $request->getVal( 'action' );
9692 $this->mRemember = $request->getCheck( 'wpRemember' );
@@ -109,9 +105,9 @@
110106 $this->mEmail = '';
111107 }
112108 if( !in_array( 'realname', $wgHiddenPrefs ) ) {
113 - $this->mRealName = $request->getText( 'wpRealName' );
 109+ $this->mRealName = $request->getText( 'wpRealName' );
114110 } else {
115 - $this->mRealName = '';
 111+ $this->mRealName = '';
116112 }
117113
118114 if( !$wgAuth->validDomain( $this->mDomain ) ) {
@@ -127,15 +123,7 @@
128124 }
129125 }
130126
131 - public function execute( $par ) {
132 - if ( session_id() == '' ) {
133 - wfSetupSession();
134 - }
135 -
136 - if ( $par == 'signup' ) { # Check for [[Special:Userlogin/signup]]
137 - $this->mType = 'signup';
138 - }
139 -
 127+ function execute() {
140128 if ( !is_null( $this->mCookieCheck ) ) {
141129 $this->onCookieRedirectCheck( $this->mCookieCheck );
142130 return;
@@ -144,6 +132,8 @@
145133 return $this->addNewAccount();
146134 } elseif ( $this->mCreateaccountMail ) {
147135 return $this->addNewAccountMailPassword();
 136+ } elseif ( $this->mMailmypassword ) {
 137+ return $this->mailPassword();
148138 } elseif ( ( 'submitlogin' == $this->mAction ) || $this->mLoginattempt ) {
149139 return $this->processLogin();
150140 }
@@ -158,7 +148,7 @@
159149 global $wgOut;
160150
161151 if ( $this->mEmail == '' ) {
162 - $this->mainLoginForm( wfMsgExt( 'noemail', array( 'parsemag', 'escape' ), $this->mUsername ) );
 152+ $this->mainLoginForm( wfMsgExt( 'noemail', array( 'parsemag', 'escape' ), $this->mName ) );
163153 return;
164154 }
165155
@@ -177,6 +167,8 @@
178168 $u->addNewUserLogEntry( true, $this->mReason );
179169
180170 $wgOut->setPageTitle( wfMsg( 'accmailtitle' ) );
 171+ $wgOut->setRobotPolicy( 'noindex,nofollow' );
 172+ $wgOut->setArticleRelated( false );
181173
182174 if( !$result->isGood() ) {
183175 $this->mainLoginForm( wfMsg( 'mailerror', $result->getWikiText() ) );
@@ -235,7 +227,9 @@
236228 # Confirm that the account was created
237229 $self = SpecialPage::getTitleFor( 'Userlogin' );
238230 $wgOut->setPageTitle( wfMsgHtml( 'accountcreated' ) );
239 - $wgOut->addWikiMsg( 'accountcreatedtext', $u->getName() );
 231+ $wgOut->setArticleRelated( false );
 232+ $wgOut->setRobotPolicy( 'noindex,nofollow' );
 233+ $wgOut->addHTML( wfMsgWikiHtml( 'accountcreatedtext', $u->getName() ) );
240234 $wgOut->returnToMain( false, $self );
241235 wfRunHooks( 'AddNewAccount', array( $u, false ) );
242236 $u->addNewUserLogEntry( false, $this->mReason );
@@ -264,8 +258,7 @@
265259 // create a local account and login as any domain user). We only need
266260 // to check this for domains that aren't local.
267261 if( 'local' != $this->mDomain && $this->mDomain != '' ) {
268 - if( !$wgAuth->canCreateAccounts() && ( !$wgAuth->userExists( $this->mUsername )
269 - || !$wgAuth->authenticate( $this->mUsername, $this->mPassword ) ) ) {
 262+ if( !$wgAuth->canCreateAccounts() && ( !$wgAuth->userExists( $this->mName ) || !$wgAuth->authenticate( $this->mName, $this->mPassword ) ) ) {
270263 $this->mainLoginForm( wfMsg( 'wrongpassword' ) );
271264 return false;
272265 }
@@ -279,7 +272,7 @@
280273 # Request forgery checks.
281274 if ( !self::getCreateaccountToken() ) {
282275 self::setCreateaccountToken();
283 - $this->mainLoginForm( wfMsgExt( 'nocookiesfornew', array( 'parseinline' ) ) );
 276+ $this->mainLoginForm( wfMsgExt( 'nocookiesnew', array( 'parseinline' ) ) );
284277 return false;
285278 }
286279
@@ -300,7 +293,7 @@
301294 $wgOut->permissionRequired( 'createaccount' );
302295 return false;
303296 } elseif ( $wgUser->isBlockedFromCreateAccount() ) {
304 - $this->userBlockedMessage( $wgUser->isBlockedFromCreateAccount() );
 297+ $this->userBlockedMessage();
305298 return false;
306299 }
307300
@@ -311,7 +304,7 @@
312305 }
313306
314307 # Now create a dummy user ($u) and check if it is valid
315 - $name = trim( $this->mUsername );
 308+ $name = trim( $this->mName );
316309 $u = User::newFromName( $name, 'creatable' );
317310 if ( !is_object( $u ) ) {
318311 $this->mainLoginForm( wfMsg( 'noname' ) );
@@ -332,14 +325,7 @@
333326 $valid = $u->getPasswordValidity( $this->mPassword );
334327 if ( $valid !== true ) {
335328 if ( !$this->mCreateaccountMail ) {
336 - if ( is_array( $valid ) ) {
337 - $message = array_shift( $valid );
338 - $params = $valid;
339 - } else {
340 - $message = $valid;
341 - $params = array( $wgMinimalPasswordLength );
342 - }
343 - $this->mainLoginForm( wfMsgExt( $message, array( 'parsemag' ), $params ) );
 329+ $this->mainLoginForm( wfMsgExt( $valid, array( 'parsemag' ), $wgMinimalPasswordLength ) );
344330 return false;
345331 } else {
346332 # do not force a password for account creation by email
@@ -447,7 +433,7 @@
448434 public function authenticateUserData() {
449435 global $wgUser, $wgAuth, $wgMemc;
450436
451 - if ( $this->mUsername == '' ) {
 437+ if ( $this->mName == '' ) {
452438 return self::NO_NAME;
453439 }
454440
@@ -470,7 +456,7 @@
471457
472458 $throttleCount = 0;
473459 if ( is_array( $wgPasswordAttemptThrottle ) ) {
474 - $throttleKey = wfMemcKey( 'password-throttle', wfGetIP(), md5( $this->mUsername ) );
 460+ $throttleKey = wfMemcKey( 'password-throttle', wfGetIP(), md5( $this->mName ) );
475461 $count = $wgPasswordAttemptThrottle['count'];
476462 $period = $wgPasswordAttemptThrottle['seconds'];
477463
@@ -495,16 +481,16 @@
496482 // creates the user in the database. Until we load $wgUser, checking
497483 // for user existence using User::newFromName($name)->getId() below
498484 // will effectively be using stale data.
499 - if ( $wgUser->getName() === $this->mUsername ) {
500 - wfDebug( __METHOD__ . ": already logged in as {$this->mUsername}\n" );
 485+ if ( $wgUser->getName() === $this->mName ) {
 486+ wfDebug( __METHOD__ . ": already logged in as {$this->mName}\n" );
501487 return self::SUCCESS;
502488 }
503489
504 - $this->mExtUser = ExternalUser::newFromName( $this->mUsername );
 490+ $this->mExtUser = ExternalUser::newFromName( $this->mName );
505491
506492 # TODO: Allow some magic here for invalid external names, e.g., let the
507493 # user choose a different wiki name.
508 - $u = User::newFromName( $this->mUsername );
 494+ $u = User::newFromName( $this->mName );
509495 if( !( $u instanceof User ) || !User::isUsableName( $u->getName() ) ) {
510496 return self::ILLEGAL;
511497 }
@@ -532,7 +518,7 @@
533519
534520 // Give general extensions, such as a captcha, a chance to abort logins
535521 $abort = self::ABORTED;
536 - if( !wfRunHooks( 'AbortLogin', array( $u, $this->mPassword, &$abort, &$this->mAbortLoginErrorMsg ) ) ) {
 522+ if( !wfRunHooks( 'AbortLogin', array( $u, $this->mPassword, &$abort ) ) ) {
537523 return $abort;
538524 }
539525
@@ -593,9 +579,6 @@
594580 /**
595581 * Attempt to automatically create a user on login. Only succeeds if there
596582 * is an external authentication method which allows it.
597 - *
598 - * @param $user User
599 - *
600583 * @return integer Status code
601584 */
602585 function attemptAutoCreate( $user ) {
@@ -635,14 +618,6 @@
636619 }
637620 }
638621
639 - $abortError = '';
640 - if( !wfRunHooks( 'AbortAutoAccount', array( $user, &$abortError ) ) ) {
641 - // Hook point to add extra creation throttles and blocks
642 - wfDebug( "LoginForm::attemptAutoCreate: a hook blocked creation: $abortError\n" );
643 - $this->mAbortLoginErrorMsg = $abortError;
644 - return self::ABORTED;
645 - }
646 -
647622 wfDebug( __METHOD__ . ": creating account\n" );
648623 $this->initUser( $user, true );
649624 return self::SUCCESS;
@@ -664,7 +639,7 @@
665640 self::clearLoginToken();
666641
667642 // Reset the throttle
668 - $key = wfMemcKey( 'password-throttle', wfGetIP(), md5( $this->mUsername ) );
 643+ $key = wfMemcKey( 'password-throttle', wfGetIP(), md5( $this->mName ) );
669644 global $wgMemc;
670645 $wgMemc->delete( $key );
671646
@@ -682,7 +657,7 @@
683658 break;
684659
685660 case self::NEED_TOKEN:
686 - $this->mainLoginForm( wfMsgExt( 'nocookiesforlogin', array( 'parseinline' ) ) );
 661+ $this->mainLoginForm( wfMsgExt( 'nocookieslogin', array( 'parseinline' ) ) );
687662 break;
688663 case self::WRONG_TOKEN:
689664 $this->mainLoginForm( wfMsg( 'sessionfailure' ) );
@@ -696,9 +671,9 @@
697672 break;
698673 case self::NOT_EXISTS:
699674 if( $wgUser->isAllowed( 'createaccount' ) ) {
700 - $this->mainLoginForm( wfMsgExt( 'nosuchuser', 'parseinline', $this->mUsername ) );
 675+ $this->mainLoginForm( wfMsgWikiHtml( 'nosuchuser', htmlspecialchars( $this->mName ) ) );
701676 } else {
702 - $this->mainLoginForm( wfMsg( 'nosuchusershort', htmlspecialchars( $this->mUsername ) ) );
 677+ $this->mainLoginForm( wfMsg( 'nosuchusershort', htmlspecialchars( $this->mName ) ) );
703678 }
704679 break;
705680 case self::WRONG_PASS:
@@ -718,11 +693,8 @@
719694 break;
720695 case self::USER_BLOCKED:
721696 $this->mainLoginForm( wfMsgExt( 'login-userblocked',
722 - array( 'parsemag', 'escape' ), $this->mUsername ) );
 697+ array( 'parsemag', 'escape' ), $this->mName ) );
723698 break;
724 - case self::ABORTED:
725 - $this->mainLoginForm( wfMsg( $this->mAbortLoginErrorMsg ) );
726 - break;
727699 default:
728700 throw new MWException( 'Unhandled case value' );
729701 }
@@ -731,11 +703,100 @@
732704 function resetLoginForm( $error ) {
733705 global $wgOut;
734706 $wgOut->addHTML( Xml::element('p', array( 'class' => 'error' ), $error ) );
735 - $reset = new SpecialChangePassword();
 707+ $reset = new SpecialResetpass();
736708 $reset->execute( null );
737709 }
738710
739711 /**
 712+ * @private
 713+ */
 714+ function mailPassword() {
 715+ global $wgUser, $wgOut, $wgAuth;
 716+
 717+ if ( wfReadOnly() ) {
 718+ $wgOut->readOnlyPage();
 719+ return false;
 720+ }
 721+
 722+ if( !$wgAuth->allowPasswordChange() ) {
 723+ $this->mainLoginForm( wfMsg( 'resetpass_forbidden' ) );
 724+ return;
 725+ }
 726+
 727+ # Check against blocked IPs so blocked users can't flood admins
 728+ # with password resets
 729+ if( $wgUser->isBlocked() ) {
 730+ $this->mainLoginForm( wfMsg( 'blocked-mailpassword' ) );
 731+ return;
 732+ }
 733+
 734+ # Check for hooks
 735+ $error = null;
 736+ if ( !wfRunHooks( 'UserLoginMailPassword', array( $this->mName, &$error ) ) ) {
 737+ $this->mainLoginForm( $error );
 738+ return;
 739+ }
 740+
 741+ # If the user doesn't have a login token yet, set one.
 742+ if ( !self::getLoginToken() ) {
 743+ self::setLoginToken();
 744+ $this->mainLoginForm( wfMsg( 'sessionfailure' ) );
 745+ return;
 746+ }
 747+
 748+ # If the user didn't pass a login token, tell them we need one
 749+ if ( !$this->mToken ) {
 750+ $this->mainLoginForm( wfMsg( 'sessionfailure' ) );
 751+ return;
 752+ }
 753+
 754+ # Check against the rate limiter
 755+ if( $wgUser->pingLimiter( 'mailpassword' ) ) {
 756+ $wgOut->rateLimited();
 757+ return;
 758+ }
 759+
 760+ if ( $this->mName == '' ) {
 761+ $this->mainLoginForm( wfMsg( 'noname' ) );
 762+ return;
 763+ }
 764+ $u = User::newFromName( $this->mName );
 765+ if( !$u instanceof User ) {
 766+ $this->mainLoginForm( wfMsg( 'noname' ) );
 767+ return;
 768+ }
 769+ if ( 0 == $u->getID() ) {
 770+ $this->mainLoginForm( wfMsgWikiHtml( 'nosuchuser', htmlspecialchars( $u->getName() ) ) );
 771+ return;
 772+ }
 773+
 774+ # Validate the login token
 775+ if ( $this->mToken !== self::getLoginToken() ) {
 776+ $this->mainLoginForm( wfMsg( 'sessionfailure' ) );
 777+ return;
 778+ }
 779+
 780+ # Check against password throttle
 781+ if ( $u->isPasswordReminderThrottled() ) {
 782+ global $wgPasswordReminderResendTime;
 783+ # Round the time in hours to 3 d.p., in case someone is specifying
 784+ # minutes or seconds.
 785+ $this->mainLoginForm( wfMsgExt( 'throttled-mailpassword', array( 'parsemag' ),
 786+ round( $wgPasswordReminderResendTime, 3 ) ) );
 787+ return;
 788+ }
 789+
 790+ $result = $this->mailPasswordInternal( $u, true, 'passwordremindertitle', 'passwordremindertext' );
 791+ if( $result->isGood() ) {
 792+ $this->mainLoginForm( wfMsg( 'passwordsent', $u->getName() ), 'success' );
 793+ self::clearLoginToken();
 794+ } else {
 795+ $this->mainLoginForm( $result->getWikiText( 'mailerror' ) );
 796+ }
 797+ }
 798+
 799+
 800+ /**
740801 * @param $u User object
741802 * @param $throttle Boolean
742803 * @param $emailTitle String: message name of email title
@@ -811,14 +872,9 @@
812873 global $wgUser;
813874 # Run any hooks; display injected HTML
814875 $injected_html = '';
815 - $welcome_creation_msg = 'welcomecreation';
816 -
817876 wfRunHooks( 'UserLoginComplete', array( &$wgUser, &$injected_html ) );
818 -
819 - //let any extensions change what message is shown
820 - wfRunHooks( 'BeforeWelcomeCreation', array( &$welcome_creation_msg, &$injected_html ) );
821 -
822 - $this->displaySuccessfulLogin( $welcome_creation_msg, $injected_html );
 877+
 878+ $this->displaySuccessfulLogin( 'welcomecreation', $injected_html );
823879 }
824880
825881 /**
@@ -828,10 +884,9 @@
829885 global $wgOut, $wgUser;
830886
831887 $wgOut->setPageTitle( wfMsg( 'loginsuccesstitle' ) );
832 - if( $msgname ){
833 - $wgOut->addWikiMsg( $msgname, $wgUser->getName() );
834 - }
835 -
 888+ $wgOut->setRobotPolicy( 'noindex,nofollow' );
 889+ $wgOut->setArticleRelated( false );
 890+ $wgOut->addWikiMsg( $msgname, $wgUser->getName() );
836891 $wgOut->addHTML( $injected_html );
837892
838893 if ( !empty( $this->mReturnTo ) ) {
@@ -841,15 +896,9 @@
842897 }
843898 }
844899
845 - /**
846 - * Output a message that informs the user that they cannot create an account because
847 - * there is a block on them or their IP which prevents account creation. Note that
848 - * User::isBlockedFromCreateAccount(), which gets this block, ignores the 'hardblock'
849 - * setting on blocks (bug 13611).
850 - * @param $block Block the block causing this error
851 - */
852 - function userBlockedMessage( Block $block ) {
853 - global $wgOut;
 900+ /** */
 901+ function userBlockedMessage() {
 902+ global $wgOut, $wgUser;
854903
855904 # Let's be nice about this, it's likely that this feature will be used
856905 # for blocking large numbers of innocent people, e.g. range blocks on
@@ -860,19 +909,17 @@
861910 # out.
862911
863912 $wgOut->setPageTitle( wfMsg( 'cantcreateaccounttitle' ) );
 913+ $wgOut->setRobotPolicy( 'noindex,nofollow' );
 914+ $wgOut->setArticleRelated( false );
864915
865 - $block_reason = $block->mReason;
 916+ $ip = wfGetIP();
 917+ $blocker = User::whoIs( $wgUser->mBlock->mBy );
 918+ $block_reason = $wgUser->mBlock->mReason;
 919+
866920 if ( strval( $block_reason ) === '' ) {
867921 $block_reason = wfMsg( 'blockednoreason' );
868922 }
869 -
870 - $wgOut->addWikiMsg(
871 - 'cantcreateaccount-text',
872 - $block->getTarget(),
873 - $block_reason,
874 - $block->getBlocker()->getName()
875 - );
876 -
 923+ $wgOut->addWikiMsg( 'cantcreateaccount-text', $ip, $block_reason, $blocker );
877924 $wgOut->returnToMain( false );
878925 }
879926
@@ -880,11 +927,10 @@
881928 * @private
882929 */
883930 function mainLoginForm( $msg, $msgtype = 'error' ) {
884 - global $wgUser, $wgOut, $wgHiddenPrefs;
885 - global $wgEnableEmail, $wgEnableUserEmail;
 931+ global $wgUser, $wgOut, $wgHiddenPrefs, $wgEnableEmail;
886932 global $wgRequest, $wgLoginLanguageSelector;
887933 global $wgAuth, $wgEmailConfirmToEdit, $wgCookieExpiration;
888 - global $wgSecureLogin, $wgPasswordResetRoutes;
 934+ global $wgSecureLogin;
889935
890936 $titleObj = SpecialPage::getTitleFor( 'Userlogin' );
891937
@@ -896,7 +942,7 @@
897943 $wgOut->readOnlyPage();
898944 return;
899945 } elseif ( $wgUser->isBlockedFromCreateAccount() ) {
900 - $this->userBlockedMessage( $wgUser->isBlockedFromCreateAccount() );
 946+ $this->userBlockedMessage();
901947 return;
902948 } elseif ( count( $permErrors = $titleObj->getUserPermissionsErrors( 'createaccount', $wgUser, true ) )>0 ) {
903949 $wgOut->showPermissionsErrorPage( $permErrors, 'createaccount' );
@@ -904,11 +950,11 @@
905951 }
906952 }
907953
908 - if ( $this->mUsername == '' ) {
 954+ if ( $this->mName == '' ) {
909955 if ( $wgUser->isLoggedIn() ) {
910 - $this->mUsername = $wgUser->getName();
 956+ $this->mName = $wgUser->getName();
911957 } else {
912 - $this->mUsername = $wgRequest->getCookie( 'UserName' );
 958+ $this->mName = $wgRequest->getCookie( 'UserName' );
913959 }
914960 }
915961
@@ -950,12 +996,8 @@
951997 $template->set( 'link', '' );
952998 }
953999
954 - $resetLink = $this->mType == 'signup'
955 - ? null
956 - : is_array( $wgPasswordResetRoutes ) && in_array( true, array_values( $wgPasswordResetRoutes ) );
957 -
9581000 $template->set( 'header', '' );
959 - $template->set( 'name', $this->mUsername );
 1001+ $template->set( 'name', $this->mName );
9601002 $template->set( 'password', $this->mPassword );
9611003 $template->set( 'retype', $this->mRetype );
9621004 $template->set( 'email', $this->mEmail );
@@ -970,9 +1012,7 @@
9711013 $template->set( 'userealname', !in_array( 'realname', $wgHiddenPrefs ) );
9721014 $template->set( 'useemail', $wgEnableEmail );
9731015 $template->set( 'emailrequired', $wgEmailConfirmToEdit );
974 - $template->set( 'emailothers', $wgEnableUserEmail );
9751016 $template->set( 'canreset', $wgAuth->allowPasswordChange() );
976 - $template->set( 'resetlink', $resetLink );
9771017 $template->set( 'canremember', ( $wgCookieExpiration > 0 ) );
9781018 $template->set( 'usereason', $wgUser->isLoggedIn() );
9791019 $template->set( 'remember', $wgUser->getOption( 'rememberpassword' ) || $this->mRemember );
@@ -1013,24 +1053,22 @@
10141054 $wgOut->setPageTitle( wfMsg( 'userloginnocreate' ) );
10151055 }
10161056
 1057+ $wgOut->setRobotPolicy( 'noindex,nofollow' );
 1058+ $wgOut->setArticleRelated( false );
10171059 $wgOut->disallowUserJs(); // just in case...
10181060 $wgOut->addTemplate( $template );
10191061 }
10201062
10211063 /**
10221064 * @private
1023 - *
1024 - * @param $user User
1025 - *
1026 - * @return Boolean
10271065 */
10281066 function showCreateOrLoginLink( &$user ) {
10291067 if( $this->mType == 'signup' ) {
1030 - return true;
 1068+ return( true );
10311069 } elseif( $user->isAllowed( 'createaccount' ) ) {
1032 - return true;
 1070+ return( true );
10331071 } else {
1034 - return false;
 1072+ return( false );
10351073 }
10361074 }
10371075
@@ -1148,9 +1186,9 @@
11491187 function makeLanguageSelector() {
11501188 global $wgLang;
11511189
1152 - $msg = wfMessage( 'loginlanguagelinks' )->inContentLanguage();
1153 - if( !$msg->isBlank() ) {
1154 - $langs = explode( "\n", $msg->text() );
 1190+ $msg = wfMsgForContent( 'loginlanguagelinks' );
 1191+ if( $msg != '' && !wfEmptyMsg( 'loginlanguagelinks', $msg ) ) {
 1192+ $langs = explode( "\n", $msg );
11551193 $links = array();
11561194 foreach( $langs as $lang ) {
11571195 $lang = trim( $lang, '* ' );

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r81457Creating new WMF branchcatrope15:31, 3 February 2011

Status & tagging log