From 9d6c1f1545883125811627b5dd7b3935c2bb14f2 Mon Sep 17 00:00:00 2001 From: "Mr. E23" Date: Tue, 22 Feb 2005 18:20:12 +0000 Subject: [PATCH] Made list of expiry options configurable.\nRemoved redundant setting $wgDefaultBlockExpiry --- includes/DefaultSettings.php | 10 +++++++--- includes/SpecialBlockip.php | 25 ++++++++----------------- 2 files changed, 15 insertions(+), 20 deletions(-) diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index e7d619e304..995a23b81d 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -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 +?> diff --git a/includes/SpecialBlockip.php b/includes/SpecialBlockip.php index 1671b43dbb..81493f7aa3 100644 --- a/includes/SpecialBlockip.php +++ b/includes/SpecialBlockip.php @@ -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(""; + $token = htmlspecialchars( $wgUser->editToken() ); $wgOut->addHTML( " @@ -85,17 +85,8 @@ class IPBlockForm { {$mIpbexpiry}: - + @@ -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); -- 2.20.1