X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fspecials%2FSpecialBlock.php;h=d198ea1cd2186b321b0368dc8ecc1c3e835782b6;hb=a2ea9f8b9289f197844e3282c2ac39e59c549996;hp=db50bd890e40c4d90b9bf4c92e92f3c5785c42e7;hpb=765829b6506ee32e06e1c070d2af2d427c989f5c;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/specials/SpecialBlock.php b/includes/specials/SpecialBlock.php index db50bd890e..d198ea1cd2 100644 --- a/includes/specials/SpecialBlock.php +++ b/includes/specials/SpecialBlock.php @@ -51,6 +51,10 @@ class SpecialBlock extends FormSpecialPage { parent::__construct( 'Block', 'block' ); } + public function doesWrites() { + return true; + } + /** * Checks that the user can unblock themselves if they are trying to do so * @@ -321,7 +325,8 @@ class SpecialBlock extends FormSpecialPage { protected function preText() { $this->getOutput()->addModules( array( 'mediawiki.special.block', 'mediawiki.userSuggest' ) ); - $text = $this->msg( 'blockiptext' )->parse(); + $blockCIDRLimit = $this->getConfig()->get( 'BlockCIDRLimit' ); + $text = $this->msg( 'blockiptext', $blockCIDRLimit['IPv4'], $blockCIDRLimit['IPv6'] )->parse(); $otherBlockMessages = array(); if ( $this->target !== null ) { @@ -645,12 +650,25 @@ class SpecialBlock extends FormSpecialPage { return array( 'badipaddress' ); } - if ( ( strlen( $data['Expiry'] ) == 0 ) || ( strlen( $data['Expiry'] ) > 50 ) - || !self::parseExpiryInput( $data['Expiry'] ) + $expiryTime = self::parseExpiryInput( $data['Expiry'] ); + + if ( + // an expiry time is needed + ( strlen( $data['Expiry'] ) == 0 ) || + // can't be a larger string as 50 (it should be a time format in any way) + ( strlen( $data['Expiry'] ) > 50 ) || + // check, if the time could be parsed + !$expiryTime ) { return array( 'ipb_expiry_invalid' ); } + // an expiry time should be in the future, not in the + // past (wouldn't make any sense) - bug T123069 + if ( $expiryTime < wfTimestampNow() ) { + return array( 'ipb_expiry_old' ); + } + if ( !isset( $data['DisableEmail'] ) ) { $data['DisableEmail'] = false; } @@ -694,7 +712,7 @@ class SpecialBlock extends FormSpecialPage { $block->setBlocker( $performer ); # Truncate reason for whole multibyte characters $block->mReason = $wgContLang->truncate( $data['Reason'][0], 255 ); - $block->mExpiry = self::parseExpiryInput( $data['Expiry'] ); + $block->mExpiry = $expiryTime; $block->prevents( 'createaccount', $data['CreateAccount'] ); $block->prevents( 'editownusertalk', ( !$wgBlockAllowsUTEdit || $data['DisableUTEdit'] ) ); $block->prevents( 'sendemail', $data['DisableEmail'] );