diff options
| author | spiderr <spiderr@bitweaver.org> | 2025-01-18 01:42:58 -0500 |
|---|---|---|
| committer | spiderr <spiderr@bitweaver.org> | 2025-01-18 01:42:58 -0500 |
| commit | 26851a0d171c1d30c01330df9670e2b0949c9499 (patch) | |
| tree | 82f85625dd5b84cdb65efb71c17aacfd013e9e05 /includes/recaptcha | |
| parent | be91aee6c9452541578536413f6feb91ae5dafde (diff) | |
| download | users-26851a0d171c1d30c01330df9670e2b0949c9499.tar.gz users-26851a0d171c1d30c01330df9670e2b0949c9499.tar.bz2 users-26851a0d171c1d30c01330df9670e2b0949c9499.zip | |
update recaptcha to 1.3.0
Diffstat (limited to 'includes/recaptcha')
| -rw-r--r-- | includes/recaptcha/ReCaptcha/ReCaptcha.php | 30 | ||||
| -rw-r--r-- | includes/recaptcha/ReCaptcha/RequestMethod.php | 1 | ||||
| -rw-r--r-- | includes/recaptcha/ReCaptcha/RequestMethod/Curl.php | 1 | ||||
| -rw-r--r-- | includes/recaptcha/ReCaptcha/RequestMethod/SocketPost.php | 2 | ||||
| -rw-r--r-- | includes/recaptcha/ReCaptcha/Response.php | 10 |
5 files changed, 25 insertions, 19 deletions
diff --git a/includes/recaptcha/ReCaptcha/ReCaptcha.php b/includes/recaptcha/ReCaptcha/ReCaptcha.php index 31ec44a..d75ce1f 100644 --- a/includes/recaptcha/ReCaptcha/ReCaptcha.php +++ b/includes/recaptcha/ReCaptcha/ReCaptcha.php @@ -43,73 +43,73 @@ class ReCaptcha * Version of this client library. * @const string */ - const VERSION = 'php_1.2.4'; + public const VERSION = 'php_1.3.0'; /** * URL for reCAPTCHA siteverify API * @const string */ - const SITE_VERIFY_URL = 'https://www.google.com/recaptcha/api/siteverify'; + public const SITE_VERIFY_URL = 'https://www.google.com/recaptcha/api/siteverify'; /** * Invalid JSON received * @const string */ - const E_INVALID_JSON = 'invalid-json'; + public const E_INVALID_JSON = 'invalid-json'; /** * Could not connect to service * @const string */ - const E_CONNECTION_FAILED = 'connection-failed'; + public const E_CONNECTION_FAILED = 'connection-failed'; /** * Did not receive a 200 from the service * @const string */ - const E_BAD_RESPONSE = 'bad-response'; + public const E_BAD_RESPONSE = 'bad-response'; /** * Not a success, but no error codes received! * @const string */ - const E_UNKNOWN_ERROR = 'unknown-error'; + public const E_UNKNOWN_ERROR = 'unknown-error'; /** * ReCAPTCHA response not provided * @const string */ - const E_MISSING_INPUT_RESPONSE = 'missing-input-response'; + public const E_MISSING_INPUT_RESPONSE = 'missing-input-response'; /** * Expected hostname did not match * @const string */ - const E_HOSTNAME_MISMATCH = 'hostname-mismatch'; + public const E_HOSTNAME_MISMATCH = 'hostname-mismatch'; /** * Expected APK package name did not match * @const string */ - const E_APK_PACKAGE_NAME_MISMATCH = 'apk_package_name-mismatch'; + public const E_APK_PACKAGE_NAME_MISMATCH = 'apk_package_name-mismatch'; /** * Expected action did not match * @const string */ - const E_ACTION_MISMATCH = 'action-mismatch'; + public const E_ACTION_MISMATCH = 'action-mismatch'; /** * Score threshold not met * @const string */ - const E_SCORE_THRESHOLD_NOT_MET = 'score-threshold-not-met'; + public const E_SCORE_THRESHOLD_NOT_MET = 'score-threshold-not-met'; /** * Challenge timeout * @const string */ - const E_CHALLENGE_TIMEOUT = 'challenge-timeout'; + public const E_CHALLENGE_TIMEOUT = 'challenge-timeout'; /** * Shared secret for the site. @@ -123,6 +123,12 @@ class ReCaptcha */ private $requestMethod; + private $hostname; + private $apkPackageName; + private $action; + private $threshold; + private $timeoutSeconds; + /** * Create a configured instance to use the reCAPTCHA service. * diff --git a/includes/recaptcha/ReCaptcha/RequestMethod.php b/includes/recaptcha/ReCaptcha/RequestMethod.php index 0a2a671..bd2a949 100644 --- a/includes/recaptcha/ReCaptcha/RequestMethod.php +++ b/includes/recaptcha/ReCaptcha/RequestMethod.php @@ -39,7 +39,6 @@ namespace ReCaptcha; */ interface RequestMethod { - /** * Submit the request with the specified parameters. * diff --git a/includes/recaptcha/ReCaptcha/RequestMethod/Curl.php b/includes/recaptcha/ReCaptcha/RequestMethod/Curl.php index eb99842..2d3b389 100644 --- a/includes/recaptcha/ReCaptcha/RequestMethod/Curl.php +++ b/includes/recaptcha/ReCaptcha/RequestMethod/Curl.php @@ -39,7 +39,6 @@ namespace ReCaptcha\RequestMethod; */ class Curl { - /** * @see http://php.net/curl_init * @param string $url diff --git a/includes/recaptcha/ReCaptcha/RequestMethod/SocketPost.php b/includes/recaptcha/ReCaptcha/RequestMethod/SocketPost.php index 464bc28..19d50ab 100644 --- a/includes/recaptcha/ReCaptcha/RequestMethod/SocketPost.php +++ b/includes/recaptcha/ReCaptcha/RequestMethod/SocketPost.php @@ -51,6 +51,8 @@ class SocketPost implements RequestMethod */ private $socket; + private $siteVerifyUrl; + /** * Only needed if you want to override the defaults * diff --git a/includes/recaptcha/ReCaptcha/Response.php b/includes/recaptcha/ReCaptcha/Response.php index 55838c0..8a5d3aa 100644 --- a/includes/recaptcha/ReCaptcha/Response.php +++ b/includes/recaptcha/ReCaptcha/Response.php @@ -95,11 +95,11 @@ class Response return new Response(false, array(ReCaptcha::E_INVALID_JSON)); } - $hostname = isset($responseData['hostname']) ? $responseData['hostname'] : null; - $challengeTs = isset($responseData['challenge_ts']) ? $responseData['challenge_ts'] : null; - $apkPackageName = isset($responseData['apk_package_name']) ? $responseData['apk_package_name'] : null; + $hostname = isset($responseData['hostname']) ? $responseData['hostname'] : ''; + $challengeTs = isset($responseData['challenge_ts']) ? $responseData['challenge_ts'] : ''; + $apkPackageName = isset($responseData['apk_package_name']) ? $responseData['apk_package_name'] : ''; $score = isset($responseData['score']) ? floatval($responseData['score']) : null; - $action = isset($responseData['action']) ? $responseData['action'] : null; + $action = isset($responseData['action']) ? $responseData['action'] : ''; if (isset($responseData['success']) && $responseData['success'] == true) { return new Response(true, array(), $hostname, $challengeTs, $apkPackageName, $score, $action); @@ -123,7 +123,7 @@ class Response * @param string $action * @param array $errorCodes */ - public function __construct($success, array $errorCodes = array(), $hostname = null, $challengeTs = null, $apkPackageName = null, $score = null, $action = null) + public function __construct($success, array $errorCodes = array(), $hostname = '', $challengeTs = '', $apkPackageName = '', $score = null, $action = '') { $this->success = $success; $this->hostname = $hostname; |
