403Webshell
Server IP : 104.21.14.103  /  Your IP : 18.227.72.172
Web Server : LiteSpeed
System : Linux business53.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64
User : giankuin ( 1871)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /proc/self/root/proc/thread-self/root/home/giankuin/thietke365.net/wp-content/plugins/mailpoet/lib/Subscription/Captcha/Validator/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /proc/self/root/proc/thread-self/root/home/giankuin/thietke365.net/wp-content/plugins/mailpoet/lib/Subscription/Captcha/Validator/RecaptchaValidator.php
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing

namespace MailPoet\Subscription\Captcha\Validator;

if (!defined('ABSPATH')) exit;


use MailPoet\Settings\SettingsController;
use MailPoet\Subscription\Captcha\CaptchaConstants;
use MailPoet\WP\Functions as WPFunctions;

class RecaptchaValidator implements CaptchaValidator {


  /** @var SettingsController  */
  private $settings;

  /** @var WPFunctions  */
  private $wp;

  private const ENDPOINT = 'https://www.google.com/recaptcha/api/siteverify';

  public function __construct(
    SettingsController $settings,
    WPFunctions $wp
  ) {
    $this->settings = $settings;
    $this->wp = $wp;
  }

  public function validate(array $data): bool {

    $captchaSettings = $this->settings->get('captcha');
    if (empty($data['recaptchaResponseToken'])) {
      throw new ValidationError(__('Please check the CAPTCHA.', 'mailpoet'));
    }

    $secretToken = $captchaSettings['type'] === CaptchaConstants::TYPE_RECAPTCHA_INVISIBLE ? $captchaSettings['recaptcha_invisible_secret_token'] : $captchaSettings['recaptcha_secret_token'];

    $response = $this->wp->wpRemotePost(self::ENDPOINT, [
      'body' => [
        'secret' => $secretToken,
        'response' => $data['recaptchaResponseToken'],
      ],
    ]);
    if ($this->wp->isWpError($response)) {
      throw new ValidationError(__('Error while validating the CAPTCHA.', 'mailpoet'));
    }
    $response = json_decode($this->wp->wpRemoteRetrieveBody($response));
    if (empty($response->success)) {
      throw new ValidationError(__('Error while validating the CAPTCHA.', 'mailpoet'));
    }

    return true;
  }
}

Youez - 2016 - github.com/yon3zu
LinuXploit