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/cvetdv.ru/bitrix/modules/wbs24.ozonapinew/options/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/cvetdv.ru/bitrix/modules/wbs24.ozonapinew/options/price_options.php
<?php
use Bitrix\Main\Loader;
use Bitrix\Main\Web\Uri;
use Bitrix\Main\Application;
use Bitrix\Main\Localization\Loc;
use Bitrix\Main\Config\Option;
use Wbs24\Ozonapinew\{
    Agents,
    Settings,
    Wrappers,
    DeliveryServices,
    Formula
};

if (!$USER->IsAdmin()) return;

$moduleId = basename(dirname(__DIR__, 1));
$module_id = $moduleId; // для group_rights
$suffix = strtoupper($moduleId);

Loc::loadMessages(__FILE__);
Loader::includeModule($moduleId);

$request = Application::getInstance()->getContext()->getRequest();
$uriString = $request->getRequestUri();
$uri = new Uri($uriString);
$redirect = $uri->getUri();

$profileId = $_REQUEST['profile_id'];

$settingsObject = new Settings();
$formulaObject = new Formula();
$optionObject = new Wrappers\Option();

// Получение аккаунта
$account = $optionObject->setPrefix($profileId);

// Подключение js и css
$settingsObject->loadJs([$profileId]);
$settingsObject->loadCss();

// Проверка, уставновлен ли Curl
$isCurlInstalled = $settingsObject->isCurlInstalled();
$settingsError = $settingsObject->getLastError();

// Получение нужных данных из обьекта Settings
$siteId = $optionObject->get($moduleId, 'siteId');
$siteIdPoductProperties = $settingsObject->getSimpleProductProperties($siteId);
$siteIdOfferProperties = $settingsObject->getOfferProductProperties($siteId);
$priceMarks = $settingsObject->getPriceTypes($modified = true);
$accounts = $settingsObject->getAccounts();

// Получение цен ОЗОНа
$ozonPriceProductValue = $optionObject->get($moduleId, 'ozonPriceProduct');
$ozonPriceOfferValue = $optionObject->get($moduleId, 'ozonPriceOffer');

$ozonOldPriceProductValue = $optionObject->get($moduleId, 'ozonOldPriceProduct');
$ozonOldPriceOfferValue = $optionObject->get($moduleId, 'ozonOldPriceOffer');

$ozonMinPriceProductValue = $optionObject->get($moduleId, 'ozonMinPriceProduct');
$ozonMinOfferProductValue = $optionObject->get($moduleId, 'ozonMinOfferProduct');

$arAllOptions["main"] = [
    (
        (!$isCurlInstalled)
        ? ['note' => Loc::getMessage($suffix.".CURL_NOTE")]
        : null
    ),
    (
        ($settingsError)
        ? ['note' => Loc::getMessage($suffix.".MODULES_ERROR")]
        : null
    ),
    Loc::getMessage($suffix.".UPDATE_PRICES"),
    [
        $account."priceUpdateFlag",
        Loc::getMessage($suffix.".AUTO_UPDATE_PRICES_FLAG"),
        "",
        ["checkbox", ""]
    ],
    [
        'note' => Loc::getMessage($suffix.".SKU_NOTE")
    ],
    [
        $account."autoUpdatePricesInterval",
        Loc::getMessage($suffix.".RESTART_INTERVAL"),
        "",
        ["text", ""]
    ],
    [
        '',
        \ShowJSHint(
            Loc::getMessage($suffix.".OZON_PRICE_NOTE"),
            ["return" => true]
        ) . Loc::getMessage($suffix.".OZON_PRICE"),
        '',
        ['statichtml']
    ],
    [
        '',
        Loc::getMessage($suffix.".PRODUCTS"),
        $settingsObject->getNameInput(
            $account."ozonPriceProduct",
            [
                'PRODUCTS' => $siteIdPoductProperties,
            ],
            $ozonPriceProductValue,
            $account
        ),
        ['statichtml']
    ],
    [
        '',
        Loc::getMessage($suffix.".OFFERS"),
        $settingsObject->getNameInput(
            $account."ozonPriceOffer",
            [
                'PRODUCTS' => $siteIdPoductProperties,
                'OFFERS' => $siteIdOfferProperties,
            ],
            $ozonPriceOfferValue,
            $account
        ),
        ['statichtml']
    ],
    [
        '',
        \ShowJSHint(
            Loc::getMessage($suffix.".OZON_OLD_PRICE_NOTE"),
            ["return" => true]
        ) . Loc::getMessage($suffix.".OZON_OLD_PRICE"),
        '',
        ['statichtml']
    ],
    [
        '',
        Loc::getMessage($suffix.".PRODUCTS"),
        $settingsObject->getNameInput(
            $account."ozonOldPriceProduct",
            [
                'PRODUCTS' => $siteIdPoductProperties,
            ],
            $ozonOldPriceProductValue,
            $account
        ),
        ['statichtml']
    ],
    [
        '',
        Loc::getMessage($suffix.".OFFERS"),
        $settingsObject->getNameInput(
            $account."ozonOldPriceOffer",
            [
                'PRODUCTS' => $siteIdPoductProperties,
                'OFFERS' => $siteIdOfferProperties,
            ],
            $ozonOldPriceOfferValue,
            $account
        ),
        ['statichtml']
    ],
    [
        '',
        \ShowJSHint(
            Loc::getMessage($suffix.".OZON_MIN_PRICE_NOTE"),
            ["return" => true]
        ) . Loc::getMessage($suffix.".OZON_MIN_PRICE"),
        '',
        ['statichtml']
    ],
    [
        '',
        Loc::getMessage($suffix.".PRODUCTS"),
        $settingsObject->getNameInput(
            $account."ozonMinPriceProduct",
            [
                'PRODUCTS' => $siteIdPoductProperties,
            ],
            $ozonMinPriceProductValue,
            $account
        ),
        ['statichtml']
    ],
    [
        '',
        Loc::getMessage($suffix.".OFFERS"),
        $settingsObject->getNameInput(
            $account."ozonMinOfferProduct",
            [
                'PRODUCTS' => $siteIdPoductProperties,
                'OFFERS' => $siteIdOfferProperties,
            ],
            $ozonMinOfferProductValue,
            $account
        ),
        ['statichtml']
    ],
    [
        'note' => Loc::getMessage($suffix.".PRICING_NOTE")
    ]
];

