42 parent::__construct(
'BlockList' );
53 $out->setPageTitle( $this->
msg(
'ipblocklist' ) );
54 $out->addModuleStyles( [
'mediawiki.special' ] );
57 $par = $request->getVal(
'ip', $par ??
'' );
58 $this->target = trim( $request->getVal(
'wpTarget', $par ) );
60 $this->options = $request->getArray(
'wpOptions', [] );
61 $this->blockType = $request->getVal(
'blockType' );
63 $action = $request->getText(
'action' );
65 if ( $action ==
'unblock' || $action ==
'submit' && $request->wasPosted() ) {
66 # B/C @since 1.18: Unblock interface is now at Special:Unblock
68 $out->redirect(
$title->getFullURL() );
73 # setup BlockListPager here to get the actual default Limit
76 # Just show the block list
80 'label-message' =>
'ipaddressorusername',
86 'type' =>
'multiselect',
87 'options-messages' => [
88 'blocklist-tempblocks' =>
'tempblocks',
89 'blocklist-indefblocks' =>
'indefblocks',
90 'blocklist-userblocks' =>
'userblocks',
91 'blocklist-addressblocks' =>
'addressblocks',
92 'blocklist-rangeblocks' =>
'rangeblocks',
98 $fields[
'BlockType'] = [
100 'label-message' =>
'blocklist-type',
102 $this->
msg(
'blocklist-type-opt-all' )->escaped() =>
'',
103 $this->
msg(
'blocklist-type-opt-sitewide' )->escaped() =>
'sitewide',
104 $this->
msg(
'blocklist-type-opt-partial' )->escaped() =>
'partial',
106 'name' =>
'blockType',
107 'cssclass' =>
'mw-field-block-type',
111 'type' =>
'limitselect',
112 'label-message' =>
'table_pager_limit_label',
113 'options' => $pager->getLimitSelectList(),
115 'default' => $pager->getLimit(),
116 'cssclass' =>
'mw-field-limit mw-has-field-block-type',
121 $form = HTMLForm::factory(
'ooui', $fields, $context );
124 ->setFormIdentifier(
'blocklist' )
125 ->setWrapperLegendMsg(
'ipblocklist-legend' )
126 ->setSubmitTextMsg(
'ipblocklist-submit' )
128 ->displayForm(
false );
139 $db = $this->
getDB();
140 # Is the user allowed to see hidden blocks?
141 if ( !MediaWikiServices::getInstance()
143 ->userHasRight( $this->
getUser(),
'hideuser' )
145 $conds[
'ipb_deleted'] = 0;
148 if ( $this->target !==
'' ) {
149 list(
$target,
$type ) = DatabaseBlock::parseTarget( $this->target );
152 case DatabaseBlock::TYPE_ID:
153 case DatabaseBlock::TYPE_AUTO:
157 case DatabaseBlock::TYPE_IP:
158 case DatabaseBlock::TYPE_RANGE:
159 list( $start, $end ) = IPUtils::parseRange(
$target );
160 $conds[] = $db->makeList(
163 DatabaseBlock::getRangeCond( $start, $end )
167 $conds[
'ipb_auto'] = 0;
170 case DatabaseBlock::TYPE_USER:
171 $conds[
'ipb_address'] =
$target->getName();
172 $conds[
'ipb_auto'] = 0;
178 if ( in_array(
'userblocks', $this->options ) ) {
179 $conds[
'ipb_user'] = 0;
181 if ( in_array(
'addressblocks', $this->options ) ) {
182 $conds[] =
"ipb_user != 0 OR ipb_range_end > ipb_range_start";
184 if ( in_array(
'rangeblocks', $this->options ) ) {
185 $conds[] =
"ipb_range_end = ipb_range_start";
188 $hideTemp = in_array(
'tempblocks', $this->options );
189 $hideIndef = in_array(
'indefblocks', $this->options );
190 if ( $hideTemp && $hideIndef ) {
193 } elseif ( $hideTemp ) {
194 $conds[
'ipb_expiry'] = $db->getInfinity();
195 } elseif ( $hideIndef ) {
196 $conds[] =
"ipb_expiry != " . $db->addQuotes( $db->getInfinity() );
199 if ( $this->blockType ===
'sitewide' ) {
200 $conds[
'ipb_sitewide'] = 1;
201 } elseif ( $this->blockType ===
'partial' ) {
202 $conds[
'ipb_sitewide'] = 0;
215 # Check for other blocks, i.e. global/tor blocks
216 $otherBlockLink = [];
217 $this->
getHookRunner()->onOtherBlockLogLink( $otherBlockLink, $this->target );
219 # Show additional header for the local block only when other blocks exists.
220 # Not necessary in a standard installation without such extensions enabled
221 if ( count( $otherBlockLink ) ) {
223 Html::element(
'h2', [], $this->
msg(
'ipblocklist-localblock' )->text() ) .
"\n"
229 } elseif ( $this->target ) {
230 $out->addWikiMsg(
'ipblocklist-no-results' );
232 $out->addWikiMsg(
'ipblocklist-empty' );
235 if ( count( $otherBlockLink ) ) {
240 $this->
msg(
'ipblocklist-otherblocks', count( $otherBlockLink ) )->parse()
244 foreach ( $otherBlockLink as $link ) {
245 $list .= Html::rawElement(
'li', [], $link ) .
"\n";
247 $out->addHTML( Html::rawElement(
249 [
'class' =>
'mw-ipblocklist-otherblocks' ],
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
An IContextSource implementation which will inherit context from another source but allow individual ...
A special page that lists existing blocks.
getDB()
Return a IDatabase object for reading.
showList(BlockListPager $pager)
Show the list of blocked accounts matching the actual filter.
getBlockListPager()
Setup a new BlockListPager instance.
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
Parent class for all special pages.
outputHeader( $summaryMessageKey='')
Outputs a summary message on top of special pages Per default the message key is the canonical name o...
setHeaders()
Sets headers - this should be called from the execute() method of all derived classes!...
getOutput()
Get the OutputPage being used for this instance.
getUser()
Shortcut to get the User executing this instance.
static getTitleFor( $name, $subpage=false, $fragment='')
Get a localised Title object for a specified special page name If you don't need a full Title object,...
getContext()
Gets the context this SpecialPage is executed in.
msg( $key,... $params)
Wrapper around wfMessage that sets the current context.
getRequest()
Get the WebRequest being used for this instance.
getPageTitle( $subpage=false)
Get a self-referential title object.
addHelpLink( $to, $overrideBaseUrl=false)
Adds help link with an icon via page indicators.