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/mail/lib/controller/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/mail/lib/controller/base.php
<?php

namespace Bitrix\Mail\Controller;

use Bitrix\Mail\Internals\Entity\UserSignature;
use Bitrix\Mail\Internals\UserSignatureTable;
use Bitrix\Main\Engine\Binder;
use Bitrix\Main\Engine\Controller;
use Bitrix\Main\Text\StringHelper;

abstract class Base extends Controller
{
	protected function init()
	{
		parent::init();

		Binder::registerParameterDependsOnName(
			UserSignature::class,
			function($className, $id)
			{
				return UserSignatureTable::getById($id)->fetchObject();
			}
		);
	}

	protected function sanitize($text)
	{
		$text = preg_replace('/<!--.*?-->/is', '', $text);
		$text = preg_replace('/<script[^>]*>.*?<\/script>/is', '', $text);
		$text = preg_replace('/<title[^>]*>.*?<\/title>/is', '', $text);

		$sanitizer = new \CBXSanitizer();
		$sanitizer->setLevel(\CBXSanitizer::SECURE_LEVEL_LOW);
		$sanitizer->applyDoubleEncode(false);
		$sanitizer->addTags(array('style' => array()));

		return $sanitizer->sanitizeHtml($text);
	}

	/**
	 * @param array $array
	 * @param int $levels
	 * @param int $currentLevel
	 * @return array
	 */
	protected function convertArrayKeysToCamel(array $array, $levels = 0, $currentLevel = 0)
	{
		$result = [];
		foreach($array as $key => $value)
		{
			if($levels > 0 && is_array($value) && $currentLevel < $levels)
			{
				$currentLevel++;
				$value = $this->convertArrayKeysToCamel($value, $levels, $currentLevel);
				$currentLevel--;
			}
			$result[$this->toCamelCase($key)] = $value;
		}

		return $result;
	}

	/**
	 * @param array $array
	 * @param int $levels
	 * @param int $currentLevel
	 * @return array
	 */
	protected function convertArrayKeysToUpper(array $array, $levels = 0, $currentLevel = 0)
	{
		$result = [];
		foreach($array as $key => $value)
		{
			if($levels > 0 && is_array($value) && $currentLevel < $levels)
			{
				$currentLevel++;
				$value = $this->convertArrayKeysToUpper($value, $levels, $currentLevel);
				$currentLevel--;
			}
			$result[$this->toUpperCase($key)] = $value;
		}

		return $result;
	}

	/**
	 * @param string $string
	 * @return string
	 */
	protected function toCamelCase($string)
	{
		if(is_numeric($string))
		{
			return $string;
		}

		return lcfirst(StringHelper::snake2camel($string));
	}

	/**
	 * @param string $string
	 * @return string
	 */
	protected function toUpperCase($string)
	{
		if(is_numeric($string))
		{
			return $string;
		}

		return mb_strtoupper(StringHelper::camel2snake($string));
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit