r40804 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r40803‎ | r40804 | r40805 >
Date:01:43, 14 September 2008
Author:krimpet
Status:old
Tags:
Comment:
self-rv; mixed up diffs
Modified paths:
  • /trunk/extensions/TitleBlacklist/TitleBlacklist.hooks.php (modified) (history)
  • /trunk/extensions/TitleBlacklist/TitleBlacklist.php (modified) (history)

Diff [purge]

Index: trunk/extensions/TitleBlacklist/TitleBlacklist.php
@@ -46,7 +46,6 @@
4747 $wgHooks['getUserPermissionsErrorsExpensive'][] = 'TitleBlacklistHooks::userCan';
4848 $wgHooks['AbortMove'][] = 'TitleBlacklistHooks::abortMove';
4949 $wgHooks['AbortNewAccount'][] = 'TitleBlacklistHooks::abortNewAccount';
50 -$wgHooks['AuthPluginAutoCreate'][] = 'TitleBlacklistHooks::abortNewAccountAuto';
5150 $wgHooks['EditFilter'][] = 'TitleBlacklistHooks::validateBlacklist';
5251 $wgHooks['ArticleSaveComplete'][] = 'TitleBlacklistHooks::clearBlacklist';
5352
Index: trunk/extensions/TitleBlacklist/TitleBlacklist.hooks.php
@@ -84,44 +84,27 @@
8585 global $wgTitleBlacklist;
8686 efInitTitleBlacklist();
8787 $title = $editor->mTitle;
88 - if( $title->getNamespace() == NS_MEDIAWIKI && $title->getDBkey() == 'Titleblacklist' ) {
89 -
90 - $bl = $wgTitleBlacklist->parseBlacklist( $text );
91 - $ok = $wgTitleBlacklist->validate( $bl );
92 - if( count( $ok ) == 0 ) {
93 - return true;
94 - }
95 -
96 - wfLoadExtensionMessages( 'TitleBlacklist' );
97 - $errmsg = wfMsgExt( 'titleblacklist-invalid', array( 'parsemag' ), count( $ok ) );
98 - $errlines = '* <tt>' . implode( "</tt>\n* <tt>", array_map( 'wfEscapeWikiText', $ok ) ) . '</tt>';
99 - $error = '<div class="errorbox">' .
100 - $errmsg .
101 - "\n" .
102 - $errlines .
103 - "</div>\n" .
104 - "<br clear='all' />\n";
105 -
106 - // $error will be displayed by the edit class
 88+ if( $title->getNamespace() != NS_MEDIAWIKI || $title->getDBkey() != 'Titleblacklist' )
10789 return true;
108 - } else if (!$section) {
109 - # Block redirects to nonexistent blacklisted titles
110 - $retitle = Title::newFromRedirect( $text );
111 - if ( $retitle !== null && !$retitle->exists() ) {
112 - $blacklisted = $wgTitleBlacklist->isBlacklisted( $retitle, 'create' );
113 - if ( $blacklisted instanceof TitleBlacklistEntry ) {
114 - wfLoadExtensionMessages( 'TitleBlacklist' );
115 - $error = ( '<div class="errorbox">' .
116 - wfMsg( 'titleblacklist-forbidden-edit',
117 - htmlspecialchars( $blacklisted->getRaw() ),
118 - $retitle->getFullText() ) .
119 - "</div>\n" .
120 - "<br clear='all' />\n" );
121 - }
122 - }
12390
 91+ $bl = $wgTitleBlacklist->parseBlacklist( $text );
 92+ $ok = $wgTitleBlacklist->validate( $bl );
 93+ if( count( $ok ) == 0 ) {
12494 return true;
12595 }
 96+
 97+ wfLoadExtensionMessages( 'TitleBlacklist' );
 98+ $errmsg = wfMsgExt( 'titleblacklist-invalid', array( 'parsemag' ), count( $ok ) );
 99+ $errlines = '* <tt>' . implode( "</tt>\n* <tt>", array_map( 'wfEscapeWikiText', $ok ) ) . '</tt>';
 100+ $error = '<div class="errorbox">' .
 101+ $errmsg .
 102+ "\n" .
 103+ $errlines .
 104+ "</div>\n" .
 105+ "<br clear='all' />\n";
 106+
 107+ // $error will be displayed by the edit class
 108+ return true;
126109 }
127110
128111 /** ArticleSaveComplete hook */