Revert "Change login/createaccount forms to new appearance"
[lhc/web/wiklou.git] / includes / specials / SpecialUserlogin.php
index a811564..eef6691 100644 (file)
@@ -49,9 +49,7 @@ class LoginForm extends SpecialPage {
        var $mSkipCookieCheck, $mReturnToQuery, $mToken, $mStickHTTPS;
        var $mType, $mReason, $mRealName;
        var $mAbortLoginErrorMsg = 'login-abort-generic';
-       private $mLoaded = false, $mSecureLoginUrl;
-       // TODO (spage 2013-02-13)  Remove old forms by, say, release 1.22.
-       private $mShowAgora;
+       private $mLoaded = false;
 
        /**
         * @var ExternalUser
@@ -136,21 +134,11 @@ class LoginForm extends SpecialPage {
                        $this->mReturnTo = '';
                        $this->mReturnToQuery = '';
                }
-
-               $this->mShowAgora = $this->shouldShowAgora();
        }
 
        function getDescription() {
-               if ( !$this->getUser()->isAllowed( 'createaccount' ) ) {
-                       return $this->msg( 'userloginnocreate' )->text();
-               }
-               if ( $this->mShowAgora ) {
-                       return $this->msg( $this->mType === 'signup' ?
-                                       'createaccount' : 'login'
-                               )->text();
-               } else {
-                       return $this->msg( 'userlogin' )->text();
-               }
+               return $this->msg( $this->getUser()->isAllowed( 'createaccount' ) ?
+                       'userlogin' : 'userloginnocreate' )->text();
        }
 
        public function execute( $par ) {
@@ -161,10 +149,10 @@ class LoginForm extends SpecialPage {
                $this->load();
                $this->setHeaders();
 
-               // If logging in and not on HTTPS, either redirect to it or offer a link.
                global $wgSecureLogin;
                if (
                        $this->mType !== 'signup' &&
+                       $wgSecureLogin &&
                        WebRequest::detectProtocol() !== 'https'
                ) {
                        $title = $this->getFullTitle();
@@ -174,17 +162,8 @@ class LoginForm extends SpecialPage {
                                'wpStickHTTPS' => $this->mStickHTTPS
                        );
                        $url = $title->getFullURL( $query, false, PROTO_HTTPS );
-                       if ( $wgSecureLogin ) {
-                               $this->getOutput()->redirect( $url );
-                               return;
-                       } else {
-                               // A wiki without https login support should set wgServer to
-                               // http://somehost, in which case the secure URL generated
-                               // above actually won't be PROTO_HTTPS.
-                               if ( strncmp($url, PROTO_HTTPS, strlen( PROTO_HTTPS ) ) === 0 ) {
-                                       $this->mSecureLoginUrl = $url;
-                               }
-                       }
+                       $this->getOutput()->redirect( $url );
+                       return;
                }
 
                if ( $par == 'signup' ) { # Check for [[Special:Userlogin/signup]]
@@ -1044,32 +1023,6 @@ class LoginForm extends SpecialPage {
                }
        }
 
-       /**
-        * Whether to show "Agora"-style forms.
-        * ?useAgora=1 forces Agora style, ?useAgora=0 forces old-style,
-        * otherwise consult $wgAgoraUserLogin or $wgAgoraCreateAccount.
-        * @return Boolean
-        */
-       private function shouldShowAgora() {
-               global $wgRequest, $wgAgoraUserLogin, $wgAgoraCreateAccount;
-               $override = $wgRequest->getBool( 'useAgora' );
-               if ( $override !== null ) {
-                       return $override;
-               }
-               if ( $this->mType == 'signup' ) {
-                       return (boolean) $wgAgoraCreateAccount;
-               } else {
-                       return (boolean) $wgAgoraUserLogin;
-               }
-       }
-
-       /**
-        */
-       private function isAgoraExtensionCSSAvailable() {
-               global $wgResourceModules;
-               return array_key_exists( 'ext.agora.base', $wgResourceModules );
-       }
-
        /**
         * @private
         */
@@ -1081,7 +1034,6 @@ class LoginForm extends SpecialPage {
 
                $titleObj = $this->getTitle();
                $user = $this->getUser();
-               $out = $this->getOutput();
 
                if ( $this->mType == 'signup' ) {
                        // Block signup here if in readonly. Keeps user from
@@ -1108,28 +1060,17 @@ class LoginForm extends SpecialPage {
                }
 
                if ( $this->mType == 'signup' ) {
-                       $template = $this->mShowAgora
-                               ? new UsercreateTemplateAgora() : new UsercreateTemplate();
+                       $template = new UsercreateTemplate();
                        $q = 'action=submitlogin&type=signup';
                        $linkq = 'type=login';
                        $linkmsg = 'gotaccount';
-                       $out->addModules( 'mediawiki.special.userlogin.signup' );
+                       $this->getOutput()->addModules( 'mediawiki.special.userlogin.signup' );
                } else {
-                       $template = $this->mShowAgora
-                               ? new UserloginTemplateAgora() : new UserloginTemplate();
+                       $template = new UserloginTemplate();
                        $q = 'action=submitlogin&type=login';
                        $linkq = 'type=signup';
                        $linkmsg = 'nologin';
                }
-               if ( $this->mShowAgora ) {
-                       $out->addModules( array(
-                               // core Agora look, what gets loaded is dependent on skin.
-                               'mediawiki.ui',
-                               $this->mType === 'signup' ? 
-                                       'mediawiki.special.createaccount.agora' :
-                                       'mediawiki.special.userlogin.agora'
-                       ) );
-               }
 
                if ( $this->mReturnTo !== '' ) {
                        $returnto = '&returnto=' . wfUrlencode( $this->mReturnTo );
@@ -1141,23 +1082,16 @@ class LoginForm extends SpecialPage {
                        $linkq .= $returnto;
                }
 
-               # Don't show a "create account" link if the user can't.
+               # Don't show a "create account" link if the user can't
                if( $this->showCreateOrLoginLink( $user ) ) {
                        # Pass any language selection on to the mode switch link
                        if( $wgLoginLanguageSelector && $this->mLanguage ) {
                                $linkq .= '&uselang=' . $this->mLanguage;
                        }
-                       if ( !$this->mShowAgora ) {
-                               $link = Html::element( 'a', array( 'href' => $titleObj->getLocalURL( $linkq ) ),
-                                       $this->msg( $linkmsg . 'link' )->text() ); # Calling either 'gotaccountlink' or 'nologinlink'
-
-                                       $template->set( 'link', $this->msg( $linkmsg )->rawParams( $link )->parse() );
+                       $link = Html::element( 'a', array( 'href' => $titleObj->getLocalURL( $linkq ) ),
+                               $this->msg( $linkmsg . 'link' )->text() ); # Calling either 'gotaccountlink' or 'nologinlink'
 
-                       } else {
-                               // Supply hyperlink, login template creates the button.
-                               // (The template 'link' key is obsolete in the Agora design.)
-                               $template->set( 'createOrLoginHref', $titleObj->getLocalURL( $linkq ) );
-                       }
+                       $template->set( 'link', $this->msg( $linkmsg )->rawParams( $link )->parse() );
                } else {
                        $template->set( 'link', '' );
                }
@@ -1217,9 +1151,8 @@ class LoginForm extends SpecialPage {
                        }
                }
 
-               $template->set( 'secureLoginUrl', $this->mSecureLoginUrl );
                // Use loginend-https for HTTPS requests if it's not blank, loginend otherwise
-               // Ditto for signupend.  Agora forms use neither.
+               // Ditto for signupend
                $usingHTTPS = WebRequest::detectProtocol() == 'https';
                $loginendHTTPS = $this->msg( 'loginend-https' );
                $signupendHTTPS = $this->msg( 'signupend-https' );
@@ -1242,6 +1175,7 @@ class LoginForm extends SpecialPage {
                        wfRunHooks( 'UserLoginForm', array( &$template ) );
                }
 
+               $out = $this->getOutput();
                $out->disallowUserJs(); // just in case...
                $out->addTemplate( $template );
        }