22if (
$USER->IsAuthorized())
27if (!function_exists(
"yandex_replace_special"))
31 if (in_array($arg[0],
array(
""",
"&",
"<",
">")))
38if (!function_exists(
"yandex_text2xml"))
42 $bHSC = (
true == $bHSC ? true :
false);
43 $bDblQuote = (
true == $bDblQuote ?
true:
false);
51 $text = preg_replace(
'/[\x01-\x08\x0B-\x0C\x0E-\x1F]/',
"",
$text);
58$usedProtocol = (Main\Context::getCurrent()->getRequest()->isHttps() ?
'https://' :
'http://');
61$strAll .=
'if (!isset($_GET["referer1"]) || $_GET["referer1"] == "") $_GET["referer1"] = "yandext";' .
"\n";
62$strAll .=
'$strReferer1 = htmlspecialchars($_GET["referer1"]);' .
"\n";
63$strAll .=
'if (!isset($_GET["referer2"]) || $_GET["referer2"] == "") $_GET["referer2"] = "";' .
"\n";
64$strAll .=
'$strReferer2 = htmlspecialchars($_GET["referer2"]);' .
"\n";
65$strAll .=
'header("Content-Type: text/xml; charset=windows-1251");' .
"\n";
67$strAll .=
'<?xml version="1.0" encoding="windows-1251"?>' .
"\n";
68$strAll .=
"<!DOCTYPE yml_catalog SYSTEM \"shops.dtd\">\n";
69$strAll .=
"<yml_catalog date=\"".date(
"Y-m-d H:i").
"\">\n";
73$strAll .=
"<url>".$usedProtocol.htmlspecialcharsbx(COption::GetOptionString(
"main",
"server_name",
"")).
"</url>\n";
74$strAll .=
"<platform>1C-Bitrix</platform>\n";
80$currencyIterator = Currency\CurrencyTable::getList(
array(
81 'select' =>
array(
'CURRENCY'),
82 'filter' =>
array(
'=CURRENCY' =>
'RUR')
84if (
$currency = $currencyIterator->fetch())
87$arCurrencyAllowed =
array(
'RUR',
'RUB',
'USD',
'EUR',
'UAH',
'BYR',
'BYN',
'KZT');
88$strTmp =
"<currencies>\n";
89$currencyIterator = Currency\CurrencyTable::getList(
array(
90 'select' =>
array(
'CURRENCY',
'SORT'),
91 'filter' =>
array(
'@CURRENCY' => $arCurrencyAllowed),
92 'order' =>
array(
'SORT' =>
'ASC')
94while (
$currency = $currencyIterator->fetch())
97$strTmp.=
"</currencies>\n";
105 "ID",
"LID",
"IBLOCK_ID",
"IBLOCK_SECTION_ID",
"ACTIVE",
"NAME",
106 "PREVIEW_PICTURE",
"PREVIEW_TEXT",
"PREVIEW_TEXT_TYPE",
107 "DETAIL_PICTURE",
"LANG_DIR",
"DETAIL_PAGE_URL",
114$arSiteServers =
array();
117while ($arCatalog_list = $db_catalog_list->Fetch())
119 $arCatalog_list[
'IBLOCK_ID'] = intval($arCatalog_list[
'IBLOCK_ID']);
120 $arIBlock = CIBlock::GetArrayByID($arCatalog_list[
'IBLOCK_ID']);
128 $arRights = CIBlock::GetGroupPermissions($arCatalog_list[
'IBLOCK_ID']);
129 if (!empty($arRights) && isset($arRights[2]) &&
'R' <= $arRights[2])
134 $obRights =
new CIBlockRights($arCatalog_list[
'IBLOCK_ID']);
135 $arRights = $obRights->GetGroups(
array(
'section_read',
'element_read'));
136 if (!empty($arRights) && in_array(
'G2',$arRights))
142 $filter =
array(
"IBLOCK_ID"=>$arCatalog_list[
"IBLOCK_ID"],
"ACTIVE"=>
"Y",
"GLOBAL_ACTIVE"=>
"Y");
145 $arAvailGroups =
array();
146 while ($arAcc = $db_acc->Fetch())
148 $strTmpCat.=
"<category id=\"".$arAcc[
"ID"].
"\"".(intval($arAcc[
"IBLOCK_SECTION_ID"])>0?
" parentId=\"".$arAcc[
"IBLOCK_SECTION_ID"].
"\"":
"").
">".
yandex_text2xml($arAcc[
"NAME"], true).
"</category>\n";
149 $arAvailGroups[] = intval($arAcc[
"ID"]);
154 $filter =
array(
"IBLOCK_ID"=>$arCatalog_list[
"IBLOCK_ID"],
"ACTIVE"=>
"Y",
"ACTIVE_DATE"=>
"Y");
161 while ($arAcc = $db_acc->GetNext())
164 if (!array_key_exists($arAcc[
'LID'], $arSiteServers))
167 if($arSite = $rsSite->Fetch())
168 $arAcc[
"SERVER_NAME"] = $arSite[
"SERVER_NAME"];
169 if($arAcc[
"SERVER_NAME"] ==
'' && defined(
"SITE_SERVER_NAME"))
170 $arAcc[
"SERVER_NAME"] = SITE_SERVER_NAME;
171 if($arAcc[
"SERVER_NAME"] ==
'')
174 $arSiteServers[$arAcc[
'LID']] = $arAcc[
'SERVER_NAME'];
178 $arAcc[
'SERVER_NAME'] = $arSiteServers[$arAcc[
'LID']];
180 $str_AVAILABLE =
' available="'.($arAcc[
'CATALOG_AVAILABLE'] ==
'Y' ?
'true' :
'false').
'"';
185 $minPriceCurrency =
"";
197 $minPrice = $arPrice[
'DISCOUNT_PRICE'];
205 $minPriceRUR = $minPrice;
207 $minPriceGroup = $arPrice[
'PRICE'][
'CATALOG_GROUP_ID'];
210 if ($minPrice <= 0)
continue;
212 $bNoActiveGroup = True;
215 while ($ar_res1 = $db_res1->Fetch())
217 if (0 < intval($ar_res1[
'ADDITIONAL_PROPERTY_ID']))
219 $strTmpOff_tmp.=
"<categoryId>".$ar_res1[
"ID"].
"</categoryId>\n";
220 if ($bNoActiveGroup && in_array(intval($ar_res1[
"ID"]), $arAvailGroups))
222 $bNoActiveGroup = False;
225 if ($bNoActiveGroup)
continue;
227 if (
'' == $arAcc[
'DETAIL_PAGE_URL'])
229 $arAcc[
'DETAIL_PAGE_URL'] =
'/';
233 $arAcc[
'DETAIL_PAGE_URL'] = str_replace(
' ',
'%20', $arAcc[
'DETAIL_PAGE_URL']);
235 if (
'' == $arAcc[
'~DETAIL_PAGE_URL'])
237 $arAcc[
'~DETAIL_PAGE_URL'] =
'/';
241 $arAcc[
'~DETAIL_PAGE_URL'] = str_replace(
' ',
'%20', $arAcc[
'~DETAIL_PAGE_URL']);
244 $strTmpOff.=
"<offer id=\"".$arAcc[
"ID"].
"\"".$str_AVAILABLE.
">\n";
245 $strTmpOff.=
"<url>".$usedProtocol.$arAcc[
'SERVER_NAME'].htmlspecialcharsbx($arAcc[
"~DETAIL_PAGE_URL"]).(mb_strstr($arAcc[
'DETAIL_PAGE_URL'],
'?') ===
false ?
'?' :
'&').
"r1=<?echo \$strReferer1; ?>&r2=<?echo \$strReferer2; ?></url>\n";
247 $strTmpOff.=
"<price>".$minPrice.
"</price>\n";
248 $strTmpOff.=
"<currencyId>".$minPriceCurrency.
"</currencyId>\n";
250 $strTmpOff.= $strTmpOff_tmp;
252 if (intval($arAcc[
"DETAIL_PICTURE"])>0 || intval($arAcc[
"PREVIEW_PICTURE"])>0)
254 $pictNo = intval($arAcc[
"DETAIL_PICTURE"]);
255 if ($pictNo<=0) $pictNo = intval($arAcc[
"PREVIEW_PICTURE"]);
258 if (is_array($arPictInfo))
260 if(mb_substr($arPictInfo[
"SRC"], 0, 1) ==
"/")
264 $strTmpOff.=
"<picture>".$strFile.
"</picture>\n";
268 $strTmpOff.=
"<name>".yandex_text2xml($arAcc[
"~NAME"],
true).
"</name>\n";
272 ($arAcc[
"PREVIEW_TEXT_TYPE"]==
"html"?
273 strip_tags(preg_replace_callback(
"'&[^;]*;'",
"yandex_replace_special", $arAcc[
"~PREVIEW_TEXT"])) : preg_replace_callback(
"'&[^;]*;'",
"yandex_replace_special", $arAcc[
"~PREVIEW_TEXT"])),
276 $strTmpOff.=
"</offer>\n";
302$strYandexPath =
Rel2Abs(
'/',str_replace(
'//',
'/',$strExportPath.
"/yandex.php"));
303if (!empty($strYandexPath))
307 if ($fp = @fopen(
$_SERVER[
"DOCUMENT_ROOT"].$strYandexPath,
'wb'))
317 CEventLog::Log(
'WARNING',
'CAT_YAND_AGENT',
'catalog',
'YandexAgent',$strYandexPath);
324 if (isset($USER_TMP))
const CATALOG_DEFAULT_EXPORT_PATH
if($USER->IsAuthorized()) if(!function_exists("yandex_replace_special")) if(!function_exists("yandex_text2xml")) $usedProtocol
static ClearCouponsByManage($intUserID)
static ClearDiscountCache($arTypes)
static GetOptimalPrice($intProductID, $quantity=1, $arUserGroups=array(), $renewal="N", $priceList=array(), $siteID=false, $arDiscountCoupons=false)
static ConvertCurrency($valSum, $curFrom, $curTo, $valDate="")
static GetElementGroups($ID, $bElementOnly=false, $arSelect=array())
static GetOptionString($module_id, $name, $def="", $site=false, $bExactSite=false)
static GetList($by="sort", $order="asc", $arFilter=[])
static GetList($arOrder=array(), $arFilter=array(), $arGroupBy=false, $arNavStartParams=false, $arSelectFields=array())
static Log($SEVERITY, $AUDIT_TYPE_ID, $MODULE_ID, $ITEM_ID, $DESCRIPTION=false, $SITE_ID=false)
static GetFileArray($fileId, $uploadDir=false)
static GetList($arOrder=array("SORT"=>"ASC"), $arFilter=array(), $arGroupBy=false, $arNavStartParams=false, $arSelectFields=array())
static GetList($arOrder=array("SORT"=>"ASC"), $arFilter=array(), $bIncCnt=false, $arSelect=array(), $arNavStartParams=false)
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
$_SERVER["DOCUMENT_ROOT"]
if(! $ar_profile) $strFile
htmlspecialcharsbx($string, $flags=ENT_COMPAT, $doubleEncode=true)
Rel2Abs($curdir, $relpath)
TruncateText($strText, $intLen)
yandex_text2xml($text, $bHSC=false, $bDblQuote=false)
if( $USER->IsAuthorized()) yandex_replace_special($arg)