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 FormSpecialPage
{
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' );
59 * Checks that the user can unblock themselves if they are trying to do so
62 * @throws ErrorPageError
64 protected function checkExecutePermissions( User
$user ) {
65 parent
::checkExecutePermissions( $user );
67 # bug 15810: blocked admins should have limited access here
68 $status = self
::checkUnblockSelf( $this->target
, $user );
69 if ( $status !== true ) {
70 throw new ErrorPageError( 'badaccess', $status );
75 * Handle some magic here
79 protected function setParameter( $par ) {
80 # Extract variables from the request. Try not to get into a situation where we
81 # need to extract *every* variable from the form just for processing here, but
82 # there are legitimate uses for some variables
83 $request = $this->getRequest();
84 list( $this->target
, $this->type
) = self
::getTargetAndType( $par, $request );
85 if ( $this->target
instanceof User
) {
86 # Set the 'relevant user' in the skin, so it displays links like Contributions,
87 # User logs, UserRights, etc.
88 $this->getSkin()->setRelevantUser( $this->target
);
91 list( $this->previousTarget
, /*...*/ ) = Block
::parseTarget( $request->getVal( 'wpPreviousTarget' ) );
92 $this->requestedHideUser
= $request->getBool( 'wpHideUser' );
96 * Customizes the HTMLForm a bit
98 * @param $form HTMLForm
100 protected function alterForm( HTMLForm
$form ) {
101 $form->setWrapperLegendMsg( 'blockip-legend' );
102 $form->setHeaderText( '' );
103 $form->setSubmitCallback( array( __CLASS__
, 'processUIForm' ) );
105 $msg = $this->alreadyBlocked ?
'ipb-change-block' : 'ipbsubmit';
106 $form->setSubmitTextMsg( $msg );
108 # Don't need to do anything if the form has been posted
109 if( !$this->getRequest()->wasPosted() && $this->preErrors
){
110 $s = HTMLForm
::formatErrors( $this->preErrors
);
112 $form->addHeaderText( Html
::rawElement(
114 array( 'class' => 'error' ),
122 * Get the HTMLForm descriptor array for the block form
125 protected function getFormFields(){
126 global $wgBlockAllowsUTEdit;
128 $user = $this->getUser();
133 'label-message' => 'ipadressorusername',
135 'id' => 'mw-bi-target',
138 'validation-callback' => array( __CLASS__
, 'validateTargetField' ),
141 'type' => !count( self
::getSuggestedDurations() ) ?
'text' : 'selectorother',
142 'label-message' => 'ipbexpiry',
145 'options' => self
::getSuggestedDurations(),
146 'other' => $this->msg( 'ipbother' )->text(),
149 'type' => 'selectandother',
150 'label-message' => 'ipbreason',
151 'options-message' => 'ipbreason-dropdown',
153 'CreateAccount' => array(
155 'label-message' => 'ipbcreateaccount',
160 if( self
::canBlockEmail( $user ) ) {
161 $a['DisableEmail'] = array(
163 'label-message' => 'ipbemailban',
167 if( $wgBlockAllowsUTEdit ){
168 $a['DisableUTEdit'] = array(
170 'label-message' => 'ipb-disableusertalk',
175 $a['AutoBlock'] = array(
177 'label-message' => 'ipbenableautoblock',
181 # Allow some users to hide name from block log, blocklist and listusers
182 if( $user->isAllowed( 'hideuser' ) ) {
183 $a['HideUser'] = array(
185 'label-message' => 'ipbhidename',
186 'cssclass' => 'mw-block-hideuser',
190 # Watchlist their user page? (Only if user is logged in)
191 if( $user->isLoggedIn() ) {
194 'label-message' => 'ipbwatchuser',
198 $a['HardBlock'] = array(
200 'label-message' => 'ipb-hardblock',
204 # This is basically a copy of the Target field, but the user can't change it, so we
205 # can see if the warnings we maybe showed to the user before still apply
206 $a['PreviousTarget'] = array(
211 # We'll turn this into a checkbox if we need to
212 $a['Confirm'] = array(
215 'label-message' => 'ipb-confirm',
218 $this->maybeAlterFormDefaults( $a );
224 * If the user has already been blocked with similar settings, load that block
225 * and change the defaults for the form fields to match the existing settings.
226 * @param $fields Array HTMLForm descriptor array
227 * @return Bool whether fields were altered (that is, whether the target is
230 protected function maybeAlterFormDefaults( &$fields ){
231 # This will be overwritten by request data
232 $fields['Target']['default'] = (string)$this->target
;
235 $fields['PreviousTarget']['default'] = (string)$this->target
;
237 $block = Block
::newFromTarget( $this->target
);
239 if( $block instanceof Block
&& !$block->mAuto
# The block exists and isn't an autoblock
240 && ( $this->type
!= Block
::TYPE_RANGE
# The block isn't a rangeblock
241 ||
$block->getTarget() == $this->target
) # or if it is, the range is what we're about to block
244 $fields['HardBlock']['default'] = $block->isHardblock();
245 $fields['CreateAccount']['default'] = $block->prevents( 'createaccount' );
246 $fields['AutoBlock']['default'] = $block->isAutoblocking();
248 if( isset( $fields['DisableEmail'] ) ){
249 $fields['DisableEmail']['default'] = $block->prevents( 'sendemail' );
252 if( isset( $fields['HideUser'] ) ){
253 $fields['HideUser']['default'] = $block->mHideName
;
256 if( isset( $fields['DisableUTEdit'] ) ){
257 $fields['DisableUTEdit']['default'] = $block->prevents( 'editownusertalk' );
260 $fields['Reason']['default'] = $block->mReason
;
262 if( $this->getRequest()->wasPosted() ){
263 # Ok, so we got a POST submission asking us to reblock a user. So show the
264 # confirm checkbox; the user will only see it if they haven't previously
265 $fields['Confirm']['type'] = 'check';
267 # We got a target, but it wasn't a POST request, so the user must have gone
268 # to a link like [[Special:Block/User]]. We don't need to show the checkbox
269 # as long as they go ahead and block *that* user
270 $fields['Confirm']['default'] = 1;
273 if( $block->mExpiry
== 'infinity' ) {
274 $fields['Expiry']['default'] = 'indefinite';
276 $fields['Expiry']['default'] = wfTimestamp( TS_RFC2822
, $block->mExpiry
);
279 $this->alreadyBlocked
= true;
280 $this->preErrors
[] = array( 'ipb-needreblock', (string)$block->getTarget() );
283 # We always need confirmation to do HideUser
284 if( $this->requestedHideUser
){
285 $fields['Confirm']['type'] = 'check';
286 unset( $fields['Confirm']['default'] );
287 $this->preErrors
[] = 'ipb-confirmhideuser';
290 # Or if the user is trying to block themselves
291 if( (string)$this->target
=== $this->getUser()->getName() ){
292 $fields['Confirm']['type'] = 'check';
293 unset( $fields['Confirm']['default'] );
294 $this->preErrors
[] = 'ipb-blockingself';
299 * Add header elements like block log entries, etc.
302 protected function preText(){
303 $text = $this->msg( 'blockiptext' )->parse();
305 $otherBlockMessages = array();
306 if( $this->target
!== null ) {
307 # Get other blocks, i.e. from GlobalBlocking or TorBlock extension
308 wfRunHooks( 'OtherBlockLogLink', array( &$otherBlockMessages, $this->target
) );
310 if( count( $otherBlockMessages ) ) {
311 $s = Html
::rawElement(
314 $this->msg( 'ipb-otherblocks-header', count( $otherBlockMessages ) )->parse()
319 foreach( $otherBlockMessages as $link ) {
320 $list .= Html
::rawElement( 'li', array(), $link ) . "\n";
323 $s .= Html
::rawElement(
325 array( 'class' => 'mw-blockip-alreadyblocked' ),
337 * Add footer elements to the form
340 protected function postText(){
341 # Link to the user's contributions, if applicable
342 if( $this->target
instanceof User
){
343 $contribsPage = SpecialPage
::getTitleFor( 'Contributions', $this->target
->getName() );
344 $links[] = Linker
::link(
346 $this->msg( 'ipb-blocklist-contribs', $this->target
->getName() )->escaped()
350 # Link to unblock the specified user, or to a blank unblock form
351 if( $this->target
instanceof User
) {
352 $message = $this->msg( 'ipb-unblock-addr', $this->target
->getName() )->parse();
353 $list = SpecialPage
::getTitleFor( 'Unblock', $this->target
->getName() );
355 $message = $this->msg( 'ipb-unblock' )->parse();
356 $list = SpecialPage
::getTitleFor( 'Unblock' );
358 $links[] = Linker
::linkKnown( $list, $message, array() );
360 # Link to the block list
361 $links[] = Linker
::linkKnown(
362 SpecialPage
::getTitleFor( 'BlockList' ),
363 $this->msg( 'ipb-blocklist' )->escaped()
366 $user = $this->getUser();
368 # Link to edit the block dropdown reasons, if applicable
369 if ( $user->isAllowed( 'editinterface' ) ) {
370 $links[] = Linker
::link(
371 Title
::makeTitle( NS_MEDIAWIKI
, 'Ipbreason-dropdown' ),
372 $this->msg( 'ipb-edit-dropdown' )->escaped(),
374 array( 'action' => 'edit' )
378 $text = Html
::rawElement(
380 array( 'class' => 'mw-ipb-conveniencelinks' ),
381 $this->getLanguage()->pipeList( $links )
384 if( $this->target
instanceof User
){
385 # Get relevant extracts from the block and suppression logs, if possible
386 $userpage = $this->target
->getUserPage();
389 LogEventsList
::showLogExtract(
396 'msgKey' => array( 'blocklog-showlog', $userpage->getText() ),
397 'showIfEmpty' => false
402 # Add suppression block entries if allowed
403 if( $user->isAllowed( 'suppressionlog' ) ) {
404 LogEventsList
::showLogExtract(
411 'conds' => array( 'log_action' => array( 'block', 'reblock', 'unblock' ) ),
412 'msgKey' => array( 'blocklog-showsuppresslog', $userpage->getText() ),
413 'showIfEmpty' => false
425 * Determine the target of the block, and the type of target
426 * TODO: should be in Block.php?
427 * @param $par String subpage parameter passed to setup, or data value from
429 * @param $request WebRequest optionally try and get data from a request too
430 * @return array( User|string|null, Block::TYPE_ constant|null )
432 public static function getTargetAndType( $par, WebRequest
$request = null ){
439 # The HTMLForm will check wpTarget first and only if it doesn't get
440 # a value use the default, which will be generated from the options
441 # below; so this has to have a higher precedence here than $par, or
442 # we could end up with different values in $this->target and the HTMLForm!
443 if( $request instanceof WebRequest
){
444 $target = $request->getText( 'wpTarget', null );
451 if( $request instanceof WebRequest
){
452 $target = $request->getText( 'ip', null );
457 if( $request instanceof WebRequest
){
458 $target = $request->getText( 'wpBlockAddress', null );
465 list( $target, $type ) = Block
::parseTarget( $target );
467 if( $type !== null ){
468 return array( $target, $type );
472 return array( null, null );
476 * HTMLForm field validation-callback for Target field.
478 * @param $value String
479 * @param $alldata Array
480 * @param $form HTMLForm
483 public static function validateTargetField( $value, $alldata, $form ) {
484 global $wgBlockCIDRLimit;
486 list( $target, $type ) = self
::getTargetAndType( $value );
488 if( $type == Block
::TYPE_USER
){
489 # TODO: why do we not have a User->exists() method?
490 if( !$target->getId() ){
491 return $form->msg( 'nosuchusershort',
492 wfEscapeWikiText( $target->getName() ) );
495 $status = self
::checkUnblockSelf( $target, $form->getUser() );
496 if ( $status !== true ) {
497 return $form->msg( 'badaccess', $status );
500 } elseif( $type == Block
::TYPE_RANGE
){
501 list( $ip, $range ) = explode( '/', $target, 2 );
503 if( ( IP
::isIPv4( $ip ) && $wgBlockCIDRLimit['IPv4'] == 32 )
504 ||
( IP
::isIPv6( $ip ) && $wgBlockCIDRLimit['IPv6'] == 128 ) )
506 # Range block effectively disabled
507 return $form->msg( 'range_block_disabled' );
510 if( ( IP
::isIPv4( $ip ) && $range > 32 )
511 ||
( IP
::isIPv6( $ip ) && $range > 128 ) )
514 return $form->msg( 'ip_range_invalid' );
517 if( IP
::isIPv4( $ip ) && $range < $wgBlockCIDRLimit['IPv4'] ) {
518 return $form->msg( 'ip_range_toolarge', $wgBlockCIDRLimit['IPv4'] );
521 if( IP
::isIPv6( $ip ) && $range < $wgBlockCIDRLimit['IPv6'] ) {
522 return $form->msg( 'ip_range_toolarge', $wgBlockCIDRLimit['IPv6'] );
524 } elseif( $type == Block
::TYPE_IP
){
527 return $form->msg( 'badipaddress' );
534 * Submit callback for an HTMLForm object, will simply pass
536 * @param $form HTMLForm
537 * @return Bool|String
539 public static function processUIForm( array $data, HTMLForm
$form ) {
540 return self
::processForm( $data, $form->getContext() );
544 * Given the form data, actually implement a block
546 * @param $context IContextSource
547 * @return Bool|String
549 public static function processForm( array $data, IContextSource
$context ){
550 global $wgBlockAllowsUTEdit;
552 $performer = $context->getUser();
554 // Handled by field validator callback
555 // self::validateTargetField( $data['Target'] );
557 # This might have been a hidden field or a checkbox, so interesting data
559 $data['Confirm'] = !in_array( $data['Confirm'], array( '', '0', null, false ), true );
561 list( $target, $type ) = self
::getTargetAndType( $data['Target'] );
562 if( $type == Block
::TYPE_USER
){
564 $target = $user->getName();
565 $userId = $user->getId();
567 # Give admins a heads-up before they go and block themselves. Much messier
568 # to do this for IPs, but it's pretty unlikely they'd ever get the 'block'
569 # permission anyway, although the code does allow for it.
570 # Note: Important to use $target instead of $data['Target']
571 # since both $data['PreviousTarget'] and $target are normalized
572 # but $data['target'] gets overriden by (non-normalized) request variable
573 # from previous request.
574 if( $target === $performer->getName() &&
575 ( $data['PreviousTarget'] !== $target ||
!$data['Confirm'] ) )
577 return array( 'ipb-blockingself' );
579 } elseif( $type == Block
::TYPE_RANGE
){
581 } elseif( $type == Block
::TYPE_IP
){
582 $target = $target->getName();
585 # This should have been caught in the form field validation
586 return array( 'badipaddress' );
589 if( ( strlen( $data['Expiry'] ) == 0) ||
( strlen( $data['Expiry'] ) > 50 )
590 ||
!self
::parseExpiryInput( $data['Expiry'] ) )
592 return array( 'ipb_expiry_invalid' );
595 if( !isset( $data['DisableEmail'] ) ){
596 $data['DisableEmail'] = false;
599 # If the user has done the form 'properly', they won't even have been given the
600 # option to suppress-block unless they have the 'hideuser' permission
601 if( !isset( $data['HideUser'] ) ){
602 $data['HideUser'] = false;
605 if( $data['HideUser'] ) {
606 if( !$performer->isAllowed('hideuser') ){
607 # this codepath is unreachable except by a malicious user spoofing forms,
608 # or by race conditions (user has oversight and sysop, loads block form,
609 # and is de-oversighted before submission); so need to fail completely
610 # rather than just silently disable hiding
611 return array( 'badaccess-group0' );
614 # Recheck params here...
615 if( $type != Block
::TYPE_USER
) {
616 $data['HideUser'] = false; # IP users should not be hidden
617 } elseif( !in_array( $data['Expiry'], array( 'infinite', 'infinity', 'indefinite' ) ) ) {
619 return array( 'ipb_expiry_temp' );
620 } elseif( $user->getEditCount() > self
::HIDEUSER_CONTRIBLIMIT
) {
621 # Typically, the user should have a handful of edits.
622 # Disallow hiding users with many edits for performance.
623 return array( 'ipb_hide_invalid' );
624 } elseif( !$data['Confirm'] ){
625 return array( 'ipb-confirmhideuser' );
629 # Create block object.
630 $block = new Block();
631 $block->setTarget( $target );
632 $block->setBlocker( $performer );
633 $block->mReason
= $data['Reason'][0];
634 $block->mExpiry
= self
::parseExpiryInput( $data['Expiry'] );
635 $block->prevents( 'createaccount', $data['CreateAccount'] );
636 $block->prevents( 'editownusertalk', ( !$wgBlockAllowsUTEdit ||
$data['DisableUTEdit'] ) );
637 $block->prevents( 'sendemail', $data['DisableEmail'] );
638 $block->isHardblock( $data['HardBlock'] );
639 $block->isAutoblocking( $data['AutoBlock'] );
640 $block->mHideName
= $data['HideUser'];
642 if( !wfRunHooks( 'BlockIp', array( &$block, &$performer ) ) ) {
643 return array( 'hookaborted' );
646 # Try to insert block. Is there a conflicting block?
647 $status = $block->insert();
649 # Show form unless the user is already aware of this...
650 if( !$data['Confirm'] ||
( array_key_exists( 'PreviousTarget', $data )
651 && $data['PreviousTarget'] !== $target ) )
653 return array( array( 'ipb_already_blocked', $block->getTarget() ) );
654 # Otherwise, try to update the block...
656 # This returns direct blocks before autoblocks/rangeblocks, since we should
657 # be sure the user is blocked by now it should work for our purposes
658 $currentBlock = Block
::newFromTarget( $target );
660 if( $block->equals( $currentBlock ) ) {
661 return array( array( 'ipb_already_blocked', $block->getTarget() ) );
664 # If the name was hidden and the blocking user cannot hide
665 # names, then don't allow any block changes...
666 if( $currentBlock->mHideName
&& !$performer->isAllowed( 'hideuser' ) ) {
667 return array( 'cant-see-hidden-user' );
670 $currentBlock->delete();
671 $status = $block->insert();
672 $logaction = 'reblock';
674 # Unset _deleted fields if requested
675 if( $currentBlock->mHideName
&& !$data['HideUser'] ) {
676 RevisionDeleteUser
::unsuppressUserName( $target, $userId );
679 # If hiding/unhiding a name, this should go in the private logs
680 if( (bool)$currentBlock->mHideName
){
681 $data['HideUser'] = true;
685 $logaction = 'block';
688 wfRunHooks( 'BlockIpComplete', array( $block, $performer ) );
690 # Set *_deleted fields if requested
691 if( $data['HideUser'] ) {
692 RevisionDeleteUser
::suppressUserName( $target, $userId );
695 # Can't watch a rangeblock
696 if( $type != Block
::TYPE_RANGE
&& $data['Watch'] ) {
697 $performer->addWatch( Title
::makeTitle( NS_USER
, $target ) );
700 # Block constructor sanitizes certain block options on insert
701 $data['BlockEmail'] = $block->prevents( 'sendemail' );
702 $data['AutoBlock'] = $block->isAutoblocking();
704 # Prepare log parameters
705 $logParams = array();
706 $logParams[] = $data['Expiry'];
707 $logParams[] = self
::blockLogFlags( $data, $type );
709 # Make log entry, if the name is hidden, put it in the oversight log
710 $log_type = $data['HideUser'] ?
'suppress' : 'block';
711 $log = new LogPage( $log_type );
712 $log_id = $log->addEntry(
714 Title
::makeTitle( NS_USER
, $target ),
718 # Relate log ID to block IDs (bug 25763)
719 $blockIds = array_merge( array( $status['id'] ), $status['autoIds'] );
720 $log->addRelations( 'ipb_id', $blockIds, $log_id );
727 * Get an array of suggested block durations from MediaWiki:Ipboptions
728 * @todo FIXME: This uses a rather odd syntax for the options, should it be converted
729 * to the standard "**<duration>|<displayname>" format?
730 * @param $lang Language|null the language to get the durations in, or null to use
731 * the wiki's content language
734 public static function getSuggestedDurations( $lang = null ){
736 $msg = $lang === null
737 ?
wfMessage( 'ipboptions' )->inContentLanguage()->text()
738 : wfMessage( 'ipboptions' )->inLanguage( $lang )->text();
744 foreach( explode( ',', $msg ) as $option ) {
745 if( strpos( $option, ':' ) === false ){
746 $option = "$option:$option";
749 list( $show, $value ) = explode( ':', $option );
750 $a[htmlspecialchars( $show )] = htmlspecialchars( $value );
757 * Convert a submitted expiry time, which may be relative ("2 weeks", etc) or absolute
758 * ("24 May 2034", etc), into an absolute timestamp we can put into the database.
759 * @param $expiry String: whatever was typed into the form
760 * @return String: timestamp or "infinity" string for the DB implementation
762 public static function parseExpiryInput( $expiry ) {
764 if( $infinity == null ){
765 $infinity = wfGetDB( DB_SLAVE
)->getInfinity();
768 if ( $expiry == 'infinite' ||
$expiry == 'indefinite' ) {
771 $expiry = strtotime( $expiry );
773 if ( $expiry < 0 ||
$expiry === false ) {
777 $expiry = wfTimestamp( TS_MW
, $expiry );
784 * Can we do an email block?
785 * @param $user User: the sysop wanting to make a block
788 public static function canBlockEmail( $user ) {
789 global $wgEnableUserEmail, $wgSysopEmailBans;
791 return ( $wgEnableUserEmail && $wgSysopEmailBans && $user->isAllowed( 'blockemail' ) );
795 * bug 15810: blocked admins should not be able to block/unblock
796 * others, and probably shouldn't be able to unblock themselves
798 * @param $user User|Int|String
799 * @param $performer User user doing the request
800 * @return Bool|String true or error message key
802 public static function checkUnblockSelf( $user, User
$performer ) {
803 if ( is_int( $user ) ) {
804 $user = User
::newFromId( $user );
805 } elseif ( is_string( $user ) ) {
806 $user = User
::newFromName( $user );
809 if( $performer->isBlocked() ){
810 if( $user instanceof User
&& $user->getId() == $performer->getId() ) {
811 # User is trying to unblock themselves
812 if ( $performer->isAllowed( 'unblockself' ) ) {
814 # User blocked themselves and is now trying to reverse it
815 } elseif ( $performer->blockedBy() === $performer->getName() ) {
818 return 'ipbnounblockself';
821 # User is trying to block/unblock someone else
830 * Return a comma-delimited list of "flags" to be passed to the log
831 * reader for this block, to provide more information in the logs
832 * @param $data Array from HTMLForm data
833 * @param $type Block::TYPE_ constant (USER, RANGE, or IP)
836 protected static function blockLogFlags( array $data, $type ) {
837 global $wgBlockAllowsUTEdit;
840 # when blocking a user the option 'anononly' is not available/has no effect -> do not write this into log
841 if( !$data['HardBlock'] && $type != Block
::TYPE_USER
){
842 // For grepping: message block-log-flags-anononly
843 $flags[] = 'anononly';
846 if( $data['CreateAccount'] ){
847 // For grepping: message block-log-flags-nocreate
848 $flags[] = 'nocreate';
851 # Same as anononly, this is not displayed when blocking an IP address
852 if( !$data['AutoBlock'] && $type == Block
::TYPE_USER
){
853 // For grepping: message block-log-flags-noautoblock
854 $flags[] = 'noautoblock';
857 if( $data['DisableEmail'] ){
858 // For grepping: message block-log-flags-noemail
859 $flags[] = 'noemail';
862 if( $wgBlockAllowsUTEdit && $data['DisableUTEdit'] ){
863 // For grepping: message block-log-flags-nousertalk
864 $flags[] = 'nousertalk';
867 if( $data['HideUser'] ){
868 // For grepping: message block-log-flags-hiddenname
869 $flags[] = 'hiddenname';
872 return implode( ',', $flags );
876 * Process the form on POST submission.
878 * @return Bool|Array true for success, false for didn't-try, array of errors on failure
880 public function onSubmit( array $data ) {
881 // This isn't used since we need that HTMLForm that's passed in the
882 // second parameter. See alterForm for the real function
886 * Do something exciting on successful processing of the form, most likely to show a
887 * confirmation message
889 public function onSuccess() {
890 $out = $this->getOutput();
891 $out->setPageTitle( $this->msg( 'blockipsuccesssub' ) );
892 $out->addWikiMsg( 'blockipsuccesstext', $this->target
);
897 class IPBlockForm
extends SpecialBlock
{}