Merge "Convert Special:AllMessages to use OOUI"
[lhc/web/wiklou.git] / includes / specials / SpecialMovepage.php
index 5cbad8a..599ab31 100644 (file)
@@ -122,7 +122,7 @@ class MovePageForm extends UnlistedSpecialPage {
                $this->moveOverShared = $request->getBool( 'wpMoveOverSharedFile' );
                $this->watch = $request->getCheck( 'wpWatch' ) && $user->isLoggedIn();
 
-               if ( 'submit' == $request->getVal( 'action' ) && $request->wasPosted()
+               if ( $request->getVal( 'action' ) == 'submit' && $request->wasPosted()
                        && $user->matchEditToken( $request->getVal( 'wpEditToken' ) )
                ) {
                        $this->doSubmit();
@@ -137,8 +137,9 @@ class MovePageForm extends UnlistedSpecialPage {
         * @param array $err Error messages. Each item is an error message.
         *    It may either be a string message name or array message name and
         *    parameters, like the second argument to OutputPage::wrapWikiMsg().
+        * @param bool $isPermError Whether the error message is about user permissions.
         */
-       function showForm( $err ) {
+       function showForm( $err, $isPermError = false ) {
                $this->getSkin()->setRelevantTitle( $this->oldTitle );
 
                $out = $this->getOutput();
@@ -235,9 +236,13 @@ class MovePageForm extends UnlistedSpecialPage {
                }
 
                if ( count( $err ) ) {
-                       $action_desc = $this->msg( 'action-move' )->plain();
-                       $errMsgHtml = $this->msg( 'permissionserrorstext-withaction',
-                               count( $err ), $action_desc )->parseAsBlock();
+                       if ( $isPermError ) {
+                               $action_desc = $this->msg( 'action-move' )->plain();
+                               $errMsgHtml = $this->msg( 'permissionserrorstext-withaction',
+                                       count( $err ), $action_desc )->parseAsBlock();
+                       } else {
+                               $errMsgHtml = $this->msg( 'cannotmove', count( $err ) )->parseAsBlock();
+                       }
 
                        if ( count( $err ) == 1 ) {
                                $errMsg = $err[0];
@@ -542,7 +547,7 @@ class MovePageForm extends UnlistedSpecialPage {
                        $permErrors = $nt->getUserPermissionsErrors( 'delete', $user );
                        if ( count( $permErrors ) ) {
                                # Only show the first error
-                               $this->showForm( $permErrors );
+                               $this->showForm( $permErrors, true );
 
                                return;
                        }
@@ -596,7 +601,7 @@ class MovePageForm extends UnlistedSpecialPage {
 
                $permStatus = $mp->checkPermissions( $user, $this->reason );
                if ( !$permStatus->isOK() ) {
-                       $this->showForm( $permStatus->getErrorsArray() );
+                       $this->showForm( $permStatus->getErrorsArray(), true );
                        return;
                }