From 1cf715349e4c9b3b11425b0ae7f2eb0592e698bd Mon Sep 17 00:00:00 2001 From: River Tarnell Date: Tue, 28 Jun 2005 17:02:13 +0000 Subject: [PATCH] (bug 2577) when [[MediaWiki:Ipboptions]] contains "-", do not show any block options, so it looks like the old block form. --- includes/SpecialBlockip.php | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/includes/SpecialBlockip.php b/includes/SpecialBlockip.php index 2545be154a..ea0cd046ef 100644 --- a/includes/SpecialBlockip.php +++ b/includes/SpecialBlockip.php @@ -42,8 +42,8 @@ class IPBlockForm { global $wgRequest; $this->BlockAddress = $wgRequest->getVal( 'wpBlockAddress', $wgRequest->getVal( 'ip' ) ); $this->BlockReason = $wgRequest->getText( 'wpBlockReason' ); - $this->BlockExpiry = $wgRequest->getVal( 'wpBlockExpiry' ); - $this->BlockOther = $wgRequest->getVal( 'wpBlockOther' ); + $this->BlockExpiry = $wgRequest->getVal( 'wpBlockExpiry', wfMsg('ipbotheroption') ); + $this->BlockOther = $wgRequest->getVal( 'wpBlockOther', '' ); } function showForm( $err ) { @@ -74,9 +74,13 @@ class IPBlockForm { $scBlockAddress = htmlspecialchars( $this->BlockAddress ); $scBlockExpiry = htmlspecialchars( $this->BlockExpiry ); $scBlockReason = htmlspecialchars( $this->BlockReason ); - $scBlockOtherTime = htmlspecialchars( $this->BlockOtherTime ); + $scBlockOtherTime = htmlspecialchars( $this->BlockOther ); $scBlockExpiryOptions = htmlspecialchars( wfMsg( 'ipboptions' ) ); + $showblockoptions = $scBlockExpiryOptions != '-'; + if (!$showblockoptions) + $mIpbother = $mIpbexpiry; + $blockExpiryFormOptions = ""; foreach (explode(',', $scBlockExpiryOptions) as $option) { $selected = ""; @@ -96,13 +100,18 @@ class IPBlockForm { - + "); + if ($showblockoptions) { + $wgOut->addHTML(" {$mIpbexpiry}: + "); + } + $wgOut->addHTML(" {$mIpbother}: @@ -166,9 +175,14 @@ class IPBlockForm { } $expirestr = $this->BlockExpiry; - if (strlen($expirestr) == 0 || $expirestr == wfMsg('ipbotheroption')) + if ($expirestr == wfMsg('ipbotheroption')) $expirestr = $this->BlockOther; + if (strlen($expirestr) == 0) { + $this->showForm( wfMsg( 'ipb_expiry_invalid' ) ); + return; + } + if ( $expirestr == 'infinite' || $expirestr == 'indefinite' ) { $expiry = ''; } else { -- 2.20.1