Your IP : 3.143.227.125


Current Path : /home/bitrix/ext_www/royal-thermo.com.ua/local/import/
Upload File :
Current File : /home/bitrix/ext_www/royal-thermo.com.ua/local/import/import.php

<?
$_SERVER["DOCUMENT_ROOT"] = realpath(dirname(__FILE__)."/../..");
$DOCUMENT_ROOT = $_SERVER["DOCUMENT_ROOT"];

define("NO_KEEP_STATISTIC", true);
define("NOT_CHECK_PERMISSIONS",true);
define("BX_CRONTAB", true);
define('BX_NO_ACCELERATOR_RESET', true);
define('SITE_ID', 's1');

require($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/prolog_before.php");
CModule::IncludeModule("iblock");

GlOBAL $DB, $USER;
//$USER->Authorize(1); // commented cause security backdoor
$el = new CIBlockElement;  

require_once('XmlParser.php');
$file = dirname(__FILE__).'/source/news.xml';
$log_file = dirname(__FILE__).'/logs/news.log';
try 
{
	$log = fopen($log_file, "w");		
	$XmlParser = new XmlParser($el, $USER, $log);		
	$XmlParser->message_to_log('Parsing');
	$XmlParser->beginParsing();
	$xml_parser = xml_parser_create("UTF-8");
	xml_set_object($xml_parser, $XmlParser);
	xml_parser_set_option($xml_parser, XML_OPTION_TARGET_ENCODING, "UTF-8");
	//xml_parser_set_option($xml_parser, XML_OPTION_SKIP_WHITE, 1);
	xml_parser_set_option($xml_parser, XML_OPTION_CASE_FOLDING, 0);
	xml_set_element_handler($xml_parser, "tagOpen", "tagClosed");
	xml_set_default_handler($xml_parser, "tagData");
	$in = fopen($file, "r");
	while (!feof($in))
	{		
		xml_parse($xml_parser, fgets($in, 4096 * 10));
	}
	fclose($in);
	if (xml_get_error_code($xml_parser))
	{
		$XmlParser->message_to_log('Error ' . 
			xml_error_string(xml_get_error_code($xml_parser)) . 
			' line ' . xml_get_current_line_number($xml_parser));
	}
	xml_parser_free($xml_parser);
	$XmlParser->endParsing();
	$XmlParser->message_to_log('Parsing is ready');
} 
catch (Exception $e) 
{
	$XmlParser->message_to_log('Error: ' . $e->getMessage());
}
fclose($log);
/*



if(isset($_REQUEST['fb_tes']) && $_REQUEST['fb_tes'] == 39) {
	if (isset($_REQUEST['name']) && strlen($_REQUEST['name']) 
		&& isset($_REQUEST['email']) && strlen($_REQUEST['email']) 
		&& isset($_REQUEST['fb_name']) && strlen($_REQUEST['fb_name']) 
		&& isset($_REQUEST['phone']) && strlen($_REQUEST['phone']) 
		&& isset($_REQUEST['company']) && strlen($_REQUEST['company'])) 
	{
		$el = new CIBlockElement;  
		$PROP['NAME'] = $_REQUEST['name'];
		$PROP['EMAIL'] = $_REQUEST['email'];
		$PROP['PHONE'] = $_REQUEST['phone'];
		$PROP['COMPANY'] = $_REQUEST['company'];
		$fields = array(
				'IBLOCK_ID' => 25,	
				'NAME' => $_REQUEST['fb_name'],
				'ACTIVE' => 'Y',
				'PROPERTY_VALUES' => $PROP,
		  );
			
		$ID = $el->Add($fields);  
		?>
<!DOCTYPE html>
<html>
<head>
</head>

<body>
    <!--video modal-->
    <div class="modal" tabindex="-1">
        <div class="modal-row">
            <div class="modal-cell wide">
                <div class="modal-close-wide"></div>
                <div class="confirm-modal-frame">

                    <p>Запрос о регистрации <br/>успешно отправлен</p>

                    <div class="modal-close-small">
                        <svg class="icon icon-close">
                            <use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#icon-close"></use>
                        </svg>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!-- end of video modal-->
</body>
</html>
<?		
	} 
}

require($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/epilog_after.php");
?>*/