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
*/
protected function showHeader() {
global $wgOut, $wgUser, $wgMaxArticleSize, $wgLang;
*/
protected function showHeader() {
global $wgOut, $wgUser, $wgMaxArticleSize, $wgLang;
+ global $wgAllowUserCss, $wgAllowUserJs;
if ( $this->mTitle->isTalkPage() ) {
$wgOut->addWikiMsg( 'talkpagetext' );
if ( $this->mTitle->isTalkPage() ) {
$wgOut->addWikiMsg( 'talkpagetext' );
);
}
if ( $this->formtype !== 'preview' ) {
);
}
if ( $this->formtype !== 'preview' ) {
- if ( $this->isCssSubpage ) {
+ if ( $this->isCssSubpage && $wgAllowUserCss ) {
$wgOut->wrapWikiMsg(
"<div id='mw-usercssyoucanpreview'>\n$1\n</div>",
array( 'usercssyoucanpreview' )
);
}
$wgOut->wrapWikiMsg(
"<div id='mw-usercssyoucanpreview'>\n$1\n</div>",
array( 'usercssyoucanpreview' )
);
}
- if ( $this->isJsSubpage ) {
+ if ( $this->isJsSubpage && $wgAllowUserJs ) {
$wgOut->wrapWikiMsg(
"<div id='mw-userjsyoucanpreview'>\n$1\n</div>",
array( 'userjsyoucanpreview' )
$wgOut->wrapWikiMsg(
"<div id='mw-userjsyoucanpreview'>\n$1\n</div>",
array( 'userjsyoucanpreview' )
*/
function getPreviewText() {
global $wgOut, $wgUser, $wgRawHtml, $wgLang;
*/
function getPreviewText() {
global $wgOut, $wgUser, $wgRawHtml, $wgLang;
+ global $wgAllowUserCss, $wgAllowUserJs;
wfProfileIn( __METHOD__ );
wfProfileIn( __METHOD__ );
if ( $content->getModel() == CONTENT_MODEL_CSS ) {
$format = 'css';
if ( $content->getModel() == CONTENT_MODEL_CSS ) {
$format = 'css';
+ if ( $level === 'user' && !$wgAllowUserCss ) {
+ $format = false;
+ }
} elseif ( $content->getModel() == CONTENT_MODEL_JAVASCRIPT ) {
$format = 'js';
} elseif ( $content->getModel() == CONTENT_MODEL_JAVASCRIPT ) {
$format = 'js';
+ if ( $level === 'user' && !$wgAllowUserJs ) {
+ $format = false;
+ }
} else {
$format = false;
}
} else {
$format = false;
}