Example #1
0
 function GetRSSText($arIBLOCK, $LIMIT_NUM = false, $LIMIT_DAY = false, $yandex = false)
 {
     global $DB;
     $strRes = "";
     $serverName = "";
     if (isset($arIBLOCK["SERVER_NAME"]) && strlen($arIBLOCK["SERVER_NAME"]) > 0) {
         $serverName = $arIBLOCK["SERVER_NAME"];
     }
     if (strlen($serverName) <= 0 && !isset($arIBLOCK["SERVER_NAME"])) {
         $dbSite = CSite::GetList($b = "sort", $o = "asc", array("LID" => $arIBLOCK["LID"]));
         if ($arSite = $dbSite->Fetch()) {
             $serverName = $arSite["SERVER_NAME"];
         }
     }
     if (strlen($serverName) <= 0) {
         if (defined("SITE_SERVER_NAME") && strlen(SITE_SERVER_NAME) > 0) {
             $serverName = SITE_SERVER_NAME;
         } else {
             $serverName = COption::GetOptionString("main", "server_name", "www.bitrixsoft.com");
         }
     }
     $strRes .= "<channel>\n";
     $strRes .= "<title>" . htmlspecialcharsbx($arIBLOCK["NAME"]) . "</title>\n";
     $strRes .= "<link>http://" . $serverName . "</link>\n";
     $strRes .= "<description>" . htmlspecialcharsbx($arIBLOCK["DESCRIPTION"]) . "</description>\n";
     $strRes .= "<lastBuildDate>" . date("r") . "</lastBuildDate>\n";
     $strRes .= "<ttl>" . $arIBLOCK["RSS_TTL"] . "</ttl>\n";
     $db_img_arr = CFile::GetFileArray($arIBLOCK["PICTURE"]);
     if ($db_img_arr) {
         if (substr($db_img_arr["SRC"], 0, 1) == "/") {
             $strImage = "http://" . $serverName . $db_img_arr["SRC"];
         } else {
             $strImage = $db_img_arr["SRC"];
         }
         $strRes .= "<image>\n";
         $strRes .= "<title>" . htmlspecialcharsbx($arIBLOCK["NAME"]) . "</title>\n";
         $strRes .= "<url>" . $strImage . "</url>\n";
         $strRes .= "<link>http://" . $serverName . "</link>\n";
         $strRes .= "<width>" . $db_img_arr["WIDTH"] . "</width>\n";
         $strRes .= "<height>" . $db_img_arr["HEIGHT"] . "</height>\n";
         $strRes .= "</image>\n";
     }
     $arNodes = array();
     $db_res = $DB->Query("SELECT NODE, NODE_VALUE FROM b_iblock_rss WHERE IBLOCK_ID = " . IntVal($arIBLOCK["ID"]));
     while ($db_res_arr = $db_res->Fetch()) {
         $arNodes[$db_res_arr["NODE"]] = $db_res_arr["NODE_VALUE"];
     }
     CTimeZone::Disable();
     $strSql = "SELECT DISTINCT BE.*, " . "\t" . $DB->DateToCharFunction("BE.TIMESTAMP_X") . " as TIMESTAMP_X, " . "\t" . $DB->DateToCharFunction("BE.ACTIVE_FROM", "FULL") . " as ACTIVE_FROM, " . "\t" . $DB->DateToCharFunction("BE.ACTIVE_TO", "FULL") . " as ACTIVE_TO, " . "\tL.DIR as LANG_DIR, B.DETAIL_PAGE_URL, B.LIST_PAGE_URL, B.LID, L.SERVER_NAME " . "FROM b_iblock_element BE, b_lang L, b_iblock B " . "\tLEFT JOIN b_iblock_group IBG ON IBG.IBLOCK_ID=B.ID " . "WHERE BE.IBLOCK_ID = B.ID " . "\tAND B.LID = L.LID " . "\tAND IBG.GROUP_ID IN (2) " . "\tAND BE.WF_STATUS_ID = 1 AND BE.WF_PARENT_ELEMENT_ID is null " . "\tAND IBG.PERMISSION>='R' " . "\tAND (IBG.PERMISSION='X' OR B.ACTIVE='Y') " . "\tAND (BE.IBLOCK_ID = " . IntVal($arIBLOCK["ID"]) . ") " . "\tAND ((BE.ACTIVE_TO >= " . $DB->GetNowFunction() . " OR BE.ACTIVE_TO IS NULL) AND (BE.ACTIVE_FROM <= " . $DB->GetNowFunction() . " OR BE.ACTIVE_FROM IS NULL)) " . "\tAND (BE.ACTIVE = 'Y') ";
     if ($LIMIT_DAY !== false) {
         $strSql .= " AND (BE.ACTIVE_FROM>=" . $DB->CharToDateFunction($DB->ForSql(date($DB->DateFormatToPHP(CLang::GetDateFormat("FULL")), mktime(date("H"), date("i"), date("s"), date("m"), date("d") - IntVal($LIMIT_DAY), date("Y")))), "FULL") . " OR BE.ACTIVE_FROM IS NULL) ";
     }
     $strSql .= "ORDER BY BE.ACTIVE_FROM DESC, BE.SORT ASC ";
     $res = $DB->Query($strSql);
     CTimeZone::Enable();
     $items = new CIBlockResult($res->result);
     if ($LIMIT_NUM !== False && IntVal($LIMIT_NUM) > 0) {
         $items->NavStart($LIMIT_NUM);
     }
     while ($arItem = $items->GetNext()) {
         $props = CIBlockElement::GetProperty($arIBLOCK["ID"], $arItem["ID"], "sort", "asc", array("ACTIVE" => "Y", "NON_EMPTY" => "Y"));
         $arProps = array();
         while ($arProp = $props->Fetch()) {
             if (strlen($arProp["CODE"]) > 0) {
                 $arProps[$arProp["CODE"]] = array("NAME" => htmlspecialcharsbx($arProp["NAME"]), "VALUE" => htmlspecialcharsex($arProp["VALUE"]));
             } else {
                 $arProps[$arProp["ID"]] = array("NAME" => htmlspecialcharsbx($arProp["NAME"]), "VALUE" => htmlspecialcharsex($arProp["VALUE"]));
             }
         }
         $arLinkProp = $arProps["DOC_LINK"];
         $strRes .= "<item>\n";
         if (strlen($arNodes["title"]) > 0) {
             $strRes .= "<title>" . htmlspecialcharsbx(CIBlockRSS::ExtractProperties($arNodes["title"], $arProps, $arItem)) . "</title>\n";
         } else {
             $strRes .= "<title>" . htmlspecialcharsbx($arItem["~NAME"]) . "</title>\n";
         }
         if (strlen($arNodes["link"]) > 0) {
             $strRes .= "<link>" . CIBlockRSS::ExtractProperties($arNodes["link"], $arProps, $arItem) . "</link>\n";
         } else {
             $strRes .= "<link>http://" . $serverName . ($arLinkProp["VALUE"] ? $arLinkProp["VALUE"] : $arItem["DETAIL_PAGE_URL"]) . "</link>\n";
         }
         if (strlen($arNodes["description"]) > 0) {
             $strRes .= "<description>" . htmlspecialcharsbx(CIBlockRSS::ExtractProperties($arNodes["description"], $arProps, $arItem)) . "</description>\n";
         } else {
             $strRes .= "<description>" . ($arItem["PREVIEW_TEXT"] || $yandex ? htmlspecialcharsbx($arItem["PREVIEW_TEXT"]) : htmlspecialcharsbx($arItem["DETAIL_TEXT"])) . "</description>\n";
         }
         if (strlen($arNodes["enclosure"]) > 0) {
             $strRes .= "<enclosure url=\"" . htmlspecialcharsbx(CIBlockRSS::ExtractProperties($arNodes["enclosure"], $arProps, $arItem)) . "\" length=\"" . htmlspecialcharsbx(CIBlockRSS::ExtractProperties($arNodes["enclosure_length"], $arProps, $arItem)) . "\" type=\"" . htmlspecialcharsbx(CIBlockRSS::ExtractProperties($arNodes["enclosure_type"], $arProps, $arItem)) . "\"/>\n";
         } else {
             $db_img_arr = CFile::GetFileArray($arItem["PREVIEW_PICTURE"]);
             if ($db_img_arr) {
                 if (substr($db_img_arr["SRC"], 0, 1) == "/") {
                     $strImage = "http://" . $serverName . $db_img_arr["SRC"];
                 } else {
                     $strImage = $db_img_arr["SRC"];
                 }
                 $strRes .= "<enclosure url=\"" . $strImage . "\" length=\"" . $db_img_arr["FILE_SIZE"] . "\" type=\"" . $db_img_arr["CONTENT_TYPE"] . "\" width=\"" . $db_img_arr["WIDTH"] . "\" height=\"" . $db_img_arr["HEIGHT"] . "\"/>\n";
             }
         }
         if (strlen($arNodes["category"]) > 0) {
             $strRes .= "<category>" . htmlspecialcharsbx(CIBlockRSS::ExtractProperties($arNodes["category"], $arProps, $arItem)) . "</category>\n";
         } else {
             $strPath = "";
             $nav = CIBlockSection::GetNavChain($arIBLOCK["ID"], $arItem["IBLOCK_SECTION_ID"]);
             while ($ar_nav = $nav->GetNext()) {
                 $strPath .= $ar_nav["NAME"] . "/";
             }
             if (strlen($strPath) > 0) {
                 $strRes .= "<category>" . htmlspecialcharsbx($strPath) . "</category>\n";
             }
         }
         if ($yandex) {
             $strRes .= "<yandex:full-text>" . htmlspecialcharsbx($arItem["DETAIL_TEXT"]) . "</yandex:full-text>\n";
         }
         if (strlen($arNodes["pubDate"]) > 0) {
             $strRes .= "<pubDate>" . htmlspecialcharsbx(CIBlockRSS::ExtractProperties($arNodes["pubDate"], $arProps, $arItem)) . "</pubDate>\n";
         } else {
             if (strlen($arItem["ACTIVE_FROM"]) > 0) {
                 $strRes .= "<pubDate>" . date("r", MkDateTime($DB->FormatDate($arItem["ACTIVE_FROM"], Clang::GetDateFormat("FULL"), "DD.MM.YYYY H:I:S"), "d.m.Y H:i:s")) . "</pubDate>\n";
             } else {
                 $strRes .= "<pubDate>" . date("r") . "</pubDate>\n";
             }
         }
         $strRes .= "</item>\n";
     }
     $strRes .= "</channel>\n";
     return $strRes;
 }
		{
			$arIBlocks = $obCache->GetVars();
		}
		elseif(CModule::IncludeModule("iblock") && $obCache->StartDataCache())
		{

			$arIBlocks = array();
			$dbRes = CIBlock::GetList(Array(), $arFilter);
			$dbRes = new CIBlockResult($dbRes);

			if(defined("BX_COMP_MANAGED_CACHE"))
			{
				global $CACHE_MANAGER;
				$CACHE_MANAGER->StartTagCache("/iblock/catalog/active");
				
				while($arIBlock = $dbRes->GetNext())
				{
					$CACHE_MANAGER->RegisterTag("iblock_id_".$arIBlock["ID"]);

					if($arIBlock["ACTIVE"] == "Y")
						$arIBlocks[$arIBlock["ID"]] = $arIBlock;
				}

				$CACHE_MANAGER->RegisterTag("iblock_id_new");
				$CACHE_MANAGER->EndTagCache();
			}
			else
			{
				while($arIBlock = $dbRes->GetNext())
				{
					if($arIBlock["ACTIVE"] == "Y")
Example #3
0
		"ACTIVE" => "Y"
	);

	$obCache = new CPHPCache();
	if ($obCache->InitCache(36000, serialize($arFilter), "/iblock/menu"))
	{
		$arSectionsInfo = $obCache->GetVars();
	}
	elseif ($obCache->StartDataCache())
	{
		if (CModule::IncludeModule("iblock"))
		{
			$dbIBlock = CIBlock::GetList(array('SORT' => 'ASC', 'ID' => 'ASC'), $arFilter);
			$dbIBlock = new CIBlockResult($dbIBlock);
			$curIblockID = 0;
			if ($arIBlock = $dbIBlock->GetNext())
			{
				$dbSections = CIBlockSection::GetList(array(), array("IBLOCK_ID" => $arIBlock["ID"]), false, array("ID", "SECTION_PAGE_URL", "PICTURE", "DESCRIPTION"));
				while($arSections = $dbSections->GetNext())
				{
					$pictureSrc = CFile::GetFileArray($arSections["PICTURE"]);

					if ($pictureSrc)
						$arResizePicture = CFile::ResizeImageGet(
							$arSections["PICTURE"],
							array("width" => 240, 'height'=>700),
							BX_RESIZE_IMAGE_PROPORTIONAL,
							true
						);

					$arSectionsInfo[crc32($arSections["SECTION_PAGE_URL"])]["PICTURE"] = $pictureSrc ? $arResizePicture["src"] : false;
Example #4
0
if ($REQUEST_METHOD == "POST" && $STEP > 1 && check_freetrix_sessid())
{
	//*****************************************************************//
	if ($STEP > 1)
	{
		//*****************************************************************//
		$arIBlockRes = CIBlock::GetList(
			array("sort" => "asc"),
			array(
				"ID" => $IBLOCK_ID,
				"MIN_PERMISSION" => "W"
			)
		);
		$arIBlockRes = new CIBlockResult($arIBlockRes);
		if ($IBLOCK_ID <= 0 || !($arIBlock = $arIBlockRes->GetNext()))
			$strError .= GetMessage("IBLOCK_ADM_EXP_NO_IBLOCK")."<br>";

		if (strlen($strError) > 0)
			$STEP = 1;
		//*****************************************************************//
	}

	if ($STEP > 2)
	{
		//*****************************************************************//
		$csvFile = new CCSVData();

		if ($fields_type != "F" && $fields_type != "R")
			$strError .= GetMessage("IBLOCK_ADM_EXP_NO_FORMAT")."<br>";
Example #5
0
/**
 * Returns an array with Information block fields or false if none found.
 * iblock have to be linked to the current site.
 *
 * @param string $lang Site identifier block linked to.
 * @param int $ID Numeric identifier of the iblock
 * @param string $type Type of iblock restrict search to.
 *
 * @return array
 */
function GetIBlockLang($lang, $ID, $type = "")
{
    $res = CIBlock::GetList(array(), array("ID" => intval($ID), "TYPE" => $type, "LID" => $lang, "ACTIVE" => "Y"));
    if ($res) {
        $res = new CIBlockResult($res);
        return $res->GetNext();
    } else {
        return false;
    }
}
Example #6
0
 foreach ($arAvailGroups as $key => $value) {
     $strTmpCat .= "<category id=\"" . $value["ID"] . "\"" . (IntVal($value["IBLOCK_SECTION_ID"]) > 0 ? " parentId=\"" . $value["IBLOCK_SECTION_ID"] . "\"" : "") . ">" . yandex_text2xml($value["NAME"], true) . "</category>\n";
     $arSectionIDs[] = $value["ID"];
 }
 //*****************************************//
 $filter = array("IBLOCK_ID" => $IBLOCK_ID, "ACTIVE_DATE" => "Y", "ACTIVE" => "Y");
 if (!$bAllSections) {
     $filter["INCLUDE_SUBSECTIONS"] = "Y";
     $filter["SECTION_ID"] = $arSectionIDs;
 }
 $res = CIBlockElement::GetList(array(), $filter, false, false, $arSelect);
 $db_acc = new CIBlockResult($res);
 $total_sum = 0;
 $is_exists = false;
 $cnt = 0;
 while ($arAcc = $db_acc->GetNext()) {
     $str_QUANTITY = IntVal($arAcc["CATALOG_QUANTITY"]);
     if ($str_QUANTITY <= 0) {
         $str_QUANTITY = 1;
     }
     $minPrice = 0;
     $minPriceRUR = 0;
     $minPriceGroup = 0;
     $minPriceCurrency = "";
     for ($i = 0; $i < count($arPTypes); $i++) {
         if (strlen($arAcc["CATALOG_CURRENCY_" . $arPTypes[$i]]) <= 0) {
             continue;
         }
         $tmpPrice = CCurrencyRates::ConvertCurrency($arAcc["CATALOG_PRICE_" . $arPTypes[$i]], $arAcc["CATALOG_CURRENCY_" . $arPTypes[$i]], "RUR");
         if ($minPriceRUR <= 0 || $minPriceRUR > $tmpPrice) {
             $minPriceRUR = $tmpPrice;
if ($arParams['IBLOCK_ID'] > 0) {
    $arrFilter["IBLOCK_ID"] = $arParams["IBLOCK_ID"];
    //if(defined("BX_COMP_MANAGED_CACHE"))
    //	$GLOBALS["CACHE_MANAGER"]->RegisterTag("iblock_id_".$arParams["IBLOCK_ID"]);
    $arFilter = array("ID" => $arParams['IBLOCK_ID'], "TYPE" => "catalog", "SITE_ID" => SITE_ID);
    $obCache = new CPHPCache();
    if ($obCache->InitCache(36000, serialize($arFilter), "/iblock/catalog/top")) {
        $arIblock = $obCache->GetVars();
    } else {
        $arIBlock = array();
        $dbRes = CIBlock::GetList(array(), $arFilter);
        $dbRes = new CIBlockResult($dbRes);
        if (defined("BX_COMP_MANAGED_CACHE")) {
            global $CACHE_MANAGER;
            $CACHE_MANAGER->StartTagCache("/iblock/catalog/top");
            if ($arIBlock = $dbRes->GetNext()) {
                $CACHE_MANAGER->RegisterTag("iblock_id_" . $arParams["IBLOCK_ID"]);
            }
            $CACHE_MANAGER->EndTagCache();
        } else {
            if (!($arIBlock = $dbRes->GetNext())) {
                $arIBlock = array();
            }
        }
        $obCache->EndDataCache($arIBlock);
    }
} else {
    ShowError("IBLOCK_ERROR");
    return;
}
if ($arParams["DISPLAY_COMPARE"] == "Y" && $APPLICATION->GetProperty("CATALOG_COMPARE_LIST", false) == false && !$arParams['SECTION_ID']) {
Example #8
0
    if (strlen($arResult["VARIABLES"]["SECTION_CODE"]) > 0) {
        $arFilter["=CODE"] = $arResult["VARIABLES"]["SECTION_CODE"];
    } elseif ($arResult["VARIABLES"]["SECTION_ID"] > 0) {
        $arFilter["ID"] = $arResult["VARIABLES"]["SECTION_ID"];
    }
    $obCache = new CPHPCache();
    if ($obCache->InitCache(36000, serialize($arFilter), "/iblock/catalog")) {
        $arCurSection = $obCache->GetVars();
    } else {
        $arCurSection = array();
        $dbRes = CIBlockSection::GetList(array(), $arFilter, false, array("ID"));
        $dbRes = new CIBlockResult($dbRes);
        if (defined("BX_COMP_MANAGED_CACHE")) {
            global $CACHE_MANAGER;
            $CACHE_MANAGER->StartTagCache("/iblock/catalog");
            if ($arCurSection = $dbRes->GetNext()) {
                $CACHE_MANAGER->RegisterTag("iblock_id_" . $arParams["IBLOCK_ID"]);
            }
            $CACHE_MANAGER->EndTagCache();
        } else {
            if (!($arCurSection = $dbRes->GetNext())) {
                $arCurSection = array();
            }
        }
        $obCache->EndDataCache($arCurSection);
    }
}
?>
<div id="smart_filter" style="visibility:hidden">
<?php 
$APPLICATION->IncludeComponent("bitrix:catalog.smart.filter", "mobile", array("IBLOCK_TYPE" => $arParams["IBLOCK_TYPE"], "IBLOCK_ID" => $arParams["IBLOCK_ID"], "SECTION_ID" => $arCurSection["ID"], "FILTER_NAME" => "arrFilter", "PRICE_CODE" => $arParams["PRICE_CODE"], "CACHE_TYPE" => "A", "CACHE_TIME" => "36000000", "CACHE_NOTES" => "", "CACHE_GROUPS" => "Y", "SAVE_IN_SESSION" => "N"), false);
Example #9
0
    if (isset($arParams["IBLOCK_TYPE_ID"])) {
        $arFilter = array("TYPE" => $arParams["IBLOCK_TYPE_ID"], "SITE_ID" => SITE_ID);
    } else {
        if (!CModule::IncludeModule('catalog')) {
            $this->AbortResultCache();
            return array();
        }
        $dbRes = CCatalog::GetList(array(), array('LID' => SITE_ID));
        $arFilter = array("ID" => array(), "SITE_ID" => SITE_ID);
        while ($arRes = $dbRes->Fetch()) {
            $arFilter["ID"][] = $arRes["IBLOCK_ID"];
        }
    }
    $dbIBlock = CIBlock::GetList(array('SORT' => 'ASC', 'ID' => 'DESC'), $arFilter);
    $dbIBlock = new CIBlockResult($dbIBlock);
    while ($arIBlock = $dbIBlock->GetNext()) {
        if (defined("BX_COMP_MANAGED_CACHE")) {
            $GLOBALS["CACHE_MANAGER"]->RegisterTag("iblock_id_" . $arIBlock["ID"]);
        }
        if ($arIBlock["ACTIVE"] == "Y") {
            $arResult["IBLOCK_LIST"][$arIBlock['ID']] = $arIBlock;
        }
    }
    if (defined("BX_COMP_MANAGED_CACHE")) {
        $GLOBALS["CACHE_MANAGER"]->RegisterTag("iblock_id_new");
    }
    $this->EndResultCache();
}
foreach ($arResult["IBLOCK_LIST"] as $arIBlock) {
    $aMenuLinksExt = $APPLICATION->IncludeComponent("bitrix:menu.sections", "", array("IS_SEF" => "Y", "SEF_BASE_URL" => "", "SECTION_PAGE_URL" => $arIBlock['SECTION_PAGE_URL'], "DETAIL_PAGE_URL" => $arIBlock['DETAIL_PAGE_URL'], "IBLOCK_TYPE" => $arIBlock['IBLOCK_TYPE_ID'], "IBLOCK_ID" => $arIBlock['ID'], "DEPTH_LEVEL" => "3", "CACHE_TYPE" => $arParams["CACHE_TYPE"], "CACHE_TIME" => $arParams["CACHE_TIME"]), false, array('HIDE_ICONS' => 'Y'));
    $arResult["MENU_ITEMS"] = $aMenuLinksExt;
Example #10
0
function GetIBlockLang($lang, $ID, $type = "")
{
    $res = CIBlock::GetList(array("sort" => "asc"), array("ID" => IntVal($ID), "TYPE" => $type, "LID" => $lang, "ACTIVE" => "Y"));
    $res = new CIBlockResult($res);
    return $arRes = $res->GetNext();
}