$fileNameForum = trim($_REQUEST['FILENAME_FORUM']); $fileNameIblock = trim($_REQUEST['FILENAME_IBLOCK']); if ($fileNameIndex == '') { $errors[] = Loc::getMessage('SEO_ERROR_SITEMAP_NO_VALUE', array('#FIELD#' => Loc::getMessage('SITEMAP_FILENAME_ADDRESS'))); } if ($fileNameFiles == '') { $errors[] = Loc::getMessage('SEO_ERROR_SITEMAP_NO_VALUE', array('#FIELD#' => Loc::getMessage('SITEMAP_FILENAME_FILE'))); } if ($bIBlock && $fileNameIblock == '') { $errors[] = Loc::getMessage('SEO_ERROR_SITEMAP_NO_VALUE', array('#FIELD#' => Loc::getMessage('SITEMAP_FILENAME_IBLOCK'))); } if ($bForum && $fileNameForum == '') { $errors[] = Loc::getMessage('SEO_ERROR_SITEMAP_NO_VALUE', array('#FIELD#' => Loc::getMessage('SITEMAP_FILENAME_FORUM'))); } if (empty($errors)) { $arSitemapSettings = SitemapTable::prepareSettings(array('FILE_MASK' => trim($_REQUEST['FILE_MASK']), 'ROBOTS' => $_REQUEST['ROBOTS'] == 'N' ? 'N' : 'Y', 'logical' => $_REQUEST['log'] == 'N' ? 'N' : 'Y', 'DIR' => $_REQUEST['DIR'], 'FILE' => $_REQUEST['FILE'], 'PROTO' => $_REQUEST['PROTO'], 'DOMAIN' => $_REQUEST['DOMAIN'], 'FILENAME_INDEX' => $fileNameIndex, 'FILENAME_FILES' => $fileNameFiles, 'FILENAME_IBLOCK' => $fileNameIblock, 'FILENAME_FORUM' => $fileNameForum, 'IBLOCK_ACTIVE' => $_REQUEST['IBLOCK_ACTIVE'], 'IBLOCK_LIST' => $_REQUEST['IBLOCK_LIST'], 'IBLOCK_SECTION' => $_REQUEST['IBLOCK_SECTION'], 'IBLOCK_ELEMENT' => $_REQUEST['IBLOCK_ELEMENT'], 'IBLOCK_SECTION_SECTION' => $_REQUEST['IBLOCK_SECTION_SECTION'], 'IBLOCK_SECTION_ELEMENT' => $_REQUEST['IBLOCK_SECTION_ELEMENT'], 'FORUM_ACTIVE' => $_REQUEST['FORUM_ACTIVE'], 'FORUM_TOPIC' => $_REQUEST['FORUM_TOPIC'])); $arSiteMapFields = array('NAME' => trim($_REQUEST['NAME']), 'ACTIVE' => $_REQUEST['ACTIVE'] == 'N' ? 'N' : 'Y', 'SITE_ID' => $SITE_ID, 'SETTINGS' => serialize($arSitemapSettings)); if ($ID > 0) { $result = SitemapTable::update($ID, $arSiteMapFields); } else { $result = SitemapTable::add($arSiteMapFields); $ID = $result->getId(); } if ($result->isSuccess()) { $arSitemapIblock = array(); SitemapIblockTable::clearBySitemap($ID); if (is_array($_REQUEST['IBLOCK_AUTO'])) { foreach ($_REQUEST['IBLOCK_AUTO'] as $iblockId => $auto) { if ($auto === 'Y') { $result = SitemapIblockTable::add(array('SITEMAP_ID' => $ID, 'IBLOCK_ID' => intval($iblockId))); }
} $arSite['DOMAINS'] = array_unique($arSite['DOMAINS']); } } if (strlen($SITE_ID) <= 0) { require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_admin_after.php"; ShowError(Loc::getMessage("SEO_ERROR_SITEMAP_NO_SITE")); require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/epilog_admin.php"; } $aTabs = array(array("DIV" => "seo_sitemap_common", "TAB" => Loc::getMessage('SEO_SITEMAP_COMMON'), "ICON" => "main_settings", "TITLE" => Loc::getMessage('SEO_SITEMAP_COMMON_TITLE')), array("DIV" => "seo_sitemap_files", "TAB" => Loc::getMessage('SEO_SITEMAP_FILES'), "ICON" => "main_settings", "TITLE" => Loc::getMessage('SEO_SITEMAP_FILES_TITLE'))); if ($bIBlock) { $aTabs[] = array("DIV" => "seo_sitemap_iblock", "TAB" => Loc::getMessage('SEO_SITEMAP_IBLOCK'), "ICON" => "main_settings", "TITLE" => Loc::getMessage('SEO_SITEMAP_IBLOCK_TITLE')); } $tabControl = new \CAdminTabControl("seoSitemapTabControl", $aTabs, true, true); if ($_SERVER['REQUEST_METHOD'] == 'POST' && check_bitrix_sessid() && (strlen($_POST["save"]) > 0 || strlen($_POST['apply']) > 0 || strlen($_POST['save_and_add']) > 0)) { $arSitemapSettings = SitemapTable::prepareSettings(array('FILE_MASK' => trim($_REQUEST['FILE_MASK']), 'ROBOTS' => $_REQUEST['ROBOTS'] == 'N' ? 'N' : 'Y', 'logical' => $_REQUEST['log'] == 'N' ? 'N' : 'Y', 'DIR' => $_REQUEST['DIR'], 'FILE' => $_REQUEST['FILE'], 'PROTO' => $_REQUEST['PROTO'], 'DOMAIN' => $_REQUEST['DOMAIN'], 'FILENAME_INDEX' => trim($_REQUEST['FILENAME_INDEX']), 'FILENAME_FILES' => trim($_REQUEST['FILENAME_FILES']), 'FILENAME_IBLOCK' => trim($_REQUEST['FILENAME_IBLOCK']), 'IBLOCK_ACTIVE' => $_REQUEST['IBLOCK_ACTIVE'], 'IBLOCK_LIST' => $_REQUEST['IBLOCK_LIST'], 'IBLOCK_SECTION' => $_REQUEST['IBLOCK_SECTION'], 'IBLOCK_ELEMENT' => $_REQUEST['IBLOCK_ELEMENT'], 'IBLOCK_SECTION_SECTION' => $_REQUEST['IBLOCK_SECTION_SECTION'], 'IBLOCK_SECTION_ELEMENT' => $_REQUEST['IBLOCK_SECTION_ELEMENT'])); $arSiteMapFields = array('NAME' => trim($_REQUEST['NAME']), 'ACTIVE' => $_REQUEST['ACTIVE'] == 'N' ? 'N' : 'Y', 'SITE_ID' => $SITE_ID, 'SETTINGS' => serialize($arSitemapSettings)); if ($ID > 0) { $result = SitemapTable::update($ID, $arSiteMapFields); } else { $result = SitemapTable::add($arSiteMapFields); $ID = $result->getId(); } if ($result->isSuccess()) { $arSitemapIblock = array(); SitemapIblockTable::clearBySitemap($ID); if (is_array($_REQUEST['IBLOCK_AUTO'])) { foreach ($_REQUEST['IBLOCK_AUTO'] as $iblockId => $auto) { if ($auto === 'Y') { $result = SitemapIblockTable::add(array('SITEMAP_ID' => $ID, 'IBLOCK_ID' => intval($iblockId))); }