r77321 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r77320‎ | r77321 | r77322 >
Date:07:48, 26 November 2010
Author:philip
Status:ok
Tags:
Comment:
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.
Modified paths:
  • /trunk/phase3/includes/EditPage.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/EditPage.php
@@ -2025,6 +2025,7 @@
20262026 * Produce the stock "your edit contains spam" page
20272027 *
20282028 * @param $match Text which triggered one or more filters
 2029+ * @deprecated Use method spamPageWithContent() instead
20292030 */
20302031 static function spamPage( $match = false ) {
20312032 global $wgOut, $wgTitle;
@@ -2044,6 +2045,38 @@
20452046 }
20462047
20472048 /**
 2049+ * Show "your edit contains spam" page with your diff and text
 2050+ *
 2051+ * @param $match Text which triggered one or more filters
 2052+ */
 2053+ public function spamPageWithContent( $match = false ) {
 2054+ global $wgOut, $wgTitle;
 2055+ $this->textbox2 = $this->textbox1;
 2056+
 2057+ $wgOut->setPageTitle( wfMsg( 'spamprotectiontitle' ) );
 2058+ $wgOut->setRobotPolicy( 'noindex,nofollow' );
 2059+ $wgOut->setArticleRelated( false );
 2060+
 2061+ $wgOut->addHTML( '<div id="spamprotected">' );
 2062+ $wgOut->addWikiMsg( 'spamprotectiontext' );
 2063+ if ( $match ) {
 2064+ $wgOut->addWikiMsg( 'spamprotectionmatch', wfEscapeWikiText( $match ) );
 2065+ }
 2066+ $wgOut->addHTML( '</div>' );
 2067+
 2068+ $wgOut->wrapWikiMsg( '<h2>$1</h2>', "yourdiff" );
 2069+ $de = new DifferenceEngine( $this->mTitle );
 2070+ $de->setText( $this->getContent(), $this->textbox2 );
 2071+ $de->showDiff( wfMsg( "storedversion" ), wfMsg( "yourtext" ) );
 2072+
 2073+ $wgOut->wrapWikiMsg( '<h2>$1</h2>', "yourtext" );
 2074+ $this->showTextbox2();
 2075+
 2076+ $wgOut->addReturnTo( $wgTitle, array( 'action' => 'edit' ) );
 2077+ }
 2078+
 2079+
 2080+ /**
20482081 * @private
20492082 * @todo document
20502083 */
@@ -2618,7 +2651,7 @@
26192652 return false;
26202653
26212654 case self::AS_SPAM_ERROR:
2622 - self::spamPage( $resultDetails['spam'] );
 2655+ $this->spamPageWithContent( $resultDetails['spam'] );
26232656 return false;
26242657
26252658 case self::AS_BLOCKED_PAGE_FOR_USER:

Follow-up revisions

RevisionCommit summaryAuthorDate
r77322Follow up r77321. Replace EditPage::spamPage to $editPage->spamPageWithConten...philip07:53, 26 November 2010

Status & tagging log