From: Evan Prodromou Date: Mon, 28 Jun 2004 21:51:52 +0000 (+0000) Subject: Added two global variables, $wgAllowUserJs and $wgAllowUserCss, which X-Git-Tag: 1.5.0alpha1~2747 X-Git-Url: http://git.cyclocoop.org/%24href?a=commitdiff_plain;h=c9d98b9dcab7d79895acaa4308c2a2a59fbf089d;p=lhc%2Fweb%2Fwiklou.git Added two global variables, $wgAllowUserJs and $wgAllowUserCss, which default to true. Admins can set one or the other to false to disable the feature of User: namespace Javascript and CSS links. Added code to Skin.php (but not SkinPHPTal.php, yet) to check these variables before adding the User: namespace Javascript and CSS links. --- diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index a78d784681..61b71afcde 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -420,4 +420,10 @@ $wgAllowRealName = true; # Extensions $wgExtensionFunctions = array(); +# Allow user Javascript page? +$wgAllowUserJs = true; + +# Allow user Cascading Style Sheets (CSS)? +$wgAllowUserCss = true; + ?> diff --git a/includes/Skin.php b/includes/Skin.php index c14b37703f..866ee65718 100644 --- a/includes/Skin.php +++ b/includes/Skin.php @@ -154,9 +154,9 @@ class Skin { } function getHeadScripts() { - global $wgStylePath, $wgUser, $wgLang; + global $wgStylePath, $wgUser, $wgLang, $wgAllowUserJs; $r = "\n"; - if( $wgUser->getID() != 0 ) { # logged in + if( $wgAllowUserJs && $wgUser->getID() != 0 ) { # logged in $userpage = $wgLang->getNsText( Namespace::getUser() ) . ":" . $wgUser->getName(); $userjs = htmlspecialchars($this->makeUrl($userpage.'/'.$this->getSkinName().'.js', 'action=raw&ctype=text/javascript')); $r .= '\n"; @@ -166,12 +166,12 @@ class Skin { # get the user/site-specific stylesheet, SkinPHPTal called from RawPage.php (settings are cached that way) function getUserStylesheet() { - global $wgOut, $wgStylePath, $wgLang, $wgUser, $wgRequest, $wgTitle; + global $wgOut, $wgStylePath, $wgLang, $wgUser, $wgRequest, $wgTitle, $wgAllowUserCss; $sheet = $this->getStylesheet(); $action = $wgRequest->getText('action'); $s = "@import \"$wgStylePath/$sheet\";\n"; if($wgLang->isRTL()) $s .= "@import \"$wgStylePath/common_rtl.css\";\n"; - if( $wgUser->getID() != 0 ) { # logged in + if( $wgAllowUserCss && $wgUser->getID() != 0 ) { # logged in if($wgTitle->isCssSubpage() and $action == 'submit' and $wgTitle->userCanEditCssJsSubpage()) { $s .= $wgRequest->getText('wpTextbox1'); } else {