Index: trunk/phase3/includes/specials/SpecialUserlogin.php |
— | — | @@ -1,6 +1,6 @@ |
2 | 2 | <?php |
3 | 3 | /** |
4 | | - * Implements Special:Userlogin |
| 4 | + * Implements Special:UserLogin |
5 | 5 | * |
6 | 6 | * This program is free software; you can redistribute it and/or modify |
7 | 7 | * it under the terms of the GNU General Public License as published by |
— | — | @@ -22,7 +22,7 @@ |
23 | 23 | */ |
24 | 24 | |
25 | 25 | /** |
26 | | - * constructor |
| 26 | + * Constructor |
27 | 27 | */ |
28 | 28 | function wfSpecialUserlogin( $par = '' ) { |
29 | 29 | global $wgRequest; |
— | — | @@ -35,7 +35,7 @@ |
36 | 36 | } |
37 | 37 | |
38 | 38 | /** |
39 | | - * Implements Special:Login |
| 39 | + * Implements Special:UserLogin |
40 | 40 | * |
41 | 41 | * @ingroup SpecialPage |
42 | 42 | */ |
— | — | @@ -91,7 +91,7 @@ |
92 | 92 | $this->mRemember = $request->getCheck( 'wpRemember' ); |
93 | 93 | $this->mLanguage = $request->getText( 'uselang' ); |
94 | 94 | $this->mSkipCookieCheck = $request->getCheck( 'wpSkipCookieCheck' ); |
95 | | - $this->mToken = ($this->mType == 'signup' ) ? $request->getVal( 'wpCreateaccountToken' ) : $request->getVal( 'wpLoginToken' ); |
| 95 | + $this->mToken = ( $this->mType == 'signup' ) ? $request->getVal( 'wpCreateaccountToken' ) : $request->getVal( 'wpLoginToken' ); |
96 | 96 | |
97 | 97 | if ( $wgRedirectOnLogin ) { |
98 | 98 | $this->mReturnTo = $wgRedirectOnLogin; |
— | — | @@ -126,14 +126,14 @@ |
127 | 127 | if ( !is_null( $this->mCookieCheck ) ) { |
128 | 128 | $this->onCookieRedirectCheck( $this->mCookieCheck ); |
129 | 129 | return; |
130 | | - } else if( $this->mPosted ) { |
| 130 | + } elseif( $this->mPosted ) { |
131 | 131 | if( $this->mCreateaccount ) { |
132 | 132 | return $this->addNewAccount(); |
133 | | - } else if ( $this->mCreateaccountMail ) { |
| 133 | + } elseif ( $this->mCreateaccountMail ) { |
134 | 134 | return $this->addNewAccountMailPassword(); |
135 | | - } else if ( $this->mMailmypassword ) { |
| 135 | + } elseif ( $this->mMailmypassword ) { |
136 | 136 | return $this->mailPassword(); |
137 | | - } else if ( ( 'submitlogin' == $this->mAction ) || $this->mLoginattempt ) { |
| 137 | + } elseif ( ( 'submitlogin' == $this->mAction ) || $this->mLoginattempt ) { |
138 | 138 | return $this->processLogin(); |
139 | 139 | } |
140 | 140 | } |
— | — | @@ -153,7 +153,7 @@ |
154 | 154 | |
155 | 155 | $u = $this->addNewaccountInternal(); |
156 | 156 | |
157 | | - if ($u == null) { |
| 157 | + if ( $u == null ) { |
158 | 158 | return; |
159 | 159 | } |
160 | 160 | |
— | — | @@ -178,7 +178,6 @@ |
179 | 179 | $u = 0; |
180 | 180 | } |
181 | 181 | |
182 | | - |
183 | 182 | /** |
184 | 183 | * @private |
185 | 184 | */ |
— | — | @@ -187,14 +186,16 @@ |
188 | 187 | |
189 | 188 | # Create the account and abort if there's a problem doing so |
190 | 189 | $u = $this->addNewAccountInternal(); |
191 | | - if( $u == null ) |
| 190 | + if( $u == null ) { |
192 | 191 | return; |
| 192 | + } |
193 | 193 | |
194 | 194 | # If we showed up language selection links, and one was in use, be |
195 | 195 | # smart (and sensible) and save that language as the user's preference |
196 | 196 | global $wgLoginLanguageSelector; |
197 | | - if( $wgLoginLanguageSelector && $this->mLanguage ) |
| 197 | + if( $wgLoginLanguageSelector && $this->mLanguage ) { |
198 | 198 | $u->setOption( 'language', $this->mLanguage ); |
| 199 | + } |
199 | 200 | |
200 | 201 | # Send out an email authentication message if needed |
201 | 202 | if( $wgEmailAuthentication && User::isValidEmailAddr( $u->getEmail() ) ) { |
— | — | @@ -274,13 +275,13 @@ |
275 | 276 | $this->mainLoginForm( wfMsg( 'sessionfailure' ) ); |
276 | 277 | return false; |
277 | 278 | } |
278 | | - |
| 279 | + |
279 | 280 | # The user didn't pass a createaccount token |
280 | 281 | if ( !$this->mToken ) { |
281 | 282 | $this->mainLoginForm( wfMsg( 'sessionfailure' ) ); |
282 | 283 | return false; |
283 | 284 | } |
284 | | - |
| 285 | + |
285 | 286 | # Validate the createaccount token |
286 | 287 | if ( $this->mToken !== self::getCreateaccountToken() ) { |
287 | 288 | $this->mainLoginForm( wfMsg( 'sessionfailure' ) ); |
— | — | @@ -376,7 +377,7 @@ |
377 | 378 | return false; |
378 | 379 | } |
379 | 380 | |
380 | | - self::clearCreateaccountToken(); |
| 381 | + self::clearCreateaccountToken(); |
381 | 382 | return $this->initUser( $u, false ); |
382 | 383 | } |
383 | 384 | |
— | — | @@ -431,16 +432,16 @@ |
432 | 433 | */ |
433 | 434 | public function authenticateUserData() { |
434 | 435 | global $wgUser, $wgAuth, $wgMemc; |
435 | | - |
| 436 | + |
436 | 437 | if ( $this->mName == '' ) { |
437 | 438 | return self::NO_NAME; |
438 | 439 | } |
439 | | - |
| 440 | + |
440 | 441 | // We require a login token to prevent login CSRF |
441 | 442 | // Handle part of this before incrementing the throttle so |
442 | 443 | // token-less login attempts don't count towards the throttle |
443 | 444 | // but wrong-token attempts do. |
444 | | - |
| 445 | + |
445 | 446 | // If the user doesn't have a login token yet, set one. |
446 | 447 | if ( !self::getLoginToken() ) { |
447 | 448 | self::setLoginToken(); |
— | — | @@ -450,7 +451,7 @@ |
451 | 452 | if ( !$this->mToken ) { |
452 | 453 | return self::NEED_TOKEN; |
453 | 454 | } |
454 | | - |
| 455 | + |
455 | 456 | global $wgPasswordAttemptThrottle; |
456 | 457 | |
457 | 458 | $throttleCount = 0; |
— | — | @@ -458,17 +459,17 @@ |
459 | 460 | $throttleKey = wfMemcKey( 'password-throttle', wfGetIP(), md5( $this->mName ) ); |
460 | 461 | $count = $wgPasswordAttemptThrottle['count']; |
461 | 462 | $period = $wgPasswordAttemptThrottle['seconds']; |
462 | | - |
| 463 | + |
463 | 464 | $throttleCount = $wgMemc->get( $throttleKey ); |
464 | 465 | if ( !$throttleCount ) { |
465 | 466 | $wgMemc->add( $throttleKey, 1, $period ); // start counter |
466 | | - } else if ( $throttleCount < $count ) { |
467 | | - $wgMemc->incr($throttleKey); |
468 | | - } else if ( $throttleCount >= $count ) { |
| 467 | + } elseif ( $throttleCount < $count ) { |
| 468 | + $wgMemc->incr( $throttleKey ); |
| 469 | + } elseif ( $throttleCount >= $count ) { |
469 | 470 | return self::THROTTLED; |
470 | 471 | } |
471 | 472 | } |
472 | | - |
| 473 | + |
473 | 474 | // Validate the login token |
474 | 475 | if ( $this->mToken !== self::getLoginToken() ) { |
475 | 476 | return self::WRONG_TOKEN; |
— | — | @@ -481,7 +482,7 @@ |
482 | 483 | // for user existence using User::newFromName($name)->getId() below |
483 | 484 | // will effectively be using stale data. |
484 | 485 | if ( $wgUser->getName() === $this->mName ) { |
485 | | - wfDebug( __METHOD__.": already logged in as {$this->mName}\n" ); |
| 486 | + wfDebug( __METHOD__ . ": already logged in as {$this->mName}\n" ); |
486 | 487 | return self::SUCCESS; |
487 | 488 | } |
488 | 489 | |
— | — | @@ -522,7 +523,7 @@ |
523 | 524 | } |
524 | 525 | |
525 | 526 | global $wgBlockDisablesLogin; |
526 | | - if (!$u->checkPassword( $this->mPassword )) { |
| 527 | + if ( !$u->checkPassword( $this->mPassword ) ) { |
527 | 528 | if( $u->checkTemporaryPassword( $this->mPassword ) ) { |
528 | 529 | // The e-mailed temporary password should not be used for actu- |
529 | 530 | // al logins; that's a very sloppy habit, and insecure if an |
— | — | @@ -550,7 +551,7 @@ |
551 | 552 | // faces etc will probably just fail cleanly here. |
552 | 553 | $retval = self::RESET_PASS; |
553 | 554 | } else { |
554 | | - $retval = ($this->mPassword == '') ? self::EMPTY_PASS : self::WRONG_PASS; |
| 555 | + $retval = ( $this->mPassword == '' ) ? self::EMPTY_PASS : self::WRONG_PASS; |
555 | 556 | } |
556 | 557 | } elseif ( $wgBlockDisablesLogin && $u->isBlocked() ) { |
557 | 558 | // If we've enabled it, make it so that a blocked user cannot login |
— | — | @@ -560,8 +561,8 @@ |
561 | 562 | $wgUser = $u; |
562 | 563 | |
563 | 564 | // Please reset throttle for successful logins, thanks! |
564 | | - if($throttleCount) { |
565 | | - $wgMemc->delete($throttleKey); |
| 565 | + if( $throttleCount ) { |
| 566 | + $wgMemc->delete( $throttleKey ); |
566 | 567 | } |
567 | 568 | |
568 | 569 | if ( $isAutoCreated ) { |
— | — | @@ -584,7 +585,7 @@ |
585 | 586 | global $wgAuth, $wgUser, $wgAutocreatePolicy; |
586 | 587 | |
587 | 588 | if ( $wgUser->isBlockedFromCreateAccount() ) { |
588 | | - wfDebug( __METHOD__.": user is blocked from account creation\n" ); |
| 589 | + wfDebug( __METHOD__ . ": user is blocked from account creation\n" ); |
589 | 590 | return self::CREATE_BLOCKED; |
590 | 591 | } |
591 | 592 | |
— | — | @@ -608,16 +609,16 @@ |
609 | 610 | return self::NOT_EXISTS; |
610 | 611 | } |
611 | 612 | if ( !$wgAuth->userExists( $user->getName() ) ) { |
612 | | - wfDebug( __METHOD__.": user does not exist\n" ); |
| 613 | + wfDebug( __METHOD__ . ": user does not exist\n" ); |
613 | 614 | return self::NOT_EXISTS; |
614 | 615 | } |
615 | 616 | if ( !$wgAuth->authenticate( $user->getName(), $this->mPassword ) ) { |
616 | | - wfDebug( __METHOD__.": \$wgAuth->authenticate() returned false, aborting\n" ); |
| 617 | + wfDebug( __METHOD__ . ": \$wgAuth->authenticate() returned false, aborting\n" ); |
617 | 618 | return self::WRONG_PLUGIN_PASS; |
618 | 619 | } |
619 | 620 | } |
620 | 621 | |
621 | | - wfDebug( __METHOD__.": creating account\n" ); |
| 622 | + wfDebug( __METHOD__ . ": creating account\n" ); |
622 | 623 | $user = $this->initUser( $user, true ); |
623 | 624 | return self::SUCCESS; |
624 | 625 | } |
— | — | @@ -654,7 +655,7 @@ |
655 | 656 | return $this->cookieRedirectCheck( 'login' ); |
656 | 657 | } |
657 | 658 | break; |
658 | | - |
| 659 | + |
659 | 660 | case self::NEED_TOKEN: |
660 | 661 | case self::WRONG_TOKEN: |
661 | 662 | $this->mainLoginForm( wfMsg( 'sessionfailure' ) ); |
— | — | @@ -667,7 +668,7 @@ |
668 | 669 | $this->mainLoginForm( wfMsg( 'wrongpassword' ) ); |
669 | 670 | break; |
670 | 671 | case self::NOT_EXISTS: |
671 | | - if( $wgUser->isAllowed( 'createaccount' ) ){ |
| 672 | + if( $wgUser->isAllowed( 'createaccount' ) ) { |
672 | 673 | $this->mainLoginForm( wfMsgWikiHtml( 'nosuchuser', htmlspecialchars( $this->mName ) ) ); |
673 | 674 | } else { |
674 | 675 | $this->mainLoginForm( wfMsg( 'nosuchusershort', htmlspecialchars( $this->mName ) ) ); |
— | — | @@ -693,7 +694,7 @@ |
694 | 695 | array( 'parsemag', 'escape' ), $this->mName ) ); |
695 | 696 | break; |
696 | 697 | default: |
697 | | - throw new MWException( "Unhandled case value" ); |
| 698 | + throw new MWException( 'Unhandled case value' ); |
698 | 699 | } |
699 | 700 | } |
700 | 701 | |
— | — | @@ -709,27 +710,27 @@ |
710 | 711 | */ |
711 | 712 | function mailPassword() { |
712 | 713 | global $wgUser, $wgOut, $wgAuth; |
713 | | - |
| 714 | + |
714 | 715 | if ( wfReadOnly() ) { |
715 | 716 | $wgOut->readOnlyPage(); |
716 | 717 | return false; |
717 | 718 | } |
718 | | - |
| 719 | + |
719 | 720 | if( !$wgAuth->allowPasswordChange() ) { |
720 | 721 | $this->mainLoginForm( wfMsg( 'resetpass_forbidden' ) ); |
721 | 722 | return; |
722 | 723 | } |
723 | 724 | |
724 | | - # Check against blocked IPs so blocked users can't flood admins |
| 725 | + # Check against blocked IPs so blocked users can't flood admins |
725 | 726 | # with password resets |
726 | 727 | if( $wgUser->isBlocked() ) { |
727 | 728 | $this->mainLoginForm( wfMsg( 'blocked-mailpassword' ) ); |
728 | 729 | return; |
729 | 730 | } |
730 | | - |
| 731 | + |
731 | 732 | # Check for hooks |
732 | 733 | $error = null; |
733 | | - if ( ! wfRunHooks( 'UserLoginMailPassword', array( $this->mName, &$error ) ) ) { |
| 734 | + if ( !wfRunHooks( 'UserLoginMailPassword', array( $this->mName, &$error ) ) ) { |
734 | 735 | $this->mainLoginForm( $error ); |
735 | 736 | return; |
736 | 737 | } |
— | — | @@ -746,7 +747,7 @@ |
747 | 748 | $this->mainLoginForm( wfMsg( 'sessionfailure' ) ); |
748 | 749 | return; |
749 | 750 | } |
750 | | - |
| 751 | + |
751 | 752 | # Check against the rate limiter |
752 | 753 | if( $wgUser->pingLimiter( 'mailpassword' ) ) { |
753 | 754 | $wgOut->rateLimited(); |
— | — | @@ -811,9 +812,9 @@ |
812 | 813 | if( !$ip ) { |
813 | 814 | return new WikiError( wfMsg( 'badipaddress' ) ); |
814 | 815 | } |
815 | | - |
816 | | - wfRunHooks( 'User::mailPasswordInternal', array(&$wgUser, &$ip, &$u) ); |
817 | 816 | |
| 817 | + wfRunHooks( 'User::mailPasswordInternal', array( &$wgUser, &$ip, &$u ) ); |
| 818 | + |
818 | 819 | $np = $u->randomPassword(); |
819 | 820 | $u->setNewpassword( $np, $throttle ); |
820 | 821 | $u->saveSettings(); |
— | — | @@ -841,7 +842,7 @@ |
842 | 843 | |
843 | 844 | # Run any hooks; display injected HTML if any, else redirect |
844 | 845 | $injected_html = ''; |
845 | | - wfRunHooks('UserLoginComplete', array(&$wgUser, &$injected_html)); |
| 846 | + wfRunHooks( 'UserLoginComplete', array( &$wgUser, &$injected_html ) ); |
846 | 847 | |
847 | 848 | if( $injected_html !== '' ) { |
848 | 849 | $this->displaySuccessfulLogin( 'loginsuccess', $injected_html ); |
— | — | @@ -864,7 +865,7 @@ |
865 | 866 | global $wgUser; |
866 | 867 | # Run any hooks; display injected HTML |
867 | 868 | $injected_html = ''; |
868 | | - wfRunHooks('UserLoginComplete', array(&$wgUser, &$injected_html)); |
| 869 | + wfRunHooks( 'UserLoginComplete', array( &$wgUser, &$injected_html ) ); |
869 | 870 | |
870 | 871 | $this->displaySuccessfulLogin( 'welcomecreation', $injected_html ); |
871 | 872 | } |
— | — | @@ -896,7 +897,7 @@ |
897 | 898 | $wgOut->setRobotPolicy( 'noindex,nofollow' ); |
898 | 899 | $wgOut->setArticleRelated( false ); |
899 | 900 | |
900 | | - $wgOut->addWikitext( $wgOut->formatPermissionsErrorMessage( $errors, 'createaccount' ) ); |
| 901 | + $wgOut->addWikiText( $wgOut->formatPermissionsErrorMessage( $errors, 'createaccount' ) ); |
901 | 902 | // Stuff that might want to be added at the end. For example, instruc- |
902 | 903 | // tions if blocked. |
903 | 904 | $wgOut->addWikiMsg( 'cantcreateaccount-nonblock-text' ); |
— | — | @@ -938,12 +939,12 @@ |
939 | 940 | global $wgUser, $wgOut, $wgHiddenPrefs, $wgEnableEmail; |
940 | 941 | global $wgRequest, $wgLoginLanguageSelector; |
941 | 942 | global $wgAuth, $wgEmailConfirmToEdit, $wgCookieExpiration; |
942 | | - |
| 943 | + |
943 | 944 | $titleObj = SpecialPage::getTitleFor( 'Userlogin' ); |
944 | | - |
| 945 | + |
945 | 946 | if ( $this->mType == 'signup' ) { |
946 | | - // Block signup here if in readonly. Keeps user from |
947 | | - // going through the process (filling out data, etc) |
| 947 | + // Block signup here if in readonly. Keeps user from |
| 948 | + // going through the process (filling out data, etc) |
948 | 949 | // and being informed later. |
949 | 950 | if ( wfReadOnly() ) { |
950 | 951 | $wgOut->readOnlyPage(); |
— | — | @@ -985,26 +986,29 @@ |
986 | 987 | |
987 | 988 | if ( !empty( $this->mReturnTo ) ) { |
988 | 989 | $returnto = '&returnto=' . wfUrlencode( $this->mReturnTo ); |
989 | | - if ( !empty( $this->mReturnToQuery ) ) |
| 990 | + if ( !empty( $this->mReturnToQuery ) ) { |
990 | 991 | $returnto .= '&returntoquery=' . |
991 | 992 | wfUrlencode( $this->mReturnToQuery ); |
| 993 | + } |
992 | 994 | $q .= $returnto; |
993 | 995 | $linkq .= $returnto; |
994 | 996 | } |
995 | 997 | |
996 | 998 | # Pass any language selection on to the mode switch link |
997 | | - if( $wgLoginLanguageSelector && $this->mLanguage ) |
| 999 | + if( $wgLoginLanguageSelector && $this->mLanguage ) { |
998 | 1000 | $linkq .= '&uselang=' . $this->mLanguage; |
| 1001 | + } |
999 | 1002 | |
1000 | | - $link = '<a href="' . htmlspecialchars ( $titleObj->getLocalUrl( $linkq ) ) . '">'; |
| 1003 | + $link = '<a href="' . htmlspecialchars ( $titleObj->getLocalURL( $linkq ) ) . '">'; |
1001 | 1004 | $link .= wfMsgHtml( $linkmsg . 'link' ); # Calling either 'gotaccountlink' or 'nologinlink' |
1002 | 1005 | $link .= '</a>'; |
1003 | 1006 | |
1004 | 1007 | # Don't show a "create account" link if the user can't |
1005 | | - if( $this->showCreateOrLoginLink( $wgUser ) ) |
| 1008 | + if( $this->showCreateOrLoginLink( $wgUser ) ) { |
1006 | 1009 | $template->set( 'link', wfMsgExt( $linkmsg, array( 'parseinline', 'replaceafter' ), $link ) ); |
1007 | | - else |
| 1010 | + } else { |
1008 | 1011 | $template->set( 'link', '' ); |
| 1012 | + } |
1009 | 1013 | |
1010 | 1014 | $template->set( 'header', '' ); |
1011 | 1015 | $template->set( 'name', $this->mName ); |
— | — | @@ -1015,7 +1019,7 @@ |
1016 | 1020 | $template->set( 'domain', $this->mDomain ); |
1017 | 1021 | $template->set( 'reason', $this->mReason ); |
1018 | 1022 | |
1019 | | - $template->set( 'action', $titleObj->getLocalUrl( $q ) ); |
| 1023 | + $template->set( 'action', $titleObj->getLocalURL( $q ) ); |
1020 | 1024 | $template->set( 'message', $msg ); |
1021 | 1025 | $template->set( 'messagetype', $msgtype ); |
1022 | 1026 | $template->set( 'createemail', $wgEnableEmail && $wgUser->isLoggedIn() ); |
— | — | @@ -1025,7 +1029,7 @@ |
1026 | 1030 | $template->set( 'canreset', $wgAuth->allowPasswordChange() ); |
1027 | 1031 | $template->set( 'canremember', ( $wgCookieExpiration > 0 ) ); |
1028 | 1032 | $template->set( 'usereason', $wgUser->isLoggedIn() ); |
1029 | | - $template->set( 'remember', $wgUser->getOption( 'rememberpassword' ) or $this->mRemember ); |
| 1033 | + $template->set( 'remember', $wgUser->getOption( 'rememberpassword' ) || $this->mRemember ); |
1030 | 1034 | |
1031 | 1035 | if ( $this->mType == 'signup' ) { |
1032 | 1036 | if ( !self::getCreateaccountToken() ) { |
— | — | @@ -1038,7 +1042,7 @@ |
1039 | 1043 | } |
1040 | 1044 | $template->set( 'token', self::getLoginToken() ); |
1041 | 1045 | } |
1042 | | - |
| 1046 | + |
1043 | 1047 | # Prepare language selection links as needed |
1044 | 1048 | if( $wgLoginLanguageSelector ) { |
1045 | 1049 | $template->set( 'languages', $this->makeLanguageSelector() ); |
— | — | @@ -1054,7 +1058,7 @@ |
1055 | 1059 | wfRunHooks( 'UserLoginForm', array( &$template ) ); |
1056 | 1060 | } |
1057 | 1061 | |
1058 | | - //Changes the title depending on permissions for creating account |
| 1062 | + // Changes the title depending on permissions for creating account |
1059 | 1063 | if ( $wgUser->isAllowed( 'createaccount' ) ) { |
1060 | 1064 | $wgOut->setPageTitle( wfMsg( 'userlogin' ) ); |
1061 | 1065 | } else { |
— | — | @@ -1063,7 +1067,7 @@ |
1064 | 1068 | |
1065 | 1069 | $wgOut->setRobotPolicy( 'noindex,nofollow' ); |
1066 | 1070 | $wgOut->setArticleRelated( false ); |
1067 | | - $wgOut->disallowUserJs(); // just in case... |
| 1071 | + $wgOut->disallowUserJs(); // just in case... |
1068 | 1072 | $wgOut->addTemplate( $template ); |
1069 | 1073 | } |
1070 | 1074 | |
— | — | @@ -1093,7 +1097,7 @@ |
1094 | 1098 | global $wgDisableCookieCheck, $wgRequest; |
1095 | 1099 | return $wgDisableCookieCheck ? true : $wgRequest->checkSessionCookie(); |
1096 | 1100 | } |
1097 | | - |
| 1101 | + |
1098 | 1102 | /** |
1099 | 1103 | * Get the login token from the current session |
1100 | 1104 | */ |
— | — | @@ -1101,7 +1105,7 @@ |
1102 | 1106 | global $wgRequest; |
1103 | 1107 | return $wgRequest->getSessionData( 'wsLoginToken' ); |
1104 | 1108 | } |
1105 | | - |
| 1109 | + |
1106 | 1110 | /** |
1107 | 1111 | * Randomly generate a new login token and attach it to the current session |
1108 | 1112 | */ |
— | — | @@ -1111,7 +1115,7 @@ |
1112 | 1116 | // because the latter reuses $_SESSION['wsEditToken'] |
1113 | 1117 | $wgRequest->setSessionData( 'wsLoginToken', User::generateToken() ); |
1114 | 1118 | } |
1115 | | - |
| 1119 | + |
1116 | 1120 | /** |
1117 | 1121 | * Remove any login token attached to the current session |
1118 | 1122 | */ |
— | — | @@ -1127,7 +1131,7 @@ |
1128 | 1132 | global $wgRequest; |
1129 | 1133 | return $wgRequest->getSessionData( 'wsCreateaccountToken' ); |
1130 | 1134 | } |
1131 | | - |
| 1135 | + |
1132 | 1136 | /** |
1133 | 1137 | * Randomly generate a new createaccount token and attach it to the current session |
1134 | 1138 | */ |
— | — | @@ -1135,7 +1139,7 @@ |
1136 | 1140 | global $wgRequest; |
1137 | 1141 | $wgRequest->setSessionData( 'wsCreateaccountToken', User::generateToken() ); |
1138 | 1142 | } |
1139 | | - |
| 1143 | + |
1140 | 1144 | /** |
1141 | 1145 | * Remove any createaccount token attached to the current session |
1142 | 1146 | */ |
— | — | @@ -1152,7 +1156,9 @@ |
1153 | 1157 | |
1154 | 1158 | $titleObj = SpecialPage::getTitleFor( 'Userlogin' ); |
1155 | 1159 | $query = array( 'wpCookieCheck' => $type ); |
1156 | | - if ( $this->mReturnTo ) $query['returnto'] = $this->mReturnTo; |
| 1160 | + if ( $this->mReturnTo ) { |
| 1161 | + $query['returnto'] = $this->mReturnTo; |
| 1162 | + } |
1157 | 1163 | $check = $titleObj->getFullURL( $query ); |
1158 | 1164 | |
1159 | 1165 | return $wgOut->redirect( $check ); |
— | — | @@ -1165,7 +1171,7 @@ |
1166 | 1172 | if ( !$this->hasSessionCookie() ) { |
1167 | 1173 | if ( $type == 'new' ) { |
1168 | 1174 | return $this->mainLoginForm( wfMsgExt( 'nocookiesnew', array( 'parseinline' ) ) ); |
1169 | | - } else if ( $type == 'login' ) { |
| 1175 | + } elseif ( $type == 'login' ) { |
1170 | 1176 | return $this->mainLoginForm( wfMsgExt( 'nocookieslogin', array( 'parseinline' ) ) ); |
1171 | 1177 | } else { |
1172 | 1178 | # shouldn't happen |
— | — | @@ -1199,7 +1205,7 @@ |
1200 | 1206 | foreach( $langs as $lang ) { |
1201 | 1207 | $lang = trim( $lang, '* ' ); |
1202 | 1208 | $parts = explode( '|', $lang ); |
1203 | | - if (count($parts) >= 2) { |
| 1209 | + if ( count( $parts ) >= 2 ) { |
1204 | 1210 | $links[] = $this->makeLanguageSelectorLink( $parts[0], $parts[1] ); |
1205 | 1211 | } |
1206 | 1212 | } |
— | — | @@ -1220,10 +1226,12 @@ |
1221 | 1227 | global $wgUser; |
1222 | 1228 | $self = SpecialPage::getTitleFor( 'Userlogin' ); |
1223 | 1229 | $attr = array( 'uselang' => $lang ); |
1224 | | - if( $this->mType == 'signup' ) |
| 1230 | + if( $this->mType == 'signup' ) { |
1225 | 1231 | $attr['type'] = 'signup'; |
1226 | | - if( $this->mReturnTo ) |
| 1232 | + } |
| 1233 | + if( $this->mReturnTo ) { |
1227 | 1234 | $attr['returnto'] = $this->mReturnTo; |
| 1235 | + } |
1228 | 1236 | $skin = $wgUser->getSkin(); |
1229 | 1237 | return $skin->linkKnown( |
1230 | 1238 | $self, |