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/cvetdv.ru/bitrix/modules/burlakastudio.realcommenter/ajax/ |
Upload File : |
<?php use Bitrix\Main\Localization\Loc; use Burlakastudio\Realcommenter\Comments; use Burlakastudio\Realcommenter\DEBUGGER; use Burlakastudio\Realcommenter\GRANT_AND_ACCESS; use Burlakastudio\Realcommenter\RequestInfo; use Burlakastudio\Realcommenter\Sanctions; use Burlakastudio\Realcommenter\USER; if (!defined('B_PROLOG_INCLUDED') || B_PROLOG_INCLUDED !== true) { die(); } /** * @var $json_return array */ /** * ����� "��������� ����������� D7" ��� ������� * �������� ���� �����: www.realcommenter.com * �������� ���� �����������: burlaka.studio * ����� � ����������: ������� ������� (AlexeyGfi) -> alexeygfi@gmail.com */ /** * ��� ������ �����, ����� �������� ��� ��������, ����� ������ ������� * ��� ������� ������ * * ���� ������ �� ������ �������������� ������������. * ��� ��� ����� ������������ ����� ��������, �� � �� �� ���� * �������� ������ ������ - �����������, ������� �� ������� ������� ���������� * */ if (GRANT_AND_ACCESS::is_any_moder($arParams)) { require_once __DIR__ . '/ajax_comment_id_to_url_validator.php'; if (!$json_return['ERROR']) { /** * @var array $comment_info */ $hideReverse = ''; $hideLabel = 'ADMT_HIDE_LABEL'; if ($comment_info['UF_UFO']) { $hideReverse = 'data-reverse="1"'; $hideLabel = 'ADMT_UNHIDE_LABEL'; } $freezeReverse = ''; $freezeLabel = 'ADMT_FREEZE_LABEL'; if ($comment_info['UF_FROZEN']) { $freezeReverse = 'data-reverse="1"'; $freezeLabel = 'ADMT_UNFREEZE_LABEL'; } $activeReverse = ''; $activeLabel = 'ADMT_ACTIVE_LABEL'; if ($comment_info['UF_ACTIVE']) { $activeReverse = 'data-reverse="1"'; $activeLabel = 'ADMT_UNACTIVE_LABEL'; } $deleteActionProofLabel = Loc::getMessage('DELETE_ACTION_PROOF_LABEL'); $adminToolsTemplate = <<<ADMT <div class="br_options"> <div data-action="EDIT" data-to-edit="1">#ADMT_EDIT_LABEL#</div> #MODERATE# #STANDARD_IF_APPROVED# <div data-action="DELETE" data-confirmable="1" data-proof-label="{$deleteActionProofLabel}">#ADMT_DELETE_LABEL#</div> #SANCTION_BLOCK# #REQUEST_INFO_BLOCK# #MORE_FROM_USER# <b>#{$comment_info['ID']}</b> </div> ADMT; /** * <div data-action="SANCTIONS">#ADMT_SANCTIONS_LABEL#</div> * * ����� ����� �����-���� ��� �������� �������: * ���� ����������� - ����������������� ����������, ������� ���������� * ���������� ��������� ������ * * ...� ���� ���� ���������� */ $sanctionBlockHtml = ''; if (!GRANT_AND_ACCESS::is_any_moder($arParams, $comment_info['UF_USER_ID'])) { $sanctionToolsList = Sanctions::burnAdminTools($comment_info['UF_USER_ID']); } if (!empty($sanctionToolsList)) { // <div data-action="FREEZE" class="_break">#{$freeze_label}#</div> foreach ($sanctionToolsList as $sPos => &$sanctionTool) { $sanctionTool = sprintf( '<div data-action="%1$s"%2$s data-confirmable="1" data-proof-label="%3$s">#%1$s_LABEL#</div>', $sanctionTool, ($sPos === 0) ? ' class="_break"' : '', $deleteActionProofLabel ); } unset($sanctionTool); $sanctionBlockHtml = implode('', $sanctionToolsList); } $moderatePart = ''; $standardIfApproved = ''; if (Comments::isProofAwaiting(0, $comment_info)) { $moderatePart = sprintf( '<div data-action="%1$s">#ADMT_%1$s_LABEL#</div>', 'APPROVE' ); } else { $standardIfApproved = <<<SIA <div data-action="HIDE" {$hideReverse}>#{$hideLabel}#</div> <div data-action="FREEZE" {$freezeReverse} class="_break">#{$freezeLabel}#</div> <div data-action="ACTIVE" {$activeReverse}>#{$activeLabel}#</div> SIA; } /** * ���� � ��� ����������� � ����������������� ����������, * ...� � ���� ���� ��� ���� ��������, * ����� ���������� ��������� ����� ��� �������� */ $moreFromTool = ''; // ���� 1! (���� 1, ����� � ��� ��� �����, ������ �� �) if (USER::calculateCommentsByUser($comment_info['UF_USER_ID']) > 1) { $moreFromTool = sprintf( '<div data-action="%1$s" class="_break">#%1$s_LABEL#</div>', 'MORE_FROM' ); } /** * TODO: ������� ������: * <div data-action="REQUEST_INFO" class="_break">#ADMT_REQUEST_INFO_LABEL#</div> */ $requestInfoTool = ''; // ���� 1! (���� 1, ����� � ��� ��� �����, ������ �� �) if (RequestInfo::getInfoByComment($comment_info['ID'])) { $requestInfoTool = sprintf( '<div data-action="%1$s">#%1$s_LABEL#</div>', 'REQUEST_INFO' ); } $adminToolsTemplate = str_replace( [ '#MORE_FROM_USER#', '#SANCTION_BLOCK#', '#REQUEST_INFO_BLOCK#', '#MODERATE#', '#STANDARD_IF_APPROVED#', ], [ $moreFromTool, $sanctionBlockHtml, $requestInfoTool, $moderatePart, $standardIfApproved ], $adminToolsTemplate ); if (preg_match_all('~#([^#]+)#~', $adminToolsTemplate, $matches)) { /** * @var string $get_message_key */ foreach ($matches[1] as $get_message_key) { $adminToolsTemplate = str_replace( '#' . $get_message_key . '#', Loc::getMessage($get_message_key), $adminToolsTemplate ); } } $json_return['ADMIN_TOOLS_TEMPLATE'] = $adminToolsTemplate; } } else { DEBUGGER::error( Loc::getMessage('OPERATION_ACCESS_DENIED'), [], false ); $json_return['ERROR'][] = Loc::getMessage('OPERATION_ACCESS_DENIED'); }