Some refactoring in Block.php and SpecialBlock.php: move backend stuff into Block...
[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 $list = SpecialPage::getTitleFor( 'Ipblocklist' );
301 $query = array( 'action' => 'unblock' );
302 if( $this->target instanceof User ) {
303 $message = wfMsgExt( 'ipb-unblock-addr', array( 'parseinline' ), $this->target->getName() );
304 $query['ip'] = $this->target->getName();
305 } else {
306 $message = wfMsgExt( 'ipb-unblock', array( 'parseinline' ) );
307 }
308 $links[] = $skin->linkKnown( $list, $message, array(), $query );
309
310 # Link to the block list
311 $links[] = $skin->linkKnown(
312 SpecialPage::getTitleFor( 'Ipblocklist' ),
313 wfMsg( 'ipb-blocklist' )
314 );
315
316 # Link to edit the block dropdown reasons, if applicable
317 if ( $wgUser->isAllowed( 'editinterface' ) ) {
318 $links[] = $skin->link(
319 Title::makeTitle( NS_MEDIAWIKI, 'Ipbreason-dropdown' ),
320 wfMsgHtml( 'ipb-edit-dropdown' ),
321 array(),
322 array( 'action' => 'edit' )
323 );
324 }
325
326 $form->addPostText( Html::rawElement(
327 'p',
328 array( 'class' => 'mw-ipb-conveniencelinks' ),
329 $wgLang->pipeList( $links )
330 ) );
331
332 if( $this->target instanceof User ){
333 # Get relevant extracts from the block and suppression logs, if possible
334 $userpage = $this->target->getUserPage();
335 $out = '';
336
337 LogEventsList::showLogExtract(
338 $out,
339 'block',
340 $userpage->getPrefixedText(),
341 '',
342 array(
343 'lim' => 10,
344 'msgKey' => array( 'blocklog-showlog', $userpage->getText() ),
345 'showIfEmpty' => false
346 )
347 );
348 $form->addPostText( $out );
349
350 # Add suppression block entries if allowed
351 if( $wgUser->isAllowed( 'suppressionlog' ) ) {
352 LogEventsList::showLogExtract(
353 $out,
354 'suppress',
355 $userpage->getPrefixedText(),
356 '',
357 array(
358 'lim' => 10,
359 'conds' => array( 'log_action' => array( 'block', 'reblock', 'unblock' ) ),
360 'msgKey' => array( 'blocklog-showsuppresslog', $userpage->getText() ),
361 'showIfEmpty' => false
362 )
363 );
364 $form->addPostText( $out );
365 }
366 }
367 }
368
369 /**
370 * Determine the target of the block, and the type of target
371 * TODO: should be in Block.php?
372 * @param $par String subpage parameter passed to setup, or data value from
373 * the HTMLForm
374 * @param $request WebRequest optionally try and get data from a request too
375 * @return void
376 */
377 public static function getTargetAndType( $par, WebRequest $request = null ){
378 $i = 0;
379 $target = null;
380 while( true ){
381 switch( $i++ ){
382 case 0:
383 # The HTMLForm will check wpTarget first and only if it doesn't get
384 # a value use the default, which will be generated from the options
385 # below; so this has to have a higher precedence here than $par, or
386 # we could end up with different values in $this->target and the HTMLForm!
387 if( $request instanceof WebRequest ){
388 $target = $request->getText( 'wpTarget', null );
389 }
390 break;
391 case 1:
392 $target = $par;
393 break;
394 case 2:
395 if( $request instanceof WebRequest ){
396 $target = $request->getText( 'ip', null );
397 }
398 break;
399 case 3:
400 # B/C @since 1.18
401 if( $request instanceof WebRequest ){
402 $target = $request->getText( 'wpBlockAddress', null );
403 }
404 break;
405 case 4:
406 break 2;
407 }
408 list( $target, $type ) = Block::parseTarget( $target );
409 if( $type !== null ){
410 return array( $target, $type );
411 }
412 }
413 return array( null, null );
414 }
415
416 /**
417 * HTMLForm field validation-callback for Target field.
418 * @since 1.18
419 * @return Message
420 */
421 public static function validateTargetField( $value, $alldata = null ) {
422 global $wgBlockCIDRLimit;
423
424 list( $target, $type ) = self::getTargetAndType( $value );
425
426 if( $type == Block::TYPE_USER ){
427 # TODO: why do we not have a User->exists() method?
428 if( !$target->getId() ){
429 return wfMessage( 'nosuchusershort', $target->getName() );
430 }
431
432 $status = self::checkUnblockSelf( $target );
433 if ( $status !== true ) {
434 return wfMessage( 'badaccess', $status );
435 }
436
437 } elseif( $type == Block::TYPE_RANGE ){
438 list( $ip, $range ) = explode( '/', $target, 2 );
439
440 if( ( IP::isIPv4( $ip ) && $wgBlockCIDRLimit['IPv4'] == 32 )
441 || ( IP::isIPv6( $ip ) && $wgBlockCIDRLimit['IPV6'] == 128 ) )
442 {
443 # Range block effectively disabled
444 return wfMessage( 'range_block_disabled' );
445 }
446
447 if( ( IP::isIPv4( $ip ) && $range > 32 )
448 || ( IP::isIPv6( $ip ) && $range > 128 ) )
449 {
450 # Dodgy range
451 return wfMessage( 'ip_range_invalid' );
452 }
453
454 if( IP::isIPv4( $ip ) && $range < $wgBlockCIDRLimit['IPv4'] ) {
455 return wfMessage( 'ip_range_toolarge', $wgBlockCIDRLimit['IPv4'] );
456 }
457
458 if( IP::isIPv6( $ip ) && $range < $wgBlockCIDRLimit['IPv6'] ) {
459 return wfMessage( 'ip_range_toolarge', $wgBlockCIDRLimit['IPv6'] );
460 }
461
462 } elseif( $type == Block::TYPE_IP ){
463 # All is well
464
465 } else {
466 return wfMessage( 'badipaddress' );
467 }
468
469 return true;
470 }
471
472 /**
473 * Given the form data, actually implement a block
474 * @param $data Array
475 * @return Bool|String
476 */
477 public static function processForm( array $data ){
478 global $wgUser, $wgBlockAllowsUTEdit;
479
480 // Handled by field validator callback
481 // self::validateTargetField( $data['Target'] );
482
483 list( $target, $type ) = self::getTargetAndType( $data['Target'] );
484 if( $type == Block::TYPE_USER ){
485 $user = $target;
486 $target = $user->getName();
487 $userId = $user->getId();
488 } elseif( $type == Block::TYPE_RANGE ){
489 $userId = 0;
490 } elseif( $type == Block::TYPE_IP ){
491 $target = $target->getName();
492 $userId = 0;
493 } else {
494 # This should have been caught in the form field validation
495 return wfMessage( 'badipaddress' );
496 }
497
498 if( ( strlen( $data['Expiry'] ) == 0) || ( strlen( $data['Expiry'] ) > 50 )
499 || !Block::parseExpiryInput( $data['Expiry'] ) )
500 {
501 return array( 'ipb_expiry_invalid' );
502 }
503
504 if( !$wgBlockAllowsUTEdit ){
505 $data['PreventUTEdit'] = true;
506 }
507
508 # If the user has done the form 'properly', they won't even have been given the
509 # option to suppress-block unless they have the 'hideuser' permission
510 if( !isset( $data['HideUser'] ) ){
511 $data['HideUser'] = false;
512 }
513 if( $data['HideUser'] ) {
514 if( !$wgUser->isAllowed('hideuser') ){
515 # this codepath is unreachable except by a malicious user spoofing forms,
516 # or by race conditions (user has oversight and sysop, loads block form,
517 # and is de-oversighted before submission); so need to fail completely
518 # rather than just silently disable hiding
519 return array( 'badaccess-group0' );
520 }
521
522 # Recheck params here...
523 if( $type != Block::TYPE_USER ) {
524 $data['HideUser'] = false; # IP users should not be hidden
525
526 } elseif( !in_array( $data['Expiry'], array( 'inifinite', 'infinity', 'indefinite' ) ) ) {
527 # Bad expiry.
528 return array( 'ipb_expiry_temp' );
529
530 } elseif( $user->getEditCount() > self::HIDEUSER_CONTRIBLIMIT ) {
531 # Typically, the user should have a handful of edits.
532 # Disallow hiding users with many edits for performance.
533 return array( 'ipb_hide_invalid' );
534 }
535 }
536
537 # Create block object. Note that for a user block, ipb_address is only for display purposes
538 # FIXME: Why do we need to pass fourteen optional parameters to do this!?!
539 $block = new Block(
540 $target, # IP address or User name
541 $userId, # User id
542 $wgUser->getId(), # Blocker id
543 $data['Reason'][0], # Reason string
544 wfTimestampNow(), # Block Timestamp
545 0, # Is this an autoblock (no)
546 Block::parseExpiryInput( $data['Expiry'] ), # Expiry time
547 !$data['HardBlock'], # Block anon only
548 $data['CreateAccount'],
549 $data['AutoBlock'],
550 $data['HideUser'],
551 $data['DisableEmail'],
552 !$data['DisableUTEdit'] # *Allow* UTEdit
553 );
554
555 if( !wfRunHooks( 'BlockIp', array( &$block, &$wgUser ) ) ) {
556 return array( 'hookaborted' );
557 }
558
559 # Try to insert block. Is there a conflicting block?
560 if( !$block->insert() ) {
561
562 # Show form unless the user is already aware of this...
563 if( !$data['AlreadyBlocked'] ) {
564 return array( array( 'ipb_already_blocked', $data['Target'] ) );
565
566 # Otherwise, try to update the block...
567 } else {
568
569 # This returns direct blocks before autoblocks/rangeblocks, since we should
570 # be sure the user is blocked by now it should work for our purposes
571 $currentBlock = Block::newFromDB( $target, $userId );
572
573 if( $block->equals( $currentBlock ) ) {
574 return array( 'ipb_already_blocked' );
575 }
576
577 # If the name was hidden and the blocking user cannot hide
578 # names, then don't allow any block changes...
579 if( $currentBlock->mHideName && !$wgUser->isAllowed( 'hideuser' ) ) {
580 return array( 'cant-see-hidden-user' );
581 }
582
583 $currentBlock->delete();
584 $block->insert();
585 $logaction = 'reblock';
586
587 # Unset _deleted fields if requested
588 if( $currentBlock->mHideName && !$data['HideUser'] ) {
589 RevisionDeleteUser::unsuppressUserName( $target, $userId );
590 }
591
592 # If hiding/unhiding a name, this should go in the private logs
593 if( (bool)$currentBlock->mHideName ){
594 $data['HideUser'] = true;
595 }
596 }
597
598 } else {
599 $logaction = 'block';
600 }
601
602 wfRunHooks( 'BlockIpComplete', array( $block, $wgUser ) );
603
604 # Set *_deleted fields if requested
605 if( $data['HideUser'] ) {
606 RevisionDeleteUser::suppressUserName( $target, $userId );
607 }
608
609 # Can't watch a rangeblock
610 if( $type != Block::TYPE_RANGE && $data['Watch'] ) {
611 $wgUser->addWatch( Title::makeTitle( NS_USER, $target ) );
612 }
613
614 # Block constructor sanitizes certain block options on insert
615 $data['BlockEmail'] = $block->mBlockEmail;
616 $data['AutoBlock'] = $block->mEnableAutoblock;
617
618 # Prepare log parameters
619 $logParams = array();
620 $logParams[] = $data['Expiry'];
621 $logParams[] = self::blockLogFlags( $data, $type );
622
623 # Make log entry, if the name is hidden, put it in the oversight log
624 $log_type = $data['HideUser'] ? 'suppress' : 'block';
625 $log = new LogPage( $log_type );
626 $log->addEntry(
627 $logaction,
628 Title::makeTitle( NS_USER, $target ),
629 $data['Reason'][0],
630 $logParams
631 );
632
633 # Report to the user
634 return true;
635 }
636
637 /**
638 * Get an array of suggested block durations from MediaWiki:Ipboptions
639 * FIXME: this uses a rather odd syntax for the options, should it be converted
640 * to the standard "**<duration>|<displayname>" format?
641 * @return Array
642 */
643 protected static function getSuggestedDurations(){
644 $a = array();
645 foreach( explode( ',', wfMsgForContent( 'ipboptions' ) ) as $option ) {
646 if( strpos( $option, ':' ) === false ) $option = "$option:$option";
647 list( $show, $value ) = explode( ':', $option );
648 $a[htmlspecialchars( $show )] = htmlspecialchars( $value );
649 }
650 return $a;
651 }
652
653 /**
654 * Can we do an email block?
655 * @param $user User: the sysop wanting to make a block
656 * @return Boolean
657 */
658 public static function canBlockEmail( $user ) {
659 global $wgEnableUserEmail, $wgSysopEmailBans;
660 return ( $wgEnableUserEmail && $wgSysopEmailBans && $user->isAllowed( 'blockemail' ) );
661 }
662
663 /**
664 * bug 15810: blocked admins should not be able to block/unblock
665 * others, and probably shouldn't be able to unblock themselves
666 * either.
667 * @param $user User|Int|String
668 */
669 public static function checkUnblockSelf( $user ) {
670 global $wgUser;
671 if ( is_int( $user ) ) {
672 $user = User::newFromId( $user );
673 } elseif ( is_string( $user ) ) {
674 $user = User::newFromName( $user );
675 }
676 if( $wgUser->isBlocked() ){
677 if( $user instanceof User && $user->getId() == $wgUser->getId() ) {
678 # User is trying to unblock themselves
679 if ( $wgUser->isAllowed( 'unblockself' ) ) {
680 return true;
681 } else {
682 return 'ipbnounblockself';
683 }
684 } else {
685 # User is trying to block/unblock someone else
686 return 'ipbblocked';
687 }
688 } else {
689 return true;
690 }
691 }
692
693 /**
694 * Return a comma-delimited list of "flags" to be passed to the log
695 * reader for this block, to provide more information in the logs
696 * @param $data Array from HTMLForm data
697 * @param $type Block::TYPE_ constant
698 * @return array
699 */
700 protected static function blockLogFlags( array $data, $type ) {
701 global $wgBlockAllowsUTEdit;
702 $flags = array();
703
704 # when blocking a user the option 'anononly' is not available/has no effect -> do not write this into log
705 if( !$data['HardBlock'] && $type != Block::TYPE_USER ){
706 $flags[] = 'anononly';
707 }
708
709 if( $data['CreateAccount'] ){
710 $flags[] = 'nocreate';
711 }
712
713 # Same as anononly, this is not displayed when blocking an IP address
714 if( !$data['AutoBlock'] && $type != Block::TYPE_IP ){
715 $flags[] = 'noautoblock';
716 }
717
718 if( $data['DisableEmail'] ){
719 $flags[] = 'noemail';
720 }
721
722 if( $data['DisableUTEdit'] && $wgBlockAllowsUTEdit ){
723 $flags[] = 'nousertalk';
724 }
725
726 if( $data['HideUser'] ){
727 $flags[] = 'hiddenname';
728 }
729
730 return implode( ',', $flags );
731 }
732 }
733
734 # BC @since 1.18
735 class IPBlockForm extends SpecialBlock {}