X-Git-Url: https://git.cyclocoop.org/%27.WWW_URL.%27admin/?a=blobdiff_plain;f=includes%2Fspecials%2FSpecialBlock.php;h=299d758435f07c6fbc54b17c4c6643f6bce328d3;hb=4eb5827a1f680feb1e92d6bd52ac84c7c4c1d488;hp=a721ab63c7f3fbeccbec46b4d892bbb228fb0356;hpb=ff194ef5b4c73b3772c45895ebafc75ab6e1336a;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/specials/SpecialBlock.php b/includes/specials/SpecialBlock.php index a721ab63c7..299d758435 100644 --- a/includes/specials/SpecialBlock.php +++ b/includes/specials/SpecialBlock.php @@ -48,7 +48,7 @@ class SpecialBlock extends SpecialPage { /// @var Bool protected $alreadyBlocked; - + /// @var Array protected $preErrors = array(); @@ -95,8 +95,7 @@ class SpecialBlock extends SpecialPage { $fields = self::getFormFields(); $this->maybeAlterFormDefaults( $fields ); - $form = new HTMLForm( $fields ); - $form->setTitle( $this->getTitle() ); + $form = new HTMLForm( $fields, $this->getContext() ); $form->setWrapperLegend( wfMsg( 'blockip-legend' ) ); $form->setSubmitCallback( array( __CLASS__, 'processForm' ) ); @@ -487,7 +486,8 @@ class SpecialBlock extends SpecialPage { if( $type == Block::TYPE_USER ){ # TODO: why do we not have a User->exists() method? if( !$target->getId() ){ - return wfMessage( 'nosuchusershort', $target->getName() ); + return wfMessage( 'nosuchusershort', + wfEscapeWikiText( $target->getName() ) ); } $status = self::checkUnblockSelf( $target ); @@ -554,7 +554,8 @@ class SpecialBlock extends SpecialPage { # Give admins a heads-up before they go and block themselves. Much messier # to do this for IPs, but it's pretty unlikely they'd ever get the 'block' # permission anyway, although the code does allow for it - if( $target === $wgUser->getName() && ( $data['PreviousTarget'] != $data['Target'] || !$data['Confirm'] ) ) + if( $target === $wgUser->getName() && + ( $data['PreviousTarget'] != $data['Target'] || !$data['Confirm'] ) ) { return array( 'ipb-blockingself' ); } @@ -634,7 +635,9 @@ class SpecialBlock extends SpecialPage { $status = $block->insert(); if( !$status ) { # Show form unless the user is already aware of this... - if( ( $data['PreviousTarget'] != htmlspecialchars( $block->getTarget() ) ) || !$data['Confirm'] ) { + if( !$data['Confirm'] || ( array_key_exists( 'PreviousTarget', $data ) + && $data['PreviousTarget'] !== htmlspecialchars( $block->getTarget() ) ) ) + { return array( array( 'ipb_already_blocked', $block->getTarget() ) ); # Otherwise, try to update the block... } else { @@ -710,7 +713,7 @@ class SpecialBlock extends SpecialPage { /** * Get an array of suggested block durations from MediaWiki:Ipboptions - * FIXME: this uses a rather odd syntax for the options, should it be converted + * @todo FIXME: This uses a rather odd syntax for the options, should it be converted * to the standard "**|" format? * @return Array */ @@ -743,7 +746,7 @@ class SpecialBlock extends SpecialPage { public static function parseExpiryInput( $expiry ) { static $infinity; if( $infinity == null ){ - $infinity = wfGetDB( DB_READ )->getInfinity(); + $infinity = wfGetDB( DB_SLAVE )->getInfinity(); } if ( $expiry == 'infinite' || $expiry == 'indefinite' ) { $expiry = $infinity; @@ -826,7 +829,7 @@ class SpecialBlock extends SpecialPage { $flags[] = 'noemail'; } - if( $data['DisableUTEdit'] && $wgBlockAllowsUTEdit ){ + if( $wgBlockAllowsUTEdit && $data['DisableUTEdit'] ){ $flags[] = 'nousertalk'; }