summaryrefslogtreecommitdiff
path: root/includes/specials/SpecialUnblock.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/specials/SpecialUnblock.php')
-rw-r--r--includes/specials/SpecialUnblock.php38
1 files changed, 27 insertions, 11 deletions
diff --git a/includes/specials/SpecialUnblock.php b/includes/specials/SpecialUnblock.php
index ca93b6d1..244b8894 100644
--- a/includes/specials/SpecialUnblock.php
+++ b/includes/specials/SpecialUnblock.php
@@ -42,6 +42,11 @@ class SpecialUnblock extends SpecialPage {
list( $this->target, $this->type ) = SpecialBlock::getTargetAndType( $par, $this->getRequest() );
$this->block = Block::newFromTarget( $this->target );
+ if ( $this->target instanceof User ) {
+ # Set the 'relevant user' in the skin, so it displays links like Contributions,
+ # User logs, UserRights, etc.
+ $this->getSkin()->setRelevantUser( $this->target );
+ }
$this->setHeaders();
$this->outputHeader();
@@ -58,8 +63,10 @@ class SpecialUnblock extends SpecialPage {
if ( $form->show() ) {
switch ( $this->type ) {
- case Block::TYPE_USER:
case Block::TYPE_IP:
+ $out->addWikiMsg( 'unblocked-ip', wfEscapeWikiText( $this->target ) );
+ break;
+ case Block::TYPE_USER:
$out->addWikiMsg( 'unblocked', wfEscapeWikiText( $this->target ) );
break;
case Block::TYPE_RANGE:
@@ -77,14 +84,14 @@ class SpecialUnblock extends SpecialPage {
$fields = array(
'Target' => array(
'type' => 'text',
- 'label-message' => 'ipadressorusername',
- 'tabindex' => '1',
+ 'label-message' => 'ipaddressorusername',
+ 'autofocus' => true,
'size' => '45',
'required' => true,
),
'Name' => array(
'type' => 'info',
- 'label-message' => 'ipadressorusername',
+ 'label-message' => 'ipaddressorusername',
),
'Reason' => array(
'type' => 'text',
@@ -102,13 +109,18 @@ class SpecialUnblock extends SpecialPage {
if ( $type == Block::TYPE_AUTO && $this->type == Block::TYPE_IP ) {
$fields['Target']['default'] = $this->target;
unset( $fields['Name'] );
-
} else {
$fields['Target']['default'] = $target;
$fields['Target']['type'] = 'hidden';
switch ( $type ) {
- case Block::TYPE_USER:
case Block::TYPE_IP:
+ $fields['Name']['default'] = Linker::linkKnown(
+ SpecialPage::getTitleFor( 'Contributions', $target->getName() ),
+ $target->getName()
+ );
+ $fields['Name']['raw'] = true;
+ break;
+ case Block::TYPE_USER:
$fields['Name']['default'] = Linker::link(
$target->getUserPage(),
$target->getName()
@@ -127,12 +139,15 @@ class SpecialUnblock extends SpecialPage {
$fields['Target']['default'] = "#{$this->target}";
break;
}
+ // target is hidden, so the reason is the first element
+ $fields['Target']['autofocus'] = false;
+ $fields['Reason']['autofocus'] = true;
}
-
} else {
$fields['Target']['default'] = $this->target;
unset( $fields['Name'] );
}
+
return $fields;
}
@@ -140,7 +155,7 @@ class SpecialUnblock extends SpecialPage {
* Submit callback for an HTMLForm object
* @param array $data
* @param HTMLForm $form
- * @return Array( Array(message key, parameters)
+ * @return array|bool Array(message key, parameters)
*/
public static function processUIUnblock( array $data, HTMLForm $form ) {
return self::processUnblock( $data, $form->getContext() );
@@ -149,10 +164,10 @@ class SpecialUnblock extends SpecialPage {
/**
* Process the form
*
- * @param $data Array
- * @param $context IContextSource
+ * @param array $data
+ * @param IContextSource $context
* @throws ErrorPageError
- * @return Array( Array(message key, parameters) ) on failure, True on success
+ * @return array|bool Array(message key, parameters) on failure, True on success
*/
public static function processUnblock( array $data, IContextSource $context ) {
$performer = $context->getUser();
@@ -176,6 +191,7 @@ class SpecialUnblock extends SpecialPage {
list( $target, $type ) = SpecialBlock::getTargetAndType( $target );
if ( $block->getType() == Block::TYPE_RANGE && $type == Block::TYPE_IP ) {
$range = $block->getTarget();
+
return array( array( 'ipb_blocked_as_range', $target, $range ) );
}