Your IP : 18.225.209.237


Current Path : /home/bitrix/ext_www/dev.home-comfort.in.ua/local/php_interface/
Upload File :
Current File : /home/bitrix/ext_www/dev.home-comfort.in.ua/local/php_interface/init.php

<?php

\Bitrix\Main\Loader::includeModule('iblock');
\Bitrix\Main\Loader::includeModule('catalog');
\Bitrix\Main\Loader::includeModule('sale');
\Bitrix\Main\Loader::includeModule('rusklimat.b2b');

function order_interview_email(){
    return true;
}

require_once($_SERVER["DOCUMENT_ROOT"] . '/local/lib/vendor/autoload.php');

include_once(__DIR__.'/BankController.php');
include_once(__DIR__.'/include/constants.php');
include_once(__DIR__.'/include/functions.php');
include_once(__DIR__.'/include/settings.php');
include_once(__DIR__.'/include/events.php');
include_once(__DIR__.'/include/agents.php');
//include_once(__DIR__.'/include/nf_pp.php');
//include_once(__DIR__.'/include/debugger.php');

include_once(__DIR__.'/.rk.config.php');

spl_autoload_register(function($class){
    $path = __DIR__.'/../classes/'.strtr($class, array('\\' => '/')).'.php';
    if(!file_exists($path)){
        return;
    }
	/** @noinspection PhpIncludeInspection */
	require_once($path);
});

function getOnlinePayByGeo($cityId = 0)
{
	$result = [];
	
	if(!empty($cityId))
	{
		$ob = CIBlockElement::GetList(
			Array(),
			Array(
				"IBLOCK_ID" => 78,
				"ACTIVE" => "Y",
				"PROPERTY_KUST_CITY_ID" => $cityId
			),
			false,
			false,
			Array(
				'NAME',
				'PROPERTY_kust_city_id',
				'PROPERTY_login',
				'PROPERTY_password',
				'PROPERTY_bank_url',
				'PROPERTY_money'
			)
		)->GetNextElement();
		
		if(!empty($ob))
		{
			$arFields = $ob->GetFields();
			
			$result['city_name'] = $arFields['NAME'];
			$result['city_id'] = $arFields['PROPERTY_KUST_CITY_ID_VALUE'];
			$result['login'] = $arFields['PROPERTY_LOGIN_VALUE'];
			$result['password'] = $arFields['PROPERTY_PASSWORD_VALUE'];
			$result['url'] = $arFields['PROPERTY_BANK_URL_VALUE'];
			$result['money'] = $arFields['PROPERTY_MONEY_VALUE'];
		}
	}
	
	return $result;
}

function IsBigSize($items)
{
	$is_big_size = false;
	
	if(!empty($items))
	{
		$res = CIBlockElement::GetList(
			Array(),
			[
				"IBLOCK_ID" => COption::GetOptionInt( "rusklimat.exchange", 'RK_EXCHANGE_CATALOG_IBLOCK_ID'),
				"ACTIVE" => "Y",
				"ID" => $items
			],
			false,
			false,
			[
				"ID", "NAME", "PROPERTY_IS_BIG_SIZE"
			]
		);
		
		while($ob = $res->GetNextElement())
		{
			$arFields = $ob->GetFields();
			$is_big_size = $is_big_size || $arFields['PROPERTY_IS_BIG_SIZE_VALUE'];
			
			if($is_big_size)
				break;
		}
	}
	
	return $is_big_size;
}

AddEventHandler("main", "OnPageStart", "redirectToLearnMore");
function redirectToLearnMore()
{
	$explode = explode('/', $_SERVER['REQUEST_URI']);
	$learn_more = $explode[count($explode)-2];

//	echo "<xmp>";
//	print_r([
//		$explode,
//		$learn_more,
//		$learn_more == 'learn_more'
//	]);
//	echo "</xmp>";
//	die();
//	if (empty($learn_more))
//	{
//		$learn_more = $explode[count($explode)-1];
//	}

	if($learn_more == 'learn_more'){
		$url = str_replace('/learn_more','',$_SERVER['REQUEST_URI']);
		header('HTTP/1.1 301 Moved Permanently');
		header('Location: '.$url.'?learn_more=y');
		exit();
	}
}