2007-11-05 16:38:38 +00:00
|
|
|
<?php
|
|
|
|
if ( !defined( 'MEDIAWIKI' ) ) {
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
$wgExtensionCredits['other'][] = array(
|
|
|
|
'name' => 'Title Blacklist',
|
2007-12-09 13:21:34 +00:00
|
|
|
'version' => '1.1',
|
|
|
|
'url' => 'http://www.mediawiki.org/wiki/Extension:TitleBlacklist',
|
2007-11-05 16:38:38 +00:00
|
|
|
'author' => 'VasilievVV',
|
|
|
|
'description' => 'Allows to forbide creation of pages with specified titles'
|
|
|
|
);
|
|
|
|
|
2007-12-08 21:06:21 +00:00
|
|
|
$wgAutoloadClasses['TitleBlacklist'] = dirname( __FILE__ ) . '/TitleBlacklist.list.php';
|
|
|
|
$wgAutoloadClasses['TitleBlacklistHooks'] = dirname( __FILE__ ) . '/TitleBlacklist.hooks.php';
|
|
|
|
|
|
|
|
$wgExtensionFunctions[] = 'efInitTitleBlacklist';
|
|
|
|
|
2007-12-09 12:15:13 +00:00
|
|
|
// Sources of TitleBlacklist
|
2007-12-10 19:02: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
|
2007-12-09 12:15:13 +00:00
|
|
|
$wgTitleBlacklistSources = array();
|
2007-11-05 16:38:38 +00:00
|
|
|
|
|
|
|
$wgAvailableRights[] = 'tboverride';
|
|
|
|
$wgGroupPermissions['sysop']['tboverride'] = true;
|
|
|
|
|
2007-12-08 21:06:21 +00:00
|
|
|
function efInitTitleBlacklist() {
|
|
|
|
global $wgTitleBlacklist;
|
|
|
|
$wgTitleBlacklist = new TitleBlacklist();
|
|
|
|
efSetupTitleBlacklistMessages();
|
|
|
|
efSetupTitleBlacklistHooks();
|
|
|
|
}
|
|
|
|
|
2007-11-05 16:38:38 +00:00
|
|
|
function efSetupTitleBlacklistMessages() {
|
|
|
|
global $wgMessageCache;
|
|
|
|
require_once( 'TitleBlacklist.i18n.php' );
|
|
|
|
foreach( efGetTitleBlacklistMessages() as $lang => $messages ) {
|
|
|
|
$wgMessageCache->addMessages( $messages, $lang );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-12-08 21:06:21 +00:00
|
|
|
function efSetupTitleBlacklistHooks() {
|
|
|
|
global $wgHooks;
|
|
|
|
$titleBlacklistHooks = new TitleBlacklistHooks();
|
|
|
|
$wgHooks['userCan'][] = array( $titleBlacklistHooks, 'userCan' );
|
|
|
|
$wgHooks['AbortMove'][] = array( $titleBlacklistHooks, 'abortMove' );
|
|
|
|
$wgHooks['UploadVerification'][] = array( $titleBlacklistHooks, 'verifyUpload' );
|
2007-12-09 13:21:34 +00:00
|
|
|
}
|