81 if ( $msg ===
null ) {
87 'blocklist-nousertalk',
91 'blocklist-editing-sitewide',
94 foreach (
$keys as $key ) {
95 $msg[$key] = $this->
msg( $key )->text();
109 case 'ipb_timestamp':
110 $formatted = htmlspecialchars( $language->userTimeAndDate( $value, $this->getUser() ) );
114 if ( $row->ipb_auto ) {
115 $formatted = $this->
msg(
'autoblockid', $row->ipb_id )->parse();
117 list( $target,
$type ) = DatabaseBlock::parseTarget( $row->ipb_address );
119 case DatabaseBlock::TYPE_USER:
120 case DatabaseBlock::TYPE_IP:
129 case DatabaseBlock::TYPE_RANGE:
130 $formatted = htmlspecialchars( $target );
136 $formatted = htmlspecialchars( $language->formatExpiry(
140 if ( MediaWikiServices::getInstance()
142 ->userHasRight( $this->
getUser(),
'block' )
145 if ( $row->ipb_auto ) {
147 SpecialPage::getTitleFor(
'Unblock' ),
150 [
'wpTarget' =>
"#{$row->ipb_id}" ]
154 SpecialPage::getTitleFor(
'Unblock', $row->ipb_address ),
158 SpecialPage::getTitleFor(
'Block', $row->ipb_address ),
159 $msg[
'change-blocklink']
162 $formatted .=
' ' . Html::rawElement(
164 [
'class' =>
'mw-blocklist-actions' ],
165 $this->
msg(
'parentheses' )->rawParams(
166 $language->pipeList( $links ) )->escaped()
169 if ( $value !==
'infinity' ) {
171 $formatted .=
'<br />' . $this->
msg(
172 'ipb-blocklist-duration-left',
173 $language->formatDuration(
174 $timestamp->getTimestamp() - MWTimestamp::time(),
188 if ( isset( $row->by_user_name ) ) {
192 $formatted = htmlspecialchars( $row->ipb_by_text );
197 $value = CommentStore::getStore()->getComment(
'ipb_reason', $row )->text;
204 if ( $this->
getConfig()->
get(
'EnablePartialBlocks' ) && $row->ipb_sitewide ) {
205 $properties[] = htmlspecialchars( $msg[
'blocklist-editing-sitewide'] );
208 if ( !$row->ipb_sitewide && $this->restrictions ) {
211 $properties[] = htmlspecialchars( $msg[
'blocklist-editing'] ) . $list;
215 if ( $row->ipb_anon_only ) {
216 $properties[] = htmlspecialchars( $msg[
'anononlyblock'] );
218 if ( $row->ipb_create_account ) {
219 $properties[] = htmlspecialchars( $msg[
'createaccountblock'] );
221 if ( $row->ipb_user && !$row->ipb_enable_autoblock ) {
222 $properties[] = htmlspecialchars( $msg[
'noautoblockblock'] );
225 if ( $row->ipb_block_email ) {
226 $properties[] = htmlspecialchars( $msg[
'emailblock'] );
229 if ( !$row->ipb_allow_usertalk ) {
230 $properties[] = htmlspecialchars( $msg[
'blocklist-nousertalk'] );
233 $formatted = Html::rawElement(
236 implode(
'', array_map(
function ( $prop ) {
237 return Html::rawElement(
247 $formatted =
"Unable to format $name";
265 foreach ( $this->restrictions as $restriction ) {
266 if ( $restriction->getBlockId() !== (
int)$row->ipb_id ) {
270 switch ( $restriction->getType() ) {
271 case PageRestriction::TYPE:
272 '@phan-var PageRestriction $restriction';
273 if ( $restriction->getTitle() ) {
274 $items[$restriction->getType()][] = Html::rawElement(
281 case NamespaceRestriction::TYPE:
282 $text = $restriction->getValue() ===
NS_MAIN
283 ? $this->
msg(
'blanknamespace' )->text()
285 $restriction->getValue()
287 $items[$restriction->getType()][] = Html::rawElement(
291 SpecialPage::getTitleValueFor(
'Allpages' ),
295 'namespace' => $restriction->getValue()
303 if ( empty( $items ) ) {
308 foreach ( $items as $key => $value ) {
309 $sets[] = Html::rawElement(
312 $this->
msg(
'blocklist-editing-' . $key ) . Html::rawElement(
315 implode(
'', $value )
320 return Html::rawElement(
415 # Do a link batch query
420 foreach ( $result as $row ) {
421 $lb->add(
NS_USER, $row->ipb_address );
424 if ( isset( $row->by_user_name ) ) {
425 $lb->add(
NS_USER, $row->by_user_name );
429 if ( !$row->ipb_sitewide ) {
430 $partialBlocks[] = $row->ipb_id;
434 if ( $partialBlocks ) {
437 $blockRestrictionStore = MediaWikiServices::getInstance()->getBlockRestrictionStore();
438 $this->restrictions = $blockRestrictionStore->loadByBlockId( $partialBlocks );