Add a new method 'spamPageWithContent' to class EditPage. User can be allowed to...
authorPhilip Tzou <philip@users.mediawiki.org>
Fri, 26 Nov 2010 07:48:41 +0000 (07:48 +0000)
committerPhilip Tzou <philip@users.mediawiki.org>
Fri, 26 Nov 2010 07:48:41 +0000 (07:48 +0000)
includes/EditPage.php

index 77dc174..b190237 100644 (file)
@@ -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( '<div id="spamprotected">' );
+               $wgOut->addWikiMsg( 'spamprotectiontext' );
+               if ( $match ) {
+                       $wgOut->addWikiMsg( 'spamprotectionmatch', wfEscapeWikiText( $match ) );
+               }
+               $wgOut->addHTML( '</div>' );
+
+               $wgOut->wrapWikiMsg( '<h2>$1</h2>', "yourdiff" );
+               $de = new DifferenceEngine( $this->mTitle );
+               $de->setText( $this->getContent(), $this->textbox2 );
+               $de->showDiff( wfMsg( "storedversion" ), wfMsg( "yourtext" ) );
+
+               $wgOut->wrapWikiMsg( '<h2>$1</h2>', "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: