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/letme.watchman/admin/settings/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/cvetdv.ru/bitrix/modules/letme.watchman/admin/settings/request_handler.php
<?php
global $APPLICATION;

use Letme\Watchman\Settings\Action\ChangeSetting\ChangeSetting;
use Letme\Watchman\Settings\Action\ChangeSetting\ChangeSettingData;
use Tightenco\Collect\Support\Collection;

$request = \Bitrix\Main\Context::getCurrent()->getRequest();

$requestList = [
    '\\' . \Letme\Watchman\Drivers\Sentry\AddSentrySettingsRequest::class,
    '\\' . \Letme\Watchman\Drivers\Telegram\AddTelegramSettingsRequest::class,
    '\\' . \Letme\Watchman\Drivers\Mail\AddMailSettingsRequest::class,
];

if ($driverCode = $request->get('CODE')) {
    try {
        $driver = \Letme\Watchman\Drivers\Manager::getByCode($driverCode);
        // @codingStandardsIgnoreLine
    } catch (\Letme\Watchman\Drivers\DriverNotFound $e) {
    }
}

if ($request->isPost()
    && $request->getPost('Update') === 'Y'
    && in_array($requestClass = $request->getPost('REQUEST'), $requestList)
    && check_bitrix_sessid()
    && isset($driver)
) {
    try {
        $currentAction = '';
        if ($request->getPost('apply') !== null) {
            $currentAction = 'apply';
        } elseif ($request->getPost('save') !== null) {
            $currentAction = 'save';
        }
        $saveAction  = $currentAction === 'save';
        $applyAction = $currentAction === 'apply';

        if ($saveAction || $applyAction) {
            $context = Collection
                ::make($request->toArray())
                ->only($requestClass::getFields())
                ->toArray();

            $data = $requestClass::validate($context);

            foreach ($data as $key => $value) {
                (new ChangeSetting())->execute(new ChangeSettingData($driver, $key, $value));
            }

            LocalRedirect($request->getServer()->getRequestUri());
        }
    } catch (\Letme\Watchman\Common\Request\RequestException $e) {
        $errorMessage = Collection
            ::make(json_decode($e->getMessage(), true))
            ->reduce(
                function ($c, $item, $code) use ($formFields) {
                    $errorString = implode(', ', $item);
                    $c .= '"' . $formFields[$code]['name'] . '" ' . $errorString . '.' . PHP_EOL;
                    return $c;
                },
                ''
            );
    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit