r9746 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r9745‎ | r9746 | r9747 >
Date:16:38, 28 June 2005
Author:kateturner
Status:old
Tags:
Comment:
* (bug 2577) Allow sysops to enter non-standard block times
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/SpecialBlockip.php (modified) (history)
  • /trunk/phase3/languages/Language.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/SpecialBlockip.php
@@ -43,6 +43,7 @@
4444 $this->BlockAddress = $wgRequest->getVal( 'wpBlockAddress', $wgRequest->getVal( 'ip' ) );
4545 $this->BlockReason = $wgRequest->getText( 'wpBlockReason' );
4646 $this->BlockExpiry = $wgRequest->getVal( 'wpBlockExpiry' );
 47+ $this->BlockOther = $wgRequest->getVal( 'wpBlockOther' );
4748 }
4849
4950 function showForm( $err ) {
@@ -58,6 +59,8 @@
5960 $mIpaddress = htmlspecialchars( wfMsg( 'ipaddress' ) );
6061 }
6162 $mIpbexpiry = htmlspecialchars( wfMsg( 'ipbexpiry' ) );
 63+ $mIpbother = htmlspecialchars( wfMsg( 'ipbother' ) );
 64+ $mIpbothertime = htmlspecialchars( wfMsg( 'ipbotheroption' ) );
6265 $mIpbreason = htmlspecialchars( wfMsg( 'ipbreason' ) );
6366 $mIpbsubmit = htmlspecialchars( wfMsg( 'ipbsubmit' ) );
6467 $titleObj = Title::makeTitle( NS_SPECIAL, 'Blockip' );
@@ -71,10 +74,16 @@
7275 $scBlockAddress = htmlspecialchars( $this->BlockAddress );
7376 $scBlockExpiry = htmlspecialchars( $this->BlockExpiry );
7477 $scBlockReason = htmlspecialchars( $this->BlockReason );
 78+ $scBlockOtherTime = htmlspecialchars( $this->BlockOtherTime );
 79+ $scBlockExpiryOptions = htmlspecialchars( wfMsg( 'ipboptions' ) );
7580
76 - $blockExpiryFormOptions = '<option>' .
77 - implode("</option>\n\t\t\t\t\t<option>", explode(',', $wgBlockExpiryOptions)) .
78 - '</option>';
 81+ $blockExpiryFormOptions = "<option value=\"other\">$mIpbothertime</option>";
 82+ foreach (explode(',', $scBlockExpiryOptions) as $option) {
 83+ $selected = "";
 84+ if ($this->BlockExpiry === $option)
 85+ $selected = ' selected="selected"';
 86+ $blockExpiryFormOptions .= "<option$selected>$option</option>";
 87+ }
7988
8089 $token = htmlspecialchars( $wgUser->editToken() );
8190
@@ -96,6 +105,12 @@
97106 </td>
98107 </tr>
99108 <tr>
 109+ <td align=\"right\">{$mIpbother}:</td>
 110+ <td align=\"left\">
 111+ <input tabindex='3' type='text' size='40' name=\"wpBlockOther\" value=\"{$scBlockOtherTime}\" />
 112+ </td>
 113+ </tr>
 114+ <tr>
100115 <td align=\"right\">{$mIpbreason}:</td>
101116 <td align=\"left\">
102117 <input tabindex='3' type='text' size='40' name=\"wpBlockReason\" value=\"{$scBlockReason}\" />
@@ -150,11 +165,15 @@
151166 }
152167 }
153168
154 - if ( $this->BlockExpiry == 'infinite' || $this->BlockExpiry == 'indefinite' ) {
 169+ $expirestr = $this->BlockExpiry;
 170+ if (strlen($expirestr) == 0 || $expirestr == wfMsg('ipbotheroption'))
 171+ $expirestr = $this->BlockOther;
 172+
 173+ if ( $expirestr == 'infinite' || $expirestr == 'indefinite' ) {
155174 $expiry = '';
156175 } else {
157176 # Convert GNU-style date, returns -1 on error
158 - $expiry = strtotime( $this->BlockExpiry );
 177+ $expiry = strtotime( $expirestr );
159178
160179 if ( $expiry < 0 ) {
161180 $this->showForm( wfMsg( 'ipb_expiry_invalid' ) );
@@ -180,7 +199,7 @@
181200 # Make log entry
182201 $log = new LogPage( 'block' );
183202 $log->addEntry( 'block', Title::makeTitle( NS_USER, $this->BlockAddress ),
184 - $this->BlockReason, $this->BlockExpiry );
 203+ $this->BlockReason, $expirestr );
185204
186205 # Report to the user
187206 $titleObj = Title::makeTitle( NS_SPECIAL, 'Blockip' );
Index: trunk/phase3/RELEASE-NOTES
@@ -401,8 +401,8 @@
402402 * Don't show bogus messages about watchlist notifications when disabled
403403 * Don't show old debug messages in watchlist
404404 * (bug 2576) Fix recording of transclusion links
 405+* (bug 2577) Allow sysops to enter non-standard block times
405406
406 -
407407 === Caveats ===
408408
409409 Some output, particularly involving user-supplied inline HTML, may not
Index: trunk/phase3/languages/Language.php
@@ -1400,6 +1400,9 @@
14011401 'ipbexpiry' => 'Expiry',
14021402 'ipbreason' => 'Reason',
14031403 'ipbsubmit' => 'Block this user',
 1404+'ipbother' => 'Other time',
 1405+'ipboptions' => '2 hours,1 day,3 days,1 week,2 weeks,1 month,3 months,6 months,1 year,infinite',
 1406+'ipbotheroption' => 'other',
14041407 'badipaddress' => 'Invalid IP address',
14051408 'blockipsuccesssub' => 'Block succeeded',
14061409 'blockipsuccesstext' => "\"$1\" has been blocked.

Follow-up revisions

RevisionCommit summaryAuthorDate
r9749(bug 2577) when [[MediaWiki:Ipboptions]] contains "-", do not show any block ...kateturner17:02, 28 June 2005

Status & tagging log