For MediaWiki (recent comments | status changes | tags | authors | states | release notes | statistics)
Index: trunk/phase3/includes/Parser.php =================================================================== --- trunk/phase3/includes/Parser.php (revision 19933) +++ trunk/phase3/includes/Parser.php (revision 19934) @@ -2887,7 +2887,7 @@ * @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 @@ $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 ) { Index: trunk/phase3/includes/DefaultSettings.php =================================================================== --- trunk/phase3/includes/DefaultSettings.php (revision 19933) +++ trunk/phase3/includes/DefaultSettings.php (revision 19934) @@ -1038,6 +1038,13 @@ $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