if (
    !$siteId
    || $siteId == 'nothing'
) {
    $arAllOptions["main"] = [
        [
            'note' => Loc::getMessage($suffix.".WARNING_NOTE")
        ]
    ];
}

if ((isset($_REQUEST["save"]) || isset($_REQUEST["apply"]) || isset($_REQUEST["addAccount"])) && check_bitrix_sessid()) {
    // Установить допустимые метки
    $formulaObject->setMarks(array_merge(
        array_keys($priceMarks),
        array_keys($siteIdPoductProperties),
        array_keys($siteIdOfferProperties),
    ));

    $ozonPriceTypes = [
        'ozonPriceProduct',
        'ozonPriceOffer',
        'ozonOldPriceProduct',
        'ozonOldPriceOffer',
        'ozonMinPriceProduct',
        'ozonMinOfferProduct'
    ];
    foreach ($ozonPriceTypes as $ozonPriceType) {
        $ozonPriceValue = $_REQUEST[$account.$ozonPriceType] ?? '';
        $optionObject->set(
            $moduleId,
            $ozonPriceType,
            $formulaObject->cleanFormula($ozonPriceValue)
        );
    }

    __AdmSettingsSaveOptions($moduleId, $arAllOptions["main"]);

    if ($isCurlInstalled) {
        if ($isCurlInstalled) {
            $agents = new Agents;
            $agents->updateAgents($accounts);

            $agentsPrices = new Agents\Prices();
            $agentsPrices->updateAgents($accounts);

            $agentsStocks = new Agents\Stocks();
            $agentsStocks->updateAgents($accounts);
        }
    }

    if (isset($_REQUEST["addAccount"])) $settingsObject->addAccount();

    LocalRedirect($redirect);
}

$aTabs[] = [
    "DIV" => str_replace(".", "_", $moduleId).'_a' . $profileId,
    "TAB" => Loc::getMessage($suffix.".TAB_NAME"),
    "ICON" => "settings",
    "TITLE" => '',
];

$tabControl = new CAdminTabControl("tabControl", $aTabs);
?>
<form method="post" action="<?=$redirect?>" name="<?=str_replace(".", "_", $moduleId)?>">
    <?
    echo bitrix_sessid_post();
    $tabControl->Begin();
    $tabControl->BeginNextTab();
    __AdmSettingsDrawList($moduleId, $arAllOptions["main"]);
    $tabControl->Buttons([]);
    ?>
    <input type="submit" name="addAccount" class="wbs24_ozonapinew_option_add_account adm-btn-save" value="<?=Loc::getMessage($suffix.".ADD_ACCOUNT");?>">
    <?
    echo Loc::getMessage($suffix.".SERVICE_MSG");
    $tabControl->End();
    ?>
</form>

Youez - 2016 - github.com/yon3zu
LinuXploit