<?php
/**
+ * Implements Special:Unblock
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
}
public function execute( $par ){
- # Check permissions
- if( !$this->userCanExecute( $this->getUser() ) ) {
- $this->displayRestrictionError();
- return;
- }
-
- # Check for database lock
- if( wfReadOnly() ) {
- throw new ReadOnlyError;
- }
+ $this->checkPermissions();
+ $this->checkReadOnly();
list( $this->target, $this->type ) = SpecialBlock::getTargetAndType( $par, $this->getRequest() );
$this->block = Block::newFromTarget( $this->target );
$out->addModules( 'mediawiki.special' );
$form = new HTMLForm( $this->getFields(), $this->getContext() );
- $form->setWrapperLegend( wfMsg( 'unblockip' ) );
+ $form->setWrapperLegendMsg( 'unblockip' );
$form->setSubmitCallback( array( __CLASS__, 'processUIUnblock' ) );
- $form->setSubmitText( wfMsg( 'ipusubmit' ) );
- $form->addPreText( wfMsgExt( 'unblockiptext', 'parse' ) );
+ $form->setSubmitTextMsg( 'ipusubmit' );
+ $form->addPreText( $this->msg( 'unblockiptext' )->parseAsBlock() );
if( $form->show() ){
switch( $this->type ){
case Block::TYPE_USER:
case Block::TYPE_IP:
- $out->addWikiMsg( 'unblocked', $this->target );
+ $out->addWikiMsg( 'unblocked', wfEscapeWikiText( $this->target ) );
break;
case Block::TYPE_RANGE:
- $out->addWikiMsg( 'unblocked-range', $this->target );
+ $out->addWikiMsg( 'unblocked-range', wfEscapeWikiText( $this->target ) );
break;
case Block::TYPE_ID:
case Block::TYPE_AUTO:
- $out->addWikiMsg( 'unblocked-id', $this->target );
+ $out->addWikiMsg( 'unblocked-id', wfEscapeWikiText( $this->target ) );
break;
}
}
/**
* Submit callback for an HTMLForm object
+ * @return Array( Array(message key, parameters)
*/
public static function processUIUnblock( array $data, HTMLForm $form ) {
return self::processUnblock( $data, $form->getContext() );
*
* @param $data Array
* @param $context IContextSource
+ * @throws ErrorPageError
* @return Array( Array(message key, parameters) ) on failure, True on success
*/
public static function processUnblock( array $data, IContextSource $context ){