From: Tim Starling Date: Sun, 22 Apr 2012 23:56:09 +0000 (+1000) Subject: Fix notices from r94259 due to undefined variables X-Git-Tag: 1.31.0-rc.0~23849^2 X-Git-Url: http://git.cyclocoop.org/%22.%20generer_url_ecrire%28%22sites_tous%22%2C%22%22%29.%20%22?a=commitdiff_plain;h=fdb9a6b64a8346e4cd19d9d7764af3b369128dab;p=lhc%2Fweb%2Fwiklou.git Fix notices from r94259 due to undefined variables Fix notices from r94259 due to undefined variables $previewtext and $class in the isWikitextPage()==true case. Change-Id: I6ae2486d8860d2c28d656cdbd594ebc3a1263537 --- diff --git a/includes/EditPage.php b/includes/EditPage.php index 69187e488a..67b94c32c0 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -2588,9 +2588,7 @@ HTML $parserOptions->setIsSectionPreview( !is_null( $this->section ) && $this->section !== '' ); # don't parse non-wikitext pages, show message about preview - # XXX: stupid php bug won't let us use $this->getContextTitle()->isCssJsSubpage() here -- This note has been there since r3530. Sure the bug was fixed time ago? - - if ( $this->isCssJsSubpage || !$this->mTitle->isWikitextPage() ) { + if ( $this->mTitle->isCssJsSubpage() || !$this->mTitle->isWikitextPage() ) { if ( $this->mTitle->isCssJsSubpage() ) { $level = 'user'; } elseif ( $this->mTitle->isCssOrJsPage() ) { @@ -2601,20 +2599,23 @@ HTML # Used messages to make sure grep find them: # Messages: usercsspreview, userjspreview, sitecsspreview, sitejspreview + $class = 'mw-code'; if ( $level ) { if ( preg_match( "/\\.css$/", $this->mTitle->getText() ) ) { $previewtext = "
\n" . wfMsg( "{$level}csspreview" ) . "\n
"; - $class = "mw-code mw-css"; + $class .= " mw-css"; } elseif ( preg_match( "/\\.js$/", $this->mTitle->getText() ) ) { $previewtext = "
\n" . wfMsg( "{$level}jspreview" ) . "\n
"; - $class = "mw-code mw-js"; + $class .= " mw-js"; } else { throw new MWException( 'A CSS/JS (sub)page but which is not css nor js!' ); } + $parserOutput = $wgParser->parse( $previewtext, $this->mTitle, $parserOptions ); + $previewHTML = $parserOutput->getText(); + } else { + $previewHTML = ''; } - $parserOutput = $wgParser->parse( $previewtext, $this->mTitle, $parserOptions ); - $previewHTML = $parserOutput->mText; $previewHTML .= "
\n" . htmlspecialchars( $this->textbox1 ) . "\n
\n"; } else { $toparse = $this->textbox1;