Index: trunk/phase3/includes/User.php |
— | — | @@ -1265,14 +1265,13 @@ |
1266 | 1266 | } |
1267 | 1267 | |
1268 | 1268 | # User/IP blocking |
1269 | | - $block = Block::newFromTarget( $this->getName(), $ip, !$bFromSlave ); |
1270 | | - if ( $block instanceof Block ) { |
| 1269 | + $this->mBlock = Block::newFromTarget( $this->getName(), $ip, !$bFromSlave ); |
| 1270 | + if ( $this->mBlock instanceof Block ) { |
1271 | 1271 | wfDebug( __METHOD__ . ": Found block.\n" ); |
1272 | | - $this->mBlock = $block; |
1273 | | - $this->mBlockedby = $block->getByName(); |
1274 | | - $this->mBlockreason = $block->mReason; |
1275 | | - $this->mHideName = $block->mHideName; |
1276 | | - $this->mAllowUsertalk = !$block->prevents( 'editownusertalk' ); |
| 1272 | + $this->mBlockedby = $this->mBlock->getByName(); |
| 1273 | + $this->mBlockreason = $this->mBlock->mReason; |
| 1274 | + $this->mHideName = $this->mBlock->mHideName; |
| 1275 | + $this->mAllowUsertalk = !$this->mBlock->prevents( 'editownusertalk' ); |
1277 | 1276 | if ( $this->isLoggedIn() && $wgUser->getID() == $this->getID() ) { |
1278 | 1277 | $this->spreadBlock(); |
1279 | 1278 | } |
Index: trunk/phase3/includes/OutputPage.php |
— | — | @@ -1934,7 +1934,7 @@ |
1935 | 1935 | * @deprecated since 1.18 |
1936 | 1936 | */ |
1937 | 1937 | function blockedPage() { |
1938 | | - throw new UserBlockedError( $this->getUser()->getBlock() ); |
| 1938 | + throw new UserBlockedError( $this->getUser()->mBlock ); |
1939 | 1939 | } |
1940 | 1940 | |
1941 | 1941 | /** |
Index: trunk/phase3/includes/Title.php |
— | — | @@ -1565,11 +1565,39 @@ |
1566 | 1566 | } elseif( ( $action == 'edit' || $action == 'create' ) && !$user->isBlockedFrom( $this ) ){ |
1567 | 1567 | // Don't block the user from editing their own talk page unless they've been |
1568 | 1568 | // explicitly blocked from that too. |
1569 | | - } elseif( $user->isBlocked() && $user->getBlock()->prevents( $action ) !== false ) { |
1570 | | - $e = new UserBlockedError( $user->getBlock() ); |
1571 | | - $params = $e->params; |
1572 | | - array_unshift( $params, $e->msg ); |
1573 | | - $errors[] = $params; |
| 1569 | + } elseif( $user->isBlocked() && $user->mBlock->prevents( $action ) !== false ) { |
| 1570 | + $block = $user->mBlock; |
| 1571 | + |
| 1572 | + // This is from OutputPage::blockedPage |
| 1573 | + // Copied at r23888 by werdna |
| 1574 | + |
| 1575 | + $id = $user->blockedBy(); |
| 1576 | + $reason = $user->blockedFor(); |
| 1577 | + if ( $reason == '' ) { |
| 1578 | + $reason = wfMsg( 'blockednoreason' ); |
| 1579 | + } |
| 1580 | + $ip = wfGetIP(); |
| 1581 | + |
| 1582 | + if ( is_numeric( $id ) ) { |
| 1583 | + $name = User::whoIs( $id ); |
| 1584 | + } else { |
| 1585 | + $name = $id; |
| 1586 | + } |
| 1587 | + |
| 1588 | + $link = '[[' . $wgContLang->getNsText( NS_USER ) . ":{$name}|{$name}]]"; |
| 1589 | + $blockid = $block->getId(); |
| 1590 | + $blockExpiry = $user->mBlock->mExpiry; |
| 1591 | + $blockTimestamp = $wgLang->timeanddate( wfTimestamp( TS_MW, $user->mBlock->mTimestamp ), true ); |
| 1592 | + if ( $blockExpiry == 'infinity' ) { |
| 1593 | + $blockExpiry = wfMessage( 'infiniteblock' )->text(); |
| 1594 | + } else { |
| 1595 | + $blockExpiry = $wgLang->timeanddate( wfTimestamp( TS_MW, $blockExpiry ), true ); |
| 1596 | + } |
| 1597 | + |
| 1598 | + $intended = strval( $user->mBlock->getTarget() ); |
| 1599 | + |
| 1600 | + $errors[] = array( ( $block->mAuto ? 'autoblockedtext' : 'blockedtext' ), $link, $reason, $ip, $name, |
| 1601 | + $blockid, $blockExpiry, $intended, $blockTimestamp ); |
1574 | 1602 | } |
1575 | 1603 | |
1576 | 1604 | return $errors; |
Index: trunk/phase3/includes/specials/SpecialUserlogin.php |
— | — | @@ -746,7 +746,7 @@ |
747 | 747 | $this->resetLoginForm( wfMsg( 'resetpass_announce' ) ); |
748 | 748 | break; |
749 | 749 | case self::CREATE_BLOCKED: |
750 | | - $this->userBlockedMessage( $wgUser->getBlock() ); |
| 750 | + $this->userBlockedMessage( $wgUser->mBlock ); |
751 | 751 | break; |
752 | 752 | case self::THROTTLED: |
753 | 753 | $this->mainLoginForm( wfMsg( 'login-throttled' ) ); |
Index: trunk/phase3/includes/specials/SpecialEmailuser.php |
— | — | @@ -99,7 +99,7 @@ |
100 | 100 | case 'badaccess': |
101 | 101 | throw new PermissionsError( 'sendemail' ); |
102 | 102 | case 'blockedemailuser': |
103 | | - throw new UserBlockedError( $this->getUser()->getBlock() ); |
| 103 | + throw new UserBlockedError( $this->getUser()->mBlock ); |
104 | 104 | case 'actionthrottledtext': |
105 | 105 | throw new ThrottledError; |
106 | 106 | case 'mailnologin': |
Index: trunk/phase3/includes/SpecialPage.php |
— | — | @@ -825,7 +825,8 @@ |
826 | 826 | } |
827 | 827 | |
828 | 828 | if ( $this->requiresUnblock() && $user->isBlocked() ) { |
829 | | - throw new UserBlockedError( $user->getBlock() ); |
| 829 | + $block = $user->mBlock; |
| 830 | + throw new UserBlockedError( $block ); |
830 | 831 | } |
831 | 832 | |
832 | 833 | return true; |
Index: trunk/phase3/includes/Action.php |
— | — | @@ -198,7 +198,8 @@ |
199 | 199 | } |
200 | 200 | |
201 | 201 | if ( $this->requiresUnblock() && $user->isBlocked() ) { |
202 | | - throw new UserBlockedError( $user->getBlock() ); |
| 202 | + $block = $user->mBlock; |
| 203 | + throw new UserBlockedError( $block ); |
203 | 204 | } |
204 | 205 | } |
205 | 206 | |