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/ajax/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/burlakastudio.realcommenter/ajax/_form_get.php
<?php

use Bitrix\Main\Localization\Loc;
use Burlakastudio\Realcommenter\AdditionalFields;
use Burlakastudio\Realcommenter\BURN;
use Burlakastudio\Realcommenter\COMMENTS;
use Burlakastudio\Realcommenter\DEBUGGER;
use Burlakastudio\Realcommenter\EVENT;
use Burlakastudio\Realcommenter\FORM;
use Burlakastudio\Realcommenter\GRANT_AND_ACCESS;
use Burlakastudio\Realcommenter\RECAPTCHA2;
use Burlakastudio\Realcommenter\RECAPTCHA3;
use Burlakastudio\Realcommenter\TOOLS;
use Burlakastudio\Realcommenter\URL;
use Burlakastudio\Realcommenter\USER;

if (!defined('B_PROLOG_INCLUDED') || B_PROLOG_INCLUDED !== true) {
    die();
}

/**
 * ����� "��������� ����������� D7" ��� �������
 * �������� ���� �����: www.realcommenter.com
 * �������� ���� �����������: burlaka.studio
 * ����� � ����������: ������� ������� (AlexeyGfi) -> alexeygfi@gmail.com
 */

/**
 * @var array $arParams
 */

/**
 * ������ �� ����� ��������� / �������������
 *
 * ����� �� ��� ����� ������ �� ��������� �����������,
 * ��� � ����� ������ � ������� ������
 *
 */

$url = $posts['talk_url'];
//$urlInfo = URL::get_info(0, $url, $arParams['TALK_GROUP_ID'], true);
$urlInfo = URL::getInfo([
    'url' => $url,
    'groupId' => $arParams['TALK_GROUP_ID'],
    'createIfNotFound' => true
]);

$commentId = (int)htmlspecialchars($posts['comment_id']);
$commentTarget = htmlspecialchars($posts['comment_target']);
$silentMode = ($posts['silent_mode'] ?? 0);

$editForm = htmlspecialchars($posts['edit_form']);

if ($commentId) {
    $commentInfo = COMMENTS::getCommentInfo($commentId);
}

$DEPTH_LEVEL_TO_CHECK = (int)$commentInfo['UF_DEPTH_LEVEL'];
if ($editForm) {
    $DEPTH_LEVEL_TO_CHECK--;
}

if (
    // ��� �� ��� ���?
    empty($urlInfo)
    // ��� �� �������� ���������� �� �������� ������� ����
    || (!$commentId && !$commentTarget)
    // ���� ������ �� ����� �������������, �� �� ������ �������� �����������
    || ($editForm && !$commentId)
    // ��� ������� ����������� �� ��� ��������� � ��
    || ($commentId && empty($commentInfo))
    // �� ����� �������������
    || !GRANT_AND_ACCESS::may_comment($arParams)
    // ������� ����������� � ������ ��������� � � ���������� ��� ������� � ����� �������
    || !GRANT_AND_ACCESS::have_access_by_special_case_of_comment(
        $commentId, $arParams, $commentInfo
    )
    // ��������� ����� �������������� � ���� ����������� ������ ������ �� ���������� �� ���������� �������
    || ($commentInfo && GRANT_AND_ACCESS::restrictedDepth(
            $arParams, $DEPTH_LEVEL_TO_CHECK))
    // ���������� ����� �� �����, �� ��������� ���������� �� ������ ������������
    // ...� ���������� ���� �������������, ���� �� ������� �� ������
    || GRANT_AND_ACCESS::restricted_by_auth_limit($arParams)
) {

    DEBUGGER::error(
        Loc::getMessage('OPERATION_ACCESS_DENIED'), [], false
    );

    $json_return['ERROR'][] = Loc::getMessage('OPERATION_ACCESS_DENIED');

} else if (
    $editForm
    && !GRANT_AND_ACCESS::is_any_moder($arParams)
) {

    $user_info = USER::get_info();

    if (
        // �� ����������� �����
        empty($user_info)
        // �� �����
        // ... ��� ������� ����, � ������ �������� ����� ����� ������������ ���� �����������
        // � �� ���������
        || (
            $user_info['ID'] != $commentInfo['UF_USER_ID']
            || !GRANT_AND_ACCESS::may_edit_comment_like_author(
                $commentInfo['UF_USER_ID'],
                $commentInfo['UF_CREATED_DATE'])
        )

        // (!!!) ������� �������� �� ���������� ������.
        // ��� ����� ������������� � ����� ����� ��������������� �������� ������,
        // ���� ����� �� �����, �� ������������ ����� (� ����� ���������� �������)
        //
        // ����������� ������� �� �������, ������ ���������� �� ����� ������������� (� ��� ��� ����� ����� o_O?)
        // ...����� ���� ����������� ����� ����������
        //	|| (
        //		\Burlakastudio\Realcommenter\GRANT_AND_ACCESS::restricted_depth(
        //		$arParams, $current_info[ 'UF_DEPTH_LEVEL' ] )
        //		&& $user_info[ 'ID' ] != $current_info[ 'UF_USER_ID' ]
        //	)

    ) {
        DEBUGGER::error(
            Loc::getMessage('OPERATION_ACCESS_DENIED', [], false)
        );

        $json_return['ERROR'][] = Loc::getMessage('OPERATION_ACCESS_DENIED');
    }

}

