Index: branches/fundraising/deployment/DonationInterface/payflowpro_gateway/extras/recaptcha/recaptcha-php/recaptchalib.php |
— | — | @@ -1,11 +1,11 @@ |
2 | 2 | <?php |
3 | 3 | /** |
4 | 4 | * This is a modified PHP library that handles calling reCaptcha |
5 | | - * |
| 5 | + * |
6 | 6 | * This is /different/ from the original PHP API for reCAPTCHA. |
7 | 7 | * This version supports cURL and using an http proxy for network |
8 | 8 | * communications and takes some settings set by MediaWiki. |
9 | | - * |
| 9 | + * |
10 | 10 | * See below for original license and other info. |
11 | 11 | */ |
12 | 12 | /* |
— | — | @@ -42,7 +42,7 @@ |
43 | 43 | */ |
44 | 44 | |
45 | 45 | // global MW variables that should be available |
46 | | -global $wgPayflowRecaptchaUseHTTPProxy, $wgPayflowRecaptchaHTTPProxy, |
| 46 | +global $wgPayflowRecaptchaUseHTTPProxy, $wgPayflowRecaptchaHTTPProxy, |
47 | 47 | $wgPayflowRecaptchaTimeout, $wgPayflowRecaptchaUseSSL, $wgPayflowRecaptchaComsRetryLimit; |
48 | 48 | |
49 | 49 | /** |
— | — | @@ -99,7 +99,7 @@ |
100 | 100 | } else { |
101 | 101 | $response = _recaptcha_http_post_curl( $host, $path, $req, $port ); |
102 | 102 | } |
103 | | - |
| 103 | + |
104 | 104 | $response = explode( "\r\n\r\n", $response, 2 ); |
105 | 105 | |
106 | 106 | return $response; |
— | — | @@ -114,7 +114,7 @@ |
115 | 115 | * @return array response |
116 | 116 | */ |
117 | 117 | function _recaptcha_http_post_fsock( $host, $path, $data, $port = 80 ) { |
118 | | - |
| 118 | + |
119 | 119 | $http_request = "POST $path HTTP/1.0\r\n"; |
120 | 120 | $http_request .= "Host: $host\r\n"; |
121 | 121 | $http_request .= "Content-Type: application/x-www-form-urlencoded;\r\n"; |
— | — | @@ -134,8 +134,8 @@ |
135 | 135 | while ( !feof( $fs ) ) |
136 | 136 | $response .= fgets( $fs, 1160 ); // One TCP-IP packet |
137 | 137 | fclose( $fs ); |
138 | | - |
139 | | - return $response; |
| 138 | + |
| 139 | + return $response; |
140 | 140 | } |
141 | 141 | |
142 | 142 | /** |
— | — | @@ -148,7 +148,7 @@ |
149 | 149 | */ |
150 | 150 | function _recaptcha_http_post_curl( $host, $path, $data, $port = 80 ) { |
151 | 151 | $url = "http://" . $host . ":" . $port . $path; |
152 | | - |
| 152 | + |
153 | 153 | $ch = curl_init( $url ); |
154 | 154 | curl_setopt( $ch, CURLOPT_POST, true ); |
155 | 155 | curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true ); |
— | — | @@ -156,15 +156,15 @@ |
157 | 157 | curl_setopt( $ch, CURLOPT_USERAGENT, 'reCAPTCHA/PHP' ); |
158 | 158 | curl_setopt( $ch, CURLOPT_POSTFIELDS, $data ); |
159 | 159 | curl_setopt( $ch, CURLOPT_HEADER, true ); |
160 | | - curl_setopt( $ch, CURLOPT_HTTPHEADER, array( "Host: " . $host ) ); |
161 | | - |
| 160 | + curl_setopt( $ch, CURLOPT_HTTPHEADER, array( "Host: " . $host ) ); |
| 161 | + |
162 | 162 | // set proxy settings if necessary |
163 | 163 | if ( RECAPTCHA_USE_HTTP_PROXY ) { |
164 | 164 | PayflowProGateway::log( 'Using http proxy ' . RECAPTCHA_HTTP_PROXY ); |
165 | 165 | curl_setopt( $ch, CURLOPT_PROXYTYPE, CURLPROXY_HTTP ); |
166 | 166 | curl_setopt( $ch, CURLOPT_PROXY, RECAPTCHA_HTTP_PROXY ); |
167 | 167 | } |
168 | | - |
| 168 | + |
169 | 169 | // try up to three times |
170 | 170 | for ( $i = 0; $i < RECAPTCHA_RETRY_LIMIT; $i++ ) { |
171 | 171 | PayflowProGateway::log( 'Preparing to communicate with reCaptcha via cURL at ' . $url . '.' ); |
— | — | @@ -175,13 +175,13 @@ |
176 | 176 | break; |
177 | 177 | } |
178 | 178 | } |
179 | | - |
| 179 | + |
180 | 180 | /** |
181 | 181 | * This is a nasty hack to pretend like things worked when they really didn't |
182 | | - * |
183 | | - * Doing this per instructions from the fundraisers to accept a trxn when we |
| 182 | + * |
| 183 | + * Doing this per instructions from the fundraisers to accept a trxn when we |
184 | 184 | * are unsuccesful communicating with reCaptcha. |
185 | | - * |
| 185 | + * |
186 | 186 | * This sets $response to a message that will fool reCaptcha (on our end) into thinking |
187 | 187 | * the user entered the correct values. |
188 | 188 | */ |
— | — | @@ -189,7 +189,7 @@ |
190 | 190 | PayflowProGateway::log( 'Failed communicating with reCaptcha: ' . curl_error( $ch ) ); |
191 | 191 | $response = "true\r\n\r\nsuccess"; |
192 | 192 | } |
193 | | - |
| 193 | + |
194 | 194 | return $response; |
195 | 195 | } |
196 | 196 | |
— | — | @@ -350,7 +350,7 @@ |
351 | 351 | |
352 | 352 | if ( strlen ( $arr[0] ) <= 4 ) { |
353 | 353 | $arr[0] = substr ( $arr[0], 0, 1 ); |
354 | | - } else if ( strlen ( $arr[0] ) <= 6 ) { |
| 354 | + } elseif ( strlen ( $arr[0] ) <= 6 ) { |
355 | 355 | $arr[0] = substr ( $arr[0], 0, 3 ); |
356 | 356 | } else { |
357 | 357 | $arr[0] = substr ( $arr[0], 0, 4 ); |
Property changes on: branches/fundraising/deployment/DonationInterface/payflowpro_gateway/extras/recaptcha/recaptcha-php/recaptchalib.php |
___________________________________________________________________ |
Added: svn:mergeinfo |
358 | 358 | Merged /trunk/extensions/DonationInterface/payflowpro_gateway/extras/recaptcha/recaptcha-php/recaptchalib.php:r75657-96108 |