From: Daniel Kinzler Date: Sun, 17 Aug 2008 21:08:58 +0000 (+0000) Subject: add new option $wgRestrictDisplayTitle X-Git-Tag: 1.31.0-rc.0~45851 X-Git-Url: http://git.cyclocoop.org/%22.%24redirect_annul.%22?a=commitdiff_plain;h=98520b17eed08bdc5c0dc746ec91499503b81990;p=lhc%2Fweb%2Fwiklou.git add new option $wgRestrictDisplayTitle --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index d67e7de864..1b73c1991b 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -19,7 +19,9 @@ Those wishing to use the latest code instead of a branch release can obtain it from source control: http://www.mediawiki.org/wiki/Download_from_SVN === Configuration changes in 1.14 === - +* $wgRestrictDisplayTitle controls if the use of the {{DISPLAYTITLE}} magic + word is restricted to titles equivalent to the actual page title. This + is true per default, but can be set to false to allow any title. * $wgExemptFromUserRobotsControl is an array of namespaces to be exempt from the effect of the new __INDEX__/__NOINDEX__ magic words. (Default: null, ex- empt all content namespaces.) diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index be75dc1cec..692e1ff802 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -3156,6 +3156,11 @@ $wgAjaxLicensePreview = true; */ $wgAllowDisplayTitle = true; +/** + * for consistency, restrict DISPLAYTITLE to titles that normalize to the same canonical DB key + */ +$wgRestrictDisplayTitle = true; + /** * Array of usernames which may not be registered or logged in from * Maintenance scripts can still use these diff --git a/includes/parser/CoreParserFunctions.php b/includes/parser/CoreParserFunctions.php index 8ae1e0a07b..14c75d07be 100644 --- a/includes/parser/CoreParserFunctions.php +++ b/includes/parser/CoreParserFunctions.php @@ -170,10 +170,16 @@ class CoreParserFunctions { * @return string */ static function displaytitle( $parser, $text = '' ) { + global $wgRestrictDisplayTitle; $text = trim( Sanitizer::decodeCharReferences( $text ) ); - $title = Title::newFromText( $text ); - if( $title instanceof Title && $title->getFragment() == '' && $title->equals( $parser->mTitle ) ) + + if ( !$wgRestrictDisplayTitle ) { $parser->mOutput->setDisplayTitle( $text ); + } else { + $title = Title::newFromText( $text ); + if( $title instanceof Title && $title->getFragment() == '' && $title->equals( $parser->mTitle ) ) + $parser->mOutput->setDisplayTitle( $text ); + } return ''; }