(bug 20052) Watch checkbox on Special:Movepage is checked by default when the old...
[lhc/web/wiklou.git] / includes / specials / SpecialMovepage.php
index 8fcf33a..f583d1a 100644 (file)
@@ -91,7 +91,7 @@ class MovePageForm {
 
                $skin = $wgUser->getSkin();
 
-               $oldTitleLink = $skin->makeLinkObj( $this->oldTitle );
+               $oldTitleLink = $skin->link( $this->oldTitle );
 
                $wgOut->setPagetitle( wfMsg( 'move-page', $this->oldTitle->getPrefixedText() ) );
                $wgOut->setSubtitle( wfMsg( 'move-page-backlink', $oldTitleLink ) );
@@ -166,6 +166,22 @@ class MovePageForm {
                        }
                }
 
+               if ( $this->oldTitle->isProtected( 'move' ) ) {
+                       # Is the title semi-protected?
+                       if ( $this->oldTitle->isSemiProtected( 'move' ) ) {
+                               $noticeMsg = 'semiprotectedpagemovewarning';
+                               $classes[] = 'mw-textarea-sprotected';
+                       } else {
+                               # Then it must be protected based on static groups (regular)
+                               $noticeMsg = 'protectedpagemovewarning';
+                               $classes[] = 'mw-textarea-protected';
+                       }
+                       $wgOut->addHTML( "<div class='mw-warning-with-logexcerpt'>\n" );
+                       $wgOut->addWikiMsg( $noticeMsg );
+                       LogEventsList::showLogExtract( $wgOut, 'protect', $this->oldTitle->getPrefixedText(), '', 1 );
+                       $wgOut->addHTML( "</div>\n" );
+               }
+
                $wgOut->addHTML(
                         Xml::openElement( 'form', array( 'method' => 'post', 'action' => $titleObj->getLocalURL( 'action=submit' ), 'id' => 'movepage' ) ) .
                         Xml::openElement( 'fieldset' ) .
@@ -261,8 +277,11 @@ class MovePageForm {
                        );
                }
 
+               # Check the watch checkbox in case the watch parameter was given in the 
+               # request, the preferences say so, or either the old or new title is 
+               # being watched.
                $watchChecked = $this->watch || $wgUser->getBoolOption( 'watchmoves' ) 
-                       || $this->oldTitle->userIsWatching();
+                       || $this->oldTitle->userIsWatching() || $this->newTitle->userIsWatching();
                $wgOut->addHTML( "
                        <tr>
                                <td></td>
@@ -406,7 +425,7 @@ class MovePageForm {
                } elseif( $this->moveTalk ) {
                        $conds = array(
                                'page_namespace' => $ot->getTalkPage()->getNamespace(),
-                               'page_title' => $ot->getDBKey()
+                               'page_title' => $ot->getDBkey()
                        );
                } else {
                        # Skip the query
@@ -434,9 +453,9 @@ class MovePageForm {
                        }
 
                        $newPageName = preg_replace(
-                               '#^'.preg_quote( $ot->getDBKey(), '#' ).'#',
-                               $nt->getDBKey(),
-                               $oldSubpage->getDBKey()
+                               '#^'.preg_quote( $ot->getDBkey(), '#' ).'#',
+                               $nt->getDBkey(),
+                               $oldSubpage->getDBkey()
                        );
                        if( $oldSubpage->isTalkPage() ) {
                                $newNs = $nt->getTalkPage()->getNamespace();
@@ -447,7 +466,7 @@ class MovePageForm {
                        # be longer than 255 characters.
                        $newSubpage = Title::makeTitleSafe( $newNs, $newPageName );
                        if( !$newSubpage ) {
-                               $oldLink = $skin->makeKnownLinkObj( $oldSubpage );
+                               $oldLink = $skin->linkKnown( $oldSubpage );
                                $extraOutput []= wfMsgHtml( 'movepage-page-unmoved', $oldLink,
                                        htmlspecialchars(Title::makeName( $newNs, $newPageName )));
                                continue;
@@ -455,7 +474,7 @@ class MovePageForm {
 
                        # This was copy-pasted from Renameuser, bleh.
                        if ( $newSubpage->exists() && !$oldSubpage->isValidMoveTarget( $newSubpage ) ) {
-                               $link = $skin->makeKnownLinkObj( $newSubpage );
+                               $link = $skin->linkKnown( $newSubpage );
                                $extraOutput []= wfMsgHtml( 'movepage-page-exists', $link );
                        } else {
                                $success = $oldSubpage->moveTo( $newSubpage, true, $this->reason, $createRedirect );
@@ -463,12 +482,17 @@ class MovePageForm {
                                        if ( $this->fixRedirects ) {
                                                DoubleRedirectJob::fixRedirects( 'move', $oldSubpage, $newSubpage );
                                        }
-                                       $oldLink = $skin->makeKnownLinkObj( $oldSubpage, '', 'redirect=no' );
-                                       $newLink = $skin->makeKnownLinkObj( $newSubpage );
+                                       $oldLink = $skin->linkKnown(
+                                               $oldSubpage,
+                                               null,
+                                               array(),
+                                               array( 'redirect' => 'no' )
+                                       );
+                                       $newLink = $skin->linkKnown( $newSubpage );
                                        $extraOutput []= wfMsgHtml( 'movepage-page-moved', $oldLink, $newLink );
                                } else {
-                                       $oldLink = $skin->makeKnownLinkObj( $oldSubpage );
-                                       $newLink = $skin->makeLinkObj( $newSubpage );
+                                       $oldLink = $skin->linkKnown( $oldSubpage );
+                                       $newLink = $skin->link( $newSubpage );
                                        $extraOutput []= wfMsgHtml( 'movepage-page-unmoved', $oldLink, $newLink );
                                }
                        }