global $wgUseSquid, $wgRequest;
$fname = "MovePageForm::doSubmit";
- # don't allow moving to pages with # in
- if ( strchr( $this->newTitle, '#') !== FALSE ) {
- $this->showForm( wfMsg( "badtitletext" ) );
- return;
- }
-
# Variables beginning with 'o' for old article 'n' for new article
# Attempt to move the article
$ot = Title::newFromText( $this->oldTitle );
$nt = Title::newFromText( $this->newTitle );
+ # don't allow moving to pages with # in
+ if ( $nt->getFragment() != '' ) {
+ $this->showForm( wfMsg( "badtitletext" ) );
+ return;
+ }
+
$error = $ot->moveTo( $nt );
if ( $error !== true ) {
$this->showForm( wfMsg( $error ) );
if ( false !== $f ) {
$this->mFragment = substr( $f, 1 );
$r = substr( $r, 0, strlen( $r ) - strlen( $f ) );
+ # remove whitespace again: prevents "Foo_bar_#"
+ # becoming "Foo_bar_"
+ $r = preg_replace( '/_*$/', '', $r );
}
# Reject illegal characters.