Merge "(bug 42787) Make import robust against corrupt content."
[lhc/web/wiklou.git] / includes / specials / SpecialUnblock.php
index e38d1c2..853a805 100644 (file)
@@ -1,5 +1,7 @@
 <?php
 /**
+ * Implements Special:Unblock
+ *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
@@ -35,16 +37,8 @@ class SpecialUnblock extends SpecialPage {
        }
 
        public function execute( $par ){
-               # Check permissions
-               if( !$this->userCanExecute( $this->getUser() ) ) {
-                       $this->displayRestrictionError();
-                       return;
-               }
-
-               # Check for database lock
-               if( wfReadOnly() ) {
-                       throw new ReadOnlyError;
-               }
+               $this->checkPermissions();
+               $this->checkReadOnly();
 
                list( $this->target, $this->type ) = SpecialBlock::getTargetAndType( $par, $this->getRequest() );
                $this->block = Block::newFromTarget( $this->target );
@@ -57,23 +51,23 @@ class SpecialUnblock extends SpecialPage {
                $out->addModules( 'mediawiki.special' );
 
                $form = new HTMLForm( $this->getFields(), $this->getContext() );
-               $form->setWrapperLegend( wfMsg( 'unblockip' ) );
+               $form->setWrapperLegendMsg( 'unblockip' );
                $form->setSubmitCallback( array( __CLASS__, 'processUIUnblock' ) );
-               $form->setSubmitText( wfMsg( 'ipusubmit' ) );
-               $form->addPreText( wfMsgExt( 'unblockiptext', 'parse' ) );
+               $form->setSubmitTextMsg( 'ipusubmit' );
+               $form->addPreText( $this->msg( 'unblockiptext' )->parseAsBlock() );
 
                if( $form->show() ){
                        switch( $this->type ){
                                case Block::TYPE_USER:
                                case Block::TYPE_IP:
-                                       $out->addWikiMsg( 'unblocked',  $this->target );
+                                       $out->addWikiMsg( 'unblocked', wfEscapeWikiText( $this->target ) );
                                        break;
                                case Block::TYPE_RANGE:
-                                       $out->addWikiMsg( 'unblocked-range', $this->target );
+                                       $out->addWikiMsg( 'unblocked-range', wfEscapeWikiText( $this->target ) );
                                        break;
                                case Block::TYPE_ID:
                                case Block::TYPE_AUTO:
-                                       $out->addWikiMsg( 'unblocked-id', $this->target );
+                                       $out->addWikiMsg( 'unblocked-id', wfEscapeWikiText( $this->target ) );
                                        break;
                        }
                }
@@ -144,6 +138,7 @@ class SpecialUnblock extends SpecialPage {
 
        /**
         * Submit callback for an HTMLForm object
+        * @return Array( Array(message key, parameters)
         */
        public static function processUIUnblock( array $data, HTMLForm $form ) {
                return self::processUnblock( $data, $form->getContext() );
@@ -154,6 +149,7 @@ class SpecialUnblock extends SpecialPage {
         *
         * @param $data Array
         * @param $context IContextSource
+        * @throws ErrorPageError
         * @return Array( Array(message key, parameters) ) on failure, True on success
         */
        public static function processUnblock( array $data, IContextSource $context ){