2007-11-05 16:38:38 +00:00
|
|
|
<?php
|
|
|
|
if ( !defined( 'MEDIAWIKI' ) ) {
|
2012-08-29 13:53:38 +00:00
|
|
|
exit( 1 );
|
2007-11-05 16:38:38 +00:00
|
|
|
}
|
|
|
|
|
2012-08-29 13:53:38 +00:00
|
|
|
// @{
|
2008-08-09 01:54:39 +00:00
|
|
|
/**
|
2010-06-06 15:12:22 +00:00
|
|
|
* @file
|
|
|
|
* @ingroup Extensions
|
2008-08-09 01:54:39 +00:00
|
|
|
*/
|
|
|
|
|
2012-02-13 14:06:45 +00:00
|
|
|
$wgExtensionCredits['antispam'][] = array(
|
2009-04-27 04:45:10 +00:00
|
|
|
'path' => __FILE__,
|
2008-02-18 20:43:36 +00:00
|
|
|
'name' => 'Title Blacklist',
|
2013-02-19 03:52:32 +00:00
|
|
|
'author' => array( 'Victor Vasiliev', 'Fran Rogers' ),
|
2014-03-29 12:47:09 +00:00
|
|
|
'version' => '1.5.0',
|
2011-12-13 23:49:33 +00:00
|
|
|
'url' => 'https://www.mediawiki.org/wiki/Extension:Title_Blacklist',
|
2008-02-18 20:43:36 +00:00
|
|
|
'descriptionmsg' => 'titleblacklist-desc',
|
2015-01-29 15:34:44 +00:00
|
|
|
'license-name' => 'GPL-2.0+',
|
2007-11-05 16:38:38 +00:00
|
|
|
);
|
|
|
|
|
2012-08-29 13:53:38 +00:00
|
|
|
$dir = __DIR__;
|
2014-03-29 12:47:09 +00:00
|
|
|
$wgMessagesDirs['TitleBlacklist'] = __DIR__ . '/i18n';
|
2012-08-29 13:53:38 +00:00
|
|
|
$wgExtensionMessagesFiles['TitleBlacklist'] = $dir . '/TitleBlacklist.i18n.php';
|
|
|
|
$wgAutoloadClasses['TitleBlacklist'] = $dir . '/TitleBlacklist.list.php';
|
2015-01-06 16:31:06 +00:00
|
|
|
$wgAutoloadClasses['TitleBlacklistEntry'] = $dir . '/TitleBlacklist.list.php';
|
2012-08-29 13:53:38 +00:00
|
|
|
$wgAutoloadClasses['TitleBlacklistHooks'] = $dir . '/TitleBlacklist.hooks.php';
|
2014-01-07 18:08:24 +00:00
|
|
|
$wgAutoloadClasses['Scribunto_LuaTitleBlacklistLibrary'] = $dir . '/TitleBlacklist.library.php';
|
2007-12-08 21:06:21 +00:00
|
|
|
|
2008-08-09 01:54:39 +00:00
|
|
|
/** @defgroup Title blacklist source types
|
|
|
|
* @{
|
|
|
|
*/
|
2012-08-29 13:53:38 +00:00
|
|
|
define( 'TBLSRC_MSG', 0 ); ///< For internal usage
|
|
|
|
define( 'TBLSRC_LOCALPAGE', 1 ); ///< Local wiki page
|
|
|
|
define( 'TBLSRC_URL', 2 ); ///< Load blacklist from URL
|
|
|
|
define( 'TBLSRC_FILE', 3 ); ///< Load from file
|
2008-08-09 01:54:39 +00:00
|
|
|
/** @} */
|
|
|
|
|
2012-05-24 23:55:22 +00:00
|
|
|
/**
|
|
|
|
* Array of title blacklist sources.
|
|
|
|
*
|
|
|
|
* Should be in array( name => source description ) format.
|
|
|
|
* See extension documentation for details of source description.
|
|
|
|
*/
|
2007-12-09 12:15:13 +00:00
|
|
|
$wgTitleBlacklistSources = array();
|
2007-11-05 16:38:38 +00:00
|
|
|
|
2012-05-24 23:55:22 +00:00
|
|
|
/**
|
|
|
|
* Sets the sources which may work as a username filter.
|
|
|
|
*
|
|
|
|
* '*' is for all; false disables all.
|
|
|
|
*
|
|
|
|
* If you want to limit it to particular sources, use
|
|
|
|
* array( source name 1, source name 2 ).
|
|
|
|
* This may be useful when you have shared account creation system
|
|
|
|
* in order to avoid blacklist fragmentation.
|
|
|
|
*/
|
|
|
|
$wgTitleBlacklistUsernameSources = '*';
|
|
|
|
|
2014-05-23 19:02:49 +00:00
|
|
|
/**
|
|
|
|
* Log blacklist hits to Special:Log
|
|
|
|
*/
|
|
|
|
$wgTitleBlacklistLogHits = false;
|
|
|
|
|
2007-12-19 18:35:44 +00:00
|
|
|
$wgTitleBlacklistCaching = array(
|
|
|
|
'warningchance' => 100,
|
|
|
|
'expiry' => 900,
|
|
|
|
'warningexpiry' => 600,
|
|
|
|
);
|
|
|
|
|
2011-07-21 22:08:44 +00:00
|
|
|
$dir = dirname( __FILE__ );
|
|
|
|
|
|
|
|
// Register the API method
|
|
|
|
$wgAutoloadClasses['ApiQueryTitleBlacklist'] = "$dir/api/ApiQueryTitleBlacklist.php";
|
|
|
|
$wgAPIModules['titleblacklist'] = 'ApiQueryTitleBlacklist';
|
|
|
|
|
2012-08-29 13:53:38 +00:00
|
|
|
$wgAvailableRights[] = 'tboverride'; // Implies tboverride-account
|
|
|
|
$wgAvailableRights[] = 'tboverride-account'; // For account creation
|
2007-11-05 16:38:38 +00:00
|
|
|
$wgGroupPermissions['sysop']['tboverride'] = true;
|
|
|
|
|
2008-06-11 21:02:36 +00:00
|
|
|
$wgHooks['getUserPermissionsErrorsExpensive'][] = 'TitleBlacklistHooks::userCan';
|
2014-06-19 17:34:57 +00:00
|
|
|
$wgHooks['TitleGetEditNotices'][] = 'TitleBlacklistHooks::displayBlacklistOverrideNotice';
|
2008-06-11 21:02:36 +00:00
|
|
|
$wgHooks['AbortMove'][] = 'TitleBlacklistHooks::abortMove';
|
2014-10-27 18:06:03 +00:00
|
|
|
$wgHooks['MovePageCheckPermissions'][] = 'TitleBlacklistHooks::onMovePageCheckPermissions';
|
2008-08-09 01:54:39 +00:00
|
|
|
$wgHooks['AbortNewAccount'][] = 'TitleBlacklistHooks::abortNewAccount';
|
2011-04-05 01:18:40 +00:00
|
|
|
$wgHooks['AbortAutoAccount'][] = 'TitleBlacklistHooks::abortNewAccount';
|
2008-06-11 21:02:36 +00:00
|
|
|
$wgHooks['EditFilter'][] = 'TitleBlacklistHooks::validateBlacklist';
|
|
|
|
$wgHooks['ArticleSaveComplete'][] = 'TitleBlacklistHooks::clearBlacklist';
|
2010-11-08 21:55:05 +00:00
|
|
|
$wgHooks['UserCreateForm'][] = 'TitleBlacklistHooks::addOverrideCheckbox';
|
2013-11-07 10:32:01 +00:00
|
|
|
$wgHooks['UnitTestsList'][] = function( &$files ) {
|
2015-01-21 00:55:35 +00:00
|
|
|
$files = array_merge( $files, glob( __DIR__ . '/tests/*Test.php' ) );
|
2013-11-07 10:32:01 +00:00
|
|
|
return true;
|
|
|
|
};
|
2014-01-07 18:08:24 +00:00
|
|
|
$wgHooks['ScribuntoExternalLibraries'][] = function( $engine, array &$extraLibraries ) {
|
|
|
|
if( $engine == 'lua' ) {
|
|
|
|
$extraLibraries['mw.ext.TitleBlacklist'] = 'Scribunto_LuaTitleBlacklistLibrary';
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
};
|
2008-06-11 21:02:36 +00:00
|
|
|
|
2014-05-23 19:02:49 +00:00
|
|
|
$wgLogTypes[] = 'titleblacklist';
|
|
|
|
$wgLogActionsHandlers['titleblacklist/*'] = 'LogFormatter';
|
|
|
|
$wgLogRestrictions['titleblacklist'] = 'titleblacklistlog';
|
|
|
|
$wgGroupPermissions['sysop']['titleblacklistlog'] = true;
|
|
|
|
$wgAvailableRights[] = 'titleblacklistlog';
|
|
|
|
|
2013-03-03 22:56:35 +00:00
|
|
|
$wgResourceModules['mediawiki.api.titleblacklist'] = array(
|
|
|
|
'scripts' => 'mediawiki.api.titleblacklist.js',
|
|
|
|
'localBasePath' => $dir . '/modules',
|
|
|
|
'remoteExtPath' => 'TitleBlacklist/modules',
|
|
|
|
'dependencies' => array( 'mediawiki.api' ),
|
|
|
|
);
|
2012-08-29 13:53:38 +00:00
|
|
|
// @}
|