Message info
 
To:mediawiki-cvs@lists.wikimedia.org From:jeroendedauw@svn.wikimedia.org Subject:[MediaWiki-CVS] SVN: [114099] trunk/extensions/ConfirmEdit Date:Sun, 18 Mar 2012 16:07:22 +0000
 

https://www.mediawiki.org/wiki/Special:Code/MediaWiki/114099

Revision: 114099
Author: jeroendedauw
Date: 2012-03-18 16:07:21 +0000 (Sun, 18 Mar 2012)
Log Message:
-----------
fix < 1.19 compat, or at least some of it :)

Modified Paths:
--------------
trunk/extensions/ConfirmEdit/Captcha.php
trunk/extensions/ConfirmEdit/ReCaptcha.class.php

Modified: trunk/extensions/ConfirmEdit/Captcha.php
===================================================================
--- trunk/extensions/ConfirmEdit/Captcha.php 2012-03-18 13:28:42 UTC (rev 114098)
+++ trunk/extensions/ConfirmEdit/Captcha.php 2012-03-18 16:07:21 UTC (rev 114099)
@@ -181,7 +181,8 @@
if ( $wgCaptchaWhitelistIP ) {
global $wgRequest;

- $ip = $wgRequest->getIP();
+ // Compat: WebRequest::getIP is only available since MW 1.19.
+ $ip = method_exists( $wgRequest, 'getIP' ) ? $wgRequest->getIP() : wfGetIP();

foreach ( $wgCaptchaWhitelistIP as $range ) {
if ( IP::isInRange( $ip, $range ) ) {
@@ -199,7 +200,9 @@
*/
function badLoginKey() {
global $wgRequest;
- return wfMemcKey( 'captcha', 'badlogin', 'ip', $wgRequest->getIP() );
+ // Compat: WebRequest::getIP is only available since MW 1.19.
+ $ip = method_exists( $wgRequest, 'getIP' ) ? $wgRequest->getIP() : wfGetIP();
+ return wfMemcKey( 'captcha', 'badlogin', 'ip', $ip );
}

/**

Modified: trunk/extensions/ConfirmEdit/ReCaptcha.class.php
===================================================================
--- trunk/extensions/ConfirmEdit/ReCaptcha.class.php 2012-03-18 13:28:42 UTC (rev 114098)
+++ trunk/extensions/ConfirmEdit/ReCaptcha.class.php 2012-03-18 16:07:21 UTC (rev 114099)
@@ -36,9 +36,12 @@
return false;
}

+ // Compat: WebRequest::getIP is only available since MW 1.19.
+ $ip = method_exists( $wgRequest, 'getIP' ) ? $wgRequest->getIP() : wfGetIP();
+
$recaptcha_response = recaptcha_check_answer(
$wgReCaptchaPrivateKey,
- $wgRequest->getIP(),
+ $ip,
$challenge,
$response
);


_______________________________________________
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs