Followup r70930: drop wfLoadExtensionMessages(), use makeTitleSafe() instead of newFromText() per r70390 CR

This commit is contained in:
Roan Kattouw 2010-08-12 09:28:30 +00:00
parent 106f773cf8
commit 01e2dc44e1

View file

@ -19,7 +19,6 @@ class TitleBlacklistHooks {
efInitTitleBlacklist(); efInitTitleBlacklist();
$blacklisted = $wgTitleBlacklist->isBlacklisted( $title, $action ); $blacklisted = $wgTitleBlacklist->isBlacklisted( $title, $action );
if( $blacklisted instanceof TitleBlacklistEntry ) { if( $blacklisted instanceof TitleBlacklistEntry ) {
wfLoadExtensionMessages( 'TitleBlacklist' );
$message = $blacklisted->getCustomMessage(); $message = $blacklisted->getCustomMessage();
if( is_null( $message ) ) if( is_null( $message ) )
$message = 'titleblacklist-forbidden-edit'; $message = 'titleblacklist-forbidden-edit';
@ -40,7 +39,6 @@ class TitleBlacklistHooks {
if( !$blacklisted ) if( !$blacklisted )
$blacklisted = $wgTitleBlacklist->isBlacklisted( $old, 'edit' ); $blacklisted = $wgTitleBlacklist->isBlacklisted( $old, 'edit' );
if( $blacklisted instanceof TitleBlacklistEntry ) { if( $blacklisted instanceof TitleBlacklistEntry ) {
wfLoadExtensionMessages( 'TitleBlacklist' );
$message = $blacklisted->getCustomMessage(); $message = $blacklisted->getCustomMessage();
if( is_null( $message ) ) if( is_null( $message ) )
$message = 'titleblacklist-forbidden-move'; $message = 'titleblacklist-forbidden-move';
@ -64,12 +62,11 @@ class TitleBlacklistHooks {
private static function acceptNewUserName( $userName, &$err ) { private static function acceptNewUserName( $userName, &$err ) {
global $wgTitleBlacklist; global $wgTitleBlacklist;
efInitTitleBlacklist(); efInitTitleBlacklist();
$title = Title::newFromText( $userName, NS_USER ); $title = Title::makeTitleSafe( NS_USER, $userName );
$blacklisted = $wgTitleBlacklist->isBlacklisted( $title, 'new-account' ); $blacklisted = $wgTitleBlacklist->isBlacklisted( $title, 'new-account' );
if( !( $blacklisted instanceof TitleBlacklistEntry ) ) if( !( $blacklisted instanceof TitleBlacklistEntry ) )
$blacklisted = $wgTitleBlacklist->isBlacklisted( $title, 'create' ); $blacklisted = $wgTitleBlacklist->isBlacklisted( $title, 'create' );
if( $blacklisted instanceof TitleBlacklistEntry ) { if( $blacklisted instanceof TitleBlacklistEntry ) {
wfLoadExtensionMessages( 'TitleBlacklist' );
$message = $blacklisted->getCustomMessage(); $message = $blacklisted->getCustomMessage();
if ( is_null( $message ) ) if ( is_null( $message ) )
$message = 'titleblacklist-forbidden-new-account'; $message = 'titleblacklist-forbidden-new-account';
@ -106,7 +103,6 @@ class TitleBlacklistHooks {
return true; return true;
} }
wfLoadExtensionMessages( 'TitleBlacklist' );
$errmsg = wfMsgExt( 'titleblacklist-invalid', array( 'parsemag' ), count( $ok ) ); $errmsg = wfMsgExt( 'titleblacklist-invalid', array( 'parsemag' ), count( $ok ) );
$errlines = '* <tt>' . implode( "</tt>\n* <tt>", array_map( 'wfEscapeWikiText', $ok ) ) . '</tt>'; $errlines = '* <tt>' . implode( "</tt>\n* <tt>", array_map( 'wfEscapeWikiText', $ok ) ) . '</tt>';
$error = Html::openElement( 'div', array( 'class' => 'errorbox' ) ) . $error = Html::openElement( 'div', array( 'class' => 'errorbox' ) ) .
@ -124,7 +120,6 @@ class TitleBlacklistHooks {
if( $retitle !== null && !$retitle->exists() ) { if( $retitle !== null && !$retitle->exists() ) {
$blacklisted = $wgTitleBlacklist->isBlacklisted( $retitle, 'create' ); $blacklisted = $wgTitleBlacklist->isBlacklisted( $retitle, 'create' );
if( $blacklisted instanceof TitleBlacklistEntry ) { if( $blacklisted instanceof TitleBlacklistEntry ) {
wfLoadExtensionMessages( 'TitleBlacklist' );
$error = Html::openElement( 'div', array( 'class' => 'errorbox' ) ) . $error = Html::openElement( 'div', array( 'class' => 'errorbox' ) ) .
wfMsg( 'titleblacklist-forbidden-edit', wfMsg( 'titleblacklist-forbidden-edit',
htmlspecialchars( $blacklisted->getRaw() ), htmlspecialchars( $blacklisted->getRaw() ),