2007-12-08 21:06:21 +00:00
|
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Hooks for Title Blacklist
|
|
|
|
|
*
|
|
|
|
|
* @package MediaWiki
|
|
|
|
|
* @subpackage Extensions
|
|
|
|
|
* @author VasilievVV
|
|
|
|
|
* @copyright <EFBFBD> 2007 VasilievVV
|
|
|
|
|
* @licence GNU General Public Licence 2.0 or later
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
class TitleBlacklistHooks {
|
|
|
|
|
public static function userCan( $title, $user, $action, &$result )
|
|
|
|
|
{
|
|
|
|
|
global $wgTitleBlacklist;
|
2007-12-10 19:02:38 +00:00
|
|
|
|
if ( $action != 'create' && $action != 'edit' ) {
|
2007-12-08 21:06:21 +00:00
|
|
|
|
$result = true;
|
|
|
|
|
return $result;
|
|
|
|
|
}
|
2007-12-10 19:02:38 +00:00
|
|
|
|
$blacklisted = $wgTitleBlacklist->isBlacklisted( $title, $action );
|
2007-12-08 21:06:21 +00:00
|
|
|
|
if( is_string( $blacklisted ) ) {
|
2007-12-15 06:16:19 +00:00
|
|
|
|
$result = array( 'titleblacklist-forbidden-edit', htmlspecialchars( $blacklisted ), $title->getFullText() );
|
|
|
|
|
return false;
|
2007-12-08 21:06:21 +00:00
|
|
|
|
}
|
|
|
|
|
|
2007-12-10 19:02:38 +00:00
|
|
|
|
return $result = true;
|
2007-12-08 21:06:21 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static function abortMove( $old, $nt, $user, &$err ) {
|
|
|
|
|
global $wgTitleBlacklist;
|
2007-12-10 19:02:38 +00:00
|
|
|
|
$blacklisted = $wgTitleBlacklist->isBlacklisted( $nt, 'move' );
|
|
|
|
|
if( is_string( $blacklisted ) ) {
|
|
|
|
|
$err = wfMsgWikiHtml( "titleblacklist-forbidden-move", htmlspecialchars( $blacklisted ), $nt->getFullText(), $old->getFullText() );
|
2007-12-08 21:06:21 +00:00
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static function verifyUpload( $fname, $fpath, &$err ) {
|
|
|
|
|
global $wgTitleBlacklist, $wgUser;
|
2007-12-10 19:02:38 +00:00
|
|
|
|
$blacklisted = $wgTitleBlacklist->isBlacklisted( $fname, 'upload' );
|
|
|
|
|
if( is_string( $blacklisted ) ) {
|
|
|
|
|
$err = wfMsgWikiHtml( "titleblacklist-forbidden-upload", htmlspecialchars( $blacklisted ), $fname );
|
2007-12-08 21:06:21 +00:00
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|