/**
* @ingroup Pager
*/
+use MediaWiki\MediaWikiServices;
+use Wikimedia\Rdbms\ResultWrapper;
+
class BlockListPager extends TablePager {
protected $conds;
];
foreach ( $keys as $key ) {
- $msg[$key] = $this->msg( $key )->escaped();
+ $msg[$key] = $this->msg( $key )->text();
}
}
$formatted = '';
+ $linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();
+
switch ( $name ) {
case 'ipb_timestamp':
$formatted = htmlspecialchars( $language->userTimeAndDate( $value, $this->getUser() ) );
) );
if ( $this->getUser()->isAllowed( 'block' ) ) {
if ( $row->ipb_auto ) {
- $links[] = Linker::linkKnown(
+ $links[] = $linkRenderer->makeKnownLink(
SpecialPage::getTitleFor( 'Unblock' ),
$msg['unblocklink'],
[],
[ 'wpTarget' => "#{$row->ipb_id}" ]
);
} else {
- $links[] = Linker::linkKnown(
+ $links[] = $linkRenderer->makeKnownLink(
SpecialPage::getTitleFor( 'Unblock', $row->ipb_address ),
$msg['unblocklink']
);
- $links[] = Linker::linkKnown(
+ $links[] = $linkRenderer->makeKnownLink(
SpecialPage::getTitleFor( 'Block', $row->ipb_address ),
$msg['change-blocklink']
);
case 'ipb_params':
$properties = [];
if ( $row->ipb_anon_only ) {
- $properties[] = $msg['anononlyblock'];
+ $properties[] = htmlspecialchars( $msg['anononlyblock'] );
}
if ( $row->ipb_create_account ) {
- $properties[] = $msg['createaccountblock'];
+ $properties[] = htmlspecialchars( $msg['createaccountblock'] );
}
if ( $row->ipb_user && !$row->ipb_enable_autoblock ) {
- $properties[] = $msg['noautoblockblock'];
+ $properties[] = htmlspecialchars( $msg['noautoblockblock'] );
}
if ( $row->ipb_block_email ) {
- $properties[] = $msg['emailblock'];
+ $properties[] = htmlspecialchars( $msg['emailblock'] );
}
if ( !$row->ipb_allow_usertalk ) {
- $properties[] = $msg['blocklist-nousertalk'];
+ $properties[] = htmlspecialchars( $msg['blocklist-nousertalk'] );
}
$formatted = $language->commaList( $properties );
return $info;
}
+ /**
+ * Get total number of autoblocks at any given time
+ *
+ * @return int Total number of unexpired active autoblocks
+ */
+ function getTotalAutoblocks() {
+ $dbr = $this->getDatabase();
+ $res = $dbr->selectField( 'ipblocks',
+ [ 'COUNT(*) AS totalautoblocks' ],
+ [
+ 'ipb_auto' => '1',
+ 'ipb_expiry >= ' . $dbr->addQuotes( $dbr->timestamp() ),
+ ]
+ );
+ if ( $res ) {
+ return $res;
+ }
+ return 0; // We found nothing
+ }
+
protected function getTableClass() {
return parent::getTableClass() . ' mw-blocklist';
}