403Webshell
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/sender.template.selector/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/rospirotorg.ru/bitrix/components/bitrix/sender.template.selector/ajax.php
<?php
define('STOP_STATISTICS', true);
define('BX_SECURITY_SHOW_MESSAGE', true);

require_once($_SERVER['DOCUMENT_ROOT'].'/bitrix/modules/main/include/prolog_before.php');

use Bitrix\Sender\Internals\CommonAjax;
use Bitrix\Sender\Internals\QueryController as Controller;
use Bitrix\Main\HttpRequest;

if (!Bitrix\Main\Loader::includeModule('sender'))
{
	return;
}

$actions = array();
$actions[] = CommonAjax\ActionGetTemplate::get();
$actions[] =  Controller\Action::create('load')->setHandler(
	function(HttpRequest $request, Controller\Response $response) {
		$lastId = (int) $request->getRaw('lastId');

		$templateType = $request->getRaw('templateType');
		$content = $response->initContentJson();

		if ($templateType !== 'USER')
		{
			return;
		}

		$filter = [
			'ACTIVE' => 'Y',
			'<ID' => $lastId,
		];

		$templateDb = \Bitrix\Sender\TemplateTable::getList([
			'filter' => $filter,
			'order' => ['ID' => 'DESC'],
			'limit' => \Bitrix\Sender\TemplateTable::PER_PAGE_LIMIT,
		]);

		$count = \Bitrix\Sender\TemplateTable::getCount($filter);

		$resultList = [];

		$counter = 0;
		while ($template = $templateDb->fetch())
		{
			$resultList[] = [
				'id' => 'USER|'.$template['ID'].'|'.++$counter,
				'name' => $template['NAME'] ?? '',
				'description' => $template['DESC'] ?? '',
				'image' => $template['ICON'] ?? '',
				'hot' => $template['HOT'] ?? '',
				'hint' => $template['HINT'] ?? '',
				'rowId' => $template['CATEGORY'] ?? '',
				'count' => $count,
				'data' => [
					'templateId' => $template['ID'],
					'templateType' => $template['TYPE'] ?? 'USER',
					'messageFields' => [
						[
							'code' => 'MESSAGE',
							'value' => \Bitrix\Sender\Security\Sanitizer::fixTemplateStyles(
								$template['CONTENT'] ?? ''
							),
							'onDemand' => \Bitrix\Sender\TemplateTable::isContentForBlockEditor(
								$template['CONTENT'] ?? ''
							),
						],
						[
							'code' => 'SUBJECT',
							'value' => $template['NAME'] ?? '',
						],
					],
					'segments' => $template['SEGMENTS'] ?? '',
					'dispatch' => $template['DISPATCH'] ?? '',
				],
			];
		}

		$content->set([
			'data' => ['items' => $resultList,],
			'error' => false,
			'status' => 'success',
		]);
	}
);

$checker = CommonAjax\Checker::getViewLetterPermissionChecker();

Controller\Listener::create()->addChecker($checker)->setActions($actions)->run();

Youez - 2016 - github.com/yon3zu
LinuXploit