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/components/bitrix/bizproc.debugger.start/ |
Upload File : |
<?php if (!defined('B_PROLOG_INCLUDED') || B_PROLOG_INCLUDED !== true) { die(); } class BizprocDebuggerStartComponent extends CBitrixComponent { public function onPrepareComponentParams($arParams) { if (isset($arParams['DOCUMENT_SIGNED']) && \Bitrix\Main\Loader::includeModule('bizproc')) { $arParams['DOCUMENT_SIGNED'] = htmlspecialcharsback($arParams['DOCUMENT_SIGNED']); $arParams['DOCUMENT_UNSIGNED'] = CBPDocument::unSignParameters($arParams['DOCUMENT_SIGNED']); $arParams['PARAMETER_DOCUMENT_TYPE'] = $arParams['DOCUMENT_UNSIGNED'] ? $arParams['DOCUMENT_UNSIGNED'][0] : null; $arParams['DOCUMENT_CATEGORY_ID'] = $arParams['DOCUMENT_UNSIGNED'] ? $arParams['DOCUMENT_UNSIGNED'][1] : null; } $arParams['SET_TITLE'] = (($arParams['SET_TITLE'] ?? 'Y') === 'N' ? 'N' : 'Y'); return $arParams; } private function showError(string $message) { $this->arResult['errorMessage'] = $message; $this->includeComponentTemplate('error'); return null; } public function executeComponent() { if (!$this->getParameterDocumentType()) { return $this->showError( \Bitrix\Main\Localization\Loc::getMessage('BIZPROC_DEBUGGER_START_ERROR_DOCUMENT_TYPE') ); } $this->includeModules(); if (!$this->checkRights()) { return $this->showError( \Bitrix\Main\Localization\Loc::getMessage('BIZPROC_DEBUGGER_START_ERROR_RIGHTS') ); } $this->arResult = [ 'activeSession' => \Bitrix\Bizproc\Debugger\Session\Manager::getActiveSession(), 'documentSigned' => $this->arParams['~DOCUMENT_SIGNED'], 'currentUserId' => (int)(\Bitrix\Main\Engine\CurrentUser::get()->getId()), ]; return $this->includeComponentTemplate(); } private function includeModules(): ?bool { if (!\Bitrix\Main\Loader::includeModule('bizproc')) { return static::showError(\Bitrix\Main\Localization\Loc::getMessage('BIZPROC_MODULE_NOT_INSTALLED')); } $module = $this->getModuleId(); if (!\Bitrix\Main\Loader::includeModule($module)) { $codeMessage = mb_strtoupper($module) . '_MODULE_NOT_INSTALLED'; return static::showError(\Bitrix\Main\Localization\Loc::getMessage($codeMessage)); } return true; } private function checkRights(): bool { return \Bitrix\Bizproc\Debugger\Session\Manager::canUserDebugAutomation( (int)(\Bitrix\Main\Engine\CurrentUser::get()->getId()), $this->getParameterDocumentType() ); } private function getParameterDocumentType() { return $this->arParams['PARAMETER_DOCUMENT_TYPE'] ?? null; } private function getModuleId() { [$moduleId, $entity, $documentId] = CBPHelper::ParseDocumentId($this->getParameterDocumentType()); return $moduleId; } }