Go to the documentation of this file.
55 $a = mt_rand( 0, 100 );
56 $b = mt_rand( 0, 10 );
60 $op = mt_rand( 0, 1 ) ?
'+' :
'−';
65 $answer = ( $op ==
'+' ) ? ( $a + $b ) : ( $a - $b );
66 return [
'question' => $test,
'answer' => $answer ];
76 $resultArr[
'captcha'][
'id'] = $index;
77 $resultArr[
'captcha'][
'question'] = $captcha[
'question'];
88 'mime' =>
'text/plain',
126 'html' =>
"<p><label for=\"wpCaptchaWord\">{$captcha['question']} = </label>" .
128 'name' =>
'wpCaptchaWord',
129 'class' =>
'mw-ui-input',
130 'id' =>
'wpCaptchaWord',
132 'autocomplete' =>
'off',
133 'tabindex' => $tabIndex ] ) .
137 'name' =>
'wpCaptchaId',
138 'id' =>
'wpCaptchaId',
139 'value' => $index ] )
162 if ( !$formInformation ) {
165 if ( isset( $formInformation[
'html'] ) ) {
166 $out->addHTML( $formInformation[
'html'] );
168 if ( isset( $formInformation[
'modules'] ) ) {
169 $out->addModules( $formInformation[
'modules'] );
171 if ( isset( $formInformation[
'modulestyles'] ) ) {
172 $out->addModuleStyles( $formInformation[
'modulestyles'] );
174 if ( isset( $formInformation[
'headitems'] ) ) {
175 $out->addHeadItems( $formInformation[
'headitems'] );
185 return $captchaData[
'question'] .
' =';
194 $page = $editPage->getArticle()->getPage();
195 if ( !isset(
$page->ConfirmEdit_ActivateCaptcha ) ) {
199 if ( $this->
action !==
'edit' ) {
200 unset(
$page->ConfirmEdit_ActivateCaptcha );
212 $page = $editPage->getArticle()->getPage();
214 if ( isset(
$page->ConfirmEdit_ActivateCaptcha ) ||
220 unset(
$page->ConfirmEdit_ActivateCaptcha );
237 return $msg->isDisabled() ?
wfMessage( static::$messagePrefix .
'edit' ) : $msg;
247 global $wgCaptchaTriggers;
248 $out = $form->getOutput();
249 $user = $form->getUser();
250 if ( $wgCaptchaTriggers[
'sendemail'] ) {
251 $this->
action =
'sendemail';
252 if (
$user->isAllowed(
'skipcaptcha' ) ) {
253 wfDebug(
"ConfirmEdit: user group allows skipping captcha on email sending\n" );
257 $formMetainfo = $formInformation;
258 unset( $formMetainfo[
'html'] );
260 $form->addFooterText(
261 "<div class='captcha'>" .
262 $out->parse( $this->getMessage(
'sendemail' )->text() ) .
263 $formInformation[
'html'] .
276 global $wgCaptchaTriggers, $wgCaptchaBadLoginExpiration,
277 $wgCaptchaBadLoginPerUserExpiration;
280 if ( $wgCaptchaTriggers[
'badlogin'] ) {
284 $cache->add( $key, 0, $wgCaptchaBadLoginExpiration );
290 if ( $wgCaptchaTriggers[
'badloginperuser'] &&
$username ) {
292 $count =
$cache->get( $key );
294 $cache->add( $key, 0, $wgCaptchaBadLoginPerUserExpiration );
306 global $wgCaptchaTriggers;
308 if ( $wgCaptchaTriggers[
'badloginperuser'] &&
$username ) {
321 global $wgCaptchaTriggers, $wgCaptchaBadLoginAttempts;
323 return $wgCaptchaTriggers[
'badlogin']
324 && (int)
$cache->get( $this->badLoginKey() ) >= $wgCaptchaBadLoginAttempts;
334 global $wgCaptchaTriggers, $wgCaptchaBadLoginPerUserAttempts;
337 if ( is_object( $u ) ) {
340 return $wgCaptchaTriggers[
'badloginperuser']
341 && (int)
$cache->get( $this->badLoginPerUserKey( $u ) ) >= $wgCaptchaBadLoginPerUserAttempts;
356 if ( $wgCaptchaWhitelistIP ) {
362 $whitelistMsg =
wfMessage(
'captcha-ip-whitelist' )->inContentLanguage();
363 if ( !$whitelistMsg->isDisabled() ) {
382 $cacheKey =
$cache->makeKey(
'confirmedit',
'ipwhitelist' );
384 $cachedWhitelist =
$cache->get( $cacheKey );
385 if ( $cachedWhitelist ===
false ) {
389 explode(
"\n", $msg->plain() )
394 $cache->set( $cacheKey, $whitelist, 86400 );
397 $whitelist = $cachedWhitelist;
416 $ips = array_map(
'trim',
$input );
417 $ips = array_filter( $ips );
420 foreach ( $ips
as $ip ) {
460 return $answer == $info[
'answer'];
471 global $wgCaptchaTriggers, $wgCaptchaTriggersOnNamespace;
473 if ( isset( $wgCaptchaTriggersOnNamespace[
$title->getNamespace()][
$action] ) ) {
474 return $wgCaptchaTriggersOnNamespace[
$title->getNamespace()][
$action];
477 return ( !empty( $wgCaptchaTriggers[
$action] ) );
491 global $ceAllowConfirmedEmail;
502 if (
$user->isAllowed(
'skipcaptcha' ) ) {
503 wfDebug(
"ConfirmEdit: user group allows skipping captcha\n" );
506 wfDebug(
"ConfirmEdit: user IP is whitelisted" );
508 } elseif ( $ceAllowConfirmedEmail &&
$user->isEmailConfirmed() ) {
509 wfDebug(
"ConfirmEdit: user has confirmed mail, skipping captcha\n" );
518 $newtext =
$content->getNativeData();
530 $this->trigger = sprintf(
"edit trigger by '%s' at [[%s]]",
532 $title->getPrefixedText() );
534 wfDebug(
"ConfirmEdit: checking all edits...\n" );
540 $this->trigger = sprintf(
"Create trigger by '%s' at [[%s]]",
542 $title->getPrefixedText() );
544 wfDebug(
"ConfirmEdit: checking on page creation...\n" );
552 "ConfirmEdit: request not posted, assuming that no content will be saved -> no CAPTCHA check"
564 if ( $editInfo->output ) {
565 $newLinks = array_keys( $editInfo->output->getExternalLinks() );
576 $unknownLinks = array_filter( $newLinks, [ $this,
'filterLink' ] );
577 $addedLinks = array_diff( $unknownLinks, $oldLinks );
578 $numLinks =
count( $addedLinks );
580 if ( $numLinks > 0 ) {
581 $this->trigger = sprintf(
"%dx url trigger by '%s' at [[%s]]: %s",
584 $title->getPrefixedText(),
585 implode(
", ", $addedLinks ) );
592 if ( $newtext !==
null && $wgCaptchaRegexes ) {
593 if ( !is_array( $wgCaptchaRegexes ) ) {
594 throw new UnexpectedValueException(
595 '$wgCaptchaRegexes is required to be an array, ' . gettype( $wgCaptchaRegexes ) .
' given.'
601 foreach ( $wgCaptchaRegexes
as $regex ) {
603 if ( preg_match_all( $regex, $newtext, $newMatches ) ) {
605 preg_match_all( $regex, $oldtext, $oldMatches );
607 $addedMatches = array_diff( $newMatches[0], $oldMatches[0] );
609 $numHits =
count( $addedMatches );
610 if ( $numHits > 0 ) {
611 $this->trigger = sprintf(
"%dx %s at [[%s]]: %s",
615 $title->getPrefixedText(),
616 implode(
", ", $addedMatches ) );
634 global $wgCaptchaWhitelist;
644 if ( $wgCaptchaWhitelist !==
false ) {
645 array_unshift(
$regexes, $wgCaptchaWhitelist );
650 if ( preg_match( $regex, $url ) ) {
665 # Code duplicated from the SpamBlacklist extension (r19197)
666 # and later modified.
668 # Strip comments and whitespace, then remove blanks
669 $lines = array_filter( array_map(
'trim', preg_replace(
'/#.*$/',
'',
$lines ) ) );
671 # No lines, don't make a regex which will match everything
677 # It's faster using the S modifier even though it will usually only be run once
682 'normal' =>
'/^(?:https?:)?\/\/+[a-z0-9_\-.]*(?:',
683 'noprotocol' =>
'/^(?:',
687 'noprotocol' =>
')/Si',
692 # Extract flags from the line
694 if ( preg_match(
'/^(.*?)\s*<([^<>]*)>$/',
$line,
$matches ) ) {
696 wfDebug(
"Line with empty regex\n" );
700 $opts = preg_split(
'/\s*\|\s*/', trim(
$matches[2] ) );
701 foreach ( $opts
as $opt ) {
703 if (
$opt ==
'noprotocol' ) {
709 $key = isset(
$options[
'noprotocol'] ) ?
'noprotocol' :
'normal';
712 if ( !isset( $build[$key] ) ) {
713 $build[$key] =
$line;
714 } elseif ( strlen( $build[$key] ) + strlen(
$line ) > $regexMax ) {
716 str_replace(
'/',
'\/', preg_replace(
'|\\\*/|',
'/', $build[$key] ) ) .
718 $build[$key] =
$line;
720 $build[$key] .=
'|' .
$line;
723 foreach ( $build
as $key =>
$value ) {
725 str_replace(
'/',
'\/', preg_replace(
'|\\\*/|',
'/', $build[$key] ) ) .
739 $id =
$title->getArticleID();
740 $res =
$dbr->select(
'externallinks', [
'el_to' ],
741 [
'el_from' => $id ], __METHOD__ );
743 foreach (
$res as $row ) {
744 $links[] = $row->el_to;
763 if (
$request->getVal(
'captchaid' ) ) {
767 if (
$request->getVal(
'captchaword' ) ) {
774 wfDebug(
"ConfirmEdit: no need to show captcha.\n" );
803 wfDebug( __METHOD__ .
': Skipped ConfirmEdit check: No WikiPage for title ' .
$title );
813 if ( $this->
action ===
'edit' ) {
818 [
'class' =>
'errorbox' ],
825 $page->ConfirmEdit_ActivateCaptcha =
true;
840 $creatingUser = $creatingUser ?:
$wgUser;
842 if ( $wgCaptchaTriggers[
'createaccount'] ) {
843 if ( $creatingUser->isAllowed(
'skipcaptcha' ) ) {
844 wfDebug(
"ConfirmEdit: user group allows skipping captcha on account creation\n" );
867 if ( $wgCaptchaTriggers[
'sendemail'] ) {
868 if (
$wgUser->isAllowed(
'skipcaptcha' ) ) {
869 wfDebug(
"ConfirmEdit: user group allows skipping captcha on email sending\n" );
876 if ( defined(
'MW_API' ) ) {
878 # Asking for captchas in the API is really silly
882 $this->trigger =
"{$wgUser->getName()} sending email";
936 $index =
$request->getVal(
'wpCaptchaId' );
937 $word =
$request->getVal(
'wpCaptchaWord' );
938 return [ $index, $word ];
953 if (
$user->pingLimiter(
'badcaptcha', 0 ) ) {
955 $this->
log(
'User reached RateLimit, preventing action' );
964 $user->pingLimiter(
'badcaptcha' );
990 if ( isset( $this->captchaSolved ) ) {
996 if ( $this->
keyMatch( $word, $info ) ) {
997 $this->
log(
"passed" );
999 $this->captchaSolved =
true;
1003 $this->
log(
"bad form input" );
1004 $this->captchaSolved =
false;
1008 $this->
log(
"new captcha session" );
1018 wfDebugLog(
'captcha',
'ConfirmEdit: ' . $message .
'; ' . $this->trigger );
1033 if ( !isset( $info[
'index'] ) ) {
1035 $info[
'index'] = strval( mt_rand() );
1038 return $info[
'index'];
1070 if ( is_null(
$rev ) ) {
1096 return array_keys(
$out->getExternalLinks() );
1105 $wgOut->addWikiMsg(
'captchahelp-text' );
1107 $wgOut->addWikiMsg(
'captchahelp-cookies-needed' );
1136 $formDescriptor[
'captchaWord'] = [
1137 'label-message' =>
null,
1138 'autocomplete' =>
false,
1139 'persistent' =>
false,
1141 ] + $formDescriptor[
'captchaWord'];
A module that allows for editing and creating pages.
confirmEmailUser( $from, $to, $subject, $text, &$error)
Check the captcha on Special:EmailUser.
Set options of the Parser.
static get()
Get somewhere to store captcha data that will persist between requests.
error also a ContextSource you ll probably need to make sure the header is varied on and they can depend only on the ResourceLoaderContext $context
getContext()
Get the base IContextSource object.
badLoginPerUserKey( $username)
Cache key for badloginPerUser checks.
error also a ContextSource you ll probably need to make sure the header is varied on $request
static getLocalClusterInstance()
Get the main cluster-local cache object.
loadText( $title, $section, $flags=Revision::READ_LATEST)
Retrieve the current version of the page or section being edited...
msg()
Get a Message object with context set Parameters are the same as wfMessage()
passCaptchaLimitedFromRequest(WebRequest $request, User $user)
Checks, if the user reached the amount of false CAPTCHAs and give him some vacation or run self::pass...
static isInRanges( $ip, $ranges)
Determines if an IP address is a list of CIDR a.b.c.d/n ranges.
addFormToOutput(OutputPage $out, $tabIndex=1)
Uses getFormInformation() to get the CAPTCHA form and adds it to the given OutputPage object.
design txt This is a brief overview of the new design More thorough and up to date information is available on the documentation wiki at etc Handles the details of getting and saving to the user table of the and dealing with sessions and cookies OutputPage Encapsulates the entire HTML page that will be sent in response to any server request It is used by calling its functions to add text
if( $wgSpamBlacklistFiles) $regexes
const PARAM_HELP_MSG
(string|array|Message) Specify an alternative i18n documentation message for this parameter.
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist Do not use this to implement individual filters if they are compatible with the ChangesListFilter and ChangesListFilterGroup structure use sub classes of those in conjunction with the ChangesListSpecialPageStructuredFilters hook This hook can be used to implement filters that do not implement that or custom behavior that is not an individual filter e g Watchlist and Watchlist you will want to construct new ChangesListBooleanFilter or ChangesListStringOptionsFilter objects When constructing you specify which group they belong to You can reuse existing or create your you must register them with $special registerFilterGroup removed from all revisions and log entries to which it was applied This gives extensions a chance to take it off their books as the deletion has already been partly carried out by this point or something similar the user will be unable to create the tag set $status
keyMatch( $answer, $info)
Check if the submitted form matches the captcha session data provided by the plugin when the form was...
as see the revision history and available at free of to any person obtaining a copy of this software and associated documentation to deal in the Software without including without limitation the rights to use
editShowCaptcha( $editPage)
Insert the captcha prompt into an edit form.
please add to it if you re going to add events to the MediaWiki code where normally authentication against an external auth plugin would be creating a account $user
this hook is for auditing only $req
Class representing a MediaWiki article and history.
static newFatal( $message)
Factory function for fatal errors.
captchaTriggers( $title, $action)
canUseWikiPage()
Check whether a WikiPage object can be get with getWikiPage().
Allows to change the fields on the form that will be generated $name
string $action
Used to select the right message.
getRequest()
Get the WebRequest object.
const CONTENT_MODEL_WIKITEXT
showHelp()
Show a page explaining what this wacky thing is.
getUser()
Get the User object.
getTitle()
Get the Title object.
injectEmailUser(&$form)
Inject whazawhoo @fixme if multiple thingies insert a header, could break.
wfDebugLog( $logGroup, $text, $dest='all', array $context=[])
Send a line to a supplementary debug log file, if configured, or main debug log if not.
buildRegexes( $lines)
Build regex from whitelist.
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
getCaptchaInfo( $captchaData, $id)
static newFromTitle(LinkTarget $linkTarget, $id=0, $flags=0)
Load either the current, or a specified, revision that's attached to a given link target.
passCaptchaLimited( $index, $word, User $user)
Checks, if the user reached the amount of false CAPTCHAs and give him some vacation or run self::pass...
addCaptchaAPI(&$resultArr)
resetBadLoginCounter( $username)
Reset bad login counter after a successful login.
namespace and then decline to actually register it file or subcat img or subcat $title
wfGlobalCacheKey()
Make a cache key with database-agnostic prefix.
getCaptcha()
Returns an array with 'question' and 'answer' keys.
filterLink( $url)
Filter callback function for URL whitelisting.
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist Do not use this to implement individual filters if they are compatible with the ChangesListFilter and ChangesListFilterGroup structure use sub classes of those in conjunction with the ChangesListSpecialPageStructuredFilters hook This hook can be used to implement filters that do not implement that or custom behavior that is not an individual filter e g Watchlist and Watchlist you will want to construct new ChangesListBooleanFilter or ChangesListStringOptionsFilter objects When constructing you specify which group they belong to You can reuse existing or create your you must register them with $special registerFilterGroup removed from all revisions and log entries to which it was applied This gives extensions a chance to take it off their books as the deletion has already been partly carried out by this point or something similar the user will be unable to create the tag set and then return false from the hook function Ensure you consume the ChangeTagAfterDelete hook to carry out custom deletion actions as context called by AbstractContent::getParserOutput May be used to override the normal model specific rendering of page content $content
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
if(is_array( $mode)) switch( $mode) $input
do that in ParserLimitReportFormat instead use this to modify the parameters of the image and a DIV can begin in one section and end in another Make sure your code can handle that case gracefully See the EditSectionClearerLink extension for an example zero but section is usually empty its values are the globals values before the output is cached $page
getOutput()
Get the OutputPage object.
findLinks( $title, $text)
Extract a list of all recognized HTTP links in the text.
getWikiIPWhitelist(Message $msg)
Get the on-wiki IP whitelist stored in [[MediaWiki:Captcha-ip-whitelist]] page from cache if possible...
getWikiPage()
Get the WikiPage object.
static element( $element, $attribs=null, $contents='', $allowShortTag=true)
Format an XML element with given attributes and, optionally, text content.
getCaptchaParamsFromRequest(WebRequest $request)
when a variable name is used in a it is silently declared as a new masking the global
onAuthChangeFormFields(array $requests, array $fieldInfo, array &$formDescriptor, $action)
Modify the apprearance of the captcha field.
wfDebug( $text, $dest='all', array $context=[])
Sends a line to the debug log if enabled or, optionally, to a comment in output.
This class should be covered by a general architecture document which does not exist as of January 20...
deferred txt A few of the database updates required by various functions here can be deferred until after the result page is displayed to the user For updating the view updating the linked to tables after a etc PHP does not yet have any way to tell the server to actually return and disconnect while still running these but it might have such a feature in the future We handle these by creating a deferred update object and putting those objects on a global list
doConfirmEdit(WikiPage $page, $newtext, $section, IContextSource $context)
Backend function for confirmEditMerged()
badLoginKey()
Internal cache key for badlogin checks.
confirmEditMerged( $context, $content, $status, $summary, $user, $minorEdit)
An efficient edit filter callback based on the text after section merging.
isIPWhitelisted()
Check if the current IP is allowed to skip captchas.
isBadLoginTriggered()
Check if a bad login has already been registered for this IP address.
log( $message)
Log the status and any triggering info for debugging or statistics.
retrieveCaptcha( $index)
Fetch this session's captcha info.
createAuthenticationRequest()
needCreateAccountCaptcha(User $creatingUser=null)
Logic to check if we need to pass a captcha for the current user to create a new account,...
addFormInformationToOutput(OutputPage $out, array $formInformation)
Processes the given $formInformation array and adds the options (see getFormInformation()) to the giv...
Demo CAPTCHA (not for production usage) and base class for real CAPTCHAs.
getError()
Return the error from the last passCaptcha* call.
storeCaptcha( $info)
Generate a captcha session ID and save the info in PHP's session storage.
static getMain()
Static methods.
getMessage( $action)
Show a message asking the user to enter a captcha on edit The result will be treated as wiki text.
Interface for objects which can provide a MediaWiki context on request.
The WebRequest class encapsulates getting at data passed in the URL or via a POSTed form stripping il...
describeCaptchaType()
Describes the captcha type for API clients.
isBadLoginPerUserTriggered( $u)
Is the per-user captcha triggered?
Base interface for content objects.
isAPICaptchaModule( $module)
Represents a title within MediaWiki.
string $trigger
Used in log messages.
static getContentText(Content $content=null)
Convenience function for getting flat text from a Content object.
shouldCheck(WikiPage $page, $content, $section, $context, $oldtext=null)
static getMainWANInstance()
Get the main WAN cache object.
increaseBadLoginCounter( $username)
Increase bad login counter after a failed login.
boolean null $captchaSolved
Was the CAPTCHA already passed and if yes, with which result?
passCaptcha( $index, $word)
Given a required captcha run, test form input for correct input on the open session.
usually copyright or history_copyright This message must be in HTML not wikitext if the section is included from a template $section
static getCanonicalName( $name, $validate='valid')
Given unvalidated user input, return a canonical username, or false if the username is invalid.
getLinksFromTracker( $title)
Load external links from the externallinks table.
presenting them properly to the user as errors is done by the caller return true use this to change the list i e etc $rev
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
Allows to change the fields on the form that will be generated are created Can be used to omit specific feeds from being outputted You must not use this hook to add use OutputPage::addFeedLink() instead. & $feedLinks hooks can tweak the array to change how login etc forms should look $requests
MediaWiki Logger LoggerFactory implements a PSR[0] compatible message logging system Named Psr Log LoggerInterface instances can be obtained from the MediaWiki Logger LoggerFactory::getInstance() static method. MediaWiki\Logger\LoggerFactory expects a class implementing the MediaWiki\Logger\Spi interface to act as a factory for new Psr\Log\LoggerInterface instances. The "Spi" in MediaWiki\Logger\Spi stands for "service provider interface". An SPI is an API intended to be implemented or extended by a third party. This software design pattern is intended to enable framework extension and replaceable components. It is specifically used in the MediaWiki\Logger\LoggerFactory service to allow alternate PSR-3 logging implementations to be easily integrated with MediaWiki. The service provider interface allows the backend logging library to be implemented in multiple ways. The $wgMWLoggerDefaultSpi global provides the classname of the default MediaWiki\Logger\Spi implementation to be loaded at runtime. This can either be the name of a class implementing the MediaWiki\Logger\Spi with a zero argument const ructor or a callable that will return an MediaWiki\Logger\Spi instance. Alternately the MediaWiki\Logger\LoggerFactory MediaWiki Logger LoggerFactory
either a unescaped string or a HtmlArmor object after in associative array form externallinks including delete and has completed for all link tables whether this was an auto creation default is conds Array Extra conditions for the No matching items in log is displayed if loglist is empty msgKey Array If you want a nice box with a set this to the key of the message First element is the message additional optional elements are parameters for the key that are processed with wfMessage() -> params() ->parseAsBlock() - offset Set to overwrite offset parameter in $wgRequest set to '' to unset offset - wrap String Wrap the message in html(usually something like "<
you have access to all of the normal MediaWiki so you can get a DB use the etc For full docs on the Maintenance class
if(! $wgDBerrorLogTZ) $wgRequest
static element( $element, $attribs=[], $contents='')
Identical to rawElement(), but HTML-escapes $contents (like Xml::element()).
APIGetAllowedParams(&$module, &$params, $flags)
showEditFormFields(&$editPage, &$out)
Show error message for missing or incorrect captcha on EditPage.
getFormInformation( $tabIndex=1)
Insert a captcha prompt into the edit form.
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
this hook is for auditing only or null if authentication failed before getting that far $username
passCaptchaFromRequest(WebRequest $request, User $user)
Given a required captcha run, test form input for correct input on the open session.
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist Do not use this to implement individual filters if they are compatible with the ChangesListFilter and ChangesListFilterGroup structure use sub classes of those in conjunction with the ChangesListSpecialPageStructuredFilters hook This hook can be used to implement filters that do not implement that or custom behavior that is not an individual filter e g Watchlist and Watchlist you will want to construct new ChangesListBooleanFilter or ChangesListStringOptionsFilter objects When constructing you specify which group they belong to You can reuse existing or create your you must register them with $special registerFilterGroup removed from all revisions and log entries to which it was applied This gives extensions a chance to take it off their books as the deletion has already been partly carried out by this point or something similar the user will be unable to create the tag set and then return false from the hook function Ensure you consume the ChangeTagAfterDelete hook to carry out custom deletion actions as context called by AbstractContent::getParserOutput May be used to override the normal model specific rendering of page content as context as context $options
it s the revision text itself In either if gzip is the revision text is gzipped $flags
const AS_HOOK_ERROR_EXPECTED
Status: A hook function returned an error.
static isIPAddress( $ip)
Determine if a string is as valid IP address or network (CIDR prefix).
the array() calling protocol came about after MediaWiki 1.4rc1.
Generic captcha authentication request class.
buildValidIPs(array $input)
From a list of unvalidated input, get all the valid IP addresses and IP ranges from it.
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that probably a stub it is not rendered in wiki pages or galleries in category pages allow injecting custom HTML after the section Any uses of the hook need to handle escaping see BaseTemplate::getToolbox and BaseTemplate::makeListItem for details on the format of individual items inside of this array or by returning and letting standard HTTP rendering take place modifiable or by returning false and taking over the output $out
clearCaptcha( $index)
Clear out existing captcha info from the session, to ensure it can't be reused.