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 : |
<?php /** * ����� "��������� ����������� D7" ��� ������� * �������� ���� �����: www.realcommenter.com * �������� ���� �����������: burlaka.studio * ����� � ����������: ������� ������� (AlexeyGfi) -> alexeygfi@gmail.com */ namespace Burlakastudio\Realcommenter; class RECAPTCHA2 extends REALCOMMENTER_HL_GENERAL_PROVIDER { public static function use_recaptcha2() { /** * ������ ��: * - ������� ���������� recaptcha, // use_recaptcha * - ������ ����� 2 // recaptcha_version == 2 * - ����� sitekey // recaptcha_sitekey * - ����� secretkey // recaptcha_secretkey */ if( OPTIONS::get( 'use_recaptcha' ) && OPTIONS::get( 'recaptcha_version' ) == 2 && self::get_sitekey() && self::get_secretkey() ) { return true; } return false; } public static function recaptcha_BX_MSG( &$BX_MSG ) { if( !self::use_recaptcha2() ) { return; } $BX_MSG[ 'REALCOMMENTER_RECAPTCHA2_SITEKEY' ]= self::get_sitekey(); } public static function get_sitekey() { return OPTIONS::get( 'recaptcha_sitekey' ); } public static function get_secretkey() { return OPTIONS::get( 'recaptcha_secretkey' ); } private static function get_recaptcha2_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 recaptcha2_response_check( &$form_data= [] ) { // ������� �����, �������� if( !self::use_recaptcha2() ) { return true; } if( empty( $form_data ) || !$form_data[ 'RECAPTCHA2_RESPONSE' ] ) { return false; } //�������� ������� $captcha_api_url= self::get_recaptcha2_api_url( $form_data[ 'RECAPTCHA2_RESPONSE' ] ); 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' ]; } }