From: Rob Church Date: Sat, 24 Jun 2006 20:58:10 +0000 (+0000) Subject: (bug 4990) Show page source to blocked users on edits, or their modified version... X-Git-Tag: 1.31.0-rc.0~56629 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/password.php?a=commitdiff_plain;h=a2c80fa4db10f66c8f2eb11c304bc0ed42b12845;p=lhc%2Fweb%2Fwiklou.git (bug 4990) Show page source to blocked users on edits, or their modified version if blocked during an edit --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 9f41b48657..c0abbc02b1 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -555,6 +555,8 @@ Some default configuration options have changed: 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 == diff --git a/includes/EditPage.php b/includes/EditPage.php index a3c98d676f..47e9b53816 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -194,7 +194,7 @@ class EditPage { # 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; } @@ -511,7 +511,7 @@ class EditPage { } if ( $wgUser->isBlockedFrom( $this->mTitle, false ) ) { # Check block state against master, thus 'false'. - $this->blockedIPpage(); + $this->blockedPage(); wfProfileOut( "$fname-checks" ); wfProfileOut( $fname ); return false; @@ -1341,9 +1341,22 @@ END /** * 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( '
' ); + $wgOut->addWikiText( wfMsg( $first ? 'blockedoriginalsource' : 'blockededitsource', $this->mTitle->getPrefixedText() ) ); + $wgOut->addHtml( wfElement( 'textarea', $attribs, $source ) ); } /** diff --git a/includes/OutputPage.php b/includes/OutputPage.php index 1cfd3f8721..31a0781a3f 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -644,7 +644,7 @@ class OutputPage { /** * Produce a "user is blocked" page */ - function blockedPage() { + function blockedPage( $return = true ) { global $wgUser, $wgContLang, $wgTitle; $this->setPageTitle( wfMsg( 'blockedtitle' ) ); @@ -665,8 +665,10 @@ class OutputPage { $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 ); + } } /** diff --git a/languages/Messages.php b/languages/Messages.php index afa99a0c79..d13d41f192 100644 --- a/languages/Messages.php +++ b/languages/Messages.php @@ -475,6 +475,8 @@ The reason given is this:
\'\'$2\'\'
You may contact $1 or one of the 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',