From: Daniel Kinzler Date: Thu, 15 Feb 2007 01:23:47 +0000 (+0000) Subject: wgNonincludableNamespaces option to disable inclusion for specific namespaces. Helps... X-Git-Tag: 1.31.0-rc.0~54047 X-Git-Url: http://git.cyclocoop.org/%22%2C%20generer_url_ecrire%28?a=commitdiff_plain;h=e67bceab97e5f928a3bbb308fc644da03d56bf99;p=lhc%2Fweb%2Fwiklou.git wgNonincludableNamespaces option to disable inclusion for specific namespaces. Helps to make read-protection work --- diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 40e09f8e90..fbfd49374c 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -1038,6 +1038,13 @@ $wgRestrictionLevels = array( '', 'autoconfirmed', 'sysop' ); $wgNamespaceProtection = array(); $wgNamespaceProtection[ NS_MEDIAWIKI ] = array( 'editinterface' ); +/** +* Pages in namespaces in this array can not be used as templates. +* Elements must be numeric namespace ids. +* Among other things, this may be useful to enforce read-restrictions +* which may otherwise be bypassed by using the template machanism. +*/ +$wgNonincludableNamespaces = array(); /** * Number of seconds an account is required to age before diff --git a/includes/Parser.php b/includes/Parser.php index e975359911..7810f1eff7 100644 --- a/includes/Parser.php +++ b/includes/Parser.php @@ -2887,7 +2887,7 @@ class Parser * @private */ function braceSubstitution( $piece ) { - global $wgContLang, $wgLang, $wgAllowDisplayTitle; + global $wgContLang, $wgLang, $wgAllowDisplayTitle, $wgNonincludableNamespaces; $fname = __METHOD__ /*. '-L' . count( $this->mArgStack )*/; wfProfileIn( $fname ); wfProfileIn( __METHOD__.'-setup' ); @@ -3065,6 +3065,9 @@ class Parser $isHTML = true; $this->disableCache(); } + } else if ( $wgNonincludableNamespaces && in_array( $title->getNamespace(), $wgNonincludableNamespaces ) ) { + $found = false; //access denied + wfDebug( "$fname: template inclusion denied for " . $title->getPrefixedDBkey() ); } else { $articleContent = $this->fetchTemplate( $title ); if ( $articleContent !== false ) {