Katie Horn has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/62179


Change subject: Nuking recaptcha as cruft that hasn't been used in at least two 
years on payments.
......................................................................

Nuking recaptcha as cruft that hasn't been used in at least two years on 
payments.

Change-Id: I9954709b26a91238e3e4765a97971e111e8335eb
---
M donationinterface.php
D extras/recaptcha/recaptcha-php/LICENSE
D extras/recaptcha/recaptcha-php/README
D extras/recaptcha/recaptcha-php/recaptchalib.php
D extras/recaptcha/recaptcha.body.php
M globalcollect_gateway/scripts/orphans.php
6 files changed, 1 insertion(+), 568 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/DonationInterface 
refs/changes/79/62179/1

diff --git a/donationinterface.php b/donationinterface.php
index 1752746..4900929 100644
--- a/donationinterface.php
+++ b/donationinterface.php
@@ -39,7 +39,6 @@
        'Stomp' => false,
        'ConversionLog' => false, //this is definitely an Extra
        'Minfraud' => false, //this is definitely an Extra
-       'Recaptcha' => false, //extra
        'PayflowPro' => false,
        'GlobalCollect' => false,
        'Amazon' => false,
@@ -65,7 +64,6 @@
                        $subextension === 'FunctionsFilter' ||
                        $subextension === 'ConversionLog' ||
                        $subextension === 'Minfraud' ||
