* Fixed unclosed <p> tag
[lhc/web/wiklou.git] / includes / SpecialMovepage.php
index 447eaf8..70c8a4f 100644 (file)
@@ -63,19 +63,18 @@ class MovePageForm {
 
                $wgOut->setPagetitle( wfMsg( 'movepage' ) );
 
-               if ( $this->oldTitle == '' ) {
+               $ot = Title::newFromURL( $this->oldTitle );
+               if( is_null( $ot ) ) {
                        $wgOut->errorpage( 'notargettitle', 'notargettext' );
                        return;
                }
-
-               $ot = Title::newFromURL( $this->oldTitle );
                $oldTitle = $ot->getPrefixedText();
                
-               $encOldTitle = htmlspecialchars( $this->oldTitle );
+               $encOldTitle = htmlspecialchars( $oldTitle );
                if( $this->newTitle == '' ) {
                        # Show the current title as a default
                        # when the form is first opened.
-                       $encNewTitle = $oldTitle;
+                       $encNewTitle = $encOldTitle;
                } else {
                        if( $err == '' ) {
                                $nt = Title::newFromURL( $this->newTitle );
@@ -207,17 +206,11 @@ class MovePageForm {
                # (2) the namespaces are not themselves talk namespaces, and of course
                # (3) it exists.
                if ( ( $wgRequest->getVal('wpMovetalk') == 1 ) &&
-                    ( ! Namespace::isTalk( $ons ) ) &&
-                    ( ! Namespace::isTalk( $nns ) ) ) {
-                       
-                       # get old talk page namespace
-                       $ons = Namespace::getTalk( $ons );
-                       # get new talk page namespace
-                       $nns = Namespace::getTalk( $nns );
+                    !$ot->isTalkPage() &&
+                    !$nt->isTalkPage() ) {
                        
-                       # make talk page title objects
-                       $ott = Title::makeTitle( $ons, $ot->getDBkey() );
-                       $ntt = Title::makeTitle( $nns, $nt->getDBkey() );
+                       $ott = $ot->getTalkPage();
+                       $ntt = $nt->getTalkPage();
 
                        # Attempt the move
                        $error = $ott->moveTo( $ntt, true, $this->reason );