* Fix up RELEASE-NOTES from previous commit (confused commit message with RELEASE...
authorAndrew Garrett <werdna@users.mediawiki.org>
Thu, 11 Oct 2007 00:53:45 +0000 (00:53 +0000)
committerAndrew Garrett <werdna@users.mediawiki.org>
Thu, 11 Oct 2007 00:53:45 +0000 (00:53 +0000)
* Fix a bug where css/js pages were displayed normally, and were causing havoc with embedded html in user css/js subpages (a la http://en.wikipedia.org/w/index.php?title=User:AzaToth/differror.js&diff=163690181)

RELEASE-NOTES
includes/DifferenceEngine.php

index 4823adc..c61d452 100644 (file)
@@ -92,8 +92,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * (bug 11574) Add an interface message loginstart, which, similarly to loginend,
   appears just before the login form. Patch by MinuteElectron.
 * Do not cache category pages if using 'from' or 'until'
-* Created new hook getUserPermissionsErrors, to go with my userCan changes from ages ago.
-
+* Created new hook getUserPermissionsErrors, to go with userCan changes.
+* Diff pages did not properly display css/js pages.
 
 === API changes in 1.12 ===
 
index e0647ee..6ae352f 100644 (file)
@@ -261,7 +261,20 @@ CONTROL;
                        $wgOut->setRevisionId( $this->mNewRev->getId() );
                }
 
-               $wgOut->addWikiTextTidy( $this->mNewtext );
+               if ($this->mTitle->isCssJsSubpage() || $this->mTitle->isCssOrJsPage()) {
+                       // Stolen from Article::view --AG 2007-10-11
+
+                       // Give hooks a chance to customise the output
+                       if( wfRunHooks( 'ShowRawCssJs', array( $this->mNewtext, $this->mTitle, $wgOut ) ) ) {
+                               // Wrap the whole lot in a <pre> and don't parse
+                               $m = array();
+                               preg_match( '!\.(css|js)$!u', $this->mTitle->getText(), $m );
+                               $wgOut->addHtml( "<pre class=\"mw-code mw-{$m[1]}\" dir=\"ltr\">\n" );
+                               $wgOut->addHtml( htmlspecialchars( $this->mNewtext ) );
+                               $wgOut->addHtml( "\n</pre>\n" );
+                       }
+               } else
+                       $wgOut->addWikiTextTidy( $this->mNewtext );
 
                if( !$this->mNewRev->isCurrent() ) {
                        $wgOut->parserOptions()->setEditSection( $oldEditSectionSetting );