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.
This commit is contained in:
parent
827c0e138a
commit
c9d98b9dca
2 changed files with 10 additions and 4 deletions
|
|
@ -420,4 +420,10 @@ $wgAllowRealName = true;
|
|||
# Extensions
|
||||
$wgExtensionFunctions = array();
|
||||
|
||||
# Allow user Javascript page?
|
||||
$wgAllowUserJs = true;
|
||||
|
||||
# Allow user Cascading Style Sheets (CSS)?
|
||||
$wgAllowUserCss = true;
|
||||
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -154,9 +154,9 @@ class Skin {
|
|||
}
|
||||
|
||||
function getHeadScripts() {
|
||||
global $wgStylePath, $wgUser, $wgLang;
|
||||
global $wgStylePath, $wgUser, $wgLang, $wgAllowUserJs;
|
||||
$r = "<script type=\"text/javascript\" src=\"{$wgStylePath}/wikibits.js\"></script>\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 .= '<script type="text/javascript" src="'.$userjs."\"></script>\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 {
|
||||
|
|
|
|||
Loading…
Reference in a new issue