-                       $subextension === 'Recaptcha' ||
                        $subextension === 'IPVelocityFilter' ||
                        $subextension === 'SessionVelocityFilter') {
 
@@ -174,11 +172,6 @@
 //Functions Filter classes
 if ( $optionalParts['FunctionsFilter'] === true ){
        $wgAutoloadClasses['Gateway_Extras_CustomFilters_Functions'] = 
$donationinterface_dir . 
"extras/custom_filters/filters/functions/functions.body.php";
-}
-
-//Recaptcha classes
-if ( $optionalParts['Recaptcha'] === true ){
-       $wgAutoloadClasses['Gateway_Extras_ReCaptcha'] = $donationinterface_dir 
. "extras/recaptcha/recaptcha.body.php";
 }
 
 //Functions Filter classes
@@ -705,37 +698,6 @@
  */
 $wgDonationInterfaceUtmSourceMap = array();
 
-//Recaptcha globals
-if ( $optionalParts['Recaptcha'] === true ){
-       /**
-        * Public and Private reCaptcha keys
-        *
-        * These can be obtained at:
-        *   http://www.google.com/recaptcha/whyrecaptcha
-        */
-       $wgDonationInterfaceRecaptchaPublicKey = '';
-       $wgDonationInterfaceRecaptchaPrivateKey = '';
-
-       // Timeout (in seconds) for communicating with reCAPTCHA
-       $wgDonationInterfaceRecaptchaTimeout = 2;
-
-       /**
-        * HTTP Proxy settings
-        */
-       $wgDonationInterfaceRecaptchaUseHTTPProxy = false;
-       $wgDonationInterfaceRecaptchaHTTPProxy = false;
-
-       /**
-        * Use SSL to communicate with reCaptcha
-        */
-       $wgDonationInterfaceRecaptchaUseSSL = 1;
-
-       /**
-        * The # of times to retry communicating with reCaptcha if 
communication fails
-        * @var int
-        */
-       $wgDonationInterfaceRecaptchaComsRetryLimit = 3;
-}
 
 /**
  * SPECIAL PAGES
@@ -816,12 +778,6 @@
 if ($optionalParts['ConversionLog'] === true){
        // Sets the 'conversion log' as logger for post-processing
        $wgHooks["GatewayPostProcess"][] = array( 
"Gateway_Extras_ConversionLog::onPostProcess" );
-}
-
-//Recaptcha hooks
-if ($optionalParts['Recaptcha'] === true){
-       // Set reCpatcha as plugin for 'challenge' action
-       $wgHooks["GatewayChallenge"][] = array( 
"Gateway_Extras_ReCaptcha::onChallenge" );
 }
 
 //Functions Filter hooks
diff --git a/extras/recaptcha/recaptcha-php/LICENSE 
b/extras/recaptcha/recaptcha-php/LICENSE
deleted file mode 100644
index b612f71..0000000
--- a/extras/recaptcha/recaptcha-php/LICENSE
+++ /dev/null
@@ -1,22 +0,0 @@
-Copyright (c) 2007 reCAPTCHA -- http://recaptcha.net
-AUTHORS:
-  Mike Crawford
-  Ben Maurer
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
diff --git a/extras/recaptcha/recaptcha-php/README 
b/extras/recaptcha/recaptcha-php/README
deleted file mode 100644
index 21f1a27..0000000
--- a/extras/recaptcha/recaptcha-php/README
+++ /dev/null
@@ -1,7 +0,0 @@
-reCAPTCHA README
-================
-
-The reCAPTCHA PHP Lirary helps you use the reCAPTCHA API. Documentation
-for this library can be found at
-
-       http://recaptcha.net/plugins/php
diff --git a/extras/recaptcha/recaptcha-php/recaptchalib.php 
b/extras/recaptcha/recaptcha-php/recaptchalib.php
deleted file mode 100644
index 649bd0c..0000000
--- a/extras/recaptcha/recaptcha-php/recaptchalib.php
+++ /dev/null
@@ -1,378 +0,0 @@
-<?php
-/**
- * This is a modified PHP library that handles calling reCaptcha
- *
- * This is /different/ from the original PHP API for reCAPTCHA.
- * This version supports cURL and using an http proxy for network
- * communications and takes some settings set by MediaWiki.
- *
- * See below for original license and other info.
- */
-/**
- * This is a PHP library that handles calling reCAPTCHA.
- *    - Documentation and latest version
- *          http://recaptcha.net/plugins/php/
- *    - Get a reCAPTCHA API Key
- *          https://www.google.com/recaptcha/admin/create
- *    - Discussion group
- *          http://groups.google.com/group/recaptcha
- *
- * Copyright (c) 2007 reCAPTCHA -- http://recaptcha.net
- * AUTHORS:
- *   Mike Crawford
- *   Ben Maurer
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to 
deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-// global MW variables that should be available
-global $wgReCaptchaConfData;
-
-/**
- * The reCAPTCHA server URL's
- */
-define( "RECAPTCHA_API_SERVER", "http://www.google.com/recaptcha/api"; );
-define( "RECAPTCHA_API_SECURE_SERVER", "https://www.google.com/recaptcha/api"; 
);
-define( "RECAPTCHA_VERIFY_SERVER", "www.google.com" );
-
-/**
- * Proxy settings
- */
-define( "RECAPTCHA_USE_HTTP_PROXY", $wgReCaptchaConfData['UseHTTPProxy'] );
-define( "RECAPTCHA_HTTP_PROXY", $wgReCaptchaConfData['HTTPProxy'] );
-
-/**
- * Other reCAPTCHA settings
- */
-define( "RECAPTCHA_TIMEOUT", $wgReCaptchaConfData['UseHTTPProxy'] );
-define( "RECAPTCHA_PROTOCOL", $wgReCaptchaConfData['UseSSL'] ); //http or https
-define( "RECAPTCHA_RETRY_LIMIT", $wgReCaptchaConfData['ComsRetryLimit'] );
-
-define( "RECAPTCHA_GATEWAY", $wgReCaptchaConfData['GatewayClass'] );
-
-/**
- * Encodes the given data into a query string format
- * @param $data - array of string elements to be encoded
- * @return string - encoded request
- */
-function _recaptcha_qsencode ( $data ) {
-        $req = "";
-        foreach ( $data as $key => $value )
-                $req .= $key . '=' . urlencode( stripslashes( $value ) ) . '&';
-
-        // Cut the last '&'
-        $req = substr( $req, 0, strlen( $req ) -1 );
-        return $req;
-}
-
-
-
-/**
- * Wrapper to submit an HTTP POST to a reCAPTCHA server
- * @param string $host
- * @param string $path
- * @param array $data
- * @param int port
- * @return array response
- */
-function _recaptcha_http_post( $host, $path, $data, $port = 80 ) {
-
-        $req = _recaptcha_qsencode ( $data );
-
-        if ( !extension_loaded( 'curl' ) ) {
-               $response = _recaptcha_http_post_fsock( $host, $path, $req, 
$port );
-        } else {
-               $response = _recaptcha_http_post_curl( $host, $path, $req, 
$port );
-        }
-
-        $response = explode( "\r\n\r\n", $response, 2 );
-
-        return $response;
-}
-
-/**
- * Submits an HTTP POST to a reCAPTCHA server using fsockopen()
- * @param $host
- * @param $path
- * @param $data
- * @param int $port
- * @return array response
- */
-function _recaptcha_http_post_fsock( $host, $path, $data, $port = 80 ) {
-
-       $http_request  = "POST $path HTTP/1.0\r\n";
-       $http_request .= "Host: $host\r\n";
-       $http_request .= "Content-Type: application/x-www-form-urlencoded;\r\n";
-       $http_request .= "Content-Length: " . strlen( $req ) . "\r\n";
-       $http_request .= "User-Agent: reCAPTCHA/PHP\r\n";
-       $http_request .= "\r\n";
-       $http_request .= $req;
-
-       $response = '';
-       if ( false == ( $fs = @fsockopen( $host, $port, $errno, $errstr, 10 ) ) 
) {
-               $c = RECAPTCHA_GATEWAY;
-               $c::log( 'Failed communicating with reCaptcha.' );
-               die ( 'Could not open socket' );
-       }
-
-       fwrite( $fs, $http_request );
-
-       while ( !feof( $fs ) )
-               $response .= fgets( $fs, 1160 ); // One TCP-IP packet
-       fclose( $fs );
-
-       return $response;
-}
-
-/**
- * Submits an HTTP POST to a reCAPTCHA server using cURL
- * @param $host
- * @param $path
- * @param $data
- * @param int $port
- * @return array response
- */
-function _recaptcha_http_post_curl( $host, $path, $data, $port = 80 ) {
-       $url = "http://"; . $host . ":" . $port . $path;
-
-       $ch = curl_init( $url );
-       curl_setopt( $ch, CURLOPT_POST, true );
-       curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
-       curl_setopt( $ch, CURLOPT_TIMEOUT, RECAPTCHA_TIMEOUT );
-       curl_setopt( $ch, CURLOPT_USERAGENT, 'reCAPTCHA/PHP' );
-       curl_setopt( $ch, CURLOPT_POSTFIELDS, $data );
-       curl_setopt( $ch, CURLOPT_HEADER, true );
-       curl_setopt( $ch, CURLOPT_HTTPHEADER, array( "Host: " . $host ) );
-
-       $c = RECAPTCHA_GATEWAY;
-       
-       // set proxy settings if necessary
-       if ( RECAPTCHA_USE_HTTP_PROXY ) {
-               $c::log( 'Using http proxy ' . RECAPTCHA_HTTP_PROXY );
-               curl_setopt( $ch, CURLOPT_PROXYTYPE, CURLPROXY_HTTP );
-               curl_setopt( $ch, CURLOPT_PROXY, RECAPTCHA_HTTP_PROXY );
-       }
-
-       // try up to three times
-       for ( $i = 0; $i < RECAPTCHA_RETRY_LIMIT; $i++ ) {
-               $c::log( 'Preparing to communicate with reCaptcha via cURL at ' 
. $url . '.' );
-               $response = curl_exec( $ch );
-               $c::log( "Finished communicating with reCaptcha." );
-               if ( $response ) {
-                       $c::log( 'Response from reCaptcha: ' . $response );
-                       break;
-               }
-       }
-
-       /**
-        * This is a nasty hack to pretend like things worked when they really 
didn't
-        *
-        * Doing this per instructions from the fundraisers to accept a trxn 
when we
-        * are unsuccesful communicating with reCaptcha.
-        *
-        * This sets $response to a message that will fool reCaptcha (on our 
end) into thinking
-        * the user entered the correct values.
-        */
-       if ( !$response ) {
-               $c::log( 'Failed communicating with reCaptcha: ' . curl_error( 
$ch ) );
-               $response = "true\r\n\r\nsuccess";
-       }
-
-       return $response;
-}
-
-/**
- * Gets the challenge HTML (javascript and non-javascript version).
- * This is called from the browser, and the resulting reCAPTCHA HTML widget
- * is embedded within the HTML form it was called from.
- * @param string $pubkey A public key for reCAPTCHA
- * @param string $error The error given by reCAPTCHA (optional, default is 
null)
- * @param boolean $use_ssl Should the request be made over ssl? (optional, 
default is false)
-
- * @return string - The HTML to be embedded in the user's form.
- */
-function recaptcha_get_html ( $pubkey, $error = null, $use_ssl = false )
-{
-       if ( $pubkey == null || $pubkey == '' ) {
-               die ( "To use reCAPTCHA you must get an API key from <a 
href='https://www.google.com/recaptcha/admin/create'>https://www.google.com/recaptcha/admin/create</a>"
 );
-       }
-
-       if ( $use_ssl ) {
-                $server = RECAPTCHA_API_SECURE_SERVER;
-        } else {
-                $server = RECAPTCHA_API_SERVER;
-        }
-
-        $errorpart = "";
-        if ( $error ) {
-           $errorpart = "&amp;error=" . $error;
-        }
-        return '<script type="text/javascript" src="' . $server . 
'/challenge?k=' . $pubkey . $errorpart . '"></script>
-
-       <noscript>
-               <iframe src="' . $server . '/noscript?k=' . $pubkey . 
$errorpart . '" height="300" width="500" frameborder="0"></iframe><br/>
-               <textarea name="recaptcha_challenge_field" rows="3" 
cols="40"></textarea>
-               <input type="hidden" name="recaptcha_response_field" 
value="manual_challenge"/>
-       </noscript>';
-}
-
-
-
-
-/**
- * A ReCaptchaResponse is returned from recaptcha_check_answer()
- */
-class ReCaptchaResponse {
-        var $is_valid;
-        var $error;
-}
-
-
-/**
-  * Calls an HTTP POST function to verify if the user's guess was correct
-  * @param string $privkey
-  * @param string $remoteip
-  * @param string $challenge
-  * @param string $response
-  * @param array $extra_params an array of extra variables to post to the 
server
-  * @return ReCaptchaResponse
-  */
-function recaptcha_check_answer ( $privkey, $remoteip, $challenge, $response, 
$extra_params = array() )
-{
-       if ( $privkey == null || $privkey == '' ) {
-               die ( "To use reCAPTCHA you must get an API key from <a 
href='https://www.google.com/recaptcha/admin/create'>https://www.google.com/recaptcha/admin/create</a>"
 );
-       }
-
-       if ( $remoteip == null || $remoteip == '' ) {
-               die ( "For security reasons, you must pass the remote ip to 
reCAPTCHA" );
-       }
-
-
-
-        // discard spam submissions
-        if ( $challenge == null || strlen( $challenge ) == 0 || $response == 
null || strlen( $response ) == 0 ) {
-                $recaptcha_response = new ReCaptchaResponse();
-                $recaptcha_response->is_valid = false;
-                $recaptcha_response->error = 'incorrect-captcha-sol';
-                return $recaptcha_response;
-        }
-
-        $response = _recaptcha_http_post ( RECAPTCHA_VERIFY_SERVER, 
"/recaptcha/api/verify",
-                                          array (
-                                                 'privatekey' => $privkey,
-                                                 'remoteip' => $remoteip,
-                                                 'challenge' => $challenge,
-                                                 'response' => $response
-                                                 ) + $extra_params
-                                          );
-
-        $answers = explode ( "\n", $response [1] );
-        $recaptcha_response = new ReCaptchaResponse();
-
-        if ( trim ( $answers [0] ) == 'true' ) {
-                $recaptcha_response->is_valid = true;
-        }
-        else {
-                $recaptcha_response->is_valid = false;
-                $recaptcha_response->error = $answers [1];
-        }
-        return $recaptcha_response;
-
-}
-
-/**
- * gets a URL where the user can sign up for reCAPTCHA. If your application
- * has a configuration page where you enter a key, you should provide a link
- * using this function.
- * @param string $domain The domain where the page is hosted
- * @param string $appname The name of your application
- */
-function recaptcha_get_signup_url ( $domain = null, $appname = null ) {
-       return "https://www.google.com/recaptcha/admin/create?"; .  
_recaptcha_qsencode ( array ( 'domains' => $domain, 'app' => $appname ) );
-}
-
-function _recaptcha_aes_pad( $val ) {
-       $block_size = 16;
-       $numpad = $block_size - ( strlen ( $val ) % $block_size );
-       return str_pad( $val, strlen ( $val ) + $numpad, chr( $numpad ) );
-}
-
-/* Mailhide related code */
-
-function _recaptcha_aes_encrypt( $val, $ky ) {
-       if ( ! function_exists ( "mcrypt_encrypt" ) ) {
-               die ( "To use reCAPTCHA Mailhide, you need to have the mcrypt 
php module installed." );
-       }
-       $mode = MCRYPT_MODE_CBC;
-       $enc = MCRYPT_RIJNDAEL_128;
-       $val = _recaptcha_aes_pad( $val );
-       return mcrypt_encrypt( $enc, $ky, $val, $mode, 
"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" );
-}
-
-
-function _recaptcha_mailhide_urlbase64 ( $x ) {
-       return strtr( base64_encode ( $x ), '+/', '-_' );
-}
-
-/* gets the reCAPTCHA Mailhide url for a given email, public key and private 
key */
-function recaptcha_mailhide_url( $pubkey, $privkey, $email ) {
-       if ( $pubkey == '' || $pubkey == null || $privkey == "" || $privkey == 
null ) {
-               die ( "To use reCAPTCHA Mailhide, you have to sign up for a 
public and private key, " .
-                    "you can do so at <a 
href='http://www.google.com/recaptcha/mailhide/apikey'>http://www.google.com/recaptcha/mailhide/apikey</a>"
 );
-       }
-
-
-       $ky = pack( 'H*', $privkey );
-       $cryptmail = _recaptcha_aes_encrypt ( $email, $ky );
-
-       return "http://www.google.com/recaptcha/mailhide/d?k="; . $pubkey . 
"&c=" . _recaptcha_mailhide_urlbase64 ( $cryptmail );
-}
-
-/**
- * gets the parts of the email to expose to the user.
- * eg, given johndoe@example,com return ["john", "example.com"].
- * the email is then displayed as [email protected]
- */
-function _recaptcha_mailhide_email_parts ( $email ) {
-       $arr = preg_split( "/@/", $email );
-
-       if ( strlen ( $arr[0] ) <= 4 ) {
-               $arr[0] = substr ( $arr[0], 0, 1 );
-       } elseif ( strlen ( $arr[0] ) <= 6 ) {
-               $arr[0] = substr ( $arr[0], 0, 3 );
-       } else {
-               $arr[0] = substr ( $arr[0], 0, 4 );
-       }
-       return $arr;
-}
-
-/**
- * Gets html to display an email address given a public an private key.
- * to get a key, go to:
- *
- * http://www.google.com/recaptcha/mailhide/apikey
- */
-function recaptcha_mailhide_html( $pubkey, $privkey, $email ) {
-       $emailparts = _recaptcha_mailhide_email_parts ( $email );
-       $url = recaptcha_mailhide_url ( $pubkey, $privkey, $email );
-
-       return htmlentities( $emailparts[0] ) . "<a href='" . htmlentities ( 
$url ) .
-               "' onclick=\"window.open('" . htmlentities ( $url ) . "', '', 
'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=500,height=300');
 return false;\" title=\"Reveal this email address\">...</a>@" . htmlentities ( 
$emailparts [1] );
-
-}
diff --git a/extras/recaptcha/recaptcha.body.php 
b/extras/recaptcha/recaptcha.body.php
deleted file mode 100644
index 7ee8b7b..0000000
--- a/extras/recaptcha/recaptcha.body.php
+++ /dev/null
@@ -1,116 +0,0 @@
-<?php
-
-/**
- * Validates a transaction against MaxMind's minFraud service
- */
-class Gateway_Extras_reCaptcha extends Gateway_Extras {
-
-       /**
-        * Container for singelton instance of self
-        */
-       static $instance;
-
-       /**
-        * Container for the captcha error
-        * @var string
-        */
-       public $recap_err;
-
-       public function __construct( &$gateway_adapter ) {
-               parent::__construct( $gateway_adapter );
-
-               //stash all the vars that reCaptcha is going to need in a 
global just for it.
-               //I know this is vaguely unpleasant, but it's the quickest way 
back to zero.
-               global $wgReCaptchaConfData;
-               $wgReCaptchaConfData['UseHTTPProxy'] = 
$this->gateway_adapter->getGlobal( 'RecaptchaUseHTTPProxy' );
-               $wgReCaptchaConfData['HTTPProxy'] = 
$this->gateway_adapter->getGlobal( 'RecaptchaHTTPProxy' );
-               $wgReCaptchaConfData['Timeout'] = 
$this->gateway_adapter->getGlobal( 'RecaptchaTimeout' );
-               $wgReCaptchaConfData['UseSSL'] = 
$this->gateway_adapter->getGlobal( 'RecaptchaUseSSL' );
-               $wgReCaptchaConfData['ComsRetryLimit'] = 
$this->gateway_adapter->getGlobal( 'RecaptchaComsRetryLimit' );
-               $wgReCaptchaConfData['GatewayClass'] = 
$this->gateway_adapter->getGatewayAdapterClass(); //for properly routing the 
logging
-               // load the reCaptcha API
-               require_once( dirname( __FILE__ ) . 
'/recaptcha-php/recaptchalib.php' );
-       }
-
-       /**
-        * Handle the challenge logic
-        */
-       public function challenge() {
-               // if captcha posted, validate
-               if ( isset( $_POST['recaptcha_response_field'] ) ) {
-                       // check the captcha response
-                       $captcha_resp = $this->check_captcha();
-                       if ( $captcha_resp->is_valid ) {
-                               // if validated, update the action and move on
-                               $this->log( 
$this->gateway_adapter->getData_Unstaged_Escaped( 'contribution_tracking_id' ), 
'Captcha passed' );
-                               $this->gateway_adapter->setValidationAction( 
'process' );
-                               return TRUE;
-                       } else {
-                               $this->recap_err = $captcha_resp->error;
-                               $this->log( 
$this->gateway_adapter->getData_Unstaged_Escaped( 'contribution_tracking_id' ), 
'Captcha failed' );
-                       }
-               }
-               // display captcha
-               $this->display_captcha();
-               return TRUE;
-       }
-
-       /**
-        * Display the submission form with the captcha injected into it
-        */
-       public function display_captcha() {
-               global $wgOut;
-               $publicKey = $this->gateway_adapter->getGlobal( 
'RecaptchaPublicKey' );
-               $useSSL = $this->gateway_adapter->getGlobal( 'RecaptchaUseSSL' 
);
-
-               // log that a captcha's been triggered
-               $this->log( $this->gateway_adapter->getData_Unstaged_Escaped( 
'contribution_tracking_id' ), 'Captcha triggered' );
-
-               // construct the HTML used to display the captcha
-               $captcha_html = Xml::openElement( 'div', array( 'id' => 
'mw-donate-captcha' ) );
-               $captcha_html .= recaptcha_get_html( $publicKey, 
$this->recap_err, $useSSL );
-               $captcha_html .= '<span class="creditcard-error-msg">' . 
wfMessage( $this->gateway_adapter->getIdentifier() . 
'_gateway-error-msg-captcha-please' )->escaped() . '</span>';
-               $captcha_html .= Xml::closeElement( 'div' ); // close 
div#mw-donate-captcha
-               // load up the form class
-               $form_class = $this->gateway_adapter->getFormClass();
-
-               //TODO: use setValidationErrors and getValidationErrors 
everywhere, and 
-               //refactor all the form constructors one more time. Eventually. 
 
-               $data = $this->gateway_adapter->getData_Unstaged_Escaped();
-               $errors = $this->gateway_adapter->getValidationErrors();
-               $form_obj = new $form_class( $this->gateway_adapter, $errors );
-
-               // set the captcha HTML to use in the form
-               $form_obj->setCaptchaHTML( $captcha_html );
-
-               // output the form
-               $wgOut->addHTML( $form_obj->getForm() );
-       }
-
-       /**
-        * Check recaptcha answer
-        */
-       public function check_captcha() {
-               global $wgRequest;
-               $privateKey = $this->gateway_adapter->getGlobal( 
'RecaptchaPrivateKey' );
-               $resp = recaptcha_check_answer( $privateKey, 
$wgRequest->getIP(), $wgRequest->getText( 'recaptcha_challenge_field' ), 
$wgRequest->getText( 'recaptcha_response_field' ) );
-
-               return $resp;
-       }
-
-       static function onChallenge( &$gateway_adapter ) {
-               if ( !$gateway_adapter->getGlobal( 'EnableRecaptcha' ) ){
-                       return true;
-               }
-               $gateway_adapter->debugarray[] = 'recaptcha onChallenge hook!';
-               return self::singleton( $gateway_adapter )->challenge();
-       }
-
-       static function singleton( &$gateway_adapter ) {
-               if ( !self::$instance ) {
-                       self::$instance = new self( $gateway_adapter );
-               }
-               return self::$instance;
-       }
-
-}
diff --git a/globalcollect_gateway/scripts/orphans.php 
b/globalcollect_gateway/scripts/orphans.php
index 9813e66..9d27eef 100644
--- a/globalcollect_gateway/scripts/orphans.php
+++ b/globalcollect_gateway/scripts/orphans.php
@@ -337,7 +337,7 @@
                // ADDITIONAL: log out what you did here, to... somewhere. 
                // Preferably *before* you rewrite the Order ID file. 
 
-               //we may need to unset some hooks out here. Like... recaptcha. 
Makes no sense.
+               //we may need to unset some hooks out here. Anything that 
requires user interaction would make no sense here.
                $i = 0;
                foreach($payments as $payment_data){
                        if ($i < $this->max_per_execute){

-- 
To view, visit https://gerrit.wikimedia.org/r/62179
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9954709b26a91238e3e4765a97971e111e8335eb
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/DonationInterface
Gerrit-Branch: master
Gerrit-Owner: Katie Horn <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to