Index: trunk/phase3/includes/SpecialBlockip.php |
— | — | @@ -42,8 +42,8 @@ |
43 | 43 | global $wgRequest; |
44 | 44 | $this->BlockAddress = $wgRequest->getVal( 'wpBlockAddress', $wgRequest->getVal( 'ip' ) ); |
45 | 45 | $this->BlockReason = $wgRequest->getText( 'wpBlockReason' ); |
46 | | - $this->BlockExpiry = $wgRequest->getVal( 'wpBlockExpiry' ); |
47 | | - $this->BlockOther = $wgRequest->getVal( 'wpBlockOther' ); |
| 46 | + $this->BlockExpiry = $wgRequest->getVal( 'wpBlockExpiry', wfMsg('ipbotheroption') ); |
| 47 | + $this->BlockOther = $wgRequest->getVal( 'wpBlockOther', '' ); |
48 | 48 | } |
49 | 49 | |
50 | 50 | function showForm( $err ) { |
— | — | @@ -74,9 +74,13 @@ |
75 | 75 | $scBlockAddress = htmlspecialchars( $this->BlockAddress ); |
76 | 76 | $scBlockExpiry = htmlspecialchars( $this->BlockExpiry ); |
77 | 77 | $scBlockReason = htmlspecialchars( $this->BlockReason ); |
78 | | - $scBlockOtherTime = htmlspecialchars( $this->BlockOtherTime ); |
| 78 | + $scBlockOtherTime = htmlspecialchars( $this->BlockOther ); |
79 | 79 | $scBlockExpiryOptions = htmlspecialchars( wfMsg( 'ipboptions' ) ); |
80 | 80 | |
| 81 | + $showblockoptions = $scBlockExpiryOptions != '-'; |
| 82 | + if (!$showblockoptions) |
| 83 | + $mIpbother = $mIpbexpiry; |
| 84 | + |
81 | 85 | $blockExpiryFormOptions = "<option value=\"other\">$mIpbothertime</option>"; |
82 | 86 | foreach (explode(',', $scBlockExpiryOptions) as $option) { |
83 | 87 | $selected = ""; |
— | — | @@ -96,13 +100,18 @@ |
97 | 101 | <input tabindex='1' type='text' size='20' name=\"wpBlockAddress\" value=\"{$scBlockAddress}\" /> |
98 | 102 | </td> |
99 | 103 | </tr> |
100 | | - <tr> |
| 104 | + <tr>"); |
| 105 | + if ($showblockoptions) { |
| 106 | + $wgOut->addHTML(" |
101 | 107 | <td align=\"right\">{$mIpbexpiry}:</td> |
102 | 108 | <td align=\"left\"> |
103 | 109 | <select tabindex='2' name=\"wpBlockExpiry\"> |
104 | 110 | $blockExpiryFormOptions |
105 | 111 | </select> |
106 | 112 | </td> |
| 113 | + "); |
| 114 | + } |
| 115 | + $wgOut->addHTML(" |
107 | 116 | </tr> |
108 | 117 | <tr> |
109 | 118 | <td align=\"right\">{$mIpbother}:</td> |
— | — | @@ -166,9 +175,14 @@ |
167 | 176 | } |
168 | 177 | |
169 | 178 | $expirestr = $this->BlockExpiry; |
170 | | - if (strlen($expirestr) == 0 || $expirestr == wfMsg('ipbotheroption')) |
| 179 | + if ($expirestr == wfMsg('ipbotheroption')) |
171 | 180 | $expirestr = $this->BlockOther; |
172 | 181 | |
| 182 | + if (strlen($expirestr) == 0) { |
| 183 | + $this->showForm( wfMsg( 'ipb_expiry_invalid' ) ); |
| 184 | + return; |
| 185 | + } |
| 186 | + |
173 | 187 | if ( $expirestr == 'infinite' || $expirestr == 'indefinite' ) { |
174 | 188 | $expiry = ''; |
175 | 189 | } else { |