/**
* Constructor
*/
-function wfSpecialMovepage() {
+function wfSpecialMovepage( $par = null ) {
global $wgUser, $wgOut, $wgRequest, $action, $wgOnlySysopMayMove;
# check rights. We don't want newbies to move pages to prevents possible attack
return;
}
- $f = new MovePageForm();
+ $f = new MovePageForm( $par );
if ( 'success' == $action ) {
$f->showSuccess();
var $oldTitle, $newTitle, $reason; # Text input
var $moveTalk, $deleteAndMove;
- function MovePageForm() {
+ function MovePageForm( $par ) {
global $wgRequest;
- $this->oldTitle = $wgRequest->getText( 'wpOldTitle', $wgRequest->getVal( 'target' ) );
+ $target = isset($par) ? $par : $wgRequest->getVal( 'target' );
+ $this->oldTitle = $wgRequest->getText( 'wpOldTitle', $target );
$this->newTitle = $wgRequest->getText( 'wpNewTitle' );
$this->reason = $wgRequest->getText( 'wpReason' );
$this->moveTalk = $wgRequest->getBool( 'wpMovetalk', true );
# when the form is first opened.
$encNewTitle = $oldTitle;
} else {
- $nt = Title::newFromURL( $this->newTitle );
- if ( $nt ) {
- // Check if it's valid
- if ( !$nt->isValidMoveTarget( $ot ) ) {
- $err = 'articleexists';
+ if( $err == '' ) {
+ $nt = Title::newFromURL( $this->newTitle );
+ if( $nt ) {
+ # If a title was supplied, probably from the move log revert
+ # link, check for validity. We can then show some diagnostic
+ # information and save a click.
+ $newerr = $ot->isValidMoveOperation( $nt );
+ if( is_string( $newerr ) ) {
+ $err = $newerr;
+ }
}
- $encNewTitle = htmlspecialchars( $this->newTitle );
- } else {
- $encNewTitle = $oldTitle;
}
+ $encNewTitle = htmlspecialchars( $this->newTitle );
}
$encReason = htmlspecialchars( $this->reason );
<tr>
<td align='right'>{$movereason}:</td>
<td align='left'>
- <input type='text' size=40 name=\"wpReason\" value=\"{$encReason}\" />
+ <input type='text' size='40' name=\"wpReason\" value=\"{$encReason}\" />
</td>
</tr>" );
global $wgUseSquid, $wgRequest;
$fname = "MovePageForm::doSubmit";
+ if ( $wgUser->pingLimiter( 'move' ) ) {
+ $wgOut->rateLimited();
+ return;
+ }
+
# Variables beginning with 'o' for old article 'n' for new article
$ot = Title::newFromText( $this->oldTitle );
} else {
$talkmoved = $error;
}
+ } else {
+ # Stay silent on the subject of talk.
+ $talkmoved = '';
}
# Give back result to user.