'FewestrevisionsPage' => 'includes/specials/SpecialFewestrevisions.php',
'FileDuplicateSearchPage' => 'includes/specials/SpecialFileDuplicateSearch.php',
'IPBlockForm' => 'includes/specials/SpecialBlock.php',
- 'IPBlocklistPager' => 'includes/specials/SpecialIpblocklist.php',
- 'IPUnblockForm' => 'includes/specials/SpecialIpblocklist.php',
+ 'BlockListPager' => 'includes/specials/SpecialBlockList.php',
+ 'SpecialBlockList' => 'includes/specials/SpecialBlockList.php',
'ImportReporter' => 'includes/specials/SpecialImport.php',
'ImportStreamSource' => 'includes/Import.php',
'ImportStringSource' => 'includes/Import.php',
'Listusers' => 'users',
'Activeusers' => 'users',
'Listgrouprights' => 'users',
- 'Ipblocklist' => 'users',
+ 'BlockList' => 'users',
'Contributions' => 'users',
'Emailuser' => 'users',
'Listadmins' => 'users',
*
* Subclassing the pager to implement concrete functionality should be fairly
* simple, please see the examples in HistoryPage.php and
- * SpecialIpblocklist.php. You just need to override formatRow(),
+ * SpecialBlockList.php. You just need to override formatRow(),
* getQueryInfo() and getIndexField(). Don't forget to call the parent
* constructor if you override it.
*
# Users and rights
'Block' => 'SpecialBlock',
'Unblock' => 'SpecialUnblock',
- 'Ipblocklist' => 'IPUnblockForm',
+ 'BlockList' => 'SpecialBlockList',
'Resetpass' => 'SpecialResetpass',
'DeletedContributions' => 'DeletedContributionsPage',
'Preferences' => 'SpecialPreferences',
# Link to the block list
$links[] = $skin->linkKnown(
- SpecialPage::getTitleFor( 'Ipblocklist' ),
+ SpecialPage::getTitleFor( 'BlockList' ),
wfMsg( 'ipb-blocklist' )
);
--- /dev/null
+<?php
+/**
+ * Implements Special:BlockList
+ *
+ * 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
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ * @ingroup SpecialPage
+ */
+
+/**
+ * A special page that lists existing blocks
+ *
+ * @ingroup SpecialPage
+ */
+class SpecialBlockList extends SpecialPage {
+
+ protected $target, $options;
+
+ function __construct() {
+ parent::__construct( 'BlockList' );
+ }
+
+ /**
+ * Main execution point
+ *
+ * @param $par String title fragment
+ */
+ public function execute( $par ) {
+ global $wgUser, $wgOut, $wgRequest;
+
+ $this->setHeaders();
+ $this->outputHeader();
+ $wgOut->setPageTitle( wfMsg( 'ipblocklist' ) );
+ $wgOut->addModuleStyles( 'mediawiki.special' );
+
+ $par = $wgRequest->getVal( 'ip', $par );
+ $this->target = trim( $wgRequest->getVal( 'wpTarget', $par ) );
+
+ $this->options = $wgRequest->getArray( 'wpOptions' );
+
+ $action = $wgRequest->getText( 'action' );
+
+ if( $action == 'unblock' || $action == 'submit' && $wgRequest->wasPosted() ) {
+ # B/C @since 1.18: Unblock interface is now at Special:Unblock
+ $title = SpecialPage::getTitleFor( 'Unblock', $this->target );
+ $wgOut->redirect( $title->getFullUrl() );
+ return;
+ }
+
+ # Just show the block list
+ $fields = array(
+ 'Target' => array(
+ 'type' => 'text',
+ 'label-message' => 'ipaddressorusername',
+ 'tabindex' => '1',
+ 'size' => '45',
+ ),
+ 'Options' => array(
+ 'type' => 'multiselect',
+ 'options' => array(
+ wfMsg( 'blocklist-userblocks' ) => 'userblocks',
+ wfMsg( 'blocklist-tempblocks' ) => 'tempblocks',
+ wfMsg( 'blocklist-addressblocks' ) => 'addressblocks',
+ ),
+ 'cssclass' => 'mw-htmlform-multiselect-flatlist',
+ ),
+ );
+ $form = new HTMLForm( $fields );
+ $form->setTitle( $this->getTitle() );
+ $form->setMethod( 'get' );
+ $form->setWrapperLegend( wfMsg( 'ipblocklist-legend' ) );
+ $form->setSubmitText( wfMsg( 'ipblocklist-submit' ) );
+ $form->prepareForm();
+
+ $form->displayForm( '' );
+ $this->showList();
+ }
+
+ /**
+ * Get the component of an IP address which is certain to be the same between an IP
+ * address and a rangeblock containing that IP address.
+ * @todo: should be in IP.php??
+ * @param $ip String
+ * @return String
+ */
+ protected static function getIpFragment( $ip ){
+ global $wgBlockCIDRLimit;
+ if( IP::isIPv4( $ip ) ){
+ $hexAddress = IP::toHex( $ip );
+ return substr( $hexAddress, 0, wfBaseconvert( $wgBlockCIDRLimit['IPv4'], 10, 16 ) );
+ } elseif( IP::isIPv6( $ip ) ) {
+ $hexAddress = substr( IP::toHex( $ip ), 2 );
+ return 'v6-' . substr( $hexAddress, 0, wfBaseconvert( $wgBlockCIDRLimit['IPv6'], 10, 16 ) );
+ } else {
+ return null;
+ }
+ }
+
+ function showList() {
+ global $wgOut, $wgUser;
+
+ # Purge expired entries on one in every 10 queries
+ if ( !mt_rand( 0, 10 ) ) {
+ Block::purgeExpired();
+ }
+
+ $conds = array();
+ # Is the user allowed to see hidden blocks?
+ if ( !$wgUser->isAllowed( 'hideuser' ) ){
+ $conds['ipb_deleted'] = 0;
+ }
+
+ if ( $this->target !== '' ){
+ list( $target, $type ) = Block::parseTarget( $this->target );
+
+ switch( $type ){
+ case Block::TYPE_ID:
+ $conds['ipb_id'] = $target;
+ break;
+
+ case Block::TYPE_IP:
+ case BLock::TYPE_RANGE:
+ list( $start, $end ) = IP::parseRange( $target );
+ # Per bug 14634, we want to include relevant active rangeblocks; for
+ # rangeblocks, we want to include larger ranges which enclose the given
+ # range. We know that all blocks must be smaller than $wgBlockCIDRLimit,
+ # so we can improve performance by filtering on a LIKE clause
+ $chunk = self::getIpFragment( $start );
+ $dbr = wfGetDB( DB_SLAVE );
+ $like = $dbr->buildLike( $chunk, $dbr->anyString() );
+
+ # Fairly hard to make a malicious SQL statement out of hex characters,
+ # but stranger things have happened...
+ $safeStart = $dbr->addQuotes( IP::toHex( $start ) );
+ $safeEnd = $dbr->addQuotes( IP::toHex( $end ) );
+ $safeTarget = $dbr->addQuotes( IP::toHex( $target ) );
+
+ # TODO: abstract this away
+ $conds[] = "(ipb_address = $safeTarget) OR
+ (ipb_range_start $like AND ipb_range_start <= $safeStart AND ipb_range_end >= $safeEnd)";
+ $conds['ipb_auto'] = 0;
+ break;
+
+ case Block::TYPE_USER:
+ $conds['ipb_address'] = (string)$this->target;
+ $conds['ipb_auto'] = 0;
+ break;
+ }
+ }
+
+ # Apply filters
+ if( in_array( 'userblocks', $this->options ) ) {
+ $conds['ipb_user'] = 0;
+ }
+ if( in_array( 'tempblocks', $this->options ) ) {
+ $conds['ipb_expiry'] = 'infinity';
+ }
+ if( in_array( 'addressblocks', $this->options ) ) {
+ $conds[] = "ipb_user != 0 OR ipb_range_end > ipb_range_start";
+ }
+
+ # Check for other blocks, i.e. global/tor blocks
+ $otherBlockLink = array();
+ wfRunHooks( 'OtherBlockLogLink', array( &$otherBlockLink, $this->target ) );
+
+ # 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 ) ) {
+ $wgOut->addHTML(
+ Html::rawElement( 'h2', array(), wfMsg( 'ipblocklist-localblock' ) ) . "\n"
+ );
+ }
+
+ $pager = new BlockListPager( $this, $conds );
+ if ( $pager->getNumRows() ) {
+ $wgOut->addHTML(
+ $pager->getNavigationBar() .
+ $pager->getBody().
+ $pager->getNavigationBar()
+ );
+
+ } elseif ( $this->target ) {
+ $wgOut->addWikiMsg( 'ipblocklist-no-results' );
+
+ } else {
+ $wgOut->addWikiMsg( 'ipblocklist-empty' );
+ }
+
+ if( count( $otherBlockLink ) ) {
+ $wgOut->addHTML(
+ Html::rawElement(
+ 'h2',
+ array(),
+ wfMsgExt(
+ 'ipblocklist-otherblocks',
+ 'parseinline',
+ count( $otherBlockLink )
+ )
+ ) . "\n"
+ );
+ $list = '';
+ foreach( $otherBlockLink as $link ) {
+ $list .= Html::rawElement( 'li', array(), $link ) . "\n";
+ }
+ $wgOut->addHTML( Html::rawElement( 'ul', array( 'class' => 'mw-ipblocklist-otherblocks' ), $list ) . "\n" );
+ }
+ }
+}
+
+class BlockListPager extends TablePager {
+ protected $conds;
+ protected $page;
+
+ function __construct( $page, $conds ) {
+ $this->page = $page;
+ $this->conds = $conds;
+ $this->mDefaultDirection = true;
+ parent::__construct();
+ }
+
+ function getFieldNames() {
+ global $wgUser;
+ static $headers = null;
+
+ if ( $headers == array() ) {
+ $headers = array(
+ 'ipb_timestamp' => 'blocklist-timestamp',
+ 'ipb_target' => 'blocklist-target',
+ 'ipb_expiry' => 'blocklist-expiry',
+ 'ipb_by' => 'blocklist-by',
+ 'ipb_params' => 'blocklist-params',
+ 'ipb_reason' => 'blocklist-reason',
+ );
+ $headers = array_map( 'wfMsg', $headers );
+ }
+
+ return $headers;
+ }
+
+ function formatValue( $name, $value ) {
+ global $wgOut, $wgLang, $wgUser;
+
+ static $sk, $msg;
+ if ( empty( $sk ) ) {
+ $sk = $wgUser->getSkin();
+ $msg = array(
+ 'anononlyblock',
+ 'createaccountblock',
+ 'noautoblockblock',
+ 'emailblock',
+ 'blocklist-nousertalk',
+ 'unblocklink',
+ 'change-blocklink',
+ );
+ $msg = array_combine( $msg, array_map( 'wfMessage', $msg ) );
+ }
+
+ $row = $this->mCurrentRow;
+ $formatted = '';
+
+ switch( $name ) {
+ case 'ipb_timestamp':
+ $formatted = $wgLang->timeanddate( $value );
+ break;
+
+ case 'ipb_target':
+ if( $row->ipb_auto ){
+ $formatted = wfMessage( 'autoblockid', $row->ipb_id );
+ } else {
+ list( $target, $type ) = Block::parseTarget( $row->ipb_address );
+ switch( $type ){
+ case Block::TYPE_USER:
+ case Block::TYPE_IP:
+ $formatted = $sk->userLink( $target->getId(), $target );
+ $formatted .= $sk->userToolLinks(
+ $target->getId(),
+ $target,
+ false,
+ Linker::TOOL_LINKS_NOBLOCK
+ );
+ break;
+ case Block::TYPE_RANGE:
+ $formatted = htmlspecialchars( $target );
+ }
+ }
+ break;
+
+ case 'ipb_expiry':
+ $formatted = $wgLang->timeanddate( $value );
+ if( $wgUser->isAllowed( 'block' ) ){
+ if( $row->ipb_auto ){
+ $links[] = $sk->linkKnown(
+ SpecialPage::getTitleFor( 'Unblock' ),
+ $msg['unblocklink'],
+ array(),
+ array( 'wpTarget' => "#{$row->ipb_id}" )
+ );
+ } else {
+ $links[] = $sk->linkKnown(
+ SpecialPage::getTitleFor( 'Unblock', $row->ipb_address ),
+ $msg['unblocklink']
+ );
+ $links[] = $sk->linkKnown(
+ SpecialPage::getTitleFor( 'Block', $row->ipb_address ),
+ $msg['change-blocklink']
+ );
+ }
+ $formatted .= ' ' . Html::rawElement(
+ 'span',
+ array( 'class' => 'mw-blocklist-actions' ),
+ "[{$wgLang->pipeList($links)}]"
+ );
+ }
+ break;
+
+ case 'ipb_by':
+ $user = User::newFromId( $value );
+ if( $user instanceof User ){
+ $formatted = $sk->userLink( $user->getId(), $user->getName() );
+ $formatted .= $sk->userToolLinks( $user->getId(), $user->getName() );
+ }
+ break;
+
+ case 'ipb_reason':
+ $formatted = $sk->commentBlock( $value );
+ break;
+
+ case 'ipb_params':
+ $properties = array();
+ if ( $row->ipb_anon_only ) {
+ $properties[] = $msg['anononlyblock'];
+ }
+ if ( $row->ipb_create_account ) {
+ $properties[] = $msg['createaccountblock'];
+ }
+ if ( !$row->ipb_enable_autoblock ) {
+ $properties[] = $msg['noautoblockblock'];
+ }
+
+ if ( $row->ipb_block_email ) {
+ $properties[] = $msg['emailblock'];
+ }
+
+ if ( !$row->ipb_allow_usertalk ) {
+ $properties[] = $msg['blocklist-nousertalk'];
+ }
+
+ $formatted = $wgLang->commaList( $properties );
+ break;
+
+ default:
+ $formatted = "Unable to format $name";
+ break;
+ }
+
+ return $formatted;
+ }
+
+ function getQueryInfo() {
+ $info = array(
+ 'tables' => array( 'ipblocks' ),
+ 'fields' => array(
+ 'ipb_id',
+ 'ipb_address',
+ 'ipb_by',
+ 'ipb_reason',
+ 'ipb_timestamp',
+ 'ipb_auto',
+ 'ipb_anon_only',
+ 'ipb_create_account',
+ 'ipb_enable_autoblock',
+ 'ipb_expiry',
+ 'ipb_range_start',
+ 'ipb_range_end',
+ 'ipb_deleted',
+ 'ipb_block_email',
+ 'ipb_allow_usertalk',
+ ),
+ 'conds' => $this->conds,
+ );
+
+ global $wgUser;
+ # Is the user allowed to see hidden blocks?
+ if ( !$wgUser->isAllowed( 'hideuser' ) ){
+ $conds['ipb_deleted'] = 0;
+ }
+
+ return $info;
+ }
+
+ public function getTableClass(){
+ return 'TablePager mw-blocklist';
+ }
+
+ function getIndexField() {
+ return 'ipb_timestamp';
+ }
+
+ function getDefaultSort() {
+ return 'ipb_timestamp';
+ }
+
+ function isFieldSortable( $name ) {
+ return false;
+ }
+
+ function getTitle() {
+ return $this->mPage->getTitle();
+ }
+}
+++ /dev/null
-<?php
-/**
- * Implements Special:ipblocklist
- *
- * 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
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- * http://www.gnu.org/copyleft/gpl.html
- *
- * @file
- * @ingroup SpecialPage
- */
-
-/**
- * A special page that lists existing blocks and allows users with the 'block'
- * permission to remove blocks
- *
- * @ingroup SpecialPage
- */
-class IPUnblockForm extends SpecialPage {
- var $ip;
- var $hideuserblocks, $hidetempblocks, $hideaddressblocks;
-
- function __construct() {
- parent::__construct( 'Ipblocklist' );
- }
-
- /**
- * Main execution point
- *
- * @param $ip part of title: Special:Ipblocklist/<ip>.
- */
- function execute( $ip ) {
- global $wgUser, $wgOut, $wgRequest;
-
- $this->setHeaders();
- $this->outputHeader();
-
- $ip = $wgRequest->getVal( 'ip', $ip );
- $this->ip = trim( $wgRequest->getVal( 'wpUnblockAddress', $ip ) );
- $this->hideuserblocks = $wgRequest->getBool( 'hideuserblocks' );
- $this->hidetempblocks = $wgRequest->getBool( 'hidetempblocks' );
- $this->hideaddressblocks = $wgRequest->getBool( 'hideaddressblocks' );
-
- $action = $wgRequest->getText( 'action' );
-
- if( $action == 'unblock' || $action == 'submit' && $wgRequest->wasPosted() ) {
- # B/C @since 1.18: Unblock interface is now at Special:Unblock
- $title = SpecialPage::getTitleFor( 'Unblock', $this->ip );
- $wgOut->redirect( $title->getFullUrl() );
- return;
- } else {
- # Just show the block list
- $this->showList( '' );
- }
- }
-
- function showList( $msg ) {
- global $wgOut, $wgUser;
-
- if ( $msg != '' ) {
- $wgOut->setSubtitle( $msg );
- }
-
- // Purge expired entries on one in every 10 queries
- if ( !mt_rand( 0, 10 ) ) {
- Block::purgeExpired();
- }
-
- $conds = array();
- // Is user allowed to see all the blocks?
- if ( !$wgUser->isAllowed( 'hideuser' ) )
- $conds['ipb_deleted'] = 0;
- if ( $this->ip == '' ) {
- // No extra conditions
- } elseif ( substr( $this->ip, 0, 1 ) == '#' ) {
- $conds['ipb_id'] = substr( $this->ip, 1 );
- // Single IPs
- } elseif ( IP::isIPAddress( $this->ip ) && strpos( $this->ip, '/' ) === false ) {
- $iaddr = IP::toHex( $this->ip );
- if( $iaddr ) {
- # Only scan ranges which start in this /16, this improves search speed
- # Blocks should not cross a /16 boundary.
- $range = substr( $iaddr, 0, 4 );
- // Fixme -- encapsulate this sort of query-building.
- $dbr = wfGetDB( DB_SLAVE );
- $encIp = $dbr->addQuotes( IP::sanitizeIP( $this->ip ) );
- $encAddr = $dbr->addQuotes( $iaddr );
- $conds[] = "(ipb_address = $encIp) OR
- (ipb_range_start" . $dbr->buildLike( $range, $dbr->anyString() ) . " AND
- ipb_range_start <= $encAddr
- AND ipb_range_end >= $encAddr)";
- } else {
- $conds['ipb_address'] = IP::sanitizeIP( $this->ip );
- }
- $conds['ipb_auto'] = 0;
- // IP range
- } elseif ( IP::isIPAddress( $this->ip ) ) {
- $conds['ipb_address'] = Block::normaliseRange( $this->ip );
- $conds['ipb_auto'] = 0;
- } else {
- $user = User::newFromName( $this->ip );
- if ( $user && ( $id = $user->getId() ) != 0 ) {
- $conds['ipb_user'] = $id;
- } else {
- // Uh...?
- $conds['ipb_address'] = $this->ip;
- $conds['ipb_auto'] = 0;
- }
- }
- // Apply filters
- if( $this->hideuserblocks ) {
- $conds['ipb_user'] = 0;
- }
- if( $this->hidetempblocks ) {
- $conds['ipb_expiry'] = 'infinity';
- }
- if( $this->hideaddressblocks ) {
- $conds[] = "ipb_user != 0 OR ipb_range_end > ipb_range_start";
- }
-
- // Search form
- $wgOut->addHTML( $this->searchForm() );
-
- // Check for other blocks, i.e. global/tor blocks
- $otherBlockLink = array();
- wfRunHooks( 'OtherBlockLogLink', array( &$otherBlockLink, $this->ip ) );
-
- // 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 ) ) {
- $wgOut->addHTML(
- Html::rawElement( 'h2', array(), wfMsg( 'ipblocklist-localblock' ) ) . "\n"
- );
- }
- $pager = new IPBlocklistPager( $this, $conds );
- if ( $pager->getNumRows() ) {
- $wgOut->addHTML(
- $pager->getNavigationBar() .
- Html::rawElement( 'ul', null, $pager->getBody() ) .
- $pager->getNavigationBar()
- );
- } elseif ( $this->ip != '') {
- $wgOut->addWikiMsg( 'ipblocklist-no-results' );
- } else {
- $wgOut->addWikiMsg( 'ipblocklist-empty' );
- }
-
- if( count( $otherBlockLink ) ) {
- $wgOut->addHTML(
- Html::rawElement( 'h2', array(), wfMsgExt( 'ipblocklist-otherblocks', 'parseinline', count( $otherBlockLink ) ) ) . "\n"
- );
- $list = '';
- foreach( $otherBlockLink as $link ) {
- $list .= Html::rawElement( 'li', array(), $link ) . "\n";
- }
- $wgOut->addHTML( Html::rawElement( 'ul', array( 'class' => 'mw-ipblocklist-otherblocks' ), $list ) . "\n" );
- }
-
- }
-
- function searchForm() {
- global $wgScript, $wgLang;
-
- $showhide = array( wfMsg( 'show' ), wfMsg( 'hide' ) );
- $nondefaults = array();
- if( $this->hideuserblocks ) {
- $nondefaults['hideuserblocks'] = $this->hideuserblocks;
- }
- if( $this->hidetempblocks ) {
- $nondefaults['hidetempblocks'] = $this->hidetempblocks;
- }
- if( $this->hideaddressblocks ) {
- $nondefaults['hideaddressblocks'] = $this->hideaddressblocks;
- }
- $ubLink = $this->makeOptionsLink( $showhide[1-$this->hideuserblocks],
- array( 'hideuserblocks' => 1-$this->hideuserblocks ), $nondefaults);
- $tbLink = $this->makeOptionsLink( $showhide[1-$this->hidetempblocks],
- array( 'hidetempblocks' => 1-$this->hidetempblocks ), $nondefaults);
- $sipbLink = $this->makeOptionsLink( $showhide[1-$this->hideaddressblocks],
- array( 'hideaddressblocks' => 1-$this->hideaddressblocks ), $nondefaults);
-
- $links = array();
- $links[] = wfMsgHtml( 'ipblocklist-sh-userblocks', $ubLink );
- $links[] = wfMsgHtml( 'ipblocklist-sh-tempblocks', $tbLink );
- $links[] = wfMsgHtml( 'ipblocklist-sh-addressblocks', $sipbLink );
- $hl = $wgLang->pipeList( $links );
-
- return
- Html::rawElement( 'form', array( 'action' => $wgScript ),
- Html::hidden( 'title', $this->getTitle()->getPrefixedDbKey() ) .
- Html::openElement( 'fieldset' ) .
- Html::element( 'legend', null, wfMsg( 'ipblocklist-legend' ) ) .
- Xml::inputLabel( wfMsg( 'ipblocklist-username' ), 'ip', 'ip', /* size */ false, $this->ip ) .
- ' ' .
- Xml::submitButton( wfMsg( 'ipblocklist-submit' ) ) . '<br />' .
- $hl .
- Html::closeElement( 'fieldset' )
- );
- }
-
- /**
- * Makes change an option link which carries all the other options
- *
- * @param $title see Title
- * @param $override Array: special query string options, will override the
- * ones in $options
- * @param $options Array: query string options
- * @param $active Boolean: whether to display the link in bold
- */
- function makeOptionsLink( $title, $override, $options, $active = false ) {
- global $wgUser;
- $sk = $wgUser->getSkin();
- $params = $override + $options;
- return $sk->link( $this->getTitle(), htmlspecialchars( $title ),
- ( $active ? array( 'style'=>'font-weight: bold;' ) : array() ), $params, array( 'known' ) );
- }
-
- /**
- * Callback function to output a block
- *
- * @param $block Block
- */
- function formatRow( $block ) {
- global $wgUser, $wgLang, $wgBlockAllowsUTEdit;
-
- wfProfileIn( __METHOD__ );
-
- static $sk=null, $msg=null;
-
- if( is_null( $sk ) )
- $sk = $wgUser->getSkin();
- if( is_null( $msg ) ) {
- $msg = array();
- $keys = array( 'infiniteblock', 'expiringblock', 'unblocklink', 'change-blocklink',
- 'anononlyblock', 'createaccountblock', 'noautoblockblock', 'emailblock', 'blocklist-nousertalk', 'blocklistline' );
- foreach( $keys as $key ) {
- $msg[$key] = wfMsgHtml( $key );
- }
- }
-
- # Prepare links to the blocker's user and talk pages
- $blocker_id = $block->getBy();
- $blocker_name = $block->getByName();
- $blocker = $sk->userLink( $blocker_id, $blocker_name );
- $blocker .= $sk->userToolLinks( $blocker_id, $blocker_name );
-
- # Prepare links to the block target's user and contribs. pages (as applicable, don't do it for autoblocks)
- if( $block->mAuto ) {
- $target = $block->getRedactedName(); # Hide the IP addresses of auto-blocks; privacy
- } else {
- $target = $sk->userLink( $block->mUser, $block->mAddress )
- . $sk->userToolLinks( $block->mUser, $block->mAddress, false, Linker::TOOL_LINKS_NOBLOCK );
- }
-
- $formattedTime = htmlspecialchars( $wgLang->timeanddate( $block->mTimestamp, true ) );
-
- $properties = array();
- $properties[] = Block::formatExpiry( $block->mExpiry );
- if ( $block->mAnonOnly ) {
- $properties[] = $msg['anononlyblock'];
- }
- if ( $block->mCreateAccount ) {
- $properties[] = $msg['createaccountblock'];
- }
- if (!$block->mEnableAutoblock && $block->mUser ) {
- $properties[] = $msg['noautoblockblock'];
- }
-
- if ( $block->mBlockEmail && $block->mUser ) {
- $properties[] = $msg['emailblock'];
- }
-
- if ( !$block->mAllowUsertalk && $wgBlockAllowsUTEdit ) {
- $properties[] = $msg['blocklist-nousertalk'];
- }
-
- $properties = $wgLang->commaList( $properties );
-
- $line = wfMsgReplaceArgs( $msg['blocklistline'], array( $formattedTime, $blocker, $target, $properties ) );
-
- $changeblocklink = '';
- $toolLinks = '';
- if ( $wgUser->isAllowed( 'block' ) ) {
- $unblocklink = $sk->link( $this->getTitle(),
- $msg['unblocklink'],
- array(),
- array( 'action' => 'unblock', 'id' => $block->mId ),
- 'known' );
-
- # Create changeblocklink for all blocks with exception of autoblocks
- if( !$block->mAuto ) {
- $changeblocklink = wfMsgExt( 'pipe-separator', 'escapenoentities' ) .
- $sk->link( SpecialPage::getTitleFor( 'Block', $block->mAddress ),
- $msg['change-blocklink'],
- array(), array(), 'known' );
- }
- $toolLinks = "($unblocklink$changeblocklink)";
- }
-
- $comment = $sk->commentBlock( htmlspecialchars($block->mReason) );
-
- $s = "{$line} $comment";
- if ( $block->mHideName )
- $s = '<span class="history-deleted">' . $s . '</span>';
-
- wfProfileOut( __METHOD__ );
- return "<li>$s $toolLinks</li>\n";
- }
-}
-
-/**
- * @todo document
- * @ingroup Pager
- */
-class IPBlocklistPager extends ReverseChronologicalPager {
- public $mForm, $mConds;
-
- function __construct( $form, $conds = array() ) {
- $this->mForm = $form;
- $this->mConds = $conds;
- parent::__construct();
- }
-
- function getStartBody() {
- wfProfileIn( __METHOD__ );
- # Do a link batch query
- $this->mResult->seek( 0 );
- $lb = new LinkBatch;
-
- /*
- while ( $row = $this->mResult->fetchObject() ) {
- $lb->addObj( Title::makeTitleSafe( NS_USER, $row->user_name ) );
- $lb->addObj( Title::makeTitleSafe( NS_USER_TALK, $row->user_name ) );
- $lb->addObj( Title::makeTitleSafe( NS_USER, $row->ipb_address ) );
- $lb->addObj( Title::makeTitleSafe( NS_USER_TALK, $row->ipb_address ) );
- }*/
- # Faster way
- # Usernames and titles are in fact related by a simple substitution of space -> underscore
- # The last few lines of Title::secureAndSplit() tell the story.
- foreach ( $this->mResult as $row ) {
- $name = str_replace( ' ', '_', $row->ipb_by_text );
- $lb->add( NS_USER, $name );
- $lb->add( NS_USER_TALK, $name );
- $name = str_replace( ' ', '_', $row->ipb_address );
- $lb->add( NS_USER, $name );
- $lb->add( NS_USER_TALK, $name );
- }
- $lb->execute();
- wfProfileOut( __METHOD__ );
- return '';
- }
-
- function formatRow( $row ) {
- $block = new Block;
- $block->initFromRow( $row );
- return $this->mForm->formatRow( $block );
- }
-
- function getQueryInfo() {
- $conds = $this->mConds;
- $conds[] = 'ipb_expiry>' . $this->mDb->addQuotes( $this->mDb->timestamp() );
- return array(
- 'tables' => 'ipblocks',
- 'fields' => '*',
- 'conds' => $conds,
- );
- }
-
- function getIndexField() {
- return 'ipb_timestamp';
- }
-}
'Filepath' => array( 'FilePath' ),
'Import' => array( 'Import' ),
'Invalidateemail' => array( 'InvalidateEmail' ),
- 'Ipblocklist' => array( 'BlockList', 'ListBlocks', 'IPBlockList' ),
+ 'BlockList' => array( 'BlockList', 'ListBlocks', 'IPBlockList' ),
'LinkSearch' => array( 'LinkSearch' ),
'Listadmins' => array( 'ListAdmins' ),
'Listbots' => array( 'ListBots' ),
# Suppression log
'suppressionlog' => 'Suppression log',
'suppressionlogtext' => 'Below is a list of deletions and blocks involving content hidden from administrators.
-See the [[Special:IPBlockList|IP block list]] for the list of currently operational bans and blocks.',
+See the [[Special:BlockList|IP block list]] for the list of currently operational bans and blocks.',
# Revision move
'moverevlogentry' => 'moved {{PLURAL:$3|one revision|$3 revisions}} from $1 to $2',
'unblocked-id' => 'Block $1 has been removed',
'ipblocklist' => 'Blocked IP addresses and usernames',
'ipblocklist-legend' => 'Find a blocked user',
-'ipblocklist-username' => 'Username or IP address:',
-'ipblocklist-sh-userblocks' => '$1 account blocks',
-'ipblocklist-sh-tempblocks' => '$1 temporary blocks',
-'ipblocklist-sh-addressblocks' => '$1 single IP blocks',
+'blocklist-userblocks' => 'Hide account blocks',
+'blocklist-tempblocks' => 'Hide temporary blocks',
+'blocklist-addressblocks' => 'Hide single IP blocks',
+'blocklist-timestamp' => 'Timestamp',
+'blocklist-target' => 'Target',
+'blocklist-expiry' => 'Expires',
+'blocklist-by' => 'Blocking admin',
+'blocklist-params' => 'Block parameters',
+'blocklist-reason' => 'Reason',
'ipblocklist-summary' => '', # do not translate or duplicate this message to other languages
'ipblocklist-submit' => 'Search',
'ipblocklist-localblock' => 'Local block',
'ipblocklist-otherblocks' => 'Other {{PLURAL:$1|block|blocks}}',
-'blocklistline' => '$1, $2 blocked $3 ($4)',
'infiniteblock' => 'infinite',
'expiringblock' => 'expires on $1 at $2',
'anononlyblock' => 'anon. only',
'unblocked-id',
'ipblocklist',
'ipblocklist-legend',
- 'ipblocklist-username',
- 'ipblocklist-sh-userblocks',
- 'ipblocklist-sh-tempblocks',
- 'ipblocklist-sh-addressblocks',
+ 'blocklist-userblocks',
+ 'blocklist-tempblocks',
+ 'blocklist-addressblocks',
+ 'blocklist-timestamp',
+ 'blocklist-target',
+ 'blocklist-expiry',
+ 'blocklist-by',
+ 'blocklist-params',
+ 'blocklist-reason',
'ipblocklist-summary',
'ipblocklist-submit',
'ipblocklist-localblock',
'ipblocklist-otherblocks',
- 'blocklistline',
+
'infiniteblock',
'expiringblock',
'anononlyblock',
font-weight: bold;
}
+/**** Special:BlockList ****/
+table.mw-blocklist span.mw-usertoollinks,
+span.mw-blocklist-actions{
+ white-space: nowrap;
+ font-size: 90%;
+}
+
/**** Special:Contributions ****/
.mw-uctop {
font-weight: bold;