Merge "API: Make jsonfm the default output format"
[lhc/web/wiklou.git] / includes / specials / SpecialBlock.php
index f8b2e8d..cf82b86 100644 (file)
@@ -98,6 +98,7 @@ 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 );
@@ -600,7 +601,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();
 
@@ -687,7 +688,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'] ) );