Handle invalid grouppage on Special:Statistics
[lhc/web/wiklou.git] / includes / specials / SpecialBlock.php
index 3297c17..1d4a860 100644 (file)
@@ -98,13 +98,14 @@ class SpecialBlock extends FormSpecialPage {
                $form->setWrapperLegendMsg( 'blockip-legend' );
                $form->setHeaderText( '' );
                $form->setSubmitCallback( array( __CLASS__, 'processUIForm' ) );
+               $form->setSubmitDestructive();
 
                $msg = $this->alreadyBlocked ? 'ipb-change-block' : 'ipbsubmit';
                $form->setSubmitTextMsg( $msg );
 
                # Don't need to do anything if the form has been posted
                if ( !$this->getRequest()->wasPosted() && $this->preErrors ) {
-                       $s = HTMLForm::formatErrors( $this->preErrors );
+                       $s = $form->formatErrors( $this->preErrors );
                        if ( $s ) {
                                $form->addHeaderText( Html::rawElement(
                                        'div',
@@ -135,6 +136,7 @@ class SpecialBlock extends FormSpecialPage {
                                'autofocus' => true,
                                'required' => true,
                                'validation-callback' => array( __CLASS__, 'validateTargetField' ),
+                               'cssclass' => 'mw-autocomplete-user', // used by mediawiki.userSuggest
                        ),
                        'Expiry' => array(
                                'type' => !count( $suggestedDurations ) ? 'text' : 'selectorother',
@@ -146,6 +148,7 @@ class SpecialBlock extends FormSpecialPage {
                        ),
                        'Reason' => array(
                                'type' => 'selectandother',
+                               'maxlength' => 255,
                                'label-message' => 'ipbreason',
                                'options-message' => 'ipbreason-dropdown',
                        ),
@@ -217,7 +220,7 @@ class SpecialBlock extends FormSpecialPage {
                $this->maybeAlterFormDefaults( $a );
 
                // Allow extensions to add more fields
-               wfRunHooks( 'SpecialBlockModifyFormFields', array( $this, &$a ) );
+               Hooks::run( 'SpecialBlockModifyFormFields', array( $this, &$a ) );
 
                return $a;
        }
@@ -307,14 +310,14 @@ class SpecialBlock extends FormSpecialPage {
         * @return string
         */
        protected function preText() {
-               $this->getOutput()->addModules( 'mediawiki.special.block' );
+               $this->getOutput()->addModules( array( 'mediawiki.special.block', 'mediawiki.userSuggest' ) );
 
                $text = $this->msg( 'blockiptext' )->parse();
 
                $otherBlockMessages = array();
                if ( $this->target !== null ) {
                        # Get other blocks, i.e. from GlobalBlocking or TorBlock extension
-                       wfRunHooks( 'OtherBlockLogLink', array( &$otherBlockMessages, $this->target ) );
+                       Hooks::run( 'OtherBlockLogLink', array( &$otherBlockMessages, $this->target ) );
 
                        if ( count( $otherBlockMessages ) ) {
                                $s = Html::rawElement(
@@ -623,7 +626,7 @@ class SpecialBlock extends FormSpecialPage {
                        # permission anyway, although the code does allow for it.
                        # Note: Important to use $target instead of $data['Target']
                        # since both $data['PreviousTarget'] and $target are normalized
-                       # but $data['target'] gets overriden by (non-normalized) request variable
+                       # but $data['target'] gets overridden by (non-normalized) request variable
                        # from previous request.
                        if ( $target === $performer->getName() &&
                                ( $data['PreviousTarget'] !== $target || !$data['Confirm'] )
@@ -698,7 +701,7 @@ class SpecialBlock extends FormSpecialPage {
                $block->mHideName = $data['HideUser'];
 
                $reason = array( 'hookaborted' );
-               if ( !wfRunHooks( 'BlockIp', array( &$block, &$performer, &$reason ) ) ) {
+               if ( !Hooks::run( 'BlockIp', array( &$block, &$performer, &$reason ) ) ) {
                        return $reason;
                }
 
@@ -759,7 +762,7 @@ class SpecialBlock extends FormSpecialPage {
                        $logaction = 'block';
                }
 
-               wfRunHooks( 'BlockIpComplete', array( $block, $performer ) );
+               Hooks::run( 'BlockIpComplete', array( $block, $performer ) );
 
                # Set *_deleted fields if requested
                if ( $data['HideUser'] ) {
@@ -826,7 +829,7 @@ class SpecialBlock extends FormSpecialPage {
                        }
 
                        list( $show, $value ) = explode( ':', $option );
-                       $a[htmlspecialchars( $show )] = htmlspecialchars( $value );
+                       $a[$show] = $value;
                }
 
                return $a;