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 ) {
59 global $wgUser, $wgOut, $wgRequest;
62 if( !$this->userCanExecute( $wgUser ) ) {
63 $this->displayRestrictionError();
67 # Can't block when the database is locked
69 throw new ReadOnlyError
;
72 # Extract variables from the request. Try not to get into a situation where we
73 # need to extract *every* variable from the form just for processing here, but
74 # there are legitimate uses for some variables
75 list( $this->target
, $this->type
) = self
::getTargetAndType( $par, $wgRequest );
76 if ( $this->target
instanceof User
) {
77 # Set the 'relevant user' in the skin, so it displays links like Contributions,
78 # User logs, UserRights, etc.
79 $this->getSkin()->setRelevantUser( $this->target
);
82 list( $this->previousTarget
, /*...*/ ) = Block
::parseTarget( $wgRequest->getVal( 'wpPreviousTarget' ) );
83 $this->requestedHideUser
= $wgRequest->getBool( 'wpHideUser' );
85 # bug 15810: blocked admins should have limited access here
86 $status = self
::checkUnblockSelf( $this->target
);
87 if ( $status !== true ) {
88 throw new ErrorPageError( 'badaccess', $status );
91 $wgOut->setPageTitle( wfMsg( 'blockip-title' ) );
92 $wgOut->addModules( 'mediawiki.special', 'mediawiki.special.block' );
94 $fields = self
::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 $wgOut->setPageTitle( wfMsg( 'blockipsuccesssub' ) );
112 $wgOut->addWikiMsg( 'blockipsuccesstext', $this->target
);
117 * Get the HTMLForm descriptor array for the block form
120 protected static function getFormFields(){
121 global $wgUser, $wgBlockAllowsUTEdit;
126 'label-message' => 'ipadressorusername',
128 'id' => 'mw-bi-target',
131 'validation-callback' => array( __CLASS__
, 'validateTargetField' ),
134 'type' => !count( self
::getSuggestedDurations() ) ?
'text' : 'selectorother',
135 'label-message' => 'ipbexpiry',
138 'options' => self
::getSuggestedDurations(),
139 'other' => wfMsg( 'ipbother' ),
142 'type' => 'selectandother',
143 'label-message' => 'ipbreason',
144 'options-message' => 'ipbreason-dropdown',
146 'CreateAccount' => array(
148 'label-message' => 'ipbcreateaccount',
153 if( self
::canBlockEmail( $wgUser ) ) {
154 $a['DisableEmail'] = array(
156 'label-message' => 'ipbemailban',
160 if( $wgBlockAllowsUTEdit ){
161 $a['DisableUTEdit'] = array(
163 'label-message' => 'ipb-disableusertalk',
168 $a['AutoBlock'] = array(
170 'label-message' => 'ipbenableautoblock',
174 # Allow some users to hide name from block log, blocklist and listusers
175 if( $wgUser->isAllowed( 'hideuser' ) ) {
176 $a['HideUser'] = array(
178 'label-message' => 'ipbhidename',
179 'cssclass' => 'mw-block-hideuser',
183 # Watchlist their user page? (Only if user is logged in)
184 if( $wgUser->isLoggedIn() ) {
187 'label-message' => 'ipbwatchuser',
191 $a['HardBlock'] = array(
193 'label-message' => 'ipb-hardblock',
197 # This is basically a copy of the Target field, but the user can't change it, so we
198 # can see if the warnings we maybe showed to the user before still apply
199 $a['PreviousTarget'] = array(
204 # We'll turn this into a checkbox if we need to
205 $a['Confirm'] = array(
208 'label-message' => 'ipb-confirm',
215 * If the user has already been blocked with similar settings, load that block
216 * and change the defaults for the form fields to match the existing settings.
217 * @param &$fields Array HTMLForm descriptor array
218 * @return Bool whether fields were altered (that is, whether the target is
221 protected function maybeAlterFormDefaults( &$fields ){
222 global $wgRequest, $wgUser;
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( $wgRequest->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
=== $wgUser->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 ){
336 # Don't need to do anything if the form has been posted
337 if( !$wgRequest->wasPosted() && $this->preErrors
){
338 $s = HTMLForm
::formatErrors( $this->preErrors
);
340 $form->addHeaderText( Html
::rawElement(
342 array( 'class' => 'error' ),
350 * Add footer elements to the form
351 * @param $form HTMLForm
354 protected function doPostText( HTMLForm
&$form ){
355 global $wgUser, $wgLang;
357 # Link to the user's contributions, if applicable
358 if( $this->target
instanceof User
){
359 $contribsPage = SpecialPage
::getTitleFor( 'Contributions', $this->target
->getName() );
360 $links[] = Linker
::link(
362 wfMsgExt( 'ipb-blocklist-contribs', 'escape', $this->target
->getName() )
366 # Link to unblock the specified user, or to a blank unblock form
367 if( $this->target
instanceof User
) {
368 $message = wfMsgExt( 'ipb-unblock-addr', array( 'parseinline' ), $this->target
->getName() );
369 $list = SpecialPage
::getTitleFor( 'Unblock', $this->target
->getName() );
371 $message = wfMsgExt( 'ipb-unblock', array( 'parseinline' ) );
372 $list = SpecialPage
::getTitleFor( 'Unblock' );
374 $links[] = Linker
::linkKnown( $list, $message, array() );
376 # Link to the block list
377 $links[] = Linker
::linkKnown(
378 SpecialPage
::getTitleFor( 'BlockList' ),
379 wfMsg( 'ipb-blocklist' )
382 # Link to edit the block dropdown reasons, if applicable
383 if ( $wgUser->isAllowed( 'editinterface' ) ) {
384 $links[] = Linker
::link(
385 Title
::makeTitle( NS_MEDIAWIKI
, 'Ipbreason-dropdown' ),
386 wfMsgHtml( 'ipb-edit-dropdown' ),
388 array( 'action' => 'edit' )
392 $form->addPostText( Html
::rawElement(
394 array( 'class' => 'mw-ipb-conveniencelinks' ),
395 $wgLang->pipeList( $links )
398 if( $this->target
instanceof User
){
399 # Get relevant extracts from the block and suppression logs, if possible
400 $userpage = $this->target
->getUserPage();
403 LogEventsList
::showLogExtract(
406 $userpage->getPrefixedText(),
410 'msgKey' => array( 'blocklog-showlog', $userpage->getText() ),
411 'showIfEmpty' => false
414 $form->addPostText( $out );
416 # Add suppression block entries if allowed
417 if( $wgUser->isAllowed( 'suppressionlog' ) ) {
418 LogEventsList
::showLogExtract(
421 $userpage->getPrefixedText(),
425 'conds' => array( 'log_action' => array( 'block', 'reblock', 'unblock' ) ),
426 'msgKey' => array( 'blocklog-showsuppresslog', $userpage->getText() ),
427 'showIfEmpty' => false
431 $form->addPostText( $out );
437 * Determine the target of the block, and the type of target
438 * TODO: should be in Block.php?
439 * @param $par String subpage parameter passed to setup, or data value from
441 * @param $request WebRequest optionally try and get data from a request too
442 * @return array( User|string|null, Block::TYPE_ constant|null )
444 public static function getTargetAndType( $par, WebRequest
$request = null ){
451 # The HTMLForm will check wpTarget first and only if it doesn't get
452 # a value use the default, which will be generated from the options
453 # below; so this has to have a higher precedence here than $par, or
454 # we could end up with different values in $this->target and the HTMLForm!
455 if( $request instanceof WebRequest
){
456 $target = $request->getText( 'wpTarget', null );
463 if( $request instanceof WebRequest
){
464 $target = $request->getText( 'ip', null );
469 if( $request instanceof WebRequest
){
470 $target = $request->getText( 'wpBlockAddress', null );
477 list( $target, $type ) = Block
::parseTarget( $target );
479 if( $type !== null ){
480 return array( $target, $type );
484 return array( null, null );
488 * HTMLForm field validation-callback for Target field.
490 * @param $value String
491 * @param $alldata Array
494 public static function validateTargetField( $value, $alldata = null ) {
495 global $wgBlockCIDRLimit;
497 list( $target, $type ) = self
::getTargetAndType( $value );
499 if( $type == Block
::TYPE_USER
){
500 # TODO: why do we not have a User->exists() method?
501 if( !$target->getId() ){
502 return wfMessage( 'nosuchusershort',
503 wfEscapeWikiText( $target->getName() ) );
506 $status = self
::checkUnblockSelf( $target );
507 if ( $status !== true ) {
508 return wfMessage( 'badaccess', $status );
511 } elseif( $type == Block
::TYPE_RANGE
){
512 list( $ip, $range ) = explode( '/', $target, 2 );
514 if( ( IP
::isIPv4( $ip ) && $wgBlockCIDRLimit['IPv4'] == 32 )
515 ||
( IP
::isIPv6( $ip ) && $wgBlockCIDRLimit['IPV6'] == 128 ) )
517 # Range block effectively disabled
518 return wfMessage( 'range_block_disabled' );
521 if( ( IP
::isIPv4( $ip ) && $range > 32 )
522 ||
( IP
::isIPv6( $ip ) && $range > 128 ) )
525 return wfMessage( 'ip_range_invalid' );
528 if( IP
::isIPv4( $ip ) && $range < $wgBlockCIDRLimit['IPv4'] ) {
529 return wfMessage( 'ip_range_toolarge', $wgBlockCIDRLimit['IPv4'] );
532 if( IP
::isIPv6( $ip ) && $range < $wgBlockCIDRLimit['IPv6'] ) {
533 return wfMessage( 'ip_range_toolarge', $wgBlockCIDRLimit['IPv6'] );
535 } elseif( $type == Block
::TYPE_IP
){
538 return wfMessage( 'badipaddress' );
545 * Given the form data, actually implement a block
547 * @return Bool|String
549 public static function processForm( array $data ){
550 global $wgUser, $wgBlockAllowsUTEdit;
552 // Handled by field validator callback
553 // self::validateTargetField( $data['Target'] );
555 # This might have been a hidden field or a checkbox, so interesting data
557 $data['Confirm'] = !in_array( $data['Confirm'], array( '', '0', null, false ), true );
559 list( $target, $type ) = self
::getTargetAndType( $data['Target'] );
560 if( $type == Block
::TYPE_USER
){
562 $target = $user->getName();
563 $userId = $user->getId();
565 # Give admins a heads-up before they go and block themselves. Much messier
566 # to do this for IPs, but it's pretty unlikely they'd ever get the 'block'
567 # permission anyway, although the code does allow for it
568 if( $target === $wgUser->getName() &&
569 ( $data['PreviousTarget'] !== $data['Target'] ||
!$data['Confirm'] ) )
571 return array( 'ipb-blockingself' );
573 } elseif( $type == Block
::TYPE_RANGE
){
575 } elseif( $type == Block
::TYPE_IP
){
576 $target = $target->getName();
579 # This should have been caught in the form field validation
580 return array( 'badipaddress' );
583 if( ( strlen( $data['Expiry'] ) == 0) ||
( strlen( $data['Expiry'] ) > 50 )
584 ||
!self
::parseExpiryInput( $data['Expiry'] ) )
586 return array( 'ipb_expiry_invalid' );
589 if( !isset( $data['DisableEmail'] ) ){
590 $data['DisableEmail'] = false;
593 # If the user has done the form 'properly', they won't even have been given the
594 # option to suppress-block unless they have the 'hideuser' permission
595 if( !isset( $data['HideUser'] ) ){
596 $data['HideUser'] = false;
599 if( $data['HideUser'] ) {
600 if( !$wgUser->isAllowed('hideuser') ){
601 # this codepath is unreachable except by a malicious user spoofing forms,
602 # or by race conditions (user has oversight and sysop, loads block form,
603 # and is de-oversighted before submission); so need to fail completely
604 # rather than just silently disable hiding
605 return array( 'badaccess-group0' );
608 # Recheck params here...
609 if( $type != Block
::TYPE_USER
) {
610 $data['HideUser'] = false; # IP users should not be hidden
611 } elseif( !in_array( $data['Expiry'], array( 'infinite', 'infinity', 'indefinite' ) ) ) {
613 return array( 'ipb_expiry_temp' );
614 } elseif( $user->getEditCount() > self
::HIDEUSER_CONTRIBLIMIT
) {
615 # Typically, the user should have a handful of edits.
616 # Disallow hiding users with many edits for performance.
617 return array( 'ipb_hide_invalid' );
618 } elseif( !$data['Confirm'] ){
619 return array( 'ipb-confirmhideuser' );
623 # Create block object.
624 $block = new Block();
625 $block->setTarget( $target );
626 $block->setBlocker( $wgUser );
627 $block->mReason
= $data['Reason'][0];
628 $block->mExpiry
= self
::parseExpiryInput( $data['Expiry'] );
629 $block->prevents( 'createaccount', $data['CreateAccount'] );
630 $block->prevents( 'editownusertalk', ( !$wgBlockAllowsUTEdit ||
$data['DisableUTEdit'] ) );
631 $block->prevents( 'sendemail', $data['DisableEmail'] );
632 $block->isHardblock( $data['HardBlock'] );
633 $block->isAutoblocking( $data['AutoBlock'] );
634 $block->mHideName
= $data['HideUser'];
636 if( !wfRunHooks( 'BlockIp', array( &$block, &$wgUser ) ) ) {
637 return array( 'hookaborted' );
640 # Try to insert block. Is there a conflicting block?
641 $status = $block->insert();
643 # Show form unless the user is already aware of this...
644 if( !$data['Confirm'] ||
( array_key_exists( 'PreviousTarget', $data )
645 && $data['PreviousTarget'] !== $block->getTarget() ) )
647 return array( array( 'ipb_already_blocked', $block->getTarget() ) );
648 # Otherwise, try to update the block...
650 # This returns direct blocks before autoblocks/rangeblocks, since we should
651 # be sure the user is blocked by now it should work for our purposes
652 $currentBlock = Block
::newFromTarget( $target );
654 if( $block->equals( $currentBlock ) ) {
655 return array( array( 'ipb_already_blocked', $block->getTarget() ) );
658 # If the name was hidden and the blocking user cannot hide
659 # names, then don't allow any block changes...
660 if( $currentBlock->mHideName
&& !$wgUser->isAllowed( 'hideuser' ) ) {
661 return array( 'cant-see-hidden-user' );
664 $currentBlock->delete();
665 $status = $block->insert();
666 $logaction = 'reblock';
668 # Unset _deleted fields if requested
669 if( $currentBlock->mHideName
&& !$data['HideUser'] ) {
670 RevisionDeleteUser
::unsuppressUserName( $target, $userId );
673 # If hiding/unhiding a name, this should go in the private logs
674 if( (bool)$currentBlock->mHideName
){
675 $data['HideUser'] = true;
679 $logaction = 'block';
682 wfRunHooks( 'BlockIpComplete', array( $block, $wgUser ) );
684 # Set *_deleted fields if requested
685 if( $data['HideUser'] ) {
686 RevisionDeleteUser
::suppressUserName( $target, $userId );
689 # Can't watch a rangeblock
690 if( $type != Block
::TYPE_RANGE
&& $data['Watch'] ) {
691 $wgUser->addWatch( Title
::makeTitle( NS_USER
, $target ) );
694 # Block constructor sanitizes certain block options on insert
695 $data['BlockEmail'] = $block->prevents( 'sendemail' );
696 $data['AutoBlock'] = $block->isAutoblocking();
698 # Prepare log parameters
699 $logParams = array();
700 $logParams[] = $data['Expiry'];
701 $logParams[] = self
::blockLogFlags( $data, $type );
703 # Make log entry, if the name is hidden, put it in the oversight log
704 $log_type = $data['HideUser'] ?
'suppress' : 'block';
705 $log = new LogPage( $log_type );
706 $log_id = $log->addEntry(
708 Title
::makeTitle( NS_USER
, $target ),
712 # Relate log ID to block IDs (bug 25763)
713 $blockIds = array_merge( array( $status['id'] ), $status['autoIds'] );
714 $log->addRelations( 'ipb_id', $blockIds, $log_id );
721 * Get an array of suggested block durations from MediaWiki:Ipboptions
722 * @todo FIXME: This uses a rather odd syntax for the options, should it be converted
723 * to the standard "**<duration>|<displayname>" format?
724 * @param $lang Language|null the language to get the durations in, or null to use
725 * the wiki's content language
728 public static function getSuggestedDurations( $lang = null ){
730 $msg = $lang === null
731 ?
wfMessage( 'ipboptions' )->inContentLanguage()->text()
732 : wfMessage( 'ipboptions' )->inLanguage( $lang )->text();
738 foreach( explode( ',', $msg ) as $option ) {
739 if( strpos( $option, ':' ) === false ){
740 $option = "$option:$option";
743 list( $show, $value ) = explode( ':', $option );
744 $a[htmlspecialchars( $show )] = htmlspecialchars( $value );
751 * Convert a submitted expiry time, which may be relative ("2 weeks", etc) or absolute
752 * ("24 May 2034", etc), into an absolute timestamp we can put into the database.
753 * @param $expiry String: whatever was typed into the form
754 * @return String: timestamp or "infinity" string for the DB implementation
756 public static function parseExpiryInput( $expiry ) {
758 if( $infinity == null ){
759 $infinity = wfGetDB( DB_SLAVE
)->getInfinity();
762 if ( $expiry == 'infinite' ||
$expiry == 'indefinite' ) {
765 $expiry = strtotime( $expiry );
767 if ( $expiry < 0 ||
$expiry === false ) {
771 $expiry = wfTimestamp( TS_MW
, $expiry );
778 * Can we do an email block?
779 * @param $user User: the sysop wanting to make a block
782 public static function canBlockEmail( $user ) {
783 global $wgEnableUserEmail, $wgSysopEmailBans;
785 return ( $wgEnableUserEmail && $wgSysopEmailBans && $user->isAllowed( 'blockemail' ) );
789 * bug 15810: blocked admins should not be able to block/unblock
790 * others, and probably shouldn't be able to unblock themselves
792 * @param $user User|Int|String
793 * @return Bool|String true or error message key
795 public static function checkUnblockSelf( $user ) {
798 if ( is_int( $user ) ) {
799 $user = User
::newFromId( $user );
800 } elseif ( is_string( $user ) ) {
801 $user = User
::newFromName( $user );
804 if( $wgUser->isBlocked() ){
805 if( $user instanceof User
&& $user->getId() == $wgUser->getId() ) {
806 # User is trying to unblock themselves
807 if ( $wgUser->isAllowed( 'unblockself' ) ) {
809 # User blocked themselves and is now trying to reverse it
810 } elseif ( $wgUser->blockedBy() === $wgUser->getName() ) {
813 return 'ipbnounblockself';
816 # User is trying to block/unblock someone else
825 * Return a comma-delimited list of "flags" to be passed to the log
826 * reader for this block, to provide more information in the logs
827 * @param $data Array from HTMLForm data
828 * @param $type Block::TYPE_ constant
831 protected static function blockLogFlags( array $data, $type ) {
832 global $wgBlockAllowsUTEdit;
835 # when blocking a user the option 'anononly' is not available/has no effect -> do not write this into log
836 if( !$data['HardBlock'] && $type != Block
::TYPE_USER
){
837 // For grepping: message block-log-flags-anononly
838 $flags[] = 'anononly';
841 if( $data['CreateAccount'] ){
842 // For grepping: message block-log-flags-nocreate
843 $flags[] = 'nocreate';
846 # Same as anononly, this is not displayed when blocking an IP address
847 if( !$data['AutoBlock'] && $type != Block
::TYPE_IP
){
848 // For grepping: message block-log-flags-noautoblock
849 $flags[] = 'noautoblock';
852 if( $data['DisableEmail'] ){
853 // For grepping: message block-log-flags-noemail
854 $flags[] = 'noemail';
857 if( $wgBlockAllowsUTEdit && $data['DisableUTEdit'] ){
858 // For grepping: message block-log-flags-nousertalk
859 $flags[] = 'nousertalk';
862 if( $data['HideUser'] ){
863 // For grepping: message block-log-flags-hiddenname
864 $flags[] = 'hiddenname';
867 return implode( ',', $flags );
872 class IPBlockForm
extends SpecialBlock
{}