Index: trunk/phase3/includes/specials/SpecialBlockip.php |
— | — | @@ -67,10 +67,16 @@ |
68 | 68 | $this->BlockEmail = $wgRequest->getBool( 'wpEmailBan', false ); |
69 | 69 | } |
70 | 70 | $this->BlockWatchUser = $wgRequest->getBool( 'wpWatchUser', false ); |
71 | | - # Re-check user's rights to hide names, very serious, defaults to 0 |
72 | | - $this->BlockHideName = ( $wgRequest->getBool( 'wpHideName', 0 ) && $wgUser->isAllowed( 'hideuser' ) ) ? 1 : 0; |
| 71 | + # Re-check user's rights to hide names, very serious, defaults to null |
| 72 | + if( $wgUser->isAllowed( 'hideuser' ) ) { |
| 73 | + $this->BlockHideName = $wgRequest->getBool( 'wpHideName', null ); |
| 74 | + } else { |
| 75 | + $this->BlockHideName = false; |
| 76 | + } |
73 | 77 | $this->BlockAllowUsertalk = ( $wgRequest->getBool( 'wpAllowUsertalk', $byDefault ) && $wgBlockAllowsUTEdit ); |
74 | 78 | $this->BlockReblock = $wgRequest->getBool( 'wpChangeBlock', false ); |
| 79 | + |
| 80 | + $this->wasPosted = $wgRequest->wasPosted(); |
75 | 81 | } |
76 | 82 | |
77 | 83 | public function showForm( $err ) { |
— | — | @@ -99,17 +105,17 @@ |
100 | 106 | $wgOut->setSubtitle( wfMsgHtml( 'formerror' ) ); |
101 | 107 | $wgOut->addHTML( Xml::tags( 'p', array( 'class' => 'error' ), $msg ) ); |
102 | 108 | } elseif( $this->BlockAddress ) { |
103 | | - $userId = 0; |
104 | | - if( is_object( $user ) ) |
105 | | - $userId = $user->getId(); |
| 109 | + $userId = is_object( $user ) ? $user->getId() : 0; |
106 | 110 | $currentBlock = Block::newFromDB( $this->BlockAddress, $userId ); |
107 | 111 | if( !is_null( $currentBlock ) && !$currentBlock->mAuto && # The block exists and isn't an autoblock |
108 | 112 | ( $currentBlock->mRangeStart == $currentBlock->mRangeEnd || # The block isn't a rangeblock |
109 | 113 | # or if it is, the range is what we're about to block |
110 | | - ( $currentBlock->mAddress == $this->BlockAddress ) ) ) { |
111 | | - $wgOut->addWikiMsg( 'ipb-needreblock', $this->BlockAddress ); |
112 | | - $alreadyBlocked = true; |
113 | | - # Set the block form settings to the existing block |
| 114 | + ( $currentBlock->mAddress == $this->BlockAddress ) ) |
| 115 | + ) { |
| 116 | + $wgOut->addWikiMsg( 'ipb-needreblock', $this->BlockAddress ); |
| 117 | + $alreadyBlocked = true; |
| 118 | + # Set the block form settings to the existing block |
| 119 | + if( !$this->wasPosted ) { |
114 | 120 | $this->BlockAnonOnly = $currentBlock->mAnonOnly; |
115 | 121 | $this->BlockCreateAccount = $currentBlock->mCreateAccount; |
116 | 122 | $this->BlockEnableAutoblock = $currentBlock->mEnableAutoblock; |
— | — | @@ -122,6 +128,7 @@ |
123 | 129 | $this->BlockOther = wfTimestamp( TS_ISO_8601, $currentBlock->mExpiry ); |
124 | 130 | } |
125 | 131 | $this->BlockReason = $currentBlock->mReason; |
| 132 | + } |
126 | 133 | } |
127 | 134 | } |
128 | 135 | |
— | — | @@ -261,7 +268,8 @@ |
262 | 269 | <td class='mw-input'><strong>" . |
263 | 270 | Xml::checkLabel( wfMsg( 'ipbhidename' ), |
264 | 271 | 'wpHideName', 'wpHideName', $this->BlockHideName, |
265 | | - array( 'tabindex' => '10' ) ) . " |
| 272 | + array( 'tabindex' => '10' ) |
| 273 | + ) . " |
266 | 274 | </strong></td> |
267 | 275 | </tr>" |
268 | 276 | ); |
— | — | @@ -433,7 +441,8 @@ |
434 | 442 | $block = new Block( $this->BlockAddress, $userId, $wgUser->getId(), |
435 | 443 | $reasonstr, wfTimestampNow(), 0, $expiry, $this->BlockAnonOnly, |
436 | 444 | $this->BlockCreateAccount, $this->BlockEnableAutoblock, $this->BlockHideName, |
437 | | - $this->BlockEmail, isset( $this->BlockAllowUsertalk ) ? $this->BlockAllowUsertalk : $wgBlockAllowsUTEdit |
| 445 | + $this->BlockEmail, |
| 446 | + isset( $this->BlockAllowUsertalk ) ? $this->BlockAllowUsertalk : $wgBlockAllowsUTEdit |
438 | 447 | ); |
439 | 448 | |
440 | 449 | # Should this be privately logged? |