From: withoutaname Date: Mon, 16 Jun 2014 19:33:50 +0000 (-0700) Subject: Check for $wgAllowUserCss and $wgAllowUserJs in EditPage.php X-Git-Tag: 1.31.0-rc.0~15246^2 X-Git-Url: https://git.heureux-cyclage.org/?a=commitdiff_plain;h=100936881aa3c622181b2b0a7d9da974aba46135;p=lhc%2Fweb%2Fwiklou.git Check for $wgAllowUserCss and $wgAllowUserJs in EditPage.php This change checks for the truth values of $wgAllowUserCss and $wgAllowUserJs before displaying the system/preview messages userjsyoucanpreview, usercssyoucanpreview, userjspreview and usercsspreview; if false, it will simply display the standard messages used by other wiki pages. Change-Id: I6a5fa8b29010f26435125479e72c423b5e4290f8 --- diff --git a/includes/EditPage.php b/includes/EditPage.php index 98e0ec4b5a..2cd335dba2 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -2621,6 +2621,7 @@ class EditPage { */ protected function showHeader() { global $wgOut, $wgUser, $wgMaxArticleSize, $wgLang; + global $wgAllowUserCss, $wgAllowUserJs; if ( $this->mTitle->isTalkPage() ) { $wgOut->addWikiMsg( 'talkpagetext' ); @@ -2721,14 +2722,14 @@ class EditPage { ); } if ( $this->formtype !== 'preview' ) { - if ( $this->isCssSubpage ) { + if ( $this->isCssSubpage && $wgAllowUserCss ) { $wgOut->wrapWikiMsg( "
\n$1\n
", array( 'usercssyoucanpreview' ) ); } - if ( $this->isJsSubpage ) { + if ( $this->isJsSubpage && $wgAllowUserJs ) { $wgOut->wrapWikiMsg( "
\n$1\n
", array( 'userjsyoucanpreview' ) @@ -3451,6 +3452,7 @@ HTML */ function getPreviewText() { global $wgOut, $wgUser, $wgRawHtml, $wgLang; + global $wgAllowUserCss, $wgAllowUserJs; wfProfileIn( __METHOD__ ); @@ -3516,8 +3518,14 @@ HTML if ( $content->getModel() == CONTENT_MODEL_CSS ) { $format = 'css'; + if ( $level === 'user' && !$wgAllowUserCss ) { + $format = false; + } } elseif ( $content->getModel() == CONTENT_MODEL_JAVASCRIPT ) { $format = 'js'; + if ( $level === 'user' && !$wgAllowUserJs ) { + $format = false; + } } else { $format = false; }