From a45d3d96fab0d0643f7e18f648d758abc0dd5f7d Mon Sep 17 00:00:00 2001 From: River Tarnell Date: Tue, 28 Jun 2005 16:38:30 +0000 Subject: [PATCH] * (bug 2577) Allow sysops to enter non-standard block times --- RELEASE-NOTES | 2 +- includes/SpecialBlockip.php | 33 ++++++++++++++++++++++++++------- languages/Language.php | 3 +++ 3 files changed, 30 insertions(+), 8 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 46eeade7b2..5ea6640dcd 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -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 === diff --git a/includes/SpecialBlockip.php b/includes/SpecialBlockip.php index ea15e3891c..ca1b398d3d 100644 --- a/includes/SpecialBlockip.php +++ b/includes/SpecialBlockip.php @@ -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 = '\n\t\t\t\t\t'; + $scBlockOtherTime = htmlspecialchars( $this->BlockOtherTime ); + $scBlockExpiryOptions = htmlspecialchars( wfMsg( 'ipboptions' ) ); + + $blockExpiryFormOptions = ""; + foreach (explode(',', $scBlockExpiryOptions) as $option) { + $selected = ""; + if ($this->BlockExpiry === $option) + $selected = ' selected="selected"'; + $blockExpiryFormOptions .= "$option"; + } $token = htmlspecialchars( $wgUser->editToken() ); @@ -95,6 +104,12 @@ class IPBlockForm { + + {$mIpbother}: + + + + {$mIpbreason}: @@ -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' ); diff --git a/languages/Language.php b/languages/Language.php index b888ae915b..87b8e9cbf9 100644 --- a/languages/Language.php +++ b/languages/Language.php @@ -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. -- 2.20.1