public function execute( $subPage ) { if ( session_id() == '' ) { wfSetupSession(); } $this->load(); // Check for [[Special:Userlogin/signup]]. This affects form display and // page title. if ( $subPage == 'signup' ) { $this->mType = 'signup'; } $this->setHeaders(); // If logging in and not on HTTPS, either redirect to it or offer a link. global $wgSecureLogin; if ( WebRequest::detectProtocol() !== 'https' ) { $title = $this->getFullTitle(); $query = array( 'returnto' => $this->mReturnTo, 'returntoquery' => $this->mReturnToQuery, 'title' => null, ) + $this->mRequest->getQueryValues(); $url = $title->getFullURL( $query, false, PROTO_HTTPS ); if ( $wgSecureLogin && wfCanIPUseHTTPS( $this->getRequest()->getIP() ) ) { $url = wfAppendQuery( $url, 'fromhttp=1' ); $this->getOutput()->redirect( $url ); // Since we only do this redir to change proto, always vary $this->getOutput()->addVaryHeader( 'X-Forwarded-Proto' ); return; } else { // A wiki without HTTPS login support should set $wgServer to // http://somehost, in which case the secure URL generated // above won't actually start with https:// if ( substr( $url, 0, 8 ) === 'https://' ) { $this->mSecureLoginUrl = $url; } } } if ( !is_null( $this->mCookieCheck ) ) { $this->onCookieRedirectCheck( $this->mCookieCheck ); return; } elseif ( $this->mPosted ) { if ( $this->mCreateaccount ) { $this->addNewAccount(); return; } elseif ( $this->mCreateaccountMail ) { $this->addNewAccountMailPassword(); return; } elseif ( ( 'submitlogin' == $this->mAction ) || $this->mLoginattempt ) { $this->processLogin(); return; } } $this->mainLoginForm( '' ); }
/** * Appends a mobile view link to the desktop footer * @param Skin $sk * @param QuickTemplate $tpl * @param MobileContext $ctx * @param Title $title * @param WebRequest $req */ public static function desktopFooter($sk, $tpl, $ctx, $title, $req) { $footerlinks = $tpl->data['footerlinks']; $args = $req->getQueryValues(); // avoid title being set twice unset($args['title'], $args['useformat']); $args['mobileaction'] = 'toggle_view_mobile'; $mobileViewUrl = $title->getFullURL($args); $mobileViewUrl = $ctx->getMobileUrl($mobileViewUrl); $link = Html::element('a', array('href' => $mobileViewUrl, 'class' => 'noprint stopMobileRedirectToggle'), wfMessage('mobile-frontend-view')->text()); $tpl->set('mobileview', $link); $footerlinks['places'][] = 'mobileview'; $tpl->set('footerlinks', $footerlinks); }