$this->mRetype = $request->getText( 'wpRetype' );
$this->mDomain = $request->getText( 'wpDomain' );
$this->mReason = $request->getText( 'wpReason' );
- $this->mReturnTo = $request->getVal( 'returnto' );
- $this->mReturnToQuery = $request->getVal( 'returntoquery' );
$this->mCookieCheck = $request->getVal( 'wpCookieCheck' );
$this->mPosted = $request->wasPosted();
$this->mCreateaccount = $request->getCheck( 'wpCreateaccount' );
if ( $wgRedirectOnLogin ) {
$this->mReturnTo = $wgRedirectOnLogin;
$this->mReturnToQuery = '';
+ } else {
+ $this->mReturnTo = $request->getVal( 'returnto', '' );
+ $this->mReturnToQuery = $request->getVal( 'returntoquery', '' );
}
if( $wgEnableEmail ) {
}
if( !$wgAuth->validDomain( $this->mDomain ) ) {
- if ( isset( $_SESSION['wsDomain'] ) ) {
- $this->mDomain = $_SESSION['wsDomain'];
- } else {
- $this->mDomain = 'invaliddomain';
- }
+ $this->mDomain = $wgAuth->getDomain();
}
$wgAuth->setDomain( $this->mDomain );
/**
* @private
- * @return bool|\User
+ * @return bool|User
*/
function addNewAccountInternal() {
global $wgAuth, $wgMemc, $wgAccountCreationThrottle,
return false;
}
+ # Include checks that will include GlobalBlocking (Bug 38333)
+ $permErrors = $this->getTitle()->getUserPermissionsErrors( 'createaccount', $currentUser, true );
+ if ( count( $permErrors ) ) {
+ throw new PermissionsError( 'createaccount', $permErrors );
+ }
+
$ip = $this->getRequest()->getIP();
if ( $currentUser->isDnsBlacklisted( $ip, true /* check $wgProxyWhitelist */ ) ) {
$this->mainLoginForm( $this->msg( 'sorbs_create_account_reason' )->text() . ' ' . $this->msg( 'parentheses', $ip )->escaped() );
$out->addHTML( $injected_html );
- if ( !empty( $this->mReturnTo ) ) {
+ if ( $this->mReturnTo !== '' ) {
$out->returnToMain( null, $this->mReturnTo, $this->mReturnToQuery );
} else {
$out->returnToMain( null );
$linkmsg = 'nologin';
}
- if ( !empty( $this->mReturnTo ) ) {
+ if ( $this->mReturnTo !== '' ) {
$returnto = '&returnto=' . wfUrlencode( $this->mReturnTo );
- if ( !empty( $this->mReturnToQuery ) ) {
+ if ( $this->mReturnToQuery !== '' ) {
$returnto .= '&returntoquery=' .
wfUrlencode( $this->mReturnToQuery );
}
function cookieRedirectCheck( $type ) {
$titleObj = SpecialPage::getTitleFor( 'Userlogin' );
$query = array( 'wpCookieCheck' => $type );
- if ( $this->mReturnTo ) {
+ if ( $this->mReturnTo !== '' ) {
$query['returnto'] = $this->mReturnTo;
+ $query['returntoquery'] = $this->mReturnToQuery;
}
$check = $titleObj->getFullURL( $query );
* @return string
*/
function makeLanguageSelectorLink( $text, $lang ) {
- $attr = array( 'uselang' => $lang );
+ if( $this->getLanguage()->getCode() == $lang ) {
+ // no link for currently used language
+ return htmlspecialchars( $text );
+ }
+ $query = array( 'uselang' => $lang );
if( $this->mType == 'signup' ) {
- $attr['type'] = 'signup';
+ $query['type'] = 'signup';
}
- if( $this->mReturnTo ) {
- $attr['returnto'] = $this->mReturnTo;
+ if( $this->mReturnTo !== '' ) {
+ $query['returnto'] = $this->mReturnTo;
+ $query['returntoquery'] = $this->mReturnToQuery;
}
+
+ $attr = array();
+ $targetLanguage = Language::factory( $lang );
+ $attr['lang'] = $attr['hreflang'] = $targetLanguage->getHtmlCode();
+
return Linker::linkKnown(
$this->getTitle(),
htmlspecialchars( $text ),
- array(),
- $attr
+ $attr,
+ $query
);
}
}