Further massive rewrite of the blocking frontend: spin out unblocking into a new...
[lhc/web/wiklou.git] / includes / specials / SpecialBlock.php
1 <?php
2 /**
3 * Implements Special:Block
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * http://www.gnu.org/copyleft/gpl.html
19 *
20 * @file
21 * @ingroup SpecialPage
22 */
23
24 /**
25 * A special page that allows users with 'block' right to block users from
26 * editing pages and other actions
27 *
28 * @ingroup SpecialPage
29 */
30 class SpecialBlock extends SpecialPage {
31
32 /** The maximum number of edits a user can have and still be hidden
33 * TODO: config setting? */
34 const HIDEUSER_CONTRIBLIMIT = 1000;
35
36 /** @var User user to be blocked, as passed either by parameter (url?wpTarget=Foo)
37 * or as subpage (Special:Block/Foo) */
38 protected $target;
39
40 /// @var Block::TYPE_ constant
41 protected $type;
42
43 /// @var Bool
44 protected $alreadyBlocked;
45
46 public function __construct() {
47 parent::__construct( 'Block', 'block' );
48 }
49
50 public function execute( $par ) {
51 global $wgUser, $wgOut, $wgRequest;
52
53 # Can't block when the database is locked
54 if( wfReadOnly() ) {
55 $wgOut->readOnlyPage();
56 return;
57 }
58 # Permission check
59 if( !$this->userCanExecute( $wgUser ) ) {
60 $wgOut->permissionRequired( 'block' );
61 return;
62 }
63
64 # Extract variables from the request. Try not to get into a situation where we
65 # need to extract *every* variable from the form just for processing here, but
66 # there are legitimate uses for some variables
67 list( $this->target, $this->type ) = self::getTargetAndType( $par, $wgRequest );
68 if ( $this->target instanceof User ) {
69 # Set the 'relevant user' in the skin, so it displays links like Contributions,
70 # User logs, UserRights, etc.
71 $wgUser->getSkin()->setRelevantUser( $this->target );
72 }
73
74 # bug 15810: blocked admins should have limited access here
75 $status = self::checkUnblockSelf( $this->target );
76 if ( $status !== true ) {
77 throw new ErrorPageError( 'badaccess', $status );
78 }
79
80 $wgOut->setPageTitle( wfMsg( 'blockip-title' ) );
81 $wgOut->addModules( 'mediawiki.special', 'mediawiki.special.block' );
82
83 $fields = self::getFormFields();
84 $this->alreadyBlocked = $this->maybeAlterFormDefaults( $fields );
85
86 $form = new HTMLForm( $fields );
87 $form->setTitle( $this->getTitle() );
88 $form->setWrapperLegend( wfMsg( 'blockip-legend' ) );
89 $form->setSubmitCallback( array( __CLASS__, 'processForm' ) );
90
91 $t = $this->alreadyBlocked
92 ? wfMsg( 'ipb-change-block' )
93 : wfMsg( 'ipbsubmit' );
94 $form->setSubmitText( $t );
95
96 $this->doPreText( $form );
97 $this->doPostText( $form );
98
99 if( $form->show() ){
100 $wgOut->setPageTitle( wfMsg( 'blockipsuccesssub' ) );
101 $wgOut->addWikiMsg( 'blockipsuccesstext', $this->target );
102 }
103 }
104
105 /**
106 * Get the HTMLForm descriptor array for the block form
107 * @return Array
108 */
109 protected static function getFormFields(){
110 global $wgUser, $wgBlockAllowsUTEdit;
111
112 $a = array(
113 'Target' => array(
114 'type' => 'text',
115 'label-message' => 'ipadressorusername',
116 'tabindex' => '1',
117 'id' => 'mw-bi-target',
118 'size' => '45',
119 'required' => true,
120 'validation-callback' => array( __CLASS__, 'validateTargetField' ),
121 ),
122 'Expiry' => array(
123 'type' => 'selectorother',
124 'label-message' => 'ipbexpiry',
125 'required' => true,
126 'tabindex' => '2',
127 'options' => self::getSuggestedDurations(),
128 'other' => wfMsg( 'ipbother' ),
129 ),
130 'Reason' => array(
131 'type' => 'selectandother',
132 'label-message' => 'ipbreason',
133 'options-message' => 'ipbreason-dropdown',
134 ),
135 'CreateAccount' => array(
136 'type' => 'check',
137 'label-message' => 'ipbcreateaccount',
138 'default' => true,
139 ),
140 );
141
142 if( wfMsgForContent( 'ipboptions' ) == '-' ){
143 $a['Expiry']['type'] = 'text';
144 }
145
146 if( self::canBlockEmail( $wgUser ) ) {
147 $a['DisableEmail'] = array(
148 'type' => 'check',
149 'label-message' => 'ipbemailban',
150 );
151 }
152
153 if( $wgBlockAllowsUTEdit ){
154 $a['DisableUTEdit'] = array(
155 'type' => 'check',
156 'label-message' => 'ipb-disableusertalk',
157 'default' => false,
158 );
159 }
160
161 $a['AutoBlock'] = array(
162 'type' => 'check',
163 'label-message' => 'ipbenableautoblock',
164 'default' => true,
165 );
166
167 # Allow some users to hide name from block log, blocklist and listusers
168 if( $wgUser->isAllowed( 'hideuser' ) ) {
169 $a['HideUser'] = array(
170 'type' => 'check',
171 'label-message' => 'ipbhidename',
172 'cssclass' => 'mw-block-hideuser',
173 );
174 }
175
176 # Watchlist their user page? (Only if user is logged in)
177 if( $wgUser->isLoggedIn() ) {
178 $a['Watch'] = array(
179 'type' => 'check',
180 'label-message' => 'ipbwatchuser',
181 );
182 }
183
184 $a['HardBlock'] = array(
185 'type' => 'check',
186 'label-message' => 'ipb-hardblock',
187 'default' => false,
188 );
189
190 $a['AlreadyBlocked'] = array(
191 'type' => 'hidden',
192 'default' => false,
193 );
194
195 return $a;
196 }
197
198 /**
199 * If the user has already been blocked with similar settings, load that block
200 * and change the defaults for the form fields to match the existing settings.
201 * @param &$fields Array HTMLForm descriptor array
202 * @return Bool whether fields were altered (that is, whether the target is
203 * already blocked)
204 */
205 protected function maybeAlterFormDefaults( &$fields ){
206 $fields['Target']['default'] = (string)$this->target;
207
208 $block = Block::newFromTargetAndType( $this->target, $this->type );
209
210 if( $block instanceof Block && !$block->mAuto # The block exists and isn't an autoblock
211 && ( $this->type != Block::TYPE_RANGE # The block isn't a rangeblock
212 || $block->mAddress == $this->target ) # or if it is, the range is what we're about to block
213 )
214 {
215 $fields['HardBlock']['default'] = !$block->mAnonOnly;
216 $fields['CreateAccount']['default'] = $block->mCreateAccount;
217 $fields['AutoBlock']['default'] = $block->mEnableAutoblock;
218 $fields['DisableEmail']['default'] = $block->mBlockEmail;
219 $fields['HideUser']['default'] = $block->mHideName;
220 $fields['DisableUTEdit']['default'] = !$block->mAllowUsertalk;
221 $fields['Reason']['default'] = $block->mReason;
222 $fields['AlreadyBlocked']['default'] = true;
223
224 if( $block->mExpiry == 'infinity' ) {
225 $fields['Expiry']['default'] = 'indefinite';
226 } else {
227 $fields['Expiry']['default'] = wfTimestamp( TS_RFC2822, $block->mExpiry );
228 }
229
230 return true;
231 }
232 return false;
233 }
234
235 /**
236 * Add header elements like block log entries, etc.
237 * @param $form HTMLForm
238 * @return void
239 */
240 protected function doPreText( HTMLForm &$form ){
241 $form->addPreText( wfMsgExt( 'blockiptext', 'parse' ) );
242
243 $otherBlockMessages = array();
244 if( $this->target !== null ) {
245 # Get other blocks, i.e. from GlobalBlocking or TorBlock extension
246 wfRunHooks( 'OtherBlockLogLink', array( &$otherBlockMessages, $this->target ) );
247
248 if( count( $otherBlockMessages ) ) {
249 $s = Html::rawElement(
250 'h2',
251 array(),
252 wfMsgExt( 'ipb-otherblocks-header', 'parseinline', count( $otherBlockMessages ) )
253 ) . "\n";
254 $list = '';
255 foreach( $otherBlockMessages as $link ) {
256 $list .= Html::rawElement( 'li', array(), $link ) . "\n";
257 }
258 $s .= Html::rawElement(
259 'ul',
260 array( 'class' => 'mw-blockip-alreadyblocked' ),
261 $list
262 ) . "\n";
263 $form->addPreText( $s );
264 }
265 }
266
267 # Username/IP is blocked already locally
268 if( $this->alreadyBlocked ) {
269 $form->addPreText( Html::rawElement(
270 'div',
271 array( 'class' => 'mw-ipb-needreblock', ),
272 wfMsgExt(
273 'ipb-needreblock',
274 array( 'parseinline' ),
275 $this->target
276 ) ) );
277 }
278 }
279
280 /**
281 * Add footer elements to the form
282 * @param $form HTMLForm
283 * @return void
284 */
285 protected function doPostText( HTMLForm &$form ){
286 global $wgUser, $wgLang;
287
288 $skin = $wgUser->getSkin();
289
290 # Link to the user's contributions, if applicable
291 if( $this->target instanceof User ){
292 $contribsPage = SpecialPage::getTitleFor( 'Contributions', $this->target->getName() );
293 $links[] = $skin->link(
294 $contribsPage,
295 wfMsgExt( 'ipb-blocklist-contribs', 'escape', $this->target->getName() )
296 );
297 }
298
299 # Link to unblock the specified user, or to a blank unblock form
300 if( $this->target instanceof User ) {
301 $message = wfMsgExt( 'ipb-unblock-addr', array( 'parseinline' ), $this->target->getName() );
302 $list = SpecialPage::getTitleFor( 'Unblock', $this->target->getName() );
303 } else {
304 $message = wfMsgExt( 'ipb-unblock', array( 'parseinline' ) );
305 $list = SpecialPage::getTitleFor( 'Unblock' );
306 }
307 $links[] = $skin->linkKnown( $list, $message, array() );
308
309 # Link to the block list
310 $links[] = $skin->linkKnown(
311 SpecialPage::getTitleFor( 'Ipblocklist' ),
312 wfMsg( 'ipb-blocklist' )
313 );
314
315 # Link to edit the block dropdown reasons, if applicable
316 if ( $wgUser->isAllowed( 'editinterface' ) ) {
317 $links[] = $skin->link(
318 Title::makeTitle( NS_MEDIAWIKI, 'Ipbreason-dropdown' ),
319 wfMsgHtml( 'ipb-edit-dropdown' ),
320 array(),
321 array( 'action' => 'edit' )
322 );
323 }
324
325 $form->addPostText( Html::rawElement(
326 'p',
327 array( 'class' => 'mw-ipb-conveniencelinks' ),
328 $wgLang->pipeList( $links )
329 ) );
330
331 if( $this->target instanceof User ){
332 # Get relevant extracts from the block and suppression logs, if possible
333 $userpage = $this->target->getUserPage();
334 $out = '';
335
336 LogEventsList::showLogExtract(
337 $out,
338 'block',
339 $userpage->getPrefixedText(),
340 '',
341 array(
342 'lim' => 10,
343 'msgKey' => array( 'blocklog-showlog', $userpage->getText() ),
344 'showIfEmpty' => false
345 )
346 );
347 $form->addPostText( $out );
348
349 # Add suppression block entries if allowed
350 if( $wgUser->isAllowed( 'suppressionlog' ) ) {
351 LogEventsList::showLogExtract(
352 $out,
353 'suppress',
354 $userpage->getPrefixedText(),
355 '',
356 array(
357 'lim' => 10,
358 'conds' => array( 'log_action' => array( 'block', 'reblock', 'unblock' ) ),
359 'msgKey' => array( 'blocklog-showsuppresslog', $userpage->getText() ),
360 'showIfEmpty' => false
361 )
362 );
363 $form->addPostText( $out );
364 }
365 }
366 }
367
368 /**
369 * Determine the target of the block, and the type of target
370 * TODO: should be in Block.php?
371 * @param $par String subpage parameter passed to setup, or data value from
372 * the HTMLForm
373 * @param $request WebRequest optionally try and get data from a request too
374 * @return void
375 */
376 public static function getTargetAndType( $par, WebRequest $request = null ){
377 $i = 0;
378 $target = null;
379 while( true ){
380 switch( $i++ ){
381 case 0:
382 # The HTMLForm will check wpTarget first and only if it doesn't get
383 # a value use the default, which will be generated from the options
384 # below; so this has to have a higher precedence here than $par, or
385 # we could end up with different values in $this->target and the HTMLForm!
386 if( $request instanceof WebRequest ){
387 $target = $request->getText( 'wpTarget', null );
388 }
389 break;
390 case 1:
391 $target = $par;
392 break;
393 case 2:
394 if( $request instanceof WebRequest ){
395 $target = $request->getText( 'ip', null );
396 }
397 break;
398 case 3:
399 # B/C @since 1.18
400 if( $request instanceof WebRequest ){
401 $target = $request->getText( 'wpBlockAddress', null );
402 }
403 break;
404 case 4:
405 break 2;
406 }
407 list( $target, $type ) = Block::parseTarget( $target );
408 if( $type !== null ){
409 return array( $target, $type );
410 }
411 }
412 return array( null, null );
413 }
414
415 /**
416 * HTMLForm field validation-callback for Target field.
417 * @since 1.18
418 * @return Message
419 */
420 public static function validateTargetField( $value, $alldata = null ) {
421 global $wgBlockCIDRLimit;
422
423 list( $target, $type ) = self::getTargetAndType( $value );
424
425 if( $type == Block::TYPE_USER ){
426 # TODO: why do we not have a User->exists() method?
427 if( !$target->getId() ){
428 return wfMessage( 'nosuchusershort', $target->getName() );
429 }
430
431 $status = self::checkUnblockSelf( $target );
432 if ( $status !== true ) {
433 return wfMessage( 'badaccess', $status );
434 }
435
436 } elseif( $type == Block::TYPE_RANGE ){
437 list( $ip, $range ) = explode( '/', $target, 2 );
438
439 if( ( IP::isIPv4( $ip ) && $wgBlockCIDRLimit['IPv4'] == 32 )
440 || ( IP::isIPv6( $ip ) && $wgBlockCIDRLimit['IPV6'] == 128 ) )
441 {
442 # Range block effectively disabled
443 return wfMessage( 'range_block_disabled' );
444 }
445
446 if( ( IP::isIPv4( $ip ) && $range > 32 )
447 || ( IP::isIPv6( $ip ) && $range > 128 ) )
448 {
449 # Dodgy range
450 return wfMessage( 'ip_range_invalid' );
451 }
452
453 if( IP::isIPv4( $ip ) && $range < $wgBlockCIDRLimit['IPv4'] ) {
454 return wfMessage( 'ip_range_toolarge', $wgBlockCIDRLimit['IPv4'] );
455 }
456
457 if( IP::isIPv6( $ip ) && $range < $wgBlockCIDRLimit['IPv6'] ) {
458 return wfMessage( 'ip_range_toolarge', $wgBlockCIDRLimit['IPv6'] );
459 }
460
461 } elseif( $type == Block::TYPE_IP ){
462 # All is well
463
464 } else {
465 return wfMessage( 'badipaddress' );
466 }
467
468 return true;
469 }
470
471 /**
472 * Given the form data, actually implement a block
473 * @param $data Array
474 * @return Bool|String
475 */
476 public static function processForm( array $data ){
477 global $wgUser, $wgBlockAllowsUTEdit;
478
479 // Handled by field validator callback
480 // self::validateTargetField( $data['Target'] );
481
482 list( $target, $type ) = self::getTargetAndType( $data['Target'] );
483 if( $type == Block::TYPE_USER ){
484 $user = $target;
485 $target = $user->getName();
486 $userId = $user->getId();
487 } elseif( $type == Block::TYPE_RANGE ){
488 $userId = 0;
489 } elseif( $type == Block::TYPE_IP ){
490 $target = $target->getName();
491 $userId = 0;
492 } else {
493 # This should have been caught in the form field validation
494 return array( 'badipaddress' );
495 }
496
497 if( ( strlen( $data['Expiry'] ) == 0) || ( strlen( $data['Expiry'] ) > 50 )
498 || !Block::parseExpiryInput( $data['Expiry'] ) )
499 {
500 return array( 'ipb_expiry_invalid' );
501 }
502
503 if( !$wgBlockAllowsUTEdit ){
504 $data['PreventUTEdit'] = true;
505 }
506
507 # If the user has done the form 'properly', they won't even have been given the
508 # option to suppress-block unless they have the 'hideuser' permission
509 if( !isset( $data['HideUser'] ) ){
510 $data['HideUser'] = false;
511 }
512 if( $data['HideUser'] ) {
513 if( !$wgUser->isAllowed('hideuser') ){
514 # this codepath is unreachable except by a malicious user spoofing forms,
515 # or by race conditions (user has oversight and sysop, loads block form,
516 # and is de-oversighted before submission); so need to fail completely
517 # rather than just silently disable hiding
518 return array( 'badaccess-group0' );
519 }
520
521 # Recheck params here...
522 if( $type != Block::TYPE_USER ) {
523 $data['HideUser'] = false; # IP users should not be hidden
524
525 } elseif( !in_array( $data['Expiry'], array( 'inifinite', 'infinity', 'indefinite' ) ) ) {
526 # Bad expiry.
527 return array( 'ipb_expiry_temp' );
528
529 } elseif( $user->getEditCount() > self::HIDEUSER_CONTRIBLIMIT ) {
530 # Typically, the user should have a handful of edits.
531 # Disallow hiding users with many edits for performance.
532 return array( 'ipb_hide_invalid' );
533 }
534 }
535
536 # Create block object. Note that for a user block, ipb_address is only for display purposes
537 # FIXME: Why do we need to pass fourteen optional parameters to do this!?!
538 $block = new Block(
539 $target, # IP address or User name
540 $userId, # User id
541 $wgUser->getId(), # Blocker id
542 $data['Reason'][0], # Reason string
543 wfTimestampNow(), # Block Timestamp
544 0, # Is this an autoblock (no)
545 Block::parseExpiryInput( $data['Expiry'] ), # Expiry time
546 !$data['HardBlock'], # Block anon only
547 $data['CreateAccount'],
548 $data['AutoBlock'],
549 $data['HideUser'],
550 $data['DisableEmail'],
551 !$data['DisableUTEdit'] # *Allow* UTEdit
552 );
553
554 if( !wfRunHooks( 'BlockIp', array( &$block, &$wgUser ) ) ) {
555 return array( 'hookaborted' );
556 }
557
558 # Try to insert block. Is there a conflicting block?
559 if( !$block->insert() ) {
560
561 # Show form unless the user is already aware of this...
562 if( !$data['AlreadyBlocked'] ) {
563 return array( array( 'ipb_already_blocked', $data['Target'] ) );
564
565 # Otherwise, try to update the block...
566 } else {
567
568 # This returns direct blocks before autoblocks/rangeblocks, since we should
569 # be sure the user is blocked by now it should work for our purposes
570 $currentBlock = Block::newFromDB( $target, $userId );
571
572 if( $block->equals( $currentBlock ) ) {
573 return array( 'ipb_already_blocked' );
574 }
575
576 # If the name was hidden and the blocking user cannot hide
577 # names, then don't allow any block changes...
578 if( $currentBlock->mHideName && !$wgUser->isAllowed( 'hideuser' ) ) {
579 return array( 'cant-see-hidden-user' );
580 }
581
582 $currentBlock->delete();
583 $block->insert();
584 $logaction = 'reblock';
585
586 # Unset _deleted fields if requested
587 if( $currentBlock->mHideName && !$data['HideUser'] ) {
588 RevisionDeleteUser::unsuppressUserName( $target, $userId );
589 }
590
591 # If hiding/unhiding a name, this should go in the private logs
592 if( (bool)$currentBlock->mHideName ){
593 $data['HideUser'] = true;
594 }
595 }
596
597 } else {
598 $logaction = 'block';
599 }
600
601 wfRunHooks( 'BlockIpComplete', array( $block, $wgUser ) );
602
603 # Set *_deleted fields if requested
604 if( $data['HideUser'] ) {
605 RevisionDeleteUser::suppressUserName( $target, $userId );
606 }
607
608 # Can't watch a rangeblock
609 if( $type != Block::TYPE_RANGE && $data['Watch'] ) {
610 $wgUser->addWatch( Title::makeTitle( NS_USER, $target ) );
611 }
612
613 # Block constructor sanitizes certain block options on insert
614 $data['BlockEmail'] = $block->mBlockEmail;
615 $data['AutoBlock'] = $block->mEnableAutoblock;
616
617 # Prepare log parameters
618 $logParams = array();
619 $logParams[] = $data['Expiry'];
620 $logParams[] = self::blockLogFlags( $data, $type );
621
622 # Make log entry, if the name is hidden, put it in the oversight log
623 $log_type = $data['HideUser'] ? 'suppress' : 'block';
624 $log = new LogPage( $log_type );
625 $log->addEntry(
626 $logaction,
627 Title::makeTitle( NS_USER, $target ),
628 $data['Reason'][0],
629 $logParams
630 );
631
632 # Report to the user
633 return true;
634 }
635
636 /**
637 * Get an array of suggested block durations from MediaWiki:Ipboptions
638 * FIXME: this uses a rather odd syntax for the options, should it be converted
639 * to the standard "**<duration>|<displayname>" format?
640 * @return Array
641 */
642 protected static function getSuggestedDurations(){
643 $a = array();
644 foreach( explode( ',', wfMsgForContent( 'ipboptions' ) ) as $option ) {
645 if( strpos( $option, ':' ) === false ) $option = "$option:$option";
646 list( $show, $value ) = explode( ':', $option );
647 $a[htmlspecialchars( $show )] = htmlspecialchars( $value );
648 }
649 return $a;
650 }
651
652 /**
653 * Can we do an email block?
654 * @param $user User: the sysop wanting to make a block
655 * @return Boolean
656 */
657 public static function canBlockEmail( $user ) {
658 global $wgEnableUserEmail, $wgSysopEmailBans;
659 return ( $wgEnableUserEmail && $wgSysopEmailBans && $user->isAllowed( 'blockemail' ) );
660 }
661
662 /**
663 * bug 15810: blocked admins should not be able to block/unblock
664 * others, and probably shouldn't be able to unblock themselves
665 * either.
666 * @param $user User|Int|String
667 */
668 public static function checkUnblockSelf( $user ) {
669 global $wgUser;
670 if ( is_int( $user ) ) {
671 $user = User::newFromId( $user );
672 } elseif ( is_string( $user ) ) {
673 $user = User::newFromName( $user );
674 }
675 if( $wgUser->isBlocked() ){
676 if( $user instanceof User && $user->getId() == $wgUser->getId() ) {
677 # User is trying to unblock themselves
678 if ( $wgUser->isAllowed( 'unblockself' ) ) {
679 return true;
680 } else {
681 return 'ipbnounblockself';
682 }
683 } else {
684 # User is trying to block/unblock someone else
685 return 'ipbblocked';
686 }
687 } else {
688 return true;
689 }
690 }
691
692 /**
693 * Return a comma-delimited list of "flags" to be passed to the log
694 * reader for this block, to provide more information in the logs
695 * @param $data Array from HTMLForm data
696 * @param $type Block::TYPE_ constant
697 * @return array
698 */
699 protected static function blockLogFlags( array $data, $type ) {
700 global $wgBlockAllowsUTEdit;
701 $flags = array();
702
703 # when blocking a user the option 'anononly' is not available/has no effect -> do not write this into log
704 if( !$data['HardBlock'] && $type != Block::TYPE_USER ){
705 $flags[] = 'anononly';
706 }
707
708 if( $data['CreateAccount'] ){
709 $flags[] = 'nocreate';
710 }
711
712 # Same as anononly, this is not displayed when blocking an IP address
713 if( !$data['AutoBlock'] && $type != Block::TYPE_IP ){
714 $flags[] = 'noautoblock';
715 }
716
717 if( $data['DisableEmail'] ){
718 $flags[] = 'noemail';
719 }
720
721 if( $data['DisableUTEdit'] && $wgBlockAllowsUTEdit ){
722 $flags[] = 'nousertalk';
723 }
724
725 if( $data['HideUser'] ){
726 $flags[] = 'hiddenname';
727 }
728
729 return implode( ',', $flags );
730 }
731 }
732
733 # BC @since 1.18
734 class IPBlockForm extends SpecialBlock {}