Made list of expiry options configurable.\nRemoved redundant setting $wgDefaultBlockE...
authorMr. E23 <e23@users.mediawiki.org>
Tue, 22 Feb 2005 18:20:12 +0000 (18:20 +0000)
committerMr. E23 <e23@users.mediawiki.org>
Tue, 22 Feb 2005 18:20:12 +0000 (18:20 +0000)
includes/DefaultSettings.php
includes/SpecialBlockip.php

index e7d619e..995a23b 100644 (file)
@@ -457,8 +457,12 @@ $wgAllowAnonymousMinor = false; # Allow anonymous users to mark changes as 'mino
 
 $wgSysopUserBans        = false; # Allow sysops to ban logged-in users
 $wgSysopRangeBans              = false; # Allow sysops to ban IP ranges
-$wgDefaultBlockExpiry  = '24 hours'; # default expiry time
-                                # strtotime format, or "infinite" for an infinite block
+
+/** Comma-separated list of options to show on the IP block form. 
+  * Use strtotime() format, or "infinite" for an infinite block 
+  */
+$wgBlockExpiryOptions = "2 hours,1 day,3 days,1 week,2 weeks,1 month,3 months,6 months,1 year,infinite";
+
 $wgAutoblockExpiry             = 86400; # Number of seconds before autoblock entries expire
 
 # Proxy scanner settings
@@ -1124,4 +1128,4 @@ $wgMinimalPasswordLength = 0;
 } else {
        die();
 }
-?>
\ No newline at end of file
+?>
index 1671b43..81493f7 100644 (file)
@@ -46,16 +46,12 @@ class IPBlockForm {
        }
        
        function showForm( $err ) {
-               global $wgOut, $wgUser, $wgLang, $wgDefaultBlockExpiry;
+               global $wgOut, $wgUser, $wgLang, $wgBlockExpiryOptions;
                global $wgRequest;
 
                $wgOut->setPagetitle( htmlspecialchars( wfMsg( 'blockip' ) ) );
                $wgOut->addWikiText( htmlspecialchars( wfMsg( 'blockiptext' ) ) );
 
-               if ( is_null( $this->BlockExpiry ) || $this->BlockExpiry === '' ) {
-                       $this->BlockExpiry = $wgDefaultBlockExpiry;
-               }
-
                $mIpaddress = htmlspecialchars( wfMsg( 'ipaddress' ) );
                $mIpbexpiry = htmlspecialchars( wfMsg( 'ipbexpiry' ) );
                $mIpbreason = htmlspecialchars( wfMsg( 'ipbreason' ) );
@@ -71,6 +67,10 @@ class IPBlockForm {
                $scBlockAddress = htmlspecialchars( $this->BlockAddress );
                $scBlockExpiry = htmlspecialchars( $this->BlockExpiry );
                $scBlockReason = htmlspecialchars( $this->BlockReason );
+
+               $blockExpiryOptions = join("</option><option>", split(",", $wgBlockExpiryOptions));
+               $blockExpiryOptions = "<option>" . $blockExpiryOptions . "</option>";
+
                $token = htmlspecialchars( $wgUser->editToken() );
                
                $wgOut->addHTML( "
@@ -85,17 +85,8 @@ class IPBlockForm {
                <tr>
                        <td align=\"right\">{$mIpbexpiry}:</td>
                        <td align=\"left\">
-                               <select name=\"wpBlockExpiry\"/>
-                                       <option>2 hours</option>
-                                       <option>1 day</option>
-                                       <option>3 days</option>
-                                       <option>1 week</option> 
-                                       <option>2 weeks</option>        
-                                       <option>1 month</option>
-                                       <option>3 months</option>
-                                       <option>6 months</option>
-                                       <option>1 year</option>
-                                       <option>indefinite</option>
+                               <select tabindex='2' name=\"wpBlockExpiry\"/>
+                                       <?= $blockExpiryOptions ?>
                                </select>
                        </td>
                </tr>
@@ -169,6 +160,7 @@ class IPBlockForm {
 
                }
                
+
                if ( $this->BlockReason == '') {
                        $this->showForm( wfMsg( 'noblockreason' ) );
                        return;
@@ -181,7 +173,6 @@ class IPBlockForm {
                        $this->BlockReason, wfTimestampNow(), 0, $expiry );
                
                if (wfRunHooks('BlockIp', $ban, $wgUser)) {
-                       
                        $ban->insert();
                        
                        wfRunHooks('BlockIpComplete', $ban, $wgUser);