* (bug 2577) Allow sysops to enter non-standard block times
authorRiver Tarnell <kateturner@users.mediawiki.org>
Tue, 28 Jun 2005 16:38:30 +0000 (16:38 +0000)
committerRiver Tarnell <kateturner@users.mediawiki.org>
Tue, 28 Jun 2005 16:38:30 +0000 (16:38 +0000)
RELEASE-NOTES
includes/SpecialBlockip.php
languages/Language.php

index 46eeade..5ea6640 100644 (file)
@@ -401,7 +401,7 @@ Various bugfixes, small features, and a few experimental things:
 * Don't show bogus messages about watchlist notifications when disabled
 * Don't show old debug messages in watchlist
 * (bug 2576) Fix recording of transclusion links
-
+* (bug 2577) Allow sysops to enter non-standard block times
 
 === Caveats ===
 
index ea15e38..ca1b398 100644 (file)
@@ -43,6 +43,7 @@ class IPBlockForm {
                $this->BlockAddress = $wgRequest->getVal( 'wpBlockAddress', $wgRequest->getVal( 'ip' ) );
                $this->BlockReason = $wgRequest->getText( 'wpBlockReason' );
                $this->BlockExpiry = $wgRequest->getVal( 'wpBlockExpiry' );
+               $this->BlockOther = $wgRequest->getVal( 'wpBlockOther' );
        }
        
        function showForm( $err ) {
@@ -58,6 +59,8 @@ class IPBlockForm {
                        $mIpaddress = htmlspecialchars( wfMsg( 'ipaddress' ) );
                }
                $mIpbexpiry = htmlspecialchars( wfMsg( 'ipbexpiry' ) );
+               $mIpbother = htmlspecialchars( wfMsg( 'ipbother' ) );
+               $mIpbothertime = htmlspecialchars( wfMsg( 'ipbotheroption' ) );
                $mIpbreason = htmlspecialchars( wfMsg( 'ipbreason' ) );
                $mIpbsubmit = htmlspecialchars( wfMsg( 'ipbsubmit' ) );
                $titleObj = Title::makeTitle( NS_SPECIAL, 'Blockip' );
@@ -71,10 +74,16 @@ class IPBlockForm {
                $scBlockAddress = htmlspecialchars( $this->BlockAddress );
                $scBlockExpiry = htmlspecialchars( $this->BlockExpiry );
                $scBlockReason = htmlspecialchars( $this->BlockReason );
-
-               $blockExpiryFormOptions = '<option>' .
-                       implode("</option>\n\t\t\t\t\t<option>", explode(',', $wgBlockExpiryOptions)) .
-                       '</option>';
+               $scBlockOtherTime = htmlspecialchars( $this->BlockOtherTime );
+               $scBlockExpiryOptions = htmlspecialchars( wfMsg( 'ipboptions' ) );
+
+               $blockExpiryFormOptions = "<option value=\"other\">$mIpbothertime</option>";
+               foreach (explode(',', $scBlockExpiryOptions) as $option) {
+                       $selected = "";
+                       if ($this->BlockExpiry === $option)
+                               $selected = ' selected="selected"';
+                       $blockExpiryFormOptions .= "<option$selected>$option</option>";
+               }
 
                $token = htmlspecialchars( $wgUser->editToken() );
                
@@ -95,6 +104,12 @@ class IPBlockForm {
                                </select>
                        </td>
                </tr>
+               <tr>
+                       <td align=\"right\">{$mIpbother}:</td>
+                       <td align=\"left\">
+                               <input tabindex='3' type='text' size='40' name=\"wpBlockOther\" value=\"{$scBlockOtherTime}\" />
+                       </td>
+               </tr>
                <tr>
                        <td align=\"right\">{$mIpbreason}:</td>
                        <td align=\"left\">
@@ -150,11 +165,15 @@ class IPBlockForm {
                        }
                }
 
-               if ( $this->BlockExpiry == 'infinite' || $this->BlockExpiry == 'indefinite' ) {
+               $expirestr = $this->BlockExpiry;
+               if (strlen($expirestr) == 0 || $expirestr == wfMsg('ipbotheroption'))
+                       $expirestr = $this->BlockOther;
+
+               if ( $expirestr == 'infinite' || $expirestr == 'indefinite' ) {
                        $expiry = '';
                } else {
                        # Convert GNU-style date, returns -1 on error
-                       $expiry = strtotime( $this->BlockExpiry );
+                       $expiry = strtotime( $expirestr );
 
                        if ( $expiry < 0 ) {
                                $this->showForm( wfMsg( 'ipb_expiry_invalid' ) );
@@ -180,7 +199,7 @@ class IPBlockForm {
                        # Make log entry
                        $log = new LogPage( 'block' );
                        $log->addEntry( 'block', Title::makeTitle( NS_USER, $this->BlockAddress ), 
-                         $this->BlockReason, $this->BlockExpiry );
+                         $this->BlockReason, $expirestr );
 
                        # Report to the user
                        $titleObj = Title::makeTitle( NS_SPECIAL, 'Blockip' );
index b888ae9..87b8e9c 100644 (file)
@@ -1400,6 +1400,9 @@ pages that were vandalized).",
 'ipbexpiry'            => 'Expiry',
 'ipbreason'            => 'Reason',
 'ipbsubmit'            => 'Block this user',
+'ipbother'             => 'Other time',
+'ipboptions'           => '2 hours,1 day,3 days,1 week,2 weeks,1 month,3 months,6 months,1 year,infinite',
+'ipbotheroption'       => 'other',
 'badipaddress' => 'Invalid IP address',
 'blockipsuccesssub' => 'Block succeeded',
 'blockipsuccesstext' => "\"$1\" has been blocked.