aboutsummaryrefslogtreecommitdiff
path: root/srcs/phpmyadmin/vendor/google/recaptcha/src
diff options
context:
space:
mode:
authorCharles Cabergs <me@cacharle.xyz>2020-07-27 10:05:23 +0200
committerCharles Cabergs <me@cacharle.xyz>2020-07-27 10:05:23 +0200
commit5bf66662a9bdd62c5bccab15e607cd95cfb8fcab (patch)
tree39a1a4629749056191c05dfd899f931701b7acf3 /srcs/phpmyadmin/vendor/google/recaptcha/src
parent5afd237bbd22028b85532b8c0b3fcead49a00764 (diff)
downloadft_server-master.tar.gz
ft_server-master.tar.bz2
ft_server-master.zip
Removed wordpress and phpmyadmin, my server doesn't handle it well and it brings shame on my famillyHEADmaster
Diffstat (limited to 'srcs/phpmyadmin/vendor/google/recaptcha/src')
-rw-r--r--srcs/phpmyadmin/vendor/google/recaptcha/src/ReCaptcha/ReCaptcha.php269
-rw-r--r--srcs/phpmyadmin/vendor/google/recaptcha/src/ReCaptcha/RequestMethod.php50
-rw-r--r--srcs/phpmyadmin/vendor/google/recaptcha/src/ReCaptcha/RequestMethod/Curl.php82
-rw-r--r--srcs/phpmyadmin/vendor/google/recaptcha/src/ReCaptcha/RequestMethod/CurlPost.php104
-rw-r--r--srcs/phpmyadmin/vendor/google/recaptcha/src/ReCaptcha/RequestMethod/Post.php88
-rw-r--r--srcs/phpmyadmin/vendor/google/recaptcha/src/ReCaptcha/RequestMethod/Socket.php112
-rw-r--r--srcs/phpmyadmin/vendor/google/recaptcha/src/ReCaptcha/RequestMethod/SocketPost.php108
-rw-r--r--srcs/phpmyadmin/vendor/google/recaptcha/src/ReCaptcha/RequestParameters.php111
-rw-r--r--srcs/phpmyadmin/vendor/google/recaptcha/src/ReCaptcha/Response.php218
-rw-r--r--srcs/phpmyadmin/vendor/google/recaptcha/src/autoload.php69
10 files changed, 0 insertions, 1211 deletions
diff --git a/srcs/phpmyadmin/vendor/google/recaptcha/src/ReCaptcha/ReCaptcha.php b/srcs/phpmyadmin/vendor/google/recaptcha/src/ReCaptcha/ReCaptcha.php
deleted file mode 100644
index 177fa44..0000000
--- a/srcs/phpmyadmin/vendor/google/recaptcha/src/ReCaptcha/ReCaptcha.php
+++ /dev/null
@@ -1,269 +0,0 @@
-<?php
-/**
- * This is a PHP library that handles calling reCAPTCHA.
- *
- * BSD 3-Clause License
- * @copyright (c) 2019, Google Inc.
- * @link https://www.google.com/recaptcha
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * 1. Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * 3. Neither the name of the copyright holder nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-namespace ReCaptcha;
-
-/**
- * reCAPTCHA client.
- */
-class ReCaptcha
-{
- /**
- * Version of this client library.
- * @const string
- */
- const VERSION = 'php_1.2.3';
-
- /**
- * URL for reCAPTCHA siteverify API
- * @const string
- */
- const SITE_VERIFY_URL = 'https://www.google.com/recaptcha/api/siteverify';
-
- /**
- * Invalid JSON received
- * @const string
- */
- const E_INVALID_JSON = 'invalid-json';
-
- /**
- * Could not connect to service
- * @const string
- */
- const E_CONNECTION_FAILED = 'connection-failed';
-
- /**
- * Did not receive a 200 from the service
- * @const string
- */
- const E_BAD_RESPONSE = 'bad-response';
-
- /**
- * Not a success, but no error codes received!
- * @const string
- */
- const E_UNKNOWN_ERROR = 'unknown-error';
-
- /**
- * ReCAPTCHA response not provided
- * @const string
- */
- const E_MISSING_INPUT_RESPONSE = 'missing-input-response';
-
- /**
- * Expected hostname did not match
- * @const string
- */
- 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';
-
- /**
- * Expected action did not match
- * @const string
- */
- const E_ACTION_MISMATCH = 'action-mismatch';
-
- /**
- * Score threshold not met
- * @const string
- */
- const E_SCORE_THRESHOLD_NOT_MET = 'score-threshold-not-met';
-
- /**
- * Challenge timeout
- * @const string
- */
- const E_CHALLENGE_TIMEOUT = 'challenge-timeout';
-
- /**
- * Shared secret for the site.
- * @var string
- */
- private $secret;
-
- /**
- * Method used to communicate with service. Defaults to POST request.
- * @var RequestMethod
- */
- private $requestMethod;
-
- /**
- * Create a configured instance to use the reCAPTCHA service.
- *
- * @param string $secret The shared key between your site and reCAPTCHA.
- * @param RequestMethod $requestMethod method used to send the request. Defaults to POST.
- * @throws \RuntimeException if $secret is invalid
- */
- public function __construct($secret, RequestMethod $requestMethod = null)
- {
- if (empty($secret)) {
- throw new \RuntimeException('No secret provided');
- }
-
- if (!is_string($secret)) {
- throw new \RuntimeException('The provided secret must be a string');
- }
-
- $this->secret = $secret;
- $this->requestMethod = (is_null($requestMethod)) ? new RequestMethod\Post() : $requestMethod;
- }
-
- /**
- * Calls the reCAPTCHA siteverify API to verify whether the user passes
- * CAPTCHA test and additionally runs any specified additional checks
- *
- * @param string $response The user response token provided by reCAPTCHA, verifying the user on your site.
- * @param string $remoteIp The end user's IP address.
- * @return Response Response from the service.
- */
- public function verify($response, $remoteIp = null)
- {
- // Discard empty solution submissions
- if (empty($response)) {
- $recaptchaResponse = new Response(false, array(self::E_MISSING_INPUT_RESPONSE));
- return $recaptchaResponse;
- }
-
- $params = new RequestParameters($this->secret, $response, $remoteIp, self::VERSION);
- $rawResponse = $this->requestMethod->submit($params);
- $initialResponse = Response::fromJson($rawResponse);
- $validationErrors = array();
-
- if (isset($this->hostname) && strcasecmp($this->hostname, $initialResponse->getHostname()) !== 0) {
- $validationErrors[] = self::E_HOSTNAME_MISMATCH;
- }
-
- if (isset($this->apkPackageName) && strcasecmp($this->apkPackageName, $initialResponse->getApkPackageName()) !== 0) {
- $validationErrors[] = self::E_APK_PACKAGE_NAME_MISMATCH;
- }
-
- if (isset($this->action) && strcasecmp($this->action, $initialResponse->getAction()) !== 0) {
- $validationErrors[] = self::E_ACTION_MISMATCH;
- }
-
- if (isset($this->threshold) && $this->threshold > $initialResponse->getScore()) {
- $validationErrors[] = self::E_SCORE_THRESHOLD_NOT_MET;
- }
-
- if (isset($this->timeoutSeconds)) {
- $challengeTs = strtotime($initialResponse->getChallengeTs());
-
- if ($challengeTs > 0 && time() - $challengeTs > $this->timeoutSeconds) {
- $validationErrors[] = self::E_CHALLENGE_TIMEOUT;
- }
- }
-
- if (empty($validationErrors)) {
- return $initialResponse;
- }
-
- return new Response(
- false,
- array_merge($initialResponse->getErrorCodes(), $validationErrors),
- $initialResponse->getHostname(),
- $initialResponse->getChallengeTs(),
- $initialResponse->getApkPackageName(),
- $initialResponse->getScore(),
- $initialResponse->getAction()
- );
- }
-
- /**
- * Provide a hostname to match against in verify()
- * This should be without a protocol or trailing slash, e.g. www.google.com
- *
- * @param string $hostname Expected hostname
- * @return ReCaptcha Current instance for fluent interface
- */
- public function setExpectedHostname($hostname)
- {
- $this->hostname = $hostname;
- return $this;
- }
-
- /**
- * Provide an APK package name to match against in verify()
- *
- * @param string $apkPackageName Expected APK package name
- * @return ReCaptcha Current instance for fluent interface
- */
- public function setExpectedApkPackageName($apkPackageName)
- {
- $this->apkPackageName = $apkPackageName;
- return $this;
- }
-
- /**
- * Provide an action to match against in verify()
- * This should be set per page.
- *
- * @param string $action Expected action
- * @return ReCaptcha Current instance for fluent interface
- */
- public function setExpectedAction($action)
- {
- $this->action = $action;
- return $this;
- }
-
- /**
- * Provide a threshold to meet or exceed in verify()
- * Threshold should be a float between 0 and 1 which will be tested as response >= threshold.
- *
- * @param float $threshold Expected threshold
- * @return ReCaptcha Current instance for fluent interface
- */
- public function setScoreThreshold($threshold)
- {
- $this->threshold = floatval($threshold);
- return $this;
- }
-
- /**
- * Provide a timeout in seconds to test against the challenge timestamp in verify()
- *
- * @param int $timeoutSeconds Expected hostname
- * @return ReCaptcha Current instance for fluent interface
- */
- public function setChallengeTimeout($timeoutSeconds)
- {
- $this->timeoutSeconds = $timeoutSeconds;
- return $this;
- }
-}
diff --git a/srcs/phpmyadmin/vendor/google/recaptcha/src/ReCaptcha/RequestMethod.php b/srcs/phpmyadmin/vendor/google/recaptcha/src/ReCaptcha/RequestMethod.php
deleted file mode 100644
index 0a2a671..0000000
--- a/srcs/phpmyadmin/vendor/google/recaptcha/src/ReCaptcha/RequestMethod.php
+++ /dev/null
@@ -1,50 +0,0 @@
-<?php
-/**
- * This is a PHP library that handles calling reCAPTCHA.
- *
- * BSD 3-Clause License
- * @copyright (c) 2019, Google Inc.
- * @link https://www.google.com/recaptcha
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * 1. Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * 3. Neither the name of the copyright holder nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-namespace ReCaptcha;
-
-/**
- * Method used to send the request to the service.
- */
-interface RequestMethod
-{
-
- /**
- * Submit the request with the specified parameters.
- *
- * @param RequestParameters $params Request parameters
- * @return string Body of the reCAPTCHA response
- */
- public function submit(RequestParameters $params);
-}
diff --git a/srcs/phpmyadmin/vendor/google/recaptcha/src/ReCaptcha/RequestMethod/Curl.php b/srcs/phpmyadmin/vendor/google/recaptcha/src/ReCaptcha/RequestMethod/Curl.php
deleted file mode 100644
index eb99842..0000000
--- a/srcs/phpmyadmin/vendor/google/recaptcha/src/ReCaptcha/RequestMethod/Curl.php
+++ /dev/null
@@ -1,82 +0,0 @@
-<?php
-/**
- * This is a PHP library that handles calling reCAPTCHA.
- *
- * BSD 3-Clause License
- * @copyright (c) 2019, Google Inc.
- * @link https://www.google.com/recaptcha
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * 1. Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * 3. Neither the name of the copyright holder nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-namespace ReCaptcha\RequestMethod;
-
-/**
- * Convenience wrapper around the cURL functions to allow mocking.
- */
-class Curl
-{
-
- /**
- * @see http://php.net/curl_init
- * @param string $url
- * @return resource cURL handle
- */
- public function init($url = null)
- {
- return curl_init($url);
- }
-
- /**
- * @see http://php.net/curl_setopt_array
- * @param resource $ch
- * @param array $options
- * @return bool
- */
- public function setoptArray($ch, array $options)
- {
- return curl_setopt_array($ch, $options);
- }
-
- /**
- * @see http://php.net/curl_exec
- * @param resource $ch
- * @return mixed
- */
- public function exec($ch)
- {
- return curl_exec($ch);
- }
-
- /**
- * @see http://php.net/curl_close
- * @param resource $ch
- */
- public function close($ch)
- {
- curl_close($ch);
- }
-}
diff --git a/srcs/phpmyadmin/vendor/google/recaptcha/src/ReCaptcha/RequestMethod/CurlPost.php b/srcs/phpmyadmin/vendor/google/recaptcha/src/ReCaptcha/RequestMethod/CurlPost.php
deleted file mode 100644
index 1bd7cce..0000000
--- a/srcs/phpmyadmin/vendor/google/recaptcha/src/ReCaptcha/RequestMethod/CurlPost.php
+++ /dev/null
@@ -1,104 +0,0 @@
-<?php
-/**
- * This is a PHP library that handles calling reCAPTCHA.
- *
- * BSD 3-Clause License
- * @copyright (c) 2019, Google Inc.
- * @link https://www.google.com/recaptcha
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * 1. Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * 3. Neither the name of the copyright holder nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-namespace ReCaptcha\RequestMethod;
-
-use ReCaptcha\ReCaptcha;
-use ReCaptcha\RequestMethod;
-use ReCaptcha\RequestParameters;
-
-/**
- * Sends cURL request to the reCAPTCHA service.
- * Note: this requires the cURL extension to be enabled in PHP
- * @see http://php.net/manual/en/book.curl.php
- */
-class CurlPost implements RequestMethod
-{
- /**
- * Curl connection to the reCAPTCHA service
- * @var Curl
- */
- private $curl;
-
- /**
- * URL for reCAPTCHA siteverify API
- * @var string
- */
- private $siteVerifyUrl;
-
- /**
- * Only needed if you want to override the defaults
- *
- * @param Curl $curl Curl resource
- * @param string $siteVerifyUrl URL for reCAPTCHA siteverify API
- */
- public function __construct(Curl $curl = null, $siteVerifyUrl = null)
- {
- $this->curl = (is_null($curl)) ? new Curl() : $curl;
- $this->siteVerifyUrl = (is_null($siteVerifyUrl)) ? ReCaptcha::SITE_VERIFY_URL : $siteVerifyUrl;
- }
-
- /**
- * Submit the cURL request with the specified parameters.
- *
- * @param RequestParameters $params Request parameters
- * @return string Body of the reCAPTCHA response
- */
- public function submit(RequestParameters $params)
- {
- $handle = $this->curl->init($this->siteVerifyUrl);
-
- $options = array(
- CURLOPT_POST => true,
- CURLOPT_POSTFIELDS => $params->toQueryString(),
- CURLOPT_HTTPHEADER => array(
- 'Content-Type: application/x-www-form-urlencoded'
- ),
- CURLINFO_HEADER_OUT => false,
- CURLOPT_HEADER => false,
- CURLOPT_RETURNTRANSFER => true,
- CURLOPT_SSL_VERIFYPEER => true
- );
- $this->curl->setoptArray($handle, $options);
-
- $response = $this->curl->exec($handle);
- $this->curl->close($handle);
-
- if ($response !== false) {
- return $response;
- }
-
- return '{"success": false, "error-codes": ["'.ReCaptcha::E_CONNECTION_FAILED.'"]}';
- }
-}
diff --git a/srcs/phpmyadmin/vendor/google/recaptcha/src/ReCaptcha/RequestMethod/Post.php b/srcs/phpmyadmin/vendor/google/recaptcha/src/ReCaptcha/RequestMethod/Post.php
deleted file mode 100644
index a4ff716..0000000
--- a/srcs/phpmyadmin/vendor/google/recaptcha/src/ReCaptcha/RequestMethod/Post.php
+++ /dev/null
@@ -1,88 +0,0 @@
-<?php
-/**
- * This is a PHP library that handles calling reCAPTCHA.
- *
- * BSD 3-Clause License
- * @copyright (c) 2019, Google Inc.
- * @link https://www.google.com/recaptcha
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * 1. Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * 3. Neither the name of the copyright holder nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-namespace ReCaptcha\RequestMethod;
-
-use ReCaptcha\ReCaptcha;
-use ReCaptcha\RequestMethod;
-use ReCaptcha\RequestParameters;
-
-/**
- * Sends POST requests to the reCAPTCHA service.
- */
-class Post implements RequestMethod
-{
- /**
- * URL for reCAPTCHA siteverify API
- * @var string
- */
- private $siteVerifyUrl;
-
- /**
- * Only needed if you want to override the defaults
- *
- * @param string $siteVerifyUrl URL for reCAPTCHA siteverify API
- */
- public function __construct($siteVerifyUrl = null)
- {
- $this->siteVerifyUrl = (is_null($siteVerifyUrl)) ? ReCaptcha::SITE_VERIFY_URL : $siteVerifyUrl;
- }
-
- /**
- * Submit the POST request with the specified parameters.
- *
- * @param RequestParameters $params Request parameters
- * @return string Body of the reCAPTCHA response
- */
- public function submit(RequestParameters $params)
- {
- $options = array(
- 'http' => array(
- 'header' => "Content-type: application/x-www-form-urlencoded\r\n",
- 'method' => 'POST',
- 'content' => $params->toQueryString(),
- // Force the peer to validate (not needed in 5.6.0+, but still works)
- 'verify_peer' => true,
- ),
- );
- $context = stream_context_create($options);
- $response = file_get_contents($this->siteVerifyUrl, false, $context);
-
- if ($response !== false) {
- return $response;
- }
-
- return '{"success": false, "error-codes": ["'.ReCaptcha::E_CONNECTION_FAILED.'"]}';
- }
-}
diff --git a/srcs/phpmyadmin/vendor/google/recaptcha/src/ReCaptcha/RequestMethod/Socket.php b/srcs/phpmyadmin/vendor/google/recaptcha/src/ReCaptcha/RequestMethod/Socket.php
deleted file mode 100644
index 236bd5f..0000000
--- a/srcs/phpmyadmin/vendor/google/recaptcha/src/ReCaptcha/RequestMethod/Socket.php
+++ /dev/null
@@ -1,112 +0,0 @@
-<?php
-/**
- * This is a PHP library that handles calling reCAPTCHA.
- *
- * BSD 3-Clause License
- * @copyright (c) 2019, Google Inc.
- * @link https://www.google.com/recaptcha
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * 1. Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * 3. Neither the name of the copyright holder nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-namespace ReCaptcha\RequestMethod;
-
-/**
- * Convenience wrapper around native socket and file functions to allow for
- * mocking.
- */
-class Socket
-{
- private $handle = null;
-
- /**
- * fsockopen
- *
- * @see http://php.net/fsockopen
- * @param string $hostname
- * @param int $port
- * @param int $errno
- * @param string $errstr
- * @param float $timeout
- * @return resource
- */
- public function fsockopen($hostname, $port = -1, &$errno = 0, &$errstr = '', $timeout = null)
- {
- $this->handle = fsockopen($hostname, $port, $errno, $errstr, (is_null($timeout) ? ini_get("default_socket_timeout") : $timeout));
-
- if ($this->handle != false && $errno === 0 && $errstr === '') {
- return $this->handle;
- }
- return false;
- }
-
- /**
- * fwrite
- *
- * @see http://php.net/fwrite
- * @param string $string
- * @param int $length
- * @return int | bool
- */
- public function fwrite($string, $length = null)
- {
- return fwrite($this->handle, $string, (is_null($length) ? strlen($string) : $length));
- }
-
- /**
- * fgets
- *
- * @see http://php.net/fgets
- * @param int $length
- * @return string
- */
- public function fgets($length = null)
- {
- return fgets($this->handle, $length);
- }
-
- /**
- * feof
- *
- * @see http://php.net/feof
- * @return bool
- */
- public function feof()
- {
- return feof($this->handle);
- }
-
- /**
- * fclose
- *
- * @see http://php.net/fclose
- * @return bool
- */
- public function fclose()
- {
- return fclose($this->handle);
- }
-}
diff --git a/srcs/phpmyadmin/vendor/google/recaptcha/src/ReCaptcha/RequestMethod/SocketPost.php b/srcs/phpmyadmin/vendor/google/recaptcha/src/ReCaptcha/RequestMethod/SocketPost.php
deleted file mode 100644
index 7edffb8..0000000
--- a/srcs/phpmyadmin/vendor/google/recaptcha/src/ReCaptcha/RequestMethod/SocketPost.php
+++ /dev/null
@@ -1,108 +0,0 @@
-<?php
-/**
- * This is a PHP library that handles calling reCAPTCHA.
- *
- * BSD 3-Clause License
- * @copyright (c) 2019, Google Inc.
- * @link https://www.google.com/recaptcha
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * 1. Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * 3. Neither the name of the copyright holder nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-namespace ReCaptcha\RequestMethod;
-
-use ReCaptcha\ReCaptcha;
-use ReCaptcha\RequestMethod;
-use ReCaptcha\RequestParameters;
-
-/**
- * Sends a POST request to the reCAPTCHA service, but makes use of fsockopen()
- * instead of get_file_contents(). This is to account for people who may be on
- * servers where allow_url_open is disabled.
- */
-class SocketPost implements RequestMethod
-{
- /**
- * Socket to the reCAPTCHA service
- * @var Socket
- */
- private $socket;
-
- /**
- * Only needed if you want to override the defaults
- *
- * @param \ReCaptcha\RequestMethod\Socket $socket optional socket, injectable for testing
- * @param string $siteVerifyUrl URL for reCAPTCHA siteverify API
- */
- public function __construct(Socket $socket = null, $siteVerifyUrl = null)
- {
- $this->socket = (is_null($socket)) ? new Socket() : $socket;
- $this->siteVerifyUrl = (is_null($siteVerifyUrl)) ? ReCaptcha::SITE_VERIFY_URL : $siteVerifyUrl;
- }
-
- /**
- * Submit the POST request with the specified parameters.
- *
- * @param RequestParameters $params Request parameters
- * @return string Body of the reCAPTCHA response
- */
- public function submit(RequestParameters $params)
- {
- $errno = 0;
- $errstr = '';
- $urlParsed = parse_url($this->siteVerifyUrl);
-
- if (false === $this->socket->fsockopen('ssl://' . $urlParsed['host'], 443, $errno, $errstr, 30)) {
- return '{"success": false, "error-codes": ["'.ReCaptcha::E_CONNECTION_FAILED.'"]}';
- }
-
- $content = $params->toQueryString();
-
- $request = "POST " . $urlParsed['path'] . " HTTP/1.1\r\n";
- $request .= "Host: " . $urlParsed['host'] . "\r\n";
- $request .= "Content-Type: application/x-www-form-urlencoded\r\n";
- $request .= "Content-length: " . strlen($content) . "\r\n";
- $request .= "Connection: close\r\n\r\n";
- $request .= $content . "\r\n\r\n";
-
- $this->socket->fwrite($request);
- $response = '';
-
- while (!$this->socket->feof()) {
- $response .= $this->socket->fgets(4096);
- }
-
- $this->socket->fclose();
-
- if (0 !== strpos($response, 'HTTP/1.1 200 OK')) {
- return '{"success": false, "error-codes": ["'.ReCaptcha::E_BAD_RESPONSE.'"]}';
- }
-
- $parts = preg_split("#\n\s*\n#Uis", $response);
-
- return $parts[1];
- }
-}
diff --git a/srcs/phpmyadmin/vendor/google/recaptcha/src/ReCaptcha/RequestParameters.php b/srcs/phpmyadmin/vendor/google/recaptcha/src/ReCaptcha/RequestParameters.php
deleted file mode 100644
index e9ba453..0000000
--- a/srcs/phpmyadmin/vendor/google/recaptcha/src/ReCaptcha/RequestParameters.php
+++ /dev/null
@@ -1,111 +0,0 @@
-<?php
-/**
- * This is a PHP library that handles calling reCAPTCHA.
- *
- * BSD 3-Clause License
- * @copyright (c) 2019, Google Inc.
- * @link https://www.google.com/recaptcha
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * 1. Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * 3. Neither the name of the copyright holder nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-namespace ReCaptcha;
-
-/**
- * Stores and formats the parameters for the request to the reCAPTCHA service.
- */
-class RequestParameters
-{
- /**
- * The shared key between your site and reCAPTCHA.
- * @var string
- */
- private $secret;
-
- /**
- * The user response token provided by reCAPTCHA, verifyin