2011-04-23 11:44:47 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
class ConfirmEditHooks {
|
2011-04-24 11:41:49 +00:00
|
|
|
/**
|
|
|
|
* Get the global Captcha instance
|
|
|
|
*
|
2014-02-18 02:13:12 +00:00
|
|
|
* @return SimpleCaptcha
|
2011-04-24 11:41:49 +00:00
|
|
|
*/
|
2011-04-23 11:44:47 +00:00
|
|
|
static function getInstance() {
|
|
|
|
global $wgCaptcha, $wgCaptchaClass;
|
2012-01-12 08:58:40 +00:00
|
|
|
|
2011-04-23 11:44:47 +00:00
|
|
|
static $done = false;
|
2012-01-12 08:58:40 +00:00
|
|
|
|
2011-04-23 11:44:47 +00:00
|
|
|
if ( !$done ) {
|
|
|
|
$done = true;
|
|
|
|
$wgCaptcha = new $wgCaptchaClass;
|
|
|
|
}
|
2012-01-12 08:58:40 +00:00
|
|
|
|
2011-04-23 11:44:47 +00:00
|
|
|
return $wgCaptcha;
|
|
|
|
}
|
|
|
|
|
|
|
|
static function confirmEditMerged( $editPage, $newtext ) {
|
|
|
|
return self::getInstance()->confirmEditMerged( $editPage, $newtext );
|
|
|
|
}
|
|
|
|
|
|
|
|
static function confirmEditAPI( $editPage, $newtext, &$resultArr ) {
|
|
|
|
return self::getInstance()->confirmEditAPI( $editPage, $newtext, $resultArr );
|
|
|
|
}
|
2014-01-10 23:16:34 +00:00
|
|
|
|
|
|
|
static function addNewAccountApiForm( $apiModule, $loginForm ) {
|
|
|
|
return self::getInstance()->addNewAccountApiForm( $apiModule, $loginForm );
|
|
|
|
}
|
|
|
|
|
|
|
|
static function addNewAccountApiResult( $apiModule, $loginPage, &$result ) {
|
|
|
|
return self::getInstance()->addNewAccountApiResult( $apiModule, $loginPage, $result );
|
|
|
|
}
|
2011-04-23 11:44:47 +00:00
|
|
|
|
|
|
|
static function injectUserCreate( &$template ) {
|
|
|
|
return self::getInstance()->injectUserCreate( $template );
|
|
|
|
}
|
|
|
|
|
2014-01-17 20:56:56 +00:00
|
|
|
static function confirmUserCreate( $u, &$message, &$status = null ) {
|
|
|
|
return self::getInstance()->confirmUserCreate( $u, $message, $status );
|
2011-04-23 11:44:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static function triggerUserLogin( $user, $password, $retval ) {
|
|
|
|
return self::getInstance()->triggerUserLogin( $user, $password, $retval );
|
|
|
|
}
|
|
|
|
|
|
|
|
static function injectUserLogin( &$template ) {
|
|
|
|
return self::getInstance()->injectUserLogin( $template );
|
|
|
|
}
|
|
|
|
|
|
|
|
static function confirmUserLogin( $u, $pass, &$retval ) {
|
|
|
|
return self::getInstance()->confirmUserLogin( $u, $pass, $retval );
|
|
|
|
}
|
|
|
|
|
|
|
|
static function injectEmailUser( &$form ) {
|
|
|
|
return self::getInstance()->injectEmailUser( $form );
|
|
|
|
}
|
|
|
|
|
|
|
|
static function confirmEmailUser( $from, $to, $subject, $text, &$error ) {
|
|
|
|
return self::getInstance()->confirmEmailUser( $from, $to, $subject, $text, $error );
|
|
|
|
}
|
2011-11-23 19:09:57 +00:00
|
|
|
|
2013-03-16 15:42:51 +00:00
|
|
|
// Default $flags to 1 for backwards-compatible behavior
|
|
|
|
public static function APIGetAllowedParams( &$module, &$params, $flags = 1 ) {
|
|
|
|
return self::getInstance()->APIGetAllowedParams( $module, $params, $flags );
|
2011-11-23 19:09:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public static function APIGetParamDescription( &$module, &$desc ) {
|
|
|
|
return self::getInstance()->APIGetParamDescription( $module, $desc );
|
|
|
|
}
|
2011-04-23 11:44:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
class CaptchaSpecialPage extends UnlistedSpecialPage {
|
2012-01-12 08:58:40 +00:00
|
|
|
public function __construct() {
|
2011-04-23 11:44:47 +00:00
|
|
|
parent::__construct( 'Captcha' );
|
|
|
|
}
|
2012-01-12 08:58:40 +00:00
|
|
|
|
2011-04-23 11:44:47 +00:00
|
|
|
function execute( $par ) {
|
|
|
|
$this->setHeaders();
|
2012-01-12 08:58:40 +00:00
|
|
|
|
2011-04-23 11:44:47 +00:00
|
|
|
$instance = ConfirmEditHooks::getInstance();
|
2012-01-12 08:58:40 +00:00
|
|
|
|
2011-04-23 11:44:47 +00:00
|
|
|
switch( $par ) {
|
2012-01-12 08:58:40 +00:00
|
|
|
case "image":
|
|
|
|
if ( method_exists( $instance, 'showImage' ) ) {
|
|
|
|
return $instance->showImage();
|
|
|
|
}
|
|
|
|
case "help":
|
|
|
|
default:
|
|
|
|
return $instance->showHelp();
|
2011-04-23 11:44:47 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|