Merge "Add parser tests about building table with {{!}}"
[lhc/web/wiklou.git] / includes / specials / SpecialBlock.php
index 007850b..3297c17 100644 (file)
@@ -28,7 +28,7 @@
  * @ingroup SpecialPage
  */
 class SpecialBlock extends FormSpecialPage {
-       /** @var User user to be blocked, as passed either by parameter (url?wpTarget=Foo)
+       /** @var User User to be blocked, as passed either by parameter (url?wpTarget=Foo)
         * or as subpage (Special:Block/Foo) */
        protected $target;
 
@@ -130,7 +130,6 @@ class SpecialBlock extends FormSpecialPage {
                        'Target' => array(
                                'type' => 'text',
                                'label-message' => 'ipaddressorusername',
-                               'tabindex' => '1',
                                'id' => 'mw-bi-target',
                                'size' => '45',
                                'autofocus' => true,
@@ -141,7 +140,6 @@ class SpecialBlock extends FormSpecialPage {
                                'type' => !count( $suggestedDurations ) ? 'text' : 'selectorother',
                                'label-message' => 'ipbexpiry',
                                'required' => true,
-                               'tabindex' => '2',
                                'options' => $suggestedDurations,
                                'other' => $this->msg( 'ipbother' )->text(),
                                'default' => $this->msg( 'ipb-default-expiry' )->inContentLanguage()->text(),
@@ -456,7 +454,7 @@ class SpecialBlock extends FormSpecialPage {
        /**
         * Determine the target of the block, and the type of target
         * @todo Should be in Block.php?
-        * @param string $par subpage parameter passed to setup, or data value from
+        * @param string $par Subpage parameter passed to setup, or data value from
         *     the HTMLForm
         * @param WebRequest $request Optionally try and get data from a request too
         * @return array( User|string|null, Block::TYPE_ constant|null )
@@ -602,7 +600,7 @@ class SpecialBlock extends FormSpecialPage {
         * @return bool|string
         */
        public static function processForm( array $data, IContextSource $context ) {
-               global $wgBlockAllowsUTEdit, $wgHideUserContribLimit;
+               global $wgBlockAllowsUTEdit, $wgHideUserContribLimit, $wgContLang;
 
                $performer = $context->getUser();
 
@@ -689,7 +687,8 @@ class SpecialBlock extends FormSpecialPage {
                $block = new Block();
                $block->setTarget( $target );
                $block->setBlocker( $performer );
-               $block->mReason = $data['Reason'][0];
+               # Truncate reason for whole multibyte characters
+               $block->mReason = $wgContLang->truncate( $data['Reason'][0], 255 );
                $block->mExpiry = self::parseExpiryInput( $data['Expiry'] );
                $block->prevents( 'createaccount', $data['CreateAccount'] );
                $block->prevents( 'editownusertalk', ( !$wgBlockAllowsUTEdit || $data['DisableUTEdit'] ) );
@@ -977,7 +976,3 @@ class SpecialBlock extends FormSpecialPage {
                return 'users';
        }
 }
-
-# BC @since 1.18
-class IPBlockForm extends SpecialBlock {
-}