summaryrefslogtreecommitdiff
path: root/includes/specials/SpecialBlockList.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/specials/SpecialBlockList.php')
-rw-r--r--includes/specials/SpecialBlockList.php74
1 files changed, 39 insertions, 35 deletions
diff --git a/includes/specials/SpecialBlockList.php b/includes/specials/SpecialBlockList.php
index 7143d5bc..f1992c0f 100644
--- a/includes/specials/SpecialBlockList.php
+++ b/includes/specials/SpecialBlockList.php
@@ -37,7 +37,7 @@ class SpecialBlockList extends SpecialPage {
/**
* Main execution point
*
- * @param $par String title fragment
+ * @param string $par title fragment
*/
public function execute( $par ) {
$this->setHeaders();
@@ -55,10 +55,11 @@ class SpecialBlockList extends SpecialPage {
$action = $request->getText( 'action' );
- if( $action == 'unblock' || $action == 'submit' && $request->wasPosted() ) {
+ if ( $action == 'unblock' || $action == 'submit' && $request->wasPosted() ) {
# B/C @since 1.18: Unblock interface is now at Special:Unblock
$title = SpecialPage::getTitleFor( 'Unblock', $this->target );
- $out->redirect( $title->getFullUrl() );
+ $out->redirect( $title->getFullURL() );
+
return;
}
@@ -95,7 +96,9 @@ class SpecialBlockList extends SpecialPage {
'default' => 50,
),
);
- $form = new HTMLForm( $fields, $this->getContext() );
+ $context = new DerivativeContext( $this->getContext() );
+ $context->setTitle( $this->getTitle() ); // Remove subpage
+ $form = new HTMLForm( $fields, $context );
$form->setMethod( 'get' );
$form->setWrapperLegendMsg( 'ipblocklist-legend' );
$form->setSubmitTextMsg( 'ipblocklist-submit' );
@@ -113,14 +116,14 @@ class SpecialBlockList extends SpecialPage {
$conds = array();
# Is the user allowed to see hidden blocks?
- if ( !$this->getUser()->isAllowed( 'hideuser' ) ){
+ if ( !$this->getUser()->isAllowed( 'hideuser' ) ) {
$conds['ipb_deleted'] = 0;
}
- if ( $this->target !== '' ){
+ if ( $this->target !== '' ) {
list( $target, $type ) = Block::parseTarget( $this->target );
- switch( $type ){
+ switch ( $type ) {
case Block::TYPE_ID:
case Block::TYPE_AUTO:
$conds['ipb_id'] = $target;
@@ -141,23 +144,23 @@ class SpecialBlockList extends SpecialPage {
break;
case Block::TYPE_USER:
- $conds['ipb_address'] = (string)$this->target;
+ $conds['ipb_address'] = $target->getName();
$conds['ipb_auto'] = 0;
break;
}
}
# Apply filters
- if( in_array( 'userblocks', $this->options ) ) {
+ if ( in_array( 'userblocks', $this->options ) ) {
$conds['ipb_user'] = 0;
}
- if( in_array( 'tempblocks', $this->options ) ) {
+ if ( in_array( 'tempblocks', $this->options ) ) {
$conds['ipb_expiry'] = 'infinity';
}
- if( in_array( 'addressblocks', $this->options ) ) {
+ if ( in_array( 'addressblocks', $this->options ) ) {
$conds[] = "ipb_user != 0 OR ipb_range_end > ipb_range_start";
}
- if( in_array( 'rangeblocks', $this->options ) ) {
+ if ( in_array( 'rangeblocks', $this->options ) ) {
$conds[] = "ipb_range_end = ipb_range_start";
}
@@ -169,7 +172,7 @@ class SpecialBlockList extends SpecialPage {
# Show additional header for the local block only when other blocks exists.
# Not necessary in a standard installation without such extensions enabled
- if( count( $otherBlockLink ) ) {
+ if ( count( $otherBlockLink ) ) {
$out->addHTML(
Html::element( 'h2', array(), $this->msg( 'ipblocklist-localblock' )->text() ) . "\n"
);
@@ -179,18 +182,16 @@ class SpecialBlockList extends SpecialPage {
if ( $pager->getNumRows() ) {
$out->addHTML(
$pager->getNavigationBar() .
- $pager->getBody().
- $pager->getNavigationBar()
+ $pager->getBody() .
+ $pager->getNavigationBar()
);
-
} elseif ( $this->target ) {
$out->addWikiMsg( 'ipblocklist-no-results' );
-
} else {
$out->addWikiMsg( 'ipblocklist-empty' );
}
- if( count( $otherBlockLink ) ) {
+ if ( count( $otherBlockLink ) ) {
$out->addHTML(
Html::rawElement(
'h2',
@@ -199,12 +200,16 @@ class SpecialBlockList extends SpecialPage {
) . "\n"
);
$list = '';
- foreach( $otherBlockLink as $link ) {
+ foreach ( $otherBlockLink as $link ) {
$list .= Html::rawElement( 'li', array(), $link ) . "\n";
}
$out->addHTML( Html::rawElement( 'ul', array( 'class' => 'mw-ipblocklist-otherblocks' ), $list ) . "\n" );
}
}
+
+ protected function getGroupName() {
+ return 'users';
+ }
}
class BlockListPager extends TablePager {
@@ -234,7 +239,7 @@ class BlockListPager extends TablePager {
'ipb_params' => 'blocklist-params',
'ipb_reason' => 'blocklist-reason',
);
- foreach( $headers as $key => $val ) {
+ foreach ( $headers as $key => $val ) {
$headers[$key] = $this->msg( $val )->text();
}
}
@@ -263,17 +268,17 @@ class BlockListPager extends TablePager {
$formatted = '';
- switch( $name ) {
+ switch ( $name ) {
case 'ipb_timestamp':
$formatted = $this->getLanguage()->userTimeAndDate( $value, $this->getUser() );
break;
case 'ipb_target':
- if( $row->ipb_auto ){
+ if ( $row->ipb_auto ) {
$formatted = $this->msg( 'autoblockid', $row->ipb_id )->parse();
} else {
list( $target, $type ) = Block::parseTarget( $row->ipb_address );
- switch( $type ){
+ switch ( $type ) {
case Block::TYPE_USER:
case Block::TYPE_IP:
$formatted = Linker::userLink( $target->getId(), $target );
@@ -291,9 +296,9 @@ class BlockListPager extends TablePager {
break;
case 'ipb_expiry':
- $formatted = $this->getLanguage()->formatExpiry( $value, /* User preference timezone */ true );
- if( $this->getUser()->isAllowed( 'block' ) ){
- if( $row->ipb_auto ){
+ $formatted = $this->getLanguage()->formatExpiry( $value, /* User preference timezone */true );
+ if ( $this->getUser()->isAllowed( 'block' ) ) {
+ if ( $row->ipb_auto ) {
$links[] = Linker::linkKnown(
SpecialPage::getTitleFor( 'Unblock' ),
$msg['unblocklink'],
@@ -329,7 +334,7 @@ class BlockListPager extends TablePager {
break;
case 'ipb_reason':
- $formatted = Linker::commentBlock( $value );
+ $formatted = Linker::formatComment( $value );
break;
case 'ipb_params':
@@ -391,14 +396,14 @@ class BlockListPager extends TablePager {
);
# Is the user allowed to see hidden blocks?
- if ( !$this->getUser()->isAllowed( 'hideuser' ) ){
+ if ( !$this->getUser()->isAllowed( 'hideuser' ) ) {
$info['conds']['ipb_deleted'] = 0;
}
return $info;
}
- public function getTableClass(){
+ public function getTableClass() {
return 'TablePager mw-blocklist';
}
@@ -416,9 +421,9 @@ class BlockListPager extends TablePager {
/**
* Do a LinkBatch query to minimise database load when generating all these links
- * @param $result
+ * @param ResultWrapper $result
*/
- function preprocessResults( $result ){
+ function preprocessResults( $result ) {
wfProfileIn( __METHOD__ );
# Do a link batch query
$lb = new LinkBatch;
@@ -437,11 +442,11 @@ class BlockListPager extends TablePager {
}
$ua = UserArray::newFromIDs( $userids );
- foreach( $ua as $user ){
+ foreach ( $ua as $user ) {
$name = str_replace( ' ', '_', $user->getName() );
$lb->add( NS_USER, $name );
$lb->add( NS_USER_TALK, $name );
- }
+ }
$lb->execute();
wfProfileOut( __METHOD__ );
@@ -472,11 +477,10 @@ class HTMLBlockedUsersItemSelect extends HTMLSelectField {
// This adds the explicitly requested limit value to the drop-down,
// then makes sure it's sorted correctly so when we output the list
// later, the custom option doesn't just show up last.
- $this->mParams['options'][ $this->mParent->getLanguage()->formatNum( $value ) ] = intval($value);
+ $this->mParams['options'][$this->mParent->getLanguage()->formatNum( $value )] = intval( $value );
asort( $this->mParams['options'] );
}
return true;
}
-
}