From 2588e553b43c27a72685f23b363277f5f067735d Mon Sep 17 00:00:00 2001 From: Andrew Garrett Date: Thu, 11 Oct 2007 00:53:45 +0000 Subject: [PATCH] * Fix up RELEASE-NOTES from previous commit (confused commit message with RELEASE-NOTES) * 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 | 4 ++-- includes/DifferenceEngine.php | 15 ++++++++++++++- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 4823adc3a3..c61d452554 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -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 === diff --git a/includes/DifferenceEngine.php b/includes/DifferenceEngine.php index e0647ee136..6ae352f3da 100644 --- a/includes/DifferenceEngine.php +++ b/includes/DifferenceEngine.php @@ -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
 and don't parse
+				$m = array();
+				preg_match( '!\.(css|js)$!u', $this->mTitle->getText(), $m );
+				$wgOut->addHtml( "
\n" );
+				$wgOut->addHtml( htmlspecialchars( $this->mNewtext ) );
+				$wgOut->addHtml( "\n
\n" ); + } + } else + $wgOut->addWikiTextTidy( $this->mNewtext ); if( !$this->mNewRev->isCurrent() ) { $wgOut->parserOptions()->setEditSection( $oldEditSectionSetting ); -- 2.20.1