From 04b1ace8b019d30d83831a8eb354b98f12904d33 Mon Sep 17 00:00:00 2001 From: Philip Tzou Date: Fri, 26 Nov 2010 07:48:41 +0000 Subject: [PATCH] Add a new method 'spamPageWithContent' to class EditPage. User can be allowed to view his/her diff and submitted text when hit the spam-filter. The changes to extension SpamBlacklist will be followed up soon. --- includes/EditPage.php | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/includes/EditPage.php b/includes/EditPage.php index 77dc174393..b19023781d 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -2025,6 +2025,7 @@ HTML * Produce the stock "your edit contains spam" page * * @param $match Text which triggered one or more filters + * @deprecated Use method spamPageWithContent() instead */ static function spamPage( $match = false ) { global $wgOut, $wgTitle; @@ -2043,6 +2044,38 @@ HTML $wgOut->returnToMain( false, $wgTitle ); } + /** + * Show "your edit contains spam" page with your diff and text + * + * @param $match Text which triggered one or more filters + */ + public function spamPageWithContent( $match = false ) { + global $wgOut, $wgTitle; + $this->textbox2 = $this->textbox1; + + $wgOut->setPageTitle( wfMsg( 'spamprotectiontitle' ) ); + $wgOut->setRobotPolicy( 'noindex,nofollow' ); + $wgOut->setArticleRelated( false ); + + $wgOut->addHTML( '
' ); + $wgOut->addWikiMsg( 'spamprotectiontext' ); + if ( $match ) { + $wgOut->addWikiMsg( 'spamprotectionmatch', wfEscapeWikiText( $match ) ); + } + $wgOut->addHTML( '
' ); + + $wgOut->wrapWikiMsg( '

$1

', "yourdiff" ); + $de = new DifferenceEngine( $this->mTitle ); + $de->setText( $this->getContent(), $this->textbox2 ); + $de->showDiff( wfMsg( "storedversion" ), wfMsg( "yourtext" ) ); + + $wgOut->wrapWikiMsg( '

$1

', "yourtext" ); + $this->showTextbox2(); + + $wgOut->addReturnTo( $wgTitle, array( 'action' => 'edit' ) ); + } + + /** * @private * @todo document @@ -2618,7 +2651,7 @@ HTML return false; case self::AS_SPAM_ERROR: - self::spamPage( $resultDetails['spam'] ); + $this->spamPageWithContent( $resultDetails['spam'] ); return false; case self::AS_BLOCKED_PAGE_FOR_USER: -- 2.20.1