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/REQUEST_INFO.php
<?php
/**
 * ����� "��������� ����������� 2.0" ��� �������
 * �������� ���� �����: www.realcommenter.com
 * �������� ���� �����������: burlaka.studio
 * ����� � ����������: ������� ������� (AlexeyGfi) -> alexeygfi@gmail.com
 */

namespace Burlakastudio\Realcommenter;

require_once 'REQUEST_INFO_TABLE.php';

class REQUEST_INFO extends REALCOMMENTER_HL_GENERAL_PROVIDER {
	
	/**
	 * @param int $comment_id
	 *
	 * @throws \Exception
	 */
	public static function save_request_for( $comment_id= 0 ) {
	
		if ( !$comment_id ) {
			return;
		}
		
		$request_info= self::collect_comment_request_info();
		$request_info[ 'UF_COMMENT_ID' ]= $comment_id;
		
		$new_row= self::get_free_row( [
			'UF_COMMENT_ID' => false
		] );
		
		if ( !$new_row[ 'ID' ] ) {
			throw new \Exception( 'REQUEST_DB_ERROR' );
		} else {
			self::update( $new_row[ 'ID' ], $request_info );
		}
		
	}
	
	/**
	 * �������� ���������� �� ���������� ��� ���� �� �������� �������
	 *
	 * @return array
	 */
	private static function collect_comment_request_info() {
		
		$result= [];
		$server= \Bitrix\Main\Context::getCurrent()->getServer();
		
		$keys_conformity= self::comment_server_keys_to_preserve();
		foreach ( $keys_conformity as $gk => $server_key ) {
			$result[ $gk ]= $server->get( $server_key );
		}
		
		return $result;
		
	}
	
	/**
	 * ��� �� ����� ����������
	 *
	 * 'REMOTE_ADDR', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_REAL_IP', 'HTTP_USER_AGENT', 'HTTP_REFERER', 'HTTP_COOKIE', 'SERVER_PORT', 'REQUEST_URI'
	 *
	 * @return array
	 */
	private static function comment_server_keys_to_preserve() {
		
		/**
		 * @var REQUEST_INFO_TABLE $table_class
		 */
		$table_class= self::getTableClass();
		
		$collect_fields= $table_class::getMap();
		$collect_fields= self::normalize_collect_fields( array_keys( $collect_fields ) );
		
		return $collect_fields;
		
	}
	
	/**
	 * ��������: � ������� ��� � ������,
	 * �� ������ ������ ������� ����� �� ���������� ��������� �������������
	 *
	 * ������ �� ���, ������ ������� �� HTTP_* ��������� �� UF_*
	 *
	 * �� ��� �� HTTP_X_FORWARDED_FOR ������ ��� UF_X_FORWARDED_FOR
	 *
	 * � �� �� ����, ��� ��� ��� ��� ������������ � ��������������,
	 * ������ ��� (������ � ��, ������ �� ������� �� HTTP_) ���� ������� �� UF_
	 *
	 * � ��������, ��� ��� ����� �����, ��� UF_ ����� ��������, ��������:
	 *      UF_REQUEST_URI �> $_SERVER[ 'REQUEST_URI' ]
	 *      UF_REMOTE_ADDR �> $_SERVER[ 'REMOTE_ADDR' ]
	 *
	 * ... � ����� �����, ��� UF_ ����� ������� �� HTTP_:
	 *      UF_X_FORWARDED_FOR �> $_SERVER[ 'HTTP_X_FORWARDED_FOR' ]
	 *      UF_X_REAL_IP �> $_SERVER[ 'HTTP_X_REAL_IP' ]
	 *
	 * @param array $collect_fields
	 *
	 * @return array
	 */
	private static function normalize_collect_fields( $collect_fields= [] ) {
		
		$normalized= [];
		
		foreach ( $collect_fields as $cf ) {
			
			$cf_clear= str_replace( 'UF_', '', $cf );
			$cf_http= str_replace( 'UF_', 'HTTP_', $cf );
			
			if ( $_SERVER[ $cf_clear ] ) {
				$normalized[ $cf ]= $cf_clear;
			} else if ( $_SERVER[ $cf_http ] ) {
				$normalized[ $cf ]= $cf_http;
			}
		}
		
		return $normalized;
		
	}
	
}

Youez - 2016 - github.com/yon3zu
LinuXploit