were causing the newtalk flag to trigger inappropriately)
* Parser functions are now set using magic words.
* (bug 6428) Incorrect form action URL on Special:Newimages with hidebots = 0 set
+* (bug 4990) Show page source to blocked users on edits, or their modified version
+ if blocked during an edit
== Compatibility ==
# When previewing, don't check blocked state - will get caught at save time.
# Also, check when starting edition is done against slave to improve performance.
wfDebug( "$fname: user is blocked\n" );
- $wgOut->blockedPage();
+ $this->blockedPage();
wfProfileOut( $fname );
return;
}
}
if ( $wgUser->isBlockedFrom( $this->mTitle, false ) ) {
# Check block state against master, thus 'false'.
- $this->blockedIPpage();
+ $this->blockedPage();
wfProfileOut( "$fname-checks" );
wfProfileOut( $fname );
return false;
/**
* Call the stock "user is blocked" page
*/
- function blockedIPpage() {
- global $wgOut;
- $wgOut->blockedPage();
+ function blockedPage() {
+ global $wgOut, $wgUser;
+ $wgOut->blockedPage( false ); # Standard block notice on the top, don't 'return'
+
+ # 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->mArticle->getContent() : $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( '<hr />' );
+ $wgOut->addWikiText( wfMsg( $first ? 'blockedoriginalsource' : 'blockededitsource', $this->mTitle->getPrefixedText() ) );
+ $wgOut->addHtml( wfElement( 'textarea', $attribs, $source ) );
}
/**
/**
* Produce a "user is blocked" page
*/
- function blockedPage() {
+ function blockedPage( $return = true ) {
global $wgUser, $wgContLang, $wgTitle;
$this->setPageTitle( wfMsg( 'blockedtitle' ) );
$this->addWikiText( wfMsg( 'blockedtext', $link, $reason, $ip, $name ) );
# Don't auto-return to special pages
- $return = $wgTitle->getNamespace() > -1 ? $wgTitle->getPrefixedText() : NULL;
- $this->returnToMain( false, $return );
+ if( $return ) {
+ $return = $wgTitle->getNamespace() > -1 ? $wgTitle->getPrefixedText() : NULL;
+ $this->returnToMain( false, $return );
+ }
}
/**
Note that you may not use the "e-mail this user" feature unless you have a valid e-mail address registered in your [[Special:Preferences|user preferences]].
Your IP address is $3. Please include this address in any queries you make.',
+'blockedoriginalsource' => "The source of '''$1''' is shown below:",
+'blockededitsource' => "The text of '''your edits''' to '''$1''' is shown below:",
'whitelistedittitle' => 'Login required to edit',
'whitelistedittext' => 'You have to $1 to edit pages.',
'whitelistreadtitle' => 'Login required to read',