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/modules/sender/lib/entity/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/sender/lib/entity/template.php
<?php
/**
 * Bitrix Framework
 * @package bitrix
 * @subpackage sender
 * @copyright 2001-2012 Bitrix
 */
namespace Bitrix\Sender\Entity;

use Bitrix\Main\Error;
use Bitrix\Main\Localization\Loc;
use Bitrix\Sender\TemplateTable;

Loc::loadMessages(__FILE__);

class Template extends Base
{
	/**
	 * Get default data.
	 *
	 * @return array
	 */
	protected function getDefaultData()
	{
		return array(
			'NAME' => '',
			'CONTENT' => '',
		);
	}

	/**
	 * Load data.
	 *
	 * @param integer $id ID.
	 * @return array|null
	 */
	protected function loadData($id)
	{
		return TemplateTable::getRowById($id);
	}

	/**
	 * Save data.
	 *
	 * @param integer|null $id ID.
	 * @param array $data Data.
	 * @return integer|null
	 */
	protected function saveData($id, array $data)
	{
		$sizeInBytes = mb_strlen($data['CONTENT'] ?? "");
		$sizeInKilobytes = $sizeInBytes / 1024;
		$limitInKilobytes = 2.4 * 1024;

		if ($sizeInKilobytes > $limitInKilobytes)
		{
			$this->addError(new Error(Loc::getMessage('SENDER_INTEGRATION_MAIL_BODY_LIMIT')));

			return null;
		}


		return $this->saveByEntity(TemplateTable::getEntity(), $id, $data);
	}

	/**
	 * Remove.
	 *
	 * @return bool
	 */
	public function remove()
	{
		return $this->removeByEntity(TemplateTable::getEntity(), $this->getId());
	}

	/**
	 * Copy.
	 *
	 *
	 */
	public function copy()
	{
		$data = [
			'ACTIVE' => $this->data['ACTIVE'],
			'NAME' => $this->data['NAME'],
			'CONTENT' => $this->data['CONTENT'],
		];
		$instance = static::create()->mergeData($data);
		return $instance->save();
	}


	/**
	 * Remove by letter ID.
	 *
	 * @param integer $id Letter ID.
	 * @return bool
	 */
	public static function removeById($id)
	{
		return static::create()->removeByEntity(TemplateTable::getEntity(), $id);
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit