} $bIBlock = Main\Loader::includeModule('iblock'); $bForum = Main\Loader::includeModule('forum'); $ID = intval($_REQUEST['ID']); $SITE_ID = trim($_REQUEST['site_id']); $bDefaultHttps = false; if ($ID > 0) { $dbSitemap = SitemapTable::getById($ID); $arSitemap = $dbSitemap->fetch(); if (!is_array($arSitemap)) { require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_admin_after.php"; ShowError(Loc::getMessage("SEO_ERROR_SITEMAP_NOT_FOUND")); require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/epilog_admin.php"; } else { if ($_REQUEST['action'] == 'delete' && check_bitrix_sessid()) { SitemapRuntimeTable::clearByPid($ID); SitemapTable::delete($ID); LocalRedirect(BX_ROOT . "/admin/seo_sitemap.php?lang=" . LANGUAGE_ID); } $arSitemap['SETTINGS'] = unserialize($arSitemap['SETTINGS']); $arSitemap['SETTINGS']['IBLOCK_AUTO'] = array(); $dbRes = SitemapIblockTable::getList(array("filter" => array("SITEMAP_ID" => $ID), "select" => array("IBLOCK_ID"))); while ($arRes = $dbRes->fetch()) { $arSitemap['SETTINGS']['IBLOCK_AUTO'][$arRes['IBLOCK_ID']] = 'Y'; } $dbRes = SitemapEntityTable::getList(array("filter" => array("SITEMAP_ID" => $ID))); while ($arRes = $dbRes->fetch()) { if (!is_array($arSitemap['SETTINGS'][$arRes["ENTITY_TYPE"] . '_AUTO'])) { $arSitemap['SETTINGS'][$arRes["ENTITY_TYPE"] . '_AUTO'] = array(); } $arSitemap['SETTINGS'][$arRes["ENTITY_TYPE"] . '_AUTO'][$arRes['ENTITY_ID']] = 'Y';
function seoSitemapGetFilesData($PID, $arSitemap, $arCurrentDir, $sitemapFile) { global $NS; $arDirList = array(); if ($arCurrentDir['ACTIVE'] == SitemapRuntimeTable::ACTIVE) { $list = \CSeoUtils::getDirStructure($arSitemap['SETTINGS']['logical'] == 'Y', $arSitemap['SITE_ID'], $arCurrentDir['ITEM_PATH']); foreach ($list as $dir) { $dirKey = "/" . ltrim($dir['DATA']['ABS_PATH'], "/"); if ($dir['TYPE'] == 'F') { if (!isset($arSitemap['SETTINGS']['FILE'][$dirKey]) || $arSitemap['SETTINGS']['FILE'][$dirKey] == 'Y') { if (preg_match($arSitemap['SETTINGS']['FILE_MASK_REGEXP'], $dir['FILE'])) { $f = new IO\File($dir['DATA']['PATH'], $arSitemap['SITE_ID']); $sitemapFile->addFileEntry($f); $NS['files_count']++; } } } else { if (!isset($arSitemap['SETTINGS']['DIR'][$dirKey]) || $arSitemap['SETTINGS']['DIR'][$dirKey] == 'Y') { $arDirList[] = $dirKey; } } } } else { $len = strlen($arCurrentDir['ITEM_PATH']); if (!empty($arSitemap['SETTINGS']['DIR'])) { foreach ($arSitemap['SETTINGS']['DIR'] as $dirKey => $checked) { if ($checked == 'Y') { if (strncmp($arCurrentDir['ITEM_PATH'], $dirKey, $len) === 0) { $arDirList[] = $dirKey; } } } } if (!empty($arSitemap['SETTINGS']['FILE'])) { foreach ($arSitemap['SETTINGS']['FILE'] as $dirKey => $checked) { if ($checked == 'Y') { if (strncmp($arCurrentDir['ITEM_PATH'], $dirKey, $len) === 0) { $fileName = IO\Path::combine(SiteTable::getDocumentRoot($arSitemap['SITE_ID']), $dirKey); if (!is_dir($fileName)) { $f = new IO\File($fileName, $arSitemap['SITE_ID']); if ($f->isExists() && !$f->isSystem() && preg_match($arSitemap['SETTINGS']['FILE_MASK_REGEXP'], $f->getName())) { $sitemapFile->addFileEntry($f); $NS['files_count']++; } } } } } } } if (count($arDirList) > 0) { foreach ($arDirList as $dirKey) { $arRuntimeData = array('PID' => $PID, 'ITEM_PATH' => $dirKey, 'PROCESSED' => SitemapRuntimeTable::UNPROCESSED, 'ACTIVE' => SitemapRuntimeTable::ACTIVE, 'ITEM_TYPE' => SitemapRuntimeTable::ITEM_TYPE_DIR); SitemapRuntimeTable::add($arRuntimeData); } } SitemapRuntimeTable::update($arCurrentDir['ID'], array('PROCESSED' => SitemapRuntimeTable::PROCESSED)); }