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 $user = $this->getUser();
61 if( !$this->userCanExecute( $user ) ) {
62 $this->displayRestrictionError();
66 # Can't block when the database is locked
68 throw new ReadOnlyError
;
71 # Extract variables from the request. Try not to get into a situation where we
72 # need to extract *every* variable from the form just for processing here, but
73 # there are legitimate uses for some variables
74 $request = $this->getRequest();
75 list( $this->target
, $this->type
) = self
::getTargetAndType( $par, $request );
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( $request->getVal( 'wpPreviousTarget' ) );
83 $this->requestedHideUser
= $request->getBool( 'wpHideUser' );
85 # bug 15810: blocked admins should have limited access here
86 $status = self
::checkUnblockSelf( $this->target
, $user );
87 if ( $status !== true ) {
88 throw new ErrorPageError( 'badaccess', $status );
92 $this->outputHeader();
94 $out = $this->getOutput();
95 $out->setPageTitle( $this->msg( 'blockip-title' ) );
96 $out->addModules( array( 'mediawiki.special', 'mediawiki.special.block' ) );
98 $fields = $this->getFormFields();
99 $this->maybeAlterFormDefaults( $fields );
101 $form = new HTMLForm( $fields, $this->getContext() );
102 $form->setWrapperLegend( wfMsg( 'blockip-legend' ) );
103 $form->setSubmitCallback( array( __CLASS__
, 'processUIForm' ) );
105 $t = $this->alreadyBlocked
106 ?
wfMsg( 'ipb-change-block' )
107 : wfMsg( 'ipbsubmit' );
108 $form->setSubmitText( $t );
110 $this->doPreText( $form );
111 $this->doHeadertext( $form );
112 $this->doPostText( $form );
115 $out->setPageTitle( $this->msg( 'blockipsuccesssub' ) );
116 $out->addWikiMsg( 'blockipsuccesstext', $this->target
);
121 * Get the HTMLForm descriptor array for the block form
124 protected function getFormFields(){
125 global $wgBlockAllowsUTEdit;
127 $user = $this->getUser();
132 'label-message' => 'ipadressorusername',
134 'id' => 'mw-bi-target',
137 'validation-callback' => array( __CLASS__
, 'validateTargetField' ),
140 'type' => !count( self
::getSuggestedDurations() ) ?
'text' : 'selectorother',
141 'label-message' => 'ipbexpiry',
144 'options' => self
::getSuggestedDurations(),
145 'other' => wfMsg( 'ipbother' ),
148 'type' => 'selectandother',
149 'label-message' => 'ipbreason',
150 'options-message' => 'ipbreason-dropdown',
152 'CreateAccount' => array(
154 'label-message' => 'ipbcreateaccount',
159 if( self
::canBlockEmail( $user ) ) {
160 $a['DisableEmail'] = array(
162 'label-message' => 'ipbemailban',
166 if( $wgBlockAllowsUTEdit ){
167 $a['DisableUTEdit'] = array(
169 'label-message' => 'ipb-disableusertalk',
174 $a['AutoBlock'] = array(
176 'label-message' => 'ipbenableautoblock',
180 # Allow some users to hide name from block log, blocklist and listusers
181 if( $user->isAllowed( 'hideuser' ) ) {
182 $a['HideUser'] = array(
184 'label-message' => 'ipbhidename',
185 'cssclass' => 'mw-block-hideuser',
189 # Watchlist their user page? (Only if user is logged in)
190 if( $user->isLoggedIn() ) {
193 'label-message' => 'ipbwatchuser',
197 $a['HardBlock'] = array(
199 'label-message' => 'ipb-hardblock',
203 # This is basically a copy of the Target field, but the user can't change it, so we
204 # can see if the warnings we maybe showed to the user before still apply
205 $a['PreviousTarget'] = array(
210 # We'll turn this into a checkbox if we need to
211 $a['Confirm'] = array(
214 'label-message' => 'ipb-confirm',
221 * If the user has already been blocked with similar settings, load that block
222 * and change the defaults for the form fields to match the existing settings.
223 * @param &$fields Array HTMLForm descriptor array
224 * @return Bool whether fields were altered (that is, whether the target is
227 protected function maybeAlterFormDefaults( &$fields ){
228 # This will be overwritten by request data
229 $fields['Target']['default'] = (string)$this->target
;
232 $fields['PreviousTarget']['default'] = (string)$this->target
;
234 $block = Block
::newFromTarget( $this->target
);
236 if( $block instanceof Block
&& !$block->mAuto
# The block exists and isn't an autoblock
237 && ( $this->type
!= Block
::TYPE_RANGE
# The block isn't a rangeblock
238 ||
$block->getTarget() == $this->target
) # or if it is, the range is what we're about to block
241 $fields['HardBlock']['default'] = $block->isHardblock();
242 $fields['CreateAccount']['default'] = $block->prevents( 'createaccount' );
243 $fields['AutoBlock']['default'] = $block->isAutoblocking();
245 if( isset( $fields['DisableEmail'] ) ){
246 $fields['DisableEmail']['default'] = $block->prevents( 'sendemail' );
249 if( isset( $fields['HideUser'] ) ){
250 $fields['HideUser']['default'] = $block->mHideName
;
253 if( isset( $fields['DisableUTEdit'] ) ){
254 $fields['DisableUTEdit']['default'] = $block->prevents( 'editownusertalk' );
257 $fields['Reason']['default'] = $block->mReason
;
259 if( $this->getRequest()->wasPosted() ){
260 # Ok, so we got a POST submission asking us to reblock a user. So show the
261 # confirm checkbox; the user will only see it if they haven't previously
262 $fields['Confirm']['type'] = 'check';
264 # We got a target, but it wasn't a POST request, so the user must have gone
265 # to a link like [[Special:Block/User]]. We don't need to show the checkbox
266 # as long as they go ahead and block *that* user
267 $fields['Confirm']['default'] = 1;
270 if( $block->mExpiry
== 'infinity' ) {
271 $fields['Expiry']['default'] = 'indefinite';
273 $fields['Expiry']['default'] = wfTimestamp( TS_RFC2822
, $block->mExpiry
);
276 $this->alreadyBlocked
= true;
277 $this->preErrors
[] = array( 'ipb-needreblock', (string)$block->getTarget() );
280 # We always need confirmation to do HideUser
281 if( $this->requestedHideUser
){
282 $fields['Confirm']['type'] = 'check';
283 unset( $fields['Confirm']['default'] );
284 $this->preErrors
[] = 'ipb-confirmhideuser';
287 # Or if the user is trying to block themselves
288 if( (string)$this->target
=== $this->getUser()->getName() ){
289 $fields['Confirm']['type'] = 'check';
290 unset( $fields['Confirm']['default'] );
291 $this->preErrors
[] = 'ipb-blockingself';
296 * Add header elements like block log entries, etc.
297 * @param $form HTMLForm
300 protected function doPreText( HTMLForm
&$form ){
301 $form->addPreText( wfMsgExt( 'blockiptext', 'parse' ) );
303 $otherBlockMessages = array();
304 if( $this->target
!== null ) {
305 # Get other blocks, i.e. from GlobalBlocking or TorBlock extension
306 wfRunHooks( 'OtherBlockLogLink', array( &$otherBlockMessages, $this->target
) );
308 if( count( $otherBlockMessages ) ) {
309 $s = Html
::rawElement(
312 wfMsgExt( 'ipb-otherblocks-header', 'parseinline', count( $otherBlockMessages ) )
317 foreach( $otherBlockMessages as $link ) {
318 $list .= Html
::rawElement( 'li', array(), $link ) . "\n";
321 $s .= Html
::rawElement(
323 array( 'class' => 'mw-blockip-alreadyblocked' ),
327 $form->addPreText( $s );
333 * Add header text inside the form, just underneath where the errors would go
334 * @param $form HTMLForm
337 protected function doHeaderText( HTMLForm
&$form ){
338 # Don't need to do anything if the form has been posted
339 if( !$this->getRequest()->wasPosted() && $this->preErrors
){
340 $s = HTMLForm
::formatErrors( $this->preErrors
);
342 $form->addHeaderText( Html
::rawElement(
344 array( 'class' => 'error' ),
352 * Add footer elements to the form
353 * @param $form HTMLForm
356 protected function doPostText( HTMLForm
&$form ){
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 $user = $this->getUser();
384 # Link to edit the block dropdown reasons, if applicable
385 if ( $user->isAllowed( 'editinterface' ) ) {
386 $links[] = Linker
::link(
387 Title
::makeTitle( NS_MEDIAWIKI
, 'Ipbreason-dropdown' ),
388 wfMsgHtml( 'ipb-edit-dropdown' ),
390 array( 'action' => 'edit' )
394 $form->addPostText( Html
::rawElement(
396 array( 'class' => 'mw-ipb-conveniencelinks' ),
397 $this->getLang()->pipeList( $links )
400 if( $this->target
instanceof User
){
401 # Get relevant extracts from the block and suppression logs, if possible
402 $userpage = $this->target
->getUserPage();
405 LogEventsList
::showLogExtract(
412 'msgKey' => array( 'blocklog-showlog', $userpage->getText() ),
413 'showIfEmpty' => false
416 $form->addPostText( $out );
418 # Add suppression block entries if allowed
419 if( $user->isAllowed( 'suppressionlog' ) ) {
420 LogEventsList
::showLogExtract(
427 'conds' => array( 'log_action' => array( 'block', 'reblock', 'unblock' ) ),
428 'msgKey' => array( 'blocklog-showsuppresslog', $userpage->getText() ),
429 'showIfEmpty' => false
433 $form->addPostText( $out );
439 * Determine the target of the block, and the type of target
440 * TODO: should be in Block.php?
441 * @param $par String subpage parameter passed to setup, or data value from
443 * @param $request WebRequest optionally try and get data from a request too
444 * @return array( User|string|null, Block::TYPE_ constant|null )
446 public static function getTargetAndType( $par, WebRequest
$request = null ){
453 # The HTMLForm will check wpTarget first and only if it doesn't get
454 # a value use the default, which will be generated from the options
455 # below; so this has to have a higher precedence here than $par, or
456 # we could end up with different values in $this->target and the HTMLForm!
457 if( $request instanceof WebRequest
){
458 $target = $request->getText( 'wpTarget', null );
465 if( $request instanceof WebRequest
){
466 $target = $request->getText( 'ip', null );
471 if( $request instanceof WebRequest
){
472 $target = $request->getText( 'wpBlockAddress', null );
479 list( $target, $type ) = Block
::parseTarget( $target );
481 if( $type !== null ){
482 return array( $target, $type );
486 return array( null, null );
490 * HTMLForm field validation-callback for Target field.
492 * @param $value String
493 * @param $alldata Array
496 public static function validateTargetField( $value, $alldata, $form ) {
497 global $wgBlockCIDRLimit;
499 list( $target, $type ) = self
::getTargetAndType( $value );
501 if( $type == Block
::TYPE_USER
){
502 # TODO: why do we not have a User->exists() method?
503 if( !$target->getId() ){
504 return $form->msg( 'nosuchusershort',
505 wfEscapeWikiText( $target->getName() ) );
508 $status = self
::checkUnblockSelf( $target, $form->getUser() );
509 if ( $status !== true ) {
510 return $form->msg( 'badaccess', $status );
513 } elseif( $type == Block
::TYPE_RANGE
){
514 list( $ip, $range ) = explode( '/', $target, 2 );
516 if( ( IP
::isIPv4( $ip ) && $wgBlockCIDRLimit['IPv4'] == 32 )
517 ||
( IP
::isIPv6( $ip ) && $wgBlockCIDRLimit['IPv6'] == 128 ) )
519 # Range block effectively disabled
520 return $form->msg( 'range_block_disabled' );
523 if( ( IP
::isIPv4( $ip ) && $range > 32 )
524 ||
( IP
::isIPv6( $ip ) && $range > 128 ) )
527 return $form->msg( 'ip_range_invalid' );
530 if( IP
::isIPv4( $ip ) && $range < $wgBlockCIDRLimit['IPv4'] ) {
531 return $form->msg( 'ip_range_toolarge', $wgBlockCIDRLimit['IPv4'] );
534 if( IP
::isIPv6( $ip ) && $range < $wgBlockCIDRLimit['IPv6'] ) {
535 return $form->msg( 'ip_range_toolarge', $wgBlockCIDRLimit['IPv6'] );
537 } elseif( $type == Block
::TYPE_IP
){
540 return $form->msg( 'badipaddress' );
547 * Submit callback for an HTMLForm object, will simply pass
549 public static function processUIForm( array $data, HTMLForm
$form ) {
550 return self
::processForm( $data, $form->getContext() );
554 * Given the form data, actually implement a block
556 * @return Bool|String
558 public static function processForm( array $data, IContextSource
$context ){
559 global $wgBlockAllowsUTEdit;
561 $performer = $context->getUser();
563 // Handled by field validator callback
564 // self::validateTargetField( $data['Target'] );
566 # This might have been a hidden field or a checkbox, so interesting data
568 $data['Confirm'] = !in_array( $data['Confirm'], array( '', '0', null, false ), true );
570 list( $target, $type ) = self
::getTargetAndType( $data['Target'] );
571 if( $type == Block
::TYPE_USER
){
573 $target = $user->getName();
574 $userId = $user->getId();
576 # Give admins a heads-up before they go and block themselves. Much messier
577 # to do this for IPs, but it's pretty unlikely they'd ever get the 'block'
578 # permission anyway, although the code does allow for it
579 if( $target === $performer->getName() &&
580 ( $data['PreviousTarget'] !== $data['Target'] ||
!$data['Confirm'] ) )
582 return array( 'ipb-blockingself' );
584 } elseif( $type == Block
::TYPE_RANGE
){
586 } elseif( $type == Block
::TYPE_IP
){
587 $target = $target->getName();
590 # This should have been caught in the form field validation
591 return array( 'badipaddress' );
594 if( ( strlen( $data['Expiry'] ) == 0) ||
( strlen( $data['Expiry'] ) > 50 )
595 ||
!self
::parseExpiryInput( $data['Expiry'] ) )
597 return array( 'ipb_expiry_invalid' );
600 if( !isset( $data['DisableEmail'] ) ){
601 $data['DisableEmail'] = false;
604 # If the user has done the form 'properly', they won't even have been given the
605 # option to suppress-block unless they have the 'hideuser' permission
606 if( !isset( $data['HideUser'] ) ){
607 $data['HideUser'] = false;
610 if( $data['HideUser'] ) {
611 if( !$performer->isAllowed('hideuser') ){
612 # this codepath is unreachable except by a malicious user spoofing forms,
613 # or by race conditions (user has oversight and sysop, loads block form,
614 # and is de-oversighted before submission); so need to fail completely
615 # rather than just silently disable hiding
616 return array( 'badaccess-group0' );
619 # Recheck params here...
620 if( $type != Block
::TYPE_USER
) {
621 $data['HideUser'] = false; # IP users should not be hidden
622 } elseif( !in_array( $data['Expiry'], array( 'infinite', 'infinity', 'indefinite' ) ) ) {
624 return array( 'ipb_expiry_temp' );
625 } elseif( $user->getEditCount() > self
::HIDEUSER_CONTRIBLIMIT
) {
626 # Typically, the user should have a handful of edits.
627 # Disallow hiding users with many edits for performance.
628 return array( 'ipb_hide_invalid' );
629 } elseif( !$data['Confirm'] ){
630 return array( 'ipb-confirmhideuser' );
634 # Create block object.
635 $block = new Block();
636 $block->setTarget( $target );
637 $block->setBlocker( $performer );
638 $block->mReason
= $data['Reason'][0];
639 $block->mExpiry
= self
::parseExpiryInput( $data['Expiry'] );
640 $block->prevents( 'createaccount', $data['CreateAccount'] );
641 $block->prevents( 'editownusertalk', ( !$wgBlockAllowsUTEdit ||
$data['DisableUTEdit'] ) );
642 $block->prevents( 'sendemail', $data['DisableEmail'] );
643 $block->isHardblock( $data['HardBlock'] );
644 $block->isAutoblocking( $data['AutoBlock'] );
645 $block->mHideName
= $data['HideUser'];
647 if( !wfRunHooks( 'BlockIp', array( &$block, &$performer ) ) ) {
648 return array( 'hookaborted' );
651 # Try to insert block. Is there a conflicting block?
652 $status = $block->insert();
654 # Show form unless the user is already aware of this...
655 if( !$data['Confirm'] ||
( array_key_exists( 'PreviousTarget', $data )
656 && $data['PreviousTarget'] !== $target ) )
658 return array( array( 'ipb_already_blocked', $block->getTarget() ) );
659 # Otherwise, try to update the block...
661 # This returns direct blocks before autoblocks/rangeblocks, since we should
662 # be sure the user is blocked by now it should work for our purposes
663 $currentBlock = Block
::newFromTarget( $target );
665 if( $block->equals( $currentBlock ) ) {
666 return array( array( 'ipb_already_blocked', $block->getTarget() ) );
669 # If the name was hidden and the blocking user cannot hide
670 # names, then don't allow any block changes...
671 if( $currentBlock->mHideName
&& !$performer->isAllowed( 'hideuser' ) ) {
672 return array( 'cant-see-hidden-user' );
675 $currentBlock->delete();
676 $status = $block->insert();
677 $logaction = 'reblock';
679 # Unset _deleted fields if requested
680 if( $currentBlock->mHideName
&& !$data['HideUser'] ) {
681 RevisionDeleteUser
::unsuppressUserName( $target, $userId );
684 # If hiding/unhiding a name, this should go in the private logs
685 if( (bool)$currentBlock->mHideName
){
686 $data['HideUser'] = true;
690 $logaction = 'block';
693 wfRunHooks( 'BlockIpComplete', array( $block, $performer ) );
695 # Set *_deleted fields if requested
696 if( $data['HideUser'] ) {
697 RevisionDeleteUser
::suppressUserName( $target, $userId );
700 # Can't watch a rangeblock
701 if( $type != Block
::TYPE_RANGE
&& $data['Watch'] ) {
702 $performer->addWatch( Title
::makeTitle( NS_USER
, $target ) );
705 # Block constructor sanitizes certain block options on insert
706 $data['BlockEmail'] = $block->prevents( 'sendemail' );
707 $data['AutoBlock'] = $block->isAutoblocking();
709 # Prepare log parameters
710 $logParams = array();
711 $logParams[] = $data['Expiry'];
712 $logParams[] = self
::blockLogFlags( $data, $type );
714 # Make log entry, if the name is hidden, put it in the oversight log
715 $log_type = $data['HideUser'] ?
'suppress' : 'block';
716 $log = new LogPage( $log_type );
717 $log_id = $log->addEntry(
719 Title
::makeTitle( NS_USER
, $target ),
723 # Relate log ID to block IDs (bug 25763)
724 $blockIds = array_merge( array( $status['id'] ), $status['autoIds'] );
725 $log->addRelations( 'ipb_id', $blockIds, $log_id );
732 * Get an array of suggested block durations from MediaWiki:Ipboptions
733 * @todo FIXME: This uses a rather odd syntax for the options, should it be converted
734 * to the standard "**<duration>|<displayname>" format?
735 * @param $lang Language|null the language to get the durations in, or null to use
736 * the wiki's content language
739 public static function getSuggestedDurations( $lang = null ){
741 $msg = $lang === null
742 ?
wfMessage( 'ipboptions' )->inContentLanguage()->text()
743 : wfMessage( 'ipboptions' )->inLanguage( $lang )->text();
749 foreach( explode( ',', $msg ) as $option ) {
750 if( strpos( $option, ':' ) === false ){
751 $option = "$option:$option";
754 list( $show, $value ) = explode( ':', $option );
755 $a[htmlspecialchars( $show )] = htmlspecialchars( $value );
762 * Convert a submitted expiry time, which may be relative ("2 weeks", etc) or absolute
763 * ("24 May 2034", etc), into an absolute timestamp we can put into the database.
764 * @param $expiry String: whatever was typed into the form
765 * @return String: timestamp or "infinity" string for the DB implementation
767 public static function parseExpiryInput( $expiry ) {
769 if( $infinity == null ){
770 $infinity = wfGetDB( DB_SLAVE
)->getInfinity();
773 if ( $expiry == 'infinite' ||
$expiry == 'indefinite' ) {
776 $expiry = strtotime( $expiry );
778 if ( $expiry < 0 ||
$expiry === false ) {
782 $expiry = wfTimestamp( TS_MW
, $expiry );
789 * Can we do an email block?
790 * @param $user User: the sysop wanting to make a block
793 public static function canBlockEmail( $user ) {
794 global $wgEnableUserEmail, $wgSysopEmailBans;
796 return ( $wgEnableUserEmail && $wgSysopEmailBans && $user->isAllowed( 'blockemail' ) );
800 * bug 15810: blocked admins should not be able to block/unblock
801 * others, and probably shouldn't be able to unblock themselves
803 * @param $user User|Int|String
804 * @param $performer User user doing the request
805 * @return Bool|String true or error message key
807 public static function checkUnblockSelf( $user, User
$performer ) {
808 if ( is_int( $user ) ) {
809 $user = User
::newFromId( $user );
810 } elseif ( is_string( $user ) ) {
811 $user = User
::newFromName( $user );
814 if( $performer->isBlocked() ){
815 if( $user instanceof User
&& $user->getId() == $performer->getId() ) {
816 # User is trying to unblock themselves
817 if ( $performer->isAllowed( 'unblockself' ) ) {
819 # User blocked themselves and is now trying to reverse it
820 } elseif ( $performer->blockedBy() === $performer->getName() ) {
823 return 'ipbnounblockself';
826 # User is trying to block/unblock someone else
835 * Return a comma-delimited list of "flags" to be passed to the log
836 * reader for this block, to provide more information in the logs
837 * @param $data Array from HTMLForm data
838 * @param $type Block::TYPE_ constant (USER, RANGE, or IP)
841 protected static function blockLogFlags( array $data, $type ) {
842 global $wgBlockAllowsUTEdit;
845 # when blocking a user the option 'anononly' is not available/has no effect -> do not write this into log
846 if( !$data['HardBlock'] && $type != Block
::TYPE_USER
){
847 // For grepping: message block-log-flags-anononly
848 $flags[] = 'anononly';
851 if( $data['CreateAccount'] ){
852 // For grepping: message block-log-flags-nocreate
853 $flags[] = 'nocreate';
856 # Same as anononly, this is not displayed when blocking an IP address
857 if( !$data['AutoBlock'] && $type == Block
::TYPE_USER
){
858 // For grepping: message block-log-flags-noautoblock
859 $flags[] = 'noautoblock';
862 if( $data['DisableEmail'] ){
863 // For grepping: message block-log-flags-noemail
864 $flags[] = 'noemail';
867 if( $wgBlockAllowsUTEdit && $data['DisableUTEdit'] ){
868 // For grepping: message block-log-flags-nousertalk
869 $flags[] = 'nousertalk';
872 if( $data['HideUser'] ){
873 // For grepping: message block-log-flags-hiddenname
874 $flags[] = 'hiddenname';
877 return implode( ',', $flags );
882 class IPBlockForm
extends SpecialBlock
{}