kill wfGetIP
authorJeroen De Dauw <jeroendedauw@users.mediawiki.org>
Tue, 13 Dec 2011 21:24:03 +0000 (21:24 +0000)
committerJeroen De Dauw <jeroendedauw@users.mediawiki.org>
Tue, 13 Dec 2011 21:24:03 +0000 (21:24 +0000)
Captcha.php
ReCaptcha.php

index 386b6bdb38d85703f86603cb3478717f390d165d..941ec0e0d8c3aa12f52fbb9a8f282cc21b18062a 100644 (file)
@@ -177,8 +177,12 @@ class SimpleCaptcha {
         */
        function isIPWhitelisted() {
                global $wgCaptchaWhitelistIP;
+               
                if ( $wgCaptchaWhitelistIP ) {
-                       $ip = wfGetIp();
+                       global $wgRequest;
+                       
+                       $ip = $wgRequest->getIP();
+                       
                        foreach ( $wgCaptchaWhitelistIP as $range ) {
                                if ( IP::isInRange( $ip, $range ) ) {
                                        return true;
@@ -194,7 +198,8 @@ class SimpleCaptcha {
         * @access private
         */
        function badLoginKey() {
-               return wfMemcKey( 'captcha', 'badlogin', 'ip', wfGetIP() );
+               global $wgRequest;
+               return wfMemcKey( 'captcha', 'badlogin', 'ip', $wgRequest->getIP() );
        }
 
        /**
index 25f6fac8692874d0340c72bac2e0e12c4fab73cd..6304b9f5b7a703fc0189f36a3ff70133b7f2c869 100644 (file)
@@ -97,10 +97,10 @@ class ReCaptcha extends SimpleCaptcha {
                        return false;
                }
 
-               $recaptcha_response =
+               
                        recaptcha_check_answer (
                                $wgReCaptchaPrivateKey,
-                               wfGetIP (),
+                               $wgRequest->getIP(),
                                $challenge,
                                $response
                        );