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/yandex.market/lib/ui/trading/ |
Upload File : |
<?php namespace Yandex\Market\Ui\Trading; use Yandex\Market; use Bitrix\Main; class FileDownload extends Market\Ui\Reference\Page { use Market\Reference\Concerns\HasLang; protected static function includeMessages() { Main\Localization\Loc::loadMessages(__FILE__); } protected function getReadRights() { return Market\Ui\Access::RIGHTS_PROCESS_TRADING; } public function show() { $url = $this->getUrl(); $setup = $this->getSetup(); $options = $setup->wakeupService()->getOptions(); list($contentType, $contents) = Market\Api\Partner\File\Facade::download($options, $url); $this->submitFile($contentType, $contents); } protected function getUrl() { $url = (string)$this->request->get('url'); if ($url === '') { $message = static::getLang('UI_TRADING_FILE_DOWNLOAD_URL_NOT_DEFINED'); throw new Main\SystemException($message); } return $url; } protected function getSetup() { $setupId = $this->getSetupId(); $setup = Market\Trading\Setup\Model::loadById($setupId); if (!$setup->isActive()) { $message = static::getLang('UI_TRADING_FILE_DOWNLOAD_SETUP_INACTIVE'); throw new Main\SystemException($message); } return $setup; } protected function getSetupId() { $setupId = (int)$this->request->get('setup'); if ($setupId <= 0) { $message = static::getLang('UI_TRADING_FILE_DOWNLOAD_SETUP_ID_NOT_DEFINED'); throw new Main\SystemException($message); } return $setupId; } protected function submitFile($type, $contents) { global $APPLICATION; $APPLICATION->RestartBuffer(); while (ob_get_level()) { ob_end_clean(); } header('Content-type: ' . $type); echo $contents; die(); } }