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/base_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));
$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'];

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

// Работа с обьектами
$settingsObject = new Settings();
$settingsObject->loadCss();
$allSites = $settingsObject->getSiteId();
$allDays = $settingsObject->getDays();
$accounts = $settingsObject->getAccounts();

// Удаление логов
if (isset($_REQUEST["clear-logs"])) {
    $settingsObject->clearLogs();
}

// Получение логов для скачивания
$htmlLogsForDowload = $settingsObject->getHtmlLogsForDowload();

// Получение настроек связанных с API Ozon
$apiKey = $optionObject->get($moduleId, 'apiKey');
$clientId = $optionObject->get($moduleId, 'clientId');

$arAllOptions["main"] = [
    Loc::getMessage($suffix.".BASIC_SETTINGS"),
    [
        $account."accountName",
        \ShowJSHint(Loc::getMessage($suffix.".ACCOUNT_NAME_HINT"), ["return" => true])
        . Loc::getMessage($suffix.".ACCOUNT_NAME"),
        "",
        ["text", ""]
    ],
    Loc::getMessage($suffix.".MAIN_HEAD"),
    [
        $account."apiKey",
        Loc::getMessage($suffix.".API_KEY"),
        "",
        ["text", ""]
    ],
    [
        $account."clientId",
        Loc::getMessage($suffix.".CLIENT_ID"),
        "",
        ["text", ""]
    ],
    (
        (!$clientId || !$apiKey)
        ? ['note' => Loc::getMessage($suffix.".API_NOTE")]
        : []
    ),
    [
        $account."numberOfDaysToProcessOrders",
        Loc::getMessage($suffix.".NUMBER_OF_DAYS_TO_PROCESS_ORDERS"),
        "30",
        ["selectbox", $allDays]
    ],
    [
        $account."testMode",
        Loc::getMessage($suffix.".TEST_MODE"),
        "",
        ["checkbox", ""]
    ],
    [
        $account."saveApiLog",
        Loc::getMessage($suffix.".SAVE_API_LOG"),
        "",
        ["checkbox", ""]
    ],
    [
        '',
        \ShowJSHint(Loc::getMessage($suffix.".LOG_HINT_1"), ["return" => true])
        . Loc::getMessage($suffix.".LOG_FOR_DOWNLOAD"),
        $htmlLogsForDowload ? $htmlLogsForDowload : Loc::getMessage($suffix.".LOG_FOR_NO_DOWNLOAD"),
        ['statichtml']
    ],
    [
        '',
        '<div class="wbs24-clear-logs-hint">'
        . \ShowJSHint(Loc::getMessage($suffix.".LOG_HINT_2"), ["return" => true])
        . '</div>', '<input type="submit" name="clear-logs" value="'.Loc::getMessage($suffix.".CLEAR_LOG_BUTTON_NAME").'">',
        ['statichtml']
    ],
];

if (count($accounts) > 1) {
    $arAllOptions['main'][] = Loc::getMessage($suffix.".DELETE_HEAD");
    $arAllOptions['main'][] = [
        '',
        Loc::getMessage($suffix.".DELETE_ACCOUNT"),
        '<input type="checkbox" name="'.$account.'deleteAccount" value="Y">',
        ['statichtml']
    ];
}

if ((isset($_REQUEST["save"]) || isset($_REQUEST["apply"]) || isset($_REQUEST["addAccount"])) && check_bitrix_sessid()) {
    __AdmSettingsSaveOptions($moduleId, $arAllOptions["main"]);
    if (isset($_REQUEST["addAccount"])) $settingsObject->addAccount();
    if (isset($_REQUEST[$account."deleteAccount"])) {
        uasort($accounts, function ($a, $b) {
            if ($a == $b) {
                return 0;
            }
            return ($a < $b) ? -1 : 1;
        });
        foreach ($accounts as $key => $needAccount) {
            if ($needAccount == $profileId) {
                if (!empty($accounts[$key-1])) {
                    $redirect =
                    '/bitrix/admin/wbs24_ozonapinew_profile_main.php?profile_id='
                    .$accounts[$key-1]
                    .'&mid=wbs24.ozonapinew&options_type=base';
                } else {
                    $redirect =
                    '/bitrix/admin/wbs24_ozonapinew_profile_main.php?profile_id='
                    .$accounts[$key+1]
                    .'&mid=wbs24.ozonapinew&options_type=base';
                }
            }
        }

        $settingsObject->deleteAccount($profileId);
    }

    LocalRedirect($redirect);
}

$aTabs[] = [
    "DIV" => str_replace(".", "_", $moduleId),
    "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