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/activities/bitrix/codeactivity/ |
Upload File : |
<?php if (!defined('B_PROLOG_INCLUDED') || B_PROLOG_INCLUDED !== true) { die(); } use Bitrix\Main\Localization\Loc; class CBPCodeActivity extends CBPActivity { public function __construct($name) { parent::__construct($name); $this->arProperties = [ 'Title' => '', 'ExecuteCode' => '' ]; } public function execute() { if ($this->ExecuteCode <> '') { @eval($this->ExecuteCode); } return CBPActivityExecutionStatus::Closed; } public static function validateProperties($arTestProperties = [], CBPWorkflowTemplateUser $user = null) { $arErrors = []; if ($user == null || !$user->isAdmin()) { $arErrors[] = [ 'code' => 'perm', 'message' => Loc::getMessage('BPCA_NO_PERMS'), ]; } if (empty($arTestProperties['ExecuteCode'])) { $arErrors[] = [ 'code' => 'emptyCode', 'message' => Loc::getMessage('BPCA_EMPTY_CODE'), ]; } return array_merge($arErrors, parent::validateProperties($arTestProperties, $user)); } public static function GetPropertiesDialog( $documentType, $activityName, $arWorkflowTemplate, $arWorkflowParameters, $arWorkflowVariables, $arCurrentValues = null, $formName = '' ) { $runtime = CBPRuntime::getRuntime(); if (!is_array($arWorkflowParameters)) { $arWorkflowParameters = []; } if (!is_array($arWorkflowVariables)) { $arWorkflowVariables = []; } if (!is_array($arCurrentValues)) { $arCurrentValues = ['execute_code' => '']; $arCurrentActivity = &CBPWorkflowTemplateLoader::FindActivityByName($arWorkflowTemplate, $activityName); if (is_array($arCurrentActivity['Properties'])) { $arCurrentValues['execute_code'] = $arCurrentActivity['Properties']['ExecuteCode'] ?? ''; } } return $runtime->executeResourceFile( __FILE__, 'properties_dialog.php', [ 'arCurrentValues' => $arCurrentValues, 'formName' => $formName, ] ); } public static function GetPropertiesDialogValues( $documentType, $activityName, &$arWorkflowTemplate, &$arWorkflowParameters, &$arWorkflowVariables, $arCurrentValues, &$arErrors ) { $arErrors = []; $runtime = CBPRuntime::getRuntime(); $arProperties = ['ExecuteCode' => $arCurrentValues['execute_code']]; $arErrors = self::validateProperties( $arProperties, new CBPWorkflowTemplateUser(CBPWorkflowTemplateUser::CurrentUser) ); if (count($arErrors) > 0) { return false; } $arCurrentActivity = &CBPWorkflowTemplateLoader::FindActivityByName($arWorkflowTemplate, $activityName); $arCurrentActivity['Properties'] = $arProperties; return true; } }