Index: TitleBlacklist.hooks.php
===================================================================
--- TitleBlacklist.hooks.php (revision 50147)
+++ TitleBlacklist.hooks.php (working copy)
@@ -14,13 +14,21 @@
class TitleBlacklistHooks {
/** getUserPermissionsErrorsExpensive hook */
public static function userCan( $title, $user, $action, &$result ) {
- global $wgTitleBlacklist;
+ global $wgTitleBlacklist, $wgOut;
if( $action == 'create' || $action == 'edit' || $action == 'upload' ) {
efInitTitleBlacklist();
$blacklisted = $wgTitleBlacklist->isBlacklisted( $title, $action );
if( $blacklisted instanceof TitleBlacklistEntry ) {
wfLoadExtensionMessages( 'TitleBlacklist' );
$message = $blacklisted->getCustomMessage();
+ if ( $blacklisted->override ) {
+ wfLoadExtensionMessages( 'TitleBlacklist' );
+ $message = 'titleblacklist-forbidden-' . $action;
+ $wgOut->addHTML( "
\n" );
+ $wgOut->addWikiMsg( $message, htmlspecialchars( $blacklisted->getRaw() ), $title->getfullText() );
+ $wgOut->addHTML( "
\n" );
+ return true;
+ }
if( is_null( $message ) )
$message = 'titleblacklist-forbidden-edit';
$result = array( $message,
@@ -40,6 +48,9 @@
if( !$blacklisted )
$blacklisted = $wgTitleBlacklist->isBlacklisted( $old, 'edit' );
if( $blacklisted instanceof TitleBlacklistEntry ) {
+ if ( $blacklisted->override ) {
+ return true;
+ }
wfLoadExtensionMessages( 'TitleBlacklist' );
$message = $blacklisted->getCustomMessage();
if( is_null( $message ) )
@@ -65,6 +76,9 @@
if( !( $blacklisted instanceof TitleBlacklistEntry ) )
$blacklisted = $wgTitleBlacklist->isBlacklisted( $title, 'create' );
if( $blacklisted instanceof TitleBlacklistEntry ) {
+ if ( $blacklisted->override ) {
+ return true;
+ }
wfLoadExtensionMessages( 'TitleBlacklist' );
$message = $blacklisted->getCustomMessage();
if( is_null( $message ) )
Index: TitleBlacklist.list.php
===================================================================
--- TitleBlacklist.list.php (revision 50147)
+++ TitleBlacklist.list.php (working copy)
@@ -149,6 +149,11 @@
if( $this->isWhitelisted( $title, $action ) ) {
return false;
}
+ if ( $wgUser->isAllowed( "tboverride" ) ) {
+ # Display a messaage that the action is prohibited but
+ # the user is assigned the 'tboverride' permission
+ $item->override = true;
+ }
return $item;
}
}
@@ -283,9 +288,6 @@
* @return TRUE if the user can; otherwise FALSE
*/
public function userCan( $title, $user, $action ) {
- if( $user->isAllowed( 'tboverride' ) ) {
- return true;
- }
wfSuppressWarnings();
$match = preg_match( "/^(?:{$this->mRegex})$/us" . ( isset( $this->mParams['casesensitive'] ) ? '' : 'i' ), $title->getFullText() );
wfRestoreWarnings();
Index: TitleBlacklist.i18n.php
===================================================================
--- TitleBlacklist.i18n.php (revision 50147)
+++ TitleBlacklist.i18n.php (working copy)
@@ -14,8 +14,10 @@
# This is case insensitive by default",
'titlewhitelist' => "# This is a title whitelist. Use \"#\" for comments.
# This is case insensitive by default",
- 'titleblacklist-forbidden-edit' => 'The title "$2" has been banned from creation.
+ 'titleblacklist-forbidden-edit' => 'The title "$2" has been banned from editing.
It matches the following blacklist entry: $1
',
+ 'titleblacklist-forbidden-create' => 'The title "$2" has been banned from creation.
+It matches the following blacklist entry: $1
',
'titleblacklist-forbidden-move' => '"$2" cannot be moved to "$3", because the title "$3" has been banned from creation.
It matches the following blacklist entry: $1
',
'titleblacklist-forbidden-upload' => 'The file name "$2" has been banned from creation.