if (empty($json_return['ERROR'])) {

    ob_start();
    ?>
    <div
            class="brna_form"
            data-form-to="<?= $commentId ?>"
            data-form-target="<?= $commentTarget ?>"
            <?php
            if ($silentMode) {
                ?>data-silent-mode <?php
            }
            ?>
    >
        <?php

        if (!$json_return['BX_MSG']) {
            $json_return['BX_MSG'] = [];
        }

        TOOLS::getHtmlEditorFilemtimes($json_return['BX_MSG']);

        if (!GRANT_AND_ACCESS::restricted_by_auth_limit($arParams, false)) {

            ?>
            <div class="brf_header">
                <del></del>
            </div>
            <div class="brf_body">
                <?php
                $addiFields = [];
                /**
                 * ������������ ��� ��������� ����� �� ������ ������
                 * ...��� ��� ��������������
                 *  !!! �� ��� �������������� ���������� ������� �����
                 *
                 * ...��� ��� �������������� ������ ����������
                 * (��������, ���� �� �� ������ �� ����,
                 * ��� ���������� �������� �� ��������� ���)
                 */
                if (!$commentId || ($editForm && (int)$commentInfo['UF_DEPTH_LEVEL'] === 1)) {
                    $addiFields = AdditionalFields::getFieldsByGroup($urlInfo['UF_GROUP_ID']);
                }

                if (
                    empty($addiFields)
                    // �����������, �� ��������������, �� ������� ������ �������� ����� ����� ����������
                    || (
                        $commentId
                        && $editForm
                        && !isset($commentInfo['AF_VALUES'])
                        && $commentInfo['UF_COMMENT']
                    )
                ) {
                    $useVisualEditor = false;

                    if (GRANT_AND_ACCESS::is_use_text_editor()) {

                        $useVisualEditor = true;

                        if (!empty($json_return['BX_MSG'])) {
                            $json_return['BX_MSG']['realcommenter_any_moder'] =
                                GRANT_AND_ACCESS::is_any_moder($arParams);
                            $json_return['BX_MSG']['realcommenter_brand_manager']=
                                GRANT_AND_ACCESS::isTheConversationBrandManager($arParams);
                        }

                        TOOLS::getHtmlEditorButtonsTitles($json_return['BX_MSG']);

                    }
                    ?>
                    <div class="brfb_msg" <?= ($useVisualEditor) ? 'data-html-editor="1"' : '' ?>>
                        <textarea
                                autocomplete="off"
                                data-input="UF_COMMENT"
                                data-require="1"
                                data-editor-type="text"
                        ><?php
                            if ($editForm) {
                                ?><?= $commentInfo['UF_COMMENT'] ?><?php
                            }
                            ?></textarea>
                    </div>
                    <?php
                } else {
                    /*
                    TODO:
                    <div class="brf_additionals">
                        <div>
                            <span>�����������: </span>
                            <div><input type="text" data-input="ADDI[23][]" data-addit-id="23"></div>
                        </div>
                        <div>
                            <span>����������: </span>
                            <div><textarea class="_error" data-input="ADDI[25][]" data-addit-id="25"></textarea></div>
                        </div>
                        <div>
                            <span>�������: </span> <abbr>1 / 2 / 3 / 4 / 5</abbr>
                            <input type="hidden" data-input="ADDI[27][]" data-addit-id="27">
                        </div>
                        <div>
                            <span>�����: </span>
                            <select data-addit-id="301">
                                <option value="1">������������</option>
                                <option value="2">��� ����</option>
                                <option value="3">��������</option>
                                <option value="4">�����</option>
                                <option value="5">������</option>
                            </select>
                        </div>
                    </div>
                    <? */
                    $resultFields = [];

                    foreach ($addiFields as $field) {
                        $field['VALUE'] = $commentInfo['AF_VALUES'][$field['ID']] ?? null;
                        $resultFields[] = BURN::additionalField($field);
                    }
                    ?>
                    <div class="brf_additionals">
                        <?= implode('', $resultFields) ?>
                    </div>
                    <?php
                }

                $showSignatureField = /*$editForm*/
                    /*GRANT_AND_ACCESS::is_any_moder($arParams)
                    || */FORM::is_show_signature_field($arParams);

                $showEmailField = /*$editForm*/
                    /*GRANT_AND_ACCESS::is_any_moder($arParams)
                    || */FORM::is_show_email_field($arParams);

                if ($showSignatureField || $showEmailField) {
                    ?>
                    <div class="brfb_userfields">
                        <?php
                        if ($showSignatureField) {
                            $signatureFieldRequired = FORM::is_signature_required($arParams);

                            /**
                             * ����� ��� �������������� ����,
                             * ��� ��������, �� � ��������������.
                             *
                             * ����, ���� ��-�� ����, ��� ���� �� ���������,
                             * � ������� ������� ������������ ��� ������������ ������ �����������
                             * ����� ������
                             */
                            if ($editForm) {
                                $signatureAutocomplete = $commentInfo['UF_SIGNATURE'];
                            } else {
//                                if (!$signature_autocomplete) {
                                $signatureAutocomplete = USER::get_formatted_name();
//                                }
                            }
                            ?>
                            <div>
                                <span><?= Loc::getMessage('ITAPE_FORM_SIGNATURE') ?></span>
                                <div><input type="text" data-input="UF_SIGNATURE" value="<?= $signatureAutocomplete ?>"
                                            <?php
                                            if ($signatureFieldRequired && !$editForm) {
                                            ?>data-require="1" <?php
                                    }
                                    ?>></div>
                            </div>
                            <?php
                        }

                        if ($showEmailField) {

                            $emailFieldRequired = FORM::is_email_required($arParams);
                            $emailAutocomplete = '';

                            if ($editForm) {
                                $emailAutocomplete = $commentInfo['UF_EMAIL'];
                            } else {
                                $user_info = USER::get_info();
                                if (!empty($user_info)) {
                                    $emailAutocomplete = $user_info['EMAIL'];
                                }
                            }

                            ?>
                            <div>
                                <span><?= Loc::getMessage('ITAPE_FORM_EMAIL') ?></span>
                                <div><input type="text" data-input="UF_EMAIL" value="<?= $emailAutocomplete ?>" <?php
                                    if ($emailFieldRequired && !$editForm) {
                                    ?>data-require="1" <?php
                                    }
                                    ?>></div>
                            </div>
                            <?php
                        }
                        ?>
                    </div>
                    <?php
                }
                ?>
            </div>
            <?php
            if ($editForm && !empty($commentInfo['UF_UPLOADS'])) {

                if (!is_array($commentInfo['UF_UPLOADS'])) {
                    $commentInfo['UF_UPLOADS'] = @unserialize(
                        $commentInfo['UF_UPLOADS'],
                        ['allowed_class' => false]
                    );
                }
                if (!empty($commentInfo['UF_UPLOADS'])) {

                    $prepared_files = BURN::prepare_upload_files($commentInfo['UF_UPLOADS']);

                    $result_pictures = $prepared_files['result_pictures'];
                    $result_files = $prepared_files['result_files'];

                    if (!empty($result_pictures) || !empty($result_files)) {
                        ?>
                        <div class="brf_edit_uploads">
                        <?= BURN::pack_upload_files_to_html($result_pictures, $result_files) ?>
                        </div><?php
                    }
                }
            }
            ?>
            <div class="brf_submit">
                <?php
                if (!$arParams['HIDE_PHOTO_UPLOADER']) {
                    ?>
                    <ins></ins><?php
                }
                ?>
                <button data-submit="<?= ($editForm) ? 'edit' : 'add' ?>"><?= $arParams['lang_send_comment'] ?></button>
                <?php
                if (RECAPTCHA2::use_recaptcha2()) {
                    ?>
                    <div class="recaptcha2"></div>
                    <?php
                }
                ?>
            </div>
            <?php

        } else {

            ?>
            <div class="brf_header">
                <del></del>
            </div>
            <div class="bf_auth brf_body">
                <?= Loc::getMessage('ITAPE_LOAD_AUTH_FORM') ?>
            </div>
            <?php

        }
        ?>
    </div>
    <?php
    $form_html = ob_get_clean();

    // ���� ���������� �������, ������ ����� ������ ������������� sitekey
    RECAPTCHA2::recaptcha_BX_MSG($json_return['BX_MSG']);
    RECAPTCHA3::recaptcha_BX_MSG($json_return['BX_MSG']);

    EVENT::call(
        'OnBeforeCommentFormPlace',
        [
            'form_html' => &$form_html,
            'arParams' => &$arParams,
        ]
    );

    $json_return['FORM_HTML'] = $form_html;

}

Youez - 2016 - github.com/yon3zu
LinuXploit