}
if ( $this->requiresUnblock() && $user->isBlocked() ) {
- $block = $user->mBlock;
- throw new UserBlockedError( $block );
+ throw new UserBlockedError( $user->getBlock() );
}
}
* @deprecated since 1.18
*/
function blockedPage() {
- throw new UserBlockedError( $this->getUser()->mBlock );
+ throw new UserBlockedError( $this->getUser()->getBlock() );
}
/**
}
if ( $this->requiresUnblock() && $user->isBlocked() ) {
- $block = $user->mBlock;
- throw new UserBlockedError( $block );
+ throw new UserBlockedError( $user->getBlock() );
}
return true;
} elseif( ( $action == 'edit' || $action == 'create' ) && !$user->isBlockedFrom( $this ) ){
// Don't block the user from editing their own talk page unless they've been
// explicitly blocked from that too.
- } elseif( $user->isBlocked() && $user->mBlock->prevents( $action ) !== false ) {
- $block = $user->mBlock;
-
- // This is from OutputPage::blockedPage
- // Copied at r23888 by werdna
-
- $id = $user->blockedBy();
- $reason = $user->blockedFor();
- if ( $reason == '' ) {
- $reason = wfMsg( 'blockednoreason' );
- }
- $ip = wfGetIP();
-
- if ( is_numeric( $id ) ) {
- $name = User::whoIs( $id );
- } else {
- $name = $id;
- }
-
- $link = '[[' . $wgContLang->getNsText( NS_USER ) . ":{$name}|{$name}]]";
- $blockid = $block->getId();
- $blockExpiry = $user->mBlock->mExpiry;
- $blockTimestamp = $wgLang->timeanddate( wfTimestamp( TS_MW, $user->mBlock->mTimestamp ), true );
- if ( $blockExpiry == 'infinity' ) {
- $blockExpiry = wfMessage( 'infiniteblock' )->text();
- } else {
- $blockExpiry = $wgLang->timeanddate( wfTimestamp( TS_MW, $blockExpiry ), true );
- }
-
- $intended = strval( $user->mBlock->getTarget() );
-
- $errors[] = array( ( $block->mAuto ? 'autoblockedtext' : 'blockedtext' ), $link, $reason, $ip, $name,
- $blockid, $blockExpiry, $intended, $blockTimestamp );
+ } elseif( $user->isBlocked() && $user->getBlock()->prevents( $action ) !== false ) {
+ $e = new UserBlockedError( $user->getBlock() );
+ $params = $e->params;
+ array_unshift( $params, $e->msg );
+ $errors[] = $params;
}
return $errors;
}
# User/IP blocking
- $this->mBlock = Block::newFromTarget( $this->getName(), $ip, !$bFromSlave );
- if ( $this->mBlock instanceof Block ) {
+ $block = Block::newFromTarget( $this->getName(), $ip, !$bFromSlave );
+ if ( $block instanceof Block ) {
wfDebug( __METHOD__ . ": Found block.\n" );
- $this->mBlockedby = $this->mBlock->getByName();
- $this->mBlockreason = $this->mBlock->mReason;
- $this->mHideName = $this->mBlock->mHideName;
- $this->mAllowUsertalk = !$this->mBlock->prevents( 'editownusertalk' );
+ $this->mBlock = $block;
+ $this->mBlockedby = $block->getByName();
+ $this->mBlockreason = $block->mReason;
+ $this->mHideName = $block->mHideName;
+ $this->mAllowUsertalk = !$block->prevents( 'editownusertalk' );
if ( $this->isLoggedIn() && $wgUser->getID() == $this->getID() ) {
$this->spreadBlock();
}
case 'badaccess':
throw new PermissionsError( 'sendemail' );
case 'blockedemailuser':
- throw new UserBlockedError( $this->getUser()->mBlock );
+ throw new UserBlockedError( $this->getUser()->getBlock() );
case 'actionthrottledtext':
throw new ThrottledError;
case 'mailnologin':
$this->resetLoginForm( wfMsg( 'resetpass_announce' ) );
break;
case self::CREATE_BLOCKED:
- $this->userBlockedMessage( $wgUser->mBlock );
+ $this->userBlockedMessage( $wgUser->getBlock() );
break;
case self::THROTTLED:
$this->mainLoginForm( wfMsg( 'login-throttled' ) );