Move page tweaks:
authorBrion Vibber <brion@users.mediawiki.org>
Tue, 26 Oct 2004 03:51:59 +0000 (03:51 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Tue, 26 Oct 2004 03:51:59 +0000 (03:51 +0000)
* Allow [[0]] to be renamed
* Fix the $wgRawHtml check so it actually works
* (bug 776) Old title as default for new title when moving pages [modified patch from guanaco]

includes/SpecialMovepage.php

index dbba17d..b7e6e2b 100644 (file)
@@ -53,13 +53,19 @@ class MovePageForm {
 
                $wgOut->setPagetitle( wfMsg( 'movepage' ) );
 
-               if ( empty( $this->oldTitle ) ) {
+               if ( $this->oldTitle == "" ) {
                        $wgOut->errorpage( 'notargettitle', 'notargettext' );
                        return;
                }
                
                $encOldTitle = htmlspecialchars( $this->oldTitle );
-               $encNewTitle = htmlspecialchars( $this->newTitle );
+               if( $this->newTitle == "" ) {
+                       # Show the current title as a default
+                       # when the form is first opened.
+                       $encNewTitle = $encOldTitle;
+               } else {
+                       $encNewTitle = htmlspecialchars( $this->newTitle );
+               }
                $ot = Title::newFromURL( $this->oldTitle );
                $ott = $ot->getPrefixedText();
 
@@ -200,7 +206,7 @@ class MovePageForm {
        }
 
        function showSuccess() {
-               global $wgOut, $wgUser, $wgRequest;
+               global $wgOut, $wgUser, $wgRequest, $wgRawHtml;
 
                $wgOut->setPagetitle( wfMsg( 'movepage' ) );
                $wgOut->setSubtitle( wfMsg( 'pagemovedsub' ) );
@@ -209,6 +215,8 @@ class MovePageForm {
                $talkmoved = $wgRequest->getVal('talkmoved');
 
                $text = wfMsg( 'pagemovedtext', $oldtitle, $newtitle );
+               
+               # Temporarily disable raw html wikitext option out of XSS paranoia
                $marchingantofdoom = $wgRawHtml;
                $wgRawHtml = false;
                $wgOut->addWikiText( $text );