3 * Implements Special:Block
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.
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.
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
21 * @ingroup SpecialPage
25 * A special page that allows users with 'block' right to block users from
26 * editing pages and other actions
28 * @ingroup SpecialPage
30 class SpecialBlock
extends SpecialPage
{
31 /** The maximum number of edits a user can have and still be hidden
32 * TODO: config setting? */
33 const HIDEUSER_CONTRIBLIMIT
= 1000;
35 /** @var User user to be blocked, as passed either by parameter (url?wpTarget=Foo)
36 * or as subpage (Special:Block/Foo) */
39 /// @var Block::TYPE_ constant
42 /// @var User|String the previous block target
43 protected $previousTarget;
45 /// @var Bool whether the previous submission of the form asked for HideUser
46 protected $requestedHideUser;
49 protected $alreadyBlocked;
52 protected $preErrors = array();
54 public function __construct() {
55 parent
::__construct( 'Block', 'block' );
58 public function execute( $par ) {
60 if( !$this->userCanExecute( $this->getUser() ) ) {
61 $this->displayRestrictionError();
65 # Can't block when the database is locked
67 throw new ReadOnlyError
;
70 # Extract variables from the request. Try not to get into a situation where we
71 # need to extract *every* variable from the form just for processing here, but
72 # there are legitimate uses for some variables
73 $request = $this->getRequest();
74 list( $this->target
, $this->type
) = self
::getTargetAndType( $par, $request );
75 if ( $this->target
instanceof User
) {
76 # Set the 'relevant user' in the skin, so it displays links like Contributions,
77 # User logs, UserRights, etc.
78 $this->getSkin()->setRelevantUser( $this->target
);
81 list( $this->previousTarget
, /*...*/ ) = Block
::parseTarget( $request->getVal( 'wpPreviousTarget' ) );
82 $this->requestedHideUser
= $request->getBool( 'wpHideUser' );
84 # bug 15810: blocked admins should have limited access here
85 $status = self
::checkUnblockSelf( $this->target
);
86 if ( $status !== true ) {
87 throw new ErrorPageError( 'badaccess', $status );
90 $out = $this->getOutput();
91 $out->setPageTitle( wfMsg( 'blockip-title' ) );
92 $out->addModules( 'mediawiki.special', 'mediawiki.special.block' );
94 $fields = $this->getFormFields();
95 $this->maybeAlterFormDefaults( $fields );
97 $form = new HTMLForm( $fields, $this->getContext() );
98 $form->setWrapperLegend( wfMsg( 'blockip-legend' ) );
99 $form->setSubmitCallback( array( __CLASS__
, 'processForm' ) );
101 $t = $this->alreadyBlocked
102 ?
wfMsg( 'ipb-change-block' )
103 : wfMsg( 'ipbsubmit' );
104 $form->setSubmitText( $t );
106 $this->doPreText( $form );
107 $this->doHeadertext( $form );
108 $this->doPostText( $form );
111 $out->setPageTitle( wfMsg( 'blockipsuccesssub' ) );
112 $out->addWikiMsg( 'blockipsuccesstext', $this->target
);
117 * Get the HTMLForm descriptor array for the block form
120 protected function getFormFields(){
121 global $wgBlockAllowsUTEdit;
123 $user = $this->getUser();
128 'label-message' => 'ipadressorusername',
130 'id' => 'mw-bi-target',
133 'validation-callback' => array( __CLASS__
, 'validateTargetField' ),
136 'type' => !count( self
::getSuggestedDurations() ) ?
'text' : 'selectorother',
137 'label-message' => 'ipbexpiry',
140 'options' => self
::getSuggestedDurations(),
141 'other' => wfMsg( 'ipbother' ),
144 'type' => 'selectandother',
145 'label-message' => 'ipbreason',
146 'options-message' => 'ipbreason-dropdown',
148 'CreateAccount' => array(
150 'label-message' => 'ipbcreateaccount',
155 if( self
::canBlockEmail( $user ) ) {
156 $a['DisableEmail'] = array(
158 'label-message' => 'ipbemailban',
162 if( $wgBlockAllowsUTEdit ){
163 $a['DisableUTEdit'] = array(
165 'label-message' => 'ipb-disableusertalk',
170 $a['AutoBlock'] = array(
172 'label-message' => 'ipbenableautoblock',
176 # Allow some users to hide name from block log, blocklist and listusers
177 if( $user->isAllowed( 'hideuser' ) ) {
178 $a['HideUser'] = array(
180 'label-message' => 'ipbhidename',
181 'cssclass' => 'mw-block-hideuser',
185 # Watchlist their user page? (Only if user is logged in)
186 if( $user->isLoggedIn() ) {
189 'label-message' => 'ipbwatchuser',
193 $a['HardBlock'] = array(
195 'label-message' => 'ipb-hardblock',
199 # This is basically a copy of the Target field, but the user can't change it, so we
200 # can see if the warnings we maybe showed to the user before still apply
201 $a['PreviousTarget'] = array(
206 # We'll turn this into a checkbox if we need to
207 $a['Confirm'] = array(
210 'label-message' => 'ipb-confirm',
217 * If the user has already been blocked with similar settings, load that block
218 * and change the defaults for the form fields to match the existing settings.
219 * @param &$fields Array HTMLForm descriptor array
220 * @return Bool whether fields were altered (that is, whether the target is
223 protected function maybeAlterFormDefaults( &$fields ){
224 # This will be overwritten by request data
225 $fields['Target']['default'] = (string)$this->target
;
228 $fields['PreviousTarget']['default'] = (string)$this->target
;
230 $block = Block
::newFromTarget( $this->target
);
232 if( $block instanceof Block
&& !$block->mAuto
# The block exists and isn't an autoblock
233 && ( $this->type
!= Block
::TYPE_RANGE
# The block isn't a rangeblock
234 ||
$block->getTarget() == $this->target
) # or if it is, the range is what we're about to block
237 $fields['HardBlock']['default'] = $block->isHardblock();
238 $fields['CreateAccount']['default'] = $block->prevents( 'createaccount' );
239 $fields['AutoBlock']['default'] = $block->isAutoblocking();
241 if( isset( $fields['DisableEmail'] ) ){
242 $fields['DisableEmail']['default'] = $block->prevents( 'sendemail' );
245 if( isset( $fields['HideUser'] ) ){
246 $fields['HideUser']['default'] = $block->mHideName
;
249 if( isset( $fields['DisableUTEdit'] ) ){
250 $fields['DisableUTEdit']['default'] = $block->prevents( 'editownusertalk' );
253 $fields['Reason']['default'] = $block->mReason
;
255 if( $this->getRequest()->wasPosted() ){
256 # Ok, so we got a POST submission asking us to reblock a user. So show the
257 # confirm checkbox; the user will only see it if they haven't previously
258 $fields['Confirm']['type'] = 'check';
260 # We got a target, but it wasn't a POST request, so the user must have gone
261 # to a link like [[Special:Block/User]]. We don't need to show the checkbox
262 # as long as they go ahead and block *that* user
263 $fields['Confirm']['default'] = 1;
266 if( $block->mExpiry
== 'infinity' ) {
267 $fields['Expiry']['default'] = 'indefinite';
269 $fields['Expiry']['default'] = wfTimestamp( TS_RFC2822
, $block->mExpiry
);
272 $this->alreadyBlocked
= true;
273 $this->preErrors
[] = array( 'ipb-needreblock', (string)$block->getTarget() );
276 # We always need confirmation to do HideUser
277 if( $this->requestedHideUser
){
278 $fields['Confirm']['type'] = 'check';
279 unset( $fields['Confirm']['default'] );
280 $this->preErrors
[] = 'ipb-confirmhideuser';
283 # Or if the user is trying to block themselves
284 if( (string)$this->target
=== $this->getUser()->getName() ){
285 $fields['Confirm']['type'] = 'check';
286 unset( $fields['Confirm']['default'] );
287 $this->preErrors
[] = 'ipb-blockingself';
292 * Add header elements like block log entries, etc.
293 * @param $form HTMLForm
296 protected function doPreText( HTMLForm
&$form ){
297 $form->addPreText( wfMsgExt( 'blockiptext', 'parse' ) );
299 $otherBlockMessages = array();
300 if( $this->target
!== null ) {
301 # Get other blocks, i.e. from GlobalBlocking or TorBlock extension
302 wfRunHooks( 'OtherBlockLogLink', array( &$otherBlockMessages, $this->target
) );
304 if( count( $otherBlockMessages ) ) {
305 $s = Html
::rawElement(
308 wfMsgExt( 'ipb-otherblocks-header', 'parseinline', count( $otherBlockMessages ) )
313 foreach( $otherBlockMessages as $link ) {
314 $list .= Html
::rawElement( 'li', array(), $link ) . "\n";
317 $s .= Html
::rawElement(
319 array( 'class' => 'mw-blockip-alreadyblocked' ),
323 $form->addPreText( $s );
329 * Add header text inside the form, just underneath where the errors would go
330 * @param $form HTMLForm
333 protected function doHeaderText( HTMLForm
&$form ){
334 # Don't need to do anything if the form has been posted
335 if( !$this->getRequest()->wasPosted() && $this->preErrors
){
336 $s = HTMLForm
::formatErrors( $this->preErrors
);
338 $form->addHeaderText( Html
::rawElement(
340 array( 'class' => 'error' ),
348 * Add footer elements to the form
349 * @param $form HTMLForm
352 protected function doPostText( HTMLForm
&$form ){
353 # Link to the user's contributions, if applicable
354 if( $this->target
instanceof User
){
355 $contribsPage = SpecialPage
::getTitleFor( 'Contributions', $this->target
->getName() );
356 $links[] = Linker
::link(
358 wfMsgExt( 'ipb-blocklist-contribs', 'escape', $this->target
->getName() )
362 # Link to unblock the specified user, or to a blank unblock form
363 if( $this->target
instanceof User
) {
364 $message = wfMsgExt( 'ipb-unblock-addr', array( 'parseinline' ), $this->target
->getName() );
365 $list = SpecialPage
::getTitleFor( 'Unblock', $this->target
->getName() );
367 $message = wfMsgExt( 'ipb-unblock', array( 'parseinline' ) );
368 $list = SpecialPage
::getTitleFor( 'Unblock' );
370 $links[] = Linker
::linkKnown( $list, $message, array() );
372 # Link to the block list
373 $links[] = Linker
::linkKnown(
374 SpecialPage
::getTitleFor( 'BlockList' ),
375 wfMsg( 'ipb-blocklist' )
378 $user = $this->getUser();
380 # Link to edit the block dropdown reasons, if applicable
381 if ( $user->isAllowed( 'editinterface' ) ) {
382 $links[] = Linker
::link(
383 Title
::makeTitle( NS_MEDIAWIKI
, 'Ipbreason-dropdown' ),
384 wfMsgHtml( 'ipb-edit-dropdown' ),
386 array( 'action' => 'edit' )
390 $form->addPostText( Html
::rawElement(
392 array( 'class' => 'mw-ipb-conveniencelinks' ),
393 $this->getLang()->pipeList( $links )
396 if( $this->target
instanceof User
){
397 # Get relevant extracts from the block and suppression logs, if possible
398 $userpage = $this->target
->getUserPage();
401 LogEventsList
::showLogExtract(
404 $userpage->getPrefixedText(),
408 'msgKey' => array( 'blocklog-showlog', $userpage->getText() ),
409 'showIfEmpty' => false
412 $form->addPostText( $out );
414 # Add suppression block entries if allowed
415 if( $user->isAllowed( 'suppressionlog' ) ) {
416 LogEventsList
::showLogExtract(
419 $userpage->getPrefixedText(),
423 'conds' => array( 'log_action' => array( 'block', 'reblock', 'unblock' ) ),
424 'msgKey' => array( 'blocklog-showsuppresslog', $userpage->getText() ),
425 'showIfEmpty' => false
429 $form->addPostText( $out );
435 * Determine the target of the block, and the type of target
436 * TODO: should be in Block.php?
437 * @param $par String subpage parameter passed to setup, or data value from
439 * @param $request WebRequest optionally try and get data from a request too
440 * @return array( User|string|null, Block::TYPE_ constant|null )
442 public static function getTargetAndType( $par, WebRequest
$request = null ){
449 # The HTMLForm will check wpTarget first and only if it doesn't get
450 # a value use the default, which will be generated from the options
451 # below; so this has to have a higher precedence here than $par, or
452 # we could end up with different values in $this->target and the HTMLForm!
453 if( $request instanceof WebRequest
){
454 $target = $request->getText( 'wpTarget', null );
461 if( $request instanceof WebRequest
){
462 $target = $request->getText( 'ip', null );
467 if( $request instanceof WebRequest
){
468 $target = $request->getText( 'wpBlockAddress', null );
475 list( $target, $type ) = Block
::parseTarget( $target );
477 if( $type !== null ){
478 return array( $target, $type );
482 return array( null, null );
486 * HTMLForm field validation-callback for Target field.
488 * @param $value String
489 * @param $alldata Array
492 public static function validateTargetField( $value, $alldata = null ) {
493 global $wgBlockCIDRLimit;
495 list( $target, $type ) = self
::getTargetAndType( $value );
497 if( $type == Block
::TYPE_USER
){
498 # TODO: why do we not have a User->exists() method?
499 if( !$target->getId() ){
500 return wfMessage( 'nosuchusershort',
501 wfEscapeWikiText( $target->getName() ) );
504 $status = self
::checkUnblockSelf( $target );
505 if ( $status !== true ) {
506 return wfMessage( 'badaccess', $status );
509 } elseif( $type == Block
::TYPE_RANGE
){
510 list( $ip, $range ) = explode( '/', $target, 2 );
512 if( ( IP
::isIPv4( $ip ) && $wgBlockCIDRLimit['IPv4'] == 32 )
513 ||
( IP
::isIPv6( $ip ) && $wgBlockCIDRLimit['IPV6'] == 128 ) )
515 # Range block effectively disabled
516 return wfMessage( 'range_block_disabled' );
519 if( ( IP
::isIPv4( $ip ) && $range > 32 )
520 ||
( IP
::isIPv6( $ip ) && $range > 128 ) )
523 return wfMessage( 'ip_range_invalid' );
526 if( IP
::isIPv4( $ip ) && $range < $wgBlockCIDRLimit['IPv4'] ) {
527 return wfMessage( 'ip_range_toolarge', $wgBlockCIDRLimit['IPv4'] );
530 if( IP
::isIPv6( $ip ) && $range < $wgBlockCIDRLimit['IPv6'] ) {
531 return wfMessage( 'ip_range_toolarge', $wgBlockCIDRLimit['IPv6'] );
533 } elseif( $type == Block
::TYPE_IP
){
536 return wfMessage( 'badipaddress' );
543 * Given the form data, actually implement a block
545 * @return Bool|String
547 public static function processForm( array $data ){
548 global $wgUser, $wgBlockAllowsUTEdit;
550 // Handled by field validator callback
551 // self::validateTargetField( $data['Target'] );
553 # This might have been a hidden field or a checkbox, so interesting data
555 $data['Confirm'] = !in_array( $data['Confirm'], array( '', '0', null, false ), true );
557 list( $target, $type ) = self
::getTargetAndType( $data['Target'] );
558 if( $type == Block
::TYPE_USER
){
560 $target = $user->getName();
561 $userId = $user->getId();
563 # Give admins a heads-up before they go and block themselves. Much messier
564 # to do this for IPs, but it's pretty unlikely they'd ever get the 'block'
565 # permission anyway, although the code does allow for it
566 if( $target === $wgUser->getName() &&
567 ( $data['PreviousTarget'] !== $data['Target'] ||
!$data['Confirm'] ) )
569 return array( 'ipb-blockingself' );
571 } elseif( $type == Block
::TYPE_RANGE
){
573 } elseif( $type == Block
::TYPE_IP
){
574 $target = $target->getName();
577 # This should have been caught in the form field validation
578 return array( 'badipaddress' );
581 if( ( strlen( $data['Expiry'] ) == 0) ||
( strlen( $data['Expiry'] ) > 50 )
582 ||
!self
::parseExpiryInput( $data['Expiry'] ) )
584 return array( 'ipb_expiry_invalid' );
587 if( !isset( $data['DisableEmail'] ) ){
588 $data['DisableEmail'] = false;
591 # If the user has done the form 'properly', they won't even have been given the
592 # option to suppress-block unless they have the 'hideuser' permission
593 if( !isset( $data['HideUser'] ) ){
594 $data['HideUser'] = false;
597 if( $data['HideUser'] ) {
598 if( !$wgUser->isAllowed('hideuser') ){
599 # this codepath is unreachable except by a malicious user spoofing forms,
600 # or by race conditions (user has oversight and sysop, loads block form,
601 # and is de-oversighted before submission); so need to fail completely
602 # rather than just silently disable hiding
603 return array( 'badaccess-group0' );
606 # Recheck params here...
607 if( $type != Block
::TYPE_USER
) {
608 $data['HideUser'] = false; # IP users should not be hidden
609 } elseif( !in_array( $data['Expiry'], array( 'infinite', 'infinity', 'indefinite' ) ) ) {
611 return array( 'ipb_expiry_temp' );
612 } elseif( $user->getEditCount() > self
::HIDEUSER_CONTRIBLIMIT
) {
613 # Typically, the user should have a handful of edits.
614 # Disallow hiding users with many edits for performance.
615 return array( 'ipb_hide_invalid' );
616 } elseif( !$data['Confirm'] ){
617 return array( 'ipb-confirmhideuser' );
621 # Create block object.
622 $block = new Block();
623 $block->setTarget( $target );
624 $block->setBlocker( $wgUser );
625 $block->mReason
= $data['Reason'][0];
626 $block->mExpiry
= self
::parseExpiryInput( $data['Expiry'] );
627 $block->prevents( 'createaccount', $data['CreateAccount'] );
628 $block->prevents( 'editownusertalk', ( !$wgBlockAllowsUTEdit ||
$data['DisableUTEdit'] ) );
629 $block->prevents( 'sendemail', $data['DisableEmail'] );
630 $block->isHardblock( $data['HardBlock'] );
631 $block->isAutoblocking( $data['AutoBlock'] );
632 $block->mHideName
= $data['HideUser'];
634 if( !wfRunHooks( 'BlockIp', array( &$block, &$wgUser ) ) ) {
635 return array( 'hookaborted' );
638 # Try to insert block. Is there a conflicting block?
639 $status = $block->insert();
641 # Show form unless the user is already aware of this...
642 if( !$data['Confirm'] ||
( array_key_exists( 'PreviousTarget', $data )
643 && $data['PreviousTarget'] !== $block->getTarget() ) )
645 return array( array( 'ipb_already_blocked', $block->getTarget() ) );
646 # Otherwise, try to update the block...
648 # This returns direct blocks before autoblocks/rangeblocks, since we should
649 # be sure the user is blocked by now it should work for our purposes
650 $currentBlock = Block
::newFromTarget( $target );
652 if( $block->equals( $currentBlock ) ) {
653 return array( array( 'ipb_already_blocked', $block->getTarget() ) );
656 # If the name was hidden and the blocking user cannot hide
657 # names, then don't allow any block changes...
658 if( $currentBlock->mHideName
&& !$wgUser->isAllowed( 'hideuser' ) ) {
659 return array( 'cant-see-hidden-user' );
662 $currentBlock->delete();
663 $status = $block->insert();
664 $logaction = 'reblock';
666 # Unset _deleted fields if requested
667 if( $currentBlock->mHideName
&& !$data['HideUser'] ) {
668 RevisionDeleteUser
::unsuppressUserName( $target, $userId );
671 # If hiding/unhiding a name, this should go in the private logs
672 if( (bool)$currentBlock->mHideName
){
673 $data['HideUser'] = true;
677 $logaction = 'block';
680 wfRunHooks( 'BlockIpComplete', array( $block, $wgUser ) );
682 # Set *_deleted fields if requested
683 if( $data['HideUser'] ) {
684 RevisionDeleteUser
::suppressUserName( $target, $userId );
687 # Can't watch a rangeblock
688 if( $type != Block
::TYPE_RANGE
&& $data['Watch'] ) {
689 $wgUser->addWatch( Title
::makeTitle( NS_USER
, $target ) );
692 # Block constructor sanitizes certain block options on insert
693 $data['BlockEmail'] = $block->prevents( 'sendemail' );
694 $data['AutoBlock'] = $block->isAutoblocking();
696 # Prepare log parameters
697 $logParams = array();
698 $logParams[] = $data['Expiry'];
699 $logParams[] = self
::blockLogFlags( $data, $type );
701 # Make log entry, if the name is hidden, put it in the oversight log
702 $log_type = $data['HideUser'] ?
'suppress' : 'block';
703 $log = new LogPage( $log_type );
704 $log_id = $log->addEntry(
706 Title
::makeTitle( NS_USER
, $target ),
710 # Relate log ID to block IDs (bug 25763)
711 $blockIds = array_merge( array( $status['id'] ), $status['autoIds'] );
712 $log->addRelations( 'ipb_id', $blockIds, $log_id );
719 * Get an array of suggested block durations from MediaWiki:Ipboptions
720 * @todo FIXME: This uses a rather odd syntax for the options, should it be converted
721 * to the standard "**<duration>|<displayname>" format?
722 * @param $lang Language|null the language to get the durations in, or null to use
723 * the wiki's content language
726 public static function getSuggestedDurations( $lang = null ){
728 $msg = $lang === null
729 ?
wfMessage( 'ipboptions' )->inContentLanguage()->text()
730 : wfMessage( 'ipboptions' )->inLanguage( $lang )->text();
736 foreach( explode( ',', $msg ) as $option ) {
737 if( strpos( $option, ':' ) === false ){
738 $option = "$option:$option";
741 list( $show, $value ) = explode( ':', $option );
742 $a[htmlspecialchars( $show )] = htmlspecialchars( $value );
749 * Convert a submitted expiry time, which may be relative ("2 weeks", etc) or absolute
750 * ("24 May 2034", etc), into an absolute timestamp we can put into the database.
751 * @param $expiry String: whatever was typed into the form
752 * @return String: timestamp or "infinity" string for the DB implementation
754 public static function parseExpiryInput( $expiry ) {
756 if( $infinity == null ){
757 $infinity = wfGetDB( DB_SLAVE
)->getInfinity();
760 if ( $expiry == 'infinite' ||
$expiry == 'indefinite' ) {
763 $expiry = strtotime( $expiry );
765 if ( $expiry < 0 ||
$expiry === false ) {
769 $expiry = wfTimestamp( TS_MW
, $expiry );
776 * Can we do an email block?
777 * @param $user User: the sysop wanting to make a block
780 public static function canBlockEmail( $user ) {
781 global $wgEnableUserEmail, $wgSysopEmailBans;
783 return ( $wgEnableUserEmail && $wgSysopEmailBans && $user->isAllowed( 'blockemail' ) );
787 * bug 15810: blocked admins should not be able to block/unblock
788 * others, and probably shouldn't be able to unblock themselves
790 * @param $user User|Int|String
791 * @return Bool|String true or error message key
793 public static function checkUnblockSelf( $user ) {
796 if ( is_int( $user ) ) {
797 $user = User
::newFromId( $user );
798 } elseif ( is_string( $user ) ) {
799 $user = User
::newFromName( $user );
802 if( $wgUser->isBlocked() ){
803 if( $user instanceof User
&& $user->getId() == $wgUser->getId() ) {
804 # User is trying to unblock themselves
805 if ( $wgUser->isAllowed( 'unblockself' ) ) {
807 # User blocked themselves and is now trying to reverse it
808 } elseif ( $wgUser->blockedBy() === $wgUser->getName() ) {
811 return 'ipbnounblockself';
814 # User is trying to block/unblock someone else
823 * Return a comma-delimited list of "flags" to be passed to the log
824 * reader for this block, to provide more information in the logs
825 * @param $data Array from HTMLForm data
826 * @param $type Block::TYPE_ constant
829 protected static function blockLogFlags( array $data, $type ) {
830 global $wgBlockAllowsUTEdit;
833 # when blocking a user the option 'anononly' is not available/has no effect -> do not write this into log
834 if( !$data['HardBlock'] && $type != Block
::TYPE_USER
){
835 // For grepping: message block-log-flags-anononly
836 $flags[] = 'anononly';
839 if( $data['CreateAccount'] ){
840 // For grepping: message block-log-flags-nocreate
841 $flags[] = 'nocreate';
844 # Same as anononly, this is not displayed when blocking an IP address
845 if( !$data['AutoBlock'] && $type != Block
::TYPE_IP
){
846 // For grepping: message block-log-flags-noautoblock
847 $flags[] = 'noautoblock';
850 if( $data['DisableEmail'] ){
851 // For grepping: message block-log-flags-noemail
852 $flags[] = 'noemail';
855 if( $wgBlockAllowsUTEdit && $data['DisableUTEdit'] ){
856 // For grepping: message block-log-flags-nousertalk
857 $flags[] = 'nousertalk';
860 if( $data['HideUser'] ){
861 // For grepping: message block-log-flags-hiddenname
862 $flags[] = 'hiddenname';
865 return implode( ',', $flags );
870 class IPBlockForm
extends SpecialBlock
{}