}
if ( $this->requiresUnblock() && $user->isBlocked() ) {
- throw new UserBlockedError( $user->getBlock() );
+ $block = $user->mBlock;
+ throw new UserBlockedError( $block );
}
}
* @deprecated since 1.18
*/
function blockedPage() {
- throw new UserBlockedError( $this->getUser()->getBlock() );
+ throw new UserBlockedError( $this->getUser()->mBlock );
}
/**
}
if ( $this->requiresUnblock() && $user->isBlocked() ) {
- throw new UserBlockedError( $user->getBlock() );
+ $block = $user->mBlock;
+ throw new UserBlockedError( $block );
}
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->getBlock()->prevents( $action ) !== false ) {
- $e = new UserBlockedError( $user->getBlock() );
- $params = $e->params;
- array_unshift( $params, $e->msg );
- $errors[] = $params;
+ } 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 );
}
return $errors;
}
# User/IP blocking
- $block = Block::newFromTarget( $this->getName(), $ip, !$bFromSlave );
- if ( $block instanceof Block ) {
+ $this->mBlock = Block::newFromTarget( $this->getName(), $ip, !$bFromSlave );
+ if ( $this->mBlock instanceof Block ) {
wfDebug( __METHOD__ . ": Found block.\n" );
- $this->mBlock = $block;
- $this->mBlockedby = $block->getByName();
- $this->mBlockreason = $block->mReason;
- $this->mHideName = $block->mHideName;
- $this->mAllowUsertalk = !$block->prevents( 'editownusertalk' );
+ $this->mBlockedby = $this->mBlock->getByName();
+ $this->mBlockreason = $this->mBlock->mReason;
+ $this->mHideName = $this->mBlock->mHideName;
+ $this->mAllowUsertalk = !$this->mBlock->prevents( 'editownusertalk' );
if ( $this->isLoggedIn() && $wgUser->getID() == $this->getID() ) {
$this->spreadBlock();
}
case 'badaccess':
throw new PermissionsError( 'sendemail' );
case 'blockedemailuser':
- throw new UserBlockedError( $this->getUser()->getBlock() );
+ throw new UserBlockedError( $this->getUser()->mBlock );
case 'actionthrottledtext':
throw new ThrottledError;
case 'mailnologin':
$this->resetLoginForm( wfMsg( 'resetpass_announce' ) );
break;
case self::CREATE_BLOCKED:
- $this->userBlockedMessage( $wgUser->getBlock() );
+ $this->userBlockedMessage( $wgUser->mBlock );
break;
case self::THROTTLED:
$this->mainLoginForm( wfMsg( 'login-throttled' ) );