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)); }
function seo_getDir($bLogical, $site_id, $dir, $depth, $checked, $arChecked = array()) { if (!is_array($arChecked)) { $arChecked = array(); } $arDirs = \CSeoUtils::getDirStructure($bLogical, $site_id, $dir); if (count($arDirs) > 0) { foreach ($arDirs as $arDir) { $d = Main\IO\Path::combine($dir, $arDir['FILE']); $bChecked = $arChecked[$d] === 'Y' || $checked && $arChecked[$d] !== 'N'; $d = Converter::getHtmlConverter()->encode($d); $r = RandString(8); $varName = $arDir['TYPE'] == 'D' ? 'DIR' : 'FILE'; ?> <div class="sitemap-dir-item"> <?php if ($arDir['TYPE'] == 'D') { ?> <span onclick="loadDir(<?php echo $bLogical ? 'true' : 'false'; ?> , this, '<?php echo CUtil::JSEscape($d); ?> ', '<?php echo $r; ?> ', '<?php echo $depth + 1; ?> ', BX('DIR_<?php echo $d; ?> ').checked)" class="sitemap-tree-icon"></span><?php } ?> <span class="sitemap-dir-item-text"> <input type="hidden" name="<?php echo $varName; ?> [<?php echo $d; ?> ]" value="N" /> <input type="checkbox" name="<?php echo $varName; ?> [<?php echo $d; ?> ]" id="DIR_<?php echo $d; ?> "<?php echo $bChecked ? ' checked="checked"' : ''; ?> value="Y" onclick="checkAll('<?php echo $r; ?> ', this.checked);" /> <label for="DIR_<?php echo $d; ?> "><?php echo Converter::getHtmlConverter()->encode($arDir['NAME'] . ($bLogical ? ' (' . $arDir['FILE'] . ')' : '')); ?> </label> </span> <div id="subdirs_<?php echo $r; ?> " class="sitemap-dir-item-children"></div> </div> <?php } } else { echo $space . Loc::getMessage('SEO_SITEMAP_NO_DIRS_FOUND'); } }