Pass in $join_conds
[lhc/web/wiklou.git] / includes / SpecialMovepage.php
index 7782554..33f043d 100644 (file)
@@ -66,7 +66,7 @@ class MovePageForm {
        }
 
        function showForm( $err, $hookErr = '' ) {
-               global $wgOut, $wgUser, $wgContLang;
+               global $wgOut, $wgUser;
 
                $ot = Title::newFromURL( $this->oldTitle );
                if( is_null( $ot ) ) {
@@ -74,8 +74,6 @@ class MovePageForm {
                        return;
                }
 
-               $start = $wgContLang->isRTL() ? 'right' : 'left';
-               $end = $wgContLang->isRTL() ? 'left' : 'right';
                $sk = $wgUser->getSkin();
 
                $oldTitleLink = $sk->makeLinkObj( $ot );
@@ -88,7 +86,6 @@ class MovePageForm {
                        # Show the current title as a default
                        # when the form is first opened.
                        $newTitle = $oldTitle;
-                       $encNewTitle = htmlspecialchars( $oldTitle );
                } else {
                        if( $err == '' ) {
                                $nt = Title::newFromURL( $this->newTitle );
@@ -103,7 +100,6 @@ class MovePageForm {
                                }
                        }
                        $newTitle = $this->newTitle;
-                       $encNewTitle = htmlspecialchars( $newTitle );
                }
 
                if ( $err == 'articleexists' && $wgUser->isAllowed( 'delete' ) ) {
@@ -113,7 +109,7 @@ class MovePageForm {
                        $confirm = "
                                <tr>
                                        <td></td>
-                                       <td>" .
+                                       <td class='mw-input'>" .
                                                Xml::checkLabel( wfMsg( 'delete_and_move_confirm' ), 'wpConfirm', 'wpConfirm' ) .
                                        "</td>
                                </tr>";
@@ -140,44 +136,42 @@ class MovePageForm {
                        $errMsg = "";
                        if( $err == 'hookaborted' ) {
                                $errMsg = "<p><strong class=\"error\">$hookErr</strong></p>\n";
+                       } else if (is_array($err)) {
+                               $errMsg = '<p><strong class="error">' . call_user_func_array( 'wfMsgWikiHtml', $err ) . "</strong></p>\n";
                        } else {
                                $errMsg = '<p><strong class="error">' . wfMsgWikiHtml( $err ) . "</strong></p>\n";
                        }
                        $wgOut->addHTML( $errMsg );
                }
 
-               $moveTalkChecked = $this->moveTalk ? ' checked="checked"' : '';
-
                $wgOut->addHTML(
                         Xml::openElement( 'form', array( 'method' => 'post', 'action' => $titleObj->getLocalURL( 'action=submit' ), 'id' => 'movepage' ) ) .
                         Xml::openElement( 'fieldset' ) .
                         Xml::element( 'legend', null, wfMsg( 'move-page-legend' ) ) .
                         Xml::openElement( 'table', array( 'border' => '0', 'id' => 'mw-movepage-table' ) ) .
                         "<tr>
-                               <td align='$end'>" .
+                               <td class='mw-label'>" .
                                        wfMsgHtml( 'movearticle' ) .
                                "</td>
-                               <td align='$start'>
+                               <td class='mw-input'>
                                        <strong>{$oldTitleLink}</strong>
                                </td>
                        </tr>
                        <tr>
-                               <td align='$end'>" .
+                               <td class='mw-label'>" .
                                        Xml::label( wfMsg( 'newtitle' ), 'wpNewTitle' ) .
                                "</td>
-                               <td align='$start'>" .
-                                       Xml::input( 'wpNewTitle', 40, $this->newTitle, array( 'type' => 'text', 'id' => 'wpNewTitle' ) ) .
+                               <td class='mw-input'>" .
+                                       Xml::input( 'wpNewTitle', 40, $newTitle, array( 'type' => 'text', 'id' => 'wpNewTitle' ) ) .
                                        Xml::hidden( 'wpOldTitle', $oldTitle ) .
                                "</td>
                        </tr>
                        <tr>
-                               <td align='$end' valign='top'><br />" .
+                               <td class='mw-label'>" .
                                        Xml::label( wfMsg( 'movereason' ), 'wpReason' ) .
                                "</td>
-                               <td align='$start' valign='top'><br />" .
-                                       Xml::openElement( 'textarea', array( 'name' => 'wpReason', 'id' => 'wpReason', 'cols' => 60, 'rows' => 2 ) ) .
-                                       htmlspecialchars( $this->reason ) .
-                                       Xml::closeElement( 'textarea' ) .
+                               <td class='mw-input'>" .
+                                       Xml::tags( 'textarea', array( 'name' => 'wpReason', 'id' => 'wpReason', 'cols' => 60, 'rows' => 2 ), htmlspecialchars( $this->reason ) ) .
                                "</td>
                        </tr>"
                );
@@ -186,8 +180,8 @@ class MovePageForm {
                        $wgOut->addHTML( "
                                <tr>
                                        <td></td>
-                                       <td>" . 
-                                               Xml::checkLabel( wfMsg( 'movetalk' ), 'wpMovetalk', 'wpMovetalk', $moveTalkChecked ) . 
+                                       <td class='mw-input'>" .
+                                               Xml::checkLabel( wfMsg( 'movetalk' ), 'wpMovetalk', 'wpMovetalk', $this->moveTalk ) .
                                        "</td>
                                </tr>"
                        );
@@ -197,14 +191,14 @@ class MovePageForm {
                $wgOut->addHTML( "
                        <tr>
                                <td></td>
-                               <td>" .
+                               <td class='mw-input'>" .
                                        Xml::checkLabel( wfMsg( 'move-watch' ), 'wpWatch', 'watch', $watchChecked ) .
                                "</td>
                        </tr>
                                {$confirm}
                        <tr>
                                <td>&nbsp;</td>
-                               <td align='$start'>" .
+                               <td class='mw-submit'>" .
                                        Xml::submitButton( $movepagebtn, array( 'name' => $submitVar ) ) .
                                "</td>
                        </tr>" .
@@ -235,6 +229,15 @@ class MovePageForm {
                # Delete to make way if requested
                if ( $wgUser->isAllowed( 'delete' ) && $this->deleteAndMove ) {
                        $article = new Article( $nt );
+
+                       # Disallow deletions of big articles
+                       $bigHistory = $article->isBigDeletion();
+                       if( $bigHistory && !$nt->userCan( 'bigdelete' ) ) {
+                               global $wgLang, $wgDeleteRevisionsLimit;
+                               $this->showForm( array('delete-toobig', $wgLang->formatNum( $wgDeleteRevisionsLimit ) ) );
+                               return;
+                       }
+
                        // This may output an error message and exit
                        $article->doDelete( wfMsgForContent( 'delete_and_move_reason' ) );
                }
@@ -336,9 +339,7 @@ class MovePageForm {
 
        function showLogFragment( $title, &$out ) {
                $out->addHTML( Xml::element( 'h2', NULL, LogPage::logName( 'move' ) ) );
-               $request = new FauxRequest( array( 'page' => $title->getPrefixedText(), 'type' => 'move' ) );
-               $viewer = new LogViewer( new LogReader( $request ) );
-               $viewer->showList( $out );
+               LogEventsList::showLogExtract( $out, 'move', $title->getPrefixedText() );
        }
 
 }