function wfSpecialMovepage( $par = null ) {
global $wgUser, $wgOut, $wgRequest, $action;
- # Check rights
- if ( !$wgUser->isAllowed( 'move' ) ) {
- $wgOut->showPermissionsErrorPage( array( $wgUser->isAnon() ? 'movenologintext' : 'movenotallowed' ) );
+ # Check for database lock
+ if ( wfReadOnly() ) {
+ $wgOut->readOnlyPage();
return;
}
- # Don't allow blocked users to move pages
- if ( $wgUser->isBlocked() ) {
- $wgOut->blockedPage();
+ $target = isset( $par ) ? $par : $wgRequest->getVal( 'target' );
+ $oldTitle = $wgRequest->getText( 'wpOldTitle', $target );
+ $newTitle = $wgRequest->getText( 'wpNewTitle' );
+
+ # Variables beginning with 'o' for old article 'n' for new article
+ $ot = Title::newFromText( $oldTitle );
+ $nt = Title::newFromText( $newTitle );
+
+ if( is_null( $ot ) ) {
+ $wgOut->showErrorPage( 'notargettitle', 'notargettext' );
+ return;
+ }
+ if( !$ot->exists() ) {
+ $wgOut->showErrorPage( 'nopagetitle', 'nopagetext' );
return;
}
- # Check for database lock
- if ( wfReadOnly() ) {
- $wgOut->readOnlyPage();
+ # Check rights
+ $permErrors = $ot->getUserPermissionsErrors( 'move', $wgUser );
+ if( !empty( $permErrors ) ) {
+ $wgOut->showPermissionsErrorPage( $permErrors );
return;
}
- $f = new MovePageForm( $par );
+ $f = new MovePageForm( $ot, $nt );
if ( 'submit' == $action && $wgRequest->wasPosted()
&& $wgUser->matchEditToken( $wgRequest->getVal( 'wpEditToken' ) ) ) {
private $watch = false;
- function MovePageForm( $par ) {
+ function MovePageForm( $oldTitle, $newTitle ) {
global $wgRequest;
$target = isset($par) ? $par : $wgRequest->getVal( 'target' );
- $this->oldTitle = $wgRequest->getText( 'wpOldTitle', $target );
- $this->newTitle = $wgRequest->getText( 'wpNewTitle' );
+ $this->oldTitle = $oldTitle;
+ $this->newTitle = $newTitle;
$this->reason = $wgRequest->getText( 'wpReason' );
if ( $wgRequest->wasPosted() ) {
$this->moveTalk = $wgRequest->getBool( 'wpMovetalk', false );
function showForm( $err, $hookErr = '' ) {
global $wgOut, $wgUser;
- $ot = Title::newFromURL( $this->oldTitle );
- if( is_null( $ot ) ) {
- $wgOut->showErrorPage( 'notargettitle', 'notargettext' );
- return;
- }
- if( !$ot->exists() ) {
- $wgOut->showErrorPage( 'nopagetitle', 'nopagetext' );
- return;
- }
-
+ $ot = $this->oldTitle;
$sk = $wgUser->getSkin();
$oldTitleLink = $sk->makeLinkObj( $ot );
return;
}
- # Variables beginning with 'o' for old article 'n' for new article
-
- $ot = Title::newFromText( $this->oldTitle );
- $nt = Title::newFromText( $this->newTitle );
+ $ot = $this->oldTitle;
+ $nt = $this->newTitle;
# Delete to make way if requested
if ( $wgUser->isAllowed( 'delete' ) && $this->deleteAndMove ) {