Go to the documentation of this file.
27 # Some places check createpage, while others check create.
28 # As it stands, upload does createpage, but normalize both
29 # to the same action, to stop future similar bugs.
30 if ( $action ===
'createpage' || $action ===
'createtalk' ) {
33 if ( $action ==
'create' || $action ==
'edit' || $action ==
'upload' ) {
36 $errmsg = $blacklisted->getErrorMessage(
'edit' );
38 $blacklisted->getRaw(),
45 htmlspecialchars( $blacklisted->getRaw() ),
48 'titleblacklist-forbidden',
54 'line' => $blacklisted->getRaw(),
59 'info' =>
'TitleBlacklist prevents this title from being created',
83 $title->exists() ?
'edit' :
'create'
85 if ( !$blacklisted ) {
89 $params = $blacklisted->getParams();
90 if ( isset( $params[
'autoconfirmed'] ) ) {
94 $msg =
wfMessage(
'titleblacklist-warning' );
95 $notices[
'titleblacklist'] = $msg->plaintextParams( $blacklisted->getRaw() )
114 $blacklisted = $titleBlacklist->userCannot( $newTitle, $user,
'move' );
115 if ( !$blacklisted ) {
116 $blacklisted = $titleBlacklist->userCannot( $oldTitle, $user,
'edit' );
120 $blacklisted->getErrorMessage(
'move' ),
121 $blacklisted->getRaw(),
143 $userName,
User $creatingUser, $override =
true, $log =
false
147 'new-account', $override );
152 $message = $blacklisted->getErrorMessage(
'new-account' );
154 $blacklisted->getRaw(),
159 [ $message, $blacklisted->getRaw(), $userName ],
160 'titleblacklist-forbidden',
166 'line' => $blacklisted->getRaw(),
168 'info' =>
'TitleBlacklist prevents this username from being created',
184 $title = $editor->getTitle();
189 $ok = $blackList->validate( $bl );
194 $errmsg =
wfMessage(
'titleblacklist-invalid' )->numParams( count( $ok ) )->text();
195 $errlines =
'* <code>' .
196 implode(
"</code>\n* <code>", array_map(
'wfEscapeWikiText', $ok ) ) .
198 $error = Html::openElement(
'div', [
'class' =>
'errorbox' ] ) .
202 Html::closeElement(
'div' ) .
"\n" .
203 Html::element(
'br', [
'clear' =>
'all' ] ) .
"\n";
221 WikiPage $wikiPage, &$user,
$content, $summary, $isminor, $iswatch, $section
238 global $wgTitleBlacklistLogHits;
239 if ( $wgTitleBlacklistLogHits ) {
240 $logEntry =
new ManualLogEntry(
'titleblacklist',
'hit-username' );
241 $logEntry->setPerformer( $user );
242 $logEntry->setTarget(
$title );
243 $logEntry->setParameters( [
244 '4::entry' => $entry,
246 $logid = $logEntry->insert();
247 $logEntry->publish( $logid );
258 if ( $engine ==
'lua' ) {
259 $extraLibraries[
'mw.ext.TitleBlacklist'] =
'Scribunto_LuaTitleBlacklistLibrary';
static onValidateBlacklist( $editor, $text, $section, &$error)
EditFilter hook.
static newFatal( $message,... $parameters)
Factory function for fatal errors.
static singleton()
Get an instance of this class.
static onClearBlacklist(WikiPage $wikiPage, &$user, $content, $summary, $isminor, $iswatch, $section)
PageContentSaveComplete hook.
Class representing a MediaWiki article and history.
static logFilterHitUsername( $user, $title, $entry)
Logs the filter username hit to Special:Log if $wgTitleBlacklistLogHits is enabled.
static onScribuntoExternalLibraries( $engine, array &$extraLibraries)
External Lua library for Scribunto.
wfMessage( $key,... $params)
This is the function for getting translated interface messages.
static onDisplayBlacklistOverrideNotice(Title $title, $oldid, array &$notices)
Display a notice if a user is only able to create or edit a page because they have tboverride.
Hooks for Title Blacklist.
Generic operation result class Has warning/error list, boolean status and arbitrary value.
static onMovePageCheckPermissions(Title $oldTitle, Title $newTitle, User $user, $reason, Status $status)
MovePageCheckPermissions hook (1.25+)
getTitle()
Get the title object of the article.
Represents a title blacklist entry.
getFullText()
Get the prefixed title with spaces, plus any fragment (part beginning with '#')
static create( $msg, $code=null, array $data=null)
Create an IApiMessage for the message.
static makeTitleSafe( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
static setIndexedTagName(array &$arr, $tag)
Set the tag name for numeric-keyed values in XML format.
static newGood( $value=null)
Factory function for good results.
static getMain()
Get the RequestContext object associated with the main request.
static parseBlacklist( $list, $sourceName)
Parse blacklist from a string.
Represents a title within MediaWiki.
static onUserCan( $title, $user, $action, &$result)
getUserPermissionsErrorsExpensive hook
Class for creating new log entries and inserting them into the database.
static testUserName( $userName, User $creatingUser, $override=true, $log=false)
Check whether a user name is acceptable for account creation or autocreation, and explain why not if ...
The User object encapsulates all of the user-specific settings (user_id, name, rights,...