From 3fa09802d61a376b05f6aa7c6567a958c3fd92cb Mon Sep 17 00:00:00 2001 From: Rob Church Date: Thu, 13 Jul 2006 10:03:45 +0000 Subject: [PATCH] * (bug 6660) Fix behaviour of EditPage::blockedPage() when the article does not exist; now doesn't show the source box if the user hasn't provided it (blocked mid-edit) and the page doesn't exist --- RELEASE-NOTES | 4 +++- includes/EditPage.php | 22 ++++++++++++++-------- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index b0d680d5a3..fa5eb7f52a 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -62,7 +62,9 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * (bug 6642) Don't offer to unlock the database when it isn't locked * cleanupTitles.php changed from --dry-run option to --fix, so default behavior is now a non-invasive check as with namespaceDupes.php - +* (bug 6660) Fix behaviour of EditPage::blockedPage() when the article does + not exist; now doesn't show the source box if the user hasn't provided it + (blocked mid-edit) and the page doesn't exist == Languages updated == diff --git a/includes/EditPage.php b/includes/EditPage.php index d43a12026d..f41e85cc95 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -1416,15 +1416,21 @@ END # If the user made changes, preserve them when showing the markup # (This happens when a user is blocked during edit, for instance) $first = $this->firsttime || ( !$this->save && $this->textbox1 == '' ); - $source = $first ? $this->getContent() : $this->textbox1; - + if( $first ) { + $source = $this->mTitle->exists() ? $this->getContent() : false; + } else { + $source = $this->textbox1; + } + # Spit out the source or the user's modified version - $rows = $wgUser->getOption( 'rows' ); - $cols = $wgUser->getOption( 'cols' ); - $attribs = array( 'id' => 'wpTextbox1', 'name' => 'wpTextbox1', 'cols' => $cols, 'rows' => $rows, 'readonly' => 'readonly' ); - $wgOut->addHtml( '
' ); - $wgOut->addWikiText( wfMsg( $first ? 'blockedoriginalsource' : 'blockededitsource', $this->mTitle->getPrefixedText() ) ); - $wgOut->addHtml( wfElement( 'textarea', $attribs, $source ) ); + if( $source !== false ) { + $rows = $wgUser->getOption( 'rows' ); + $cols = $wgUser->getOption( 'cols' ); + $attribs = array( 'id' => 'wpTextbox1', 'name' => 'wpTextbox1', 'cols' => $cols, 'rows' => $rows, 'readonly' => 'readonly' ); + $wgOut->addHtml( '
' ); + $wgOut->addWikiText( wfMsg( $first ? 'blockedoriginalsource' : 'blockededitsource', $this->mTitle->getPrefixedText() ) ); + $wgOut->addHtml( wfElement( 'textarea', $attribs, $source ) ); + } } /** -- 2.20.1