PageRenderTime 54ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 0ms

/modules/seo/admin/seo_sitemap_edit.php

https://gitlab.com/alexprowars/bitrix
PHP | 940 lines | 842 code | 96 blank | 2 comment | 144 complexity | 2731fe15a3641e9ce791c3e508c33e07 MD5 | raw file
  1. <?
  2. require_once($_SERVER['DOCUMENT_ROOT']."/bitrix/modules/main/include/prolog_admin_before.php");
  3. define('ADMIN_MODULE_NAME', 'seo');
  4. use Bitrix\Main;
  5. use Bitrix\Main\Text\Converter;
  6. use Bitrix\Main\Localization\Loc;
  7. use Bitrix\Seo\RobotsFile;
  8. use Bitrix\Seo\SitemapTable;
  9. use Bitrix\Seo\SitemapEntityTable;
  10. use Bitrix\Seo\SitemapIblockTable;
  11. use Bitrix\Seo\SitemapForumTable;
  12. use Bitrix\Seo\SitemapRuntimeTable;
  13. use Bitrix\Main\Text\HtmlFilter;
  14. Loc::loadMessages(dirname(__FILE__).'/../../main/tools.php');
  15. Loc::loadMessages(dirname(__FILE__).'/seo_sitemap.php');
  16. if (!$USER->CanDoOperation('seo_tools'))
  17. {
  18. $APPLICATION->AuthForm(Loc::getMessage("ACCESS_DENIED"));
  19. }
  20. if(!Main\Loader::includeModule('seo'))
  21. {
  22. require($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/prolog_admin_after.php");
  23. ShowError(Loc::getMessage("SEO_ERROR_NO_MODULE"));
  24. require($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/epilog_admin.php");
  25. }
  26. $bIBlock = Main\Loader::includeModule('iblock');
  27. $bForum = Main\Loader::includeModule('forum');
  28. $mapId = intval($_REQUEST['ID']);
  29. $siteId = htmlspecialcharsbx(trim($_REQUEST['site_id']));
  30. $bDefaultHttps = false;
  31. if($mapId > 0)
  32. {
  33. $dbSitemap = SitemapTable::getById($mapId);
  34. $arSitemap = $dbSitemap->fetch();
  35. if(!is_array($arSitemap))
  36. {
  37. require($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/prolog_admin_after.php");
  38. ShowError(Loc::getMessage("SEO_ERROR_SITEMAP_NOT_FOUND"));
  39. require($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/epilog_admin.php");
  40. }
  41. else
  42. {
  43. if($_REQUEST['action'] == 'delete' && check_bitrix_sessid())
  44. {
  45. SitemapRuntimeTable::clearByPid($mapId);
  46. SitemapTable::delete($mapId);
  47. LocalRedirect(BX_ROOT."/admin/seo_sitemap.php?lang=".LANGUAGE_ID);
  48. }
  49. $arSitemap['SETTINGS'] = unserialize($arSitemap['SETTINGS'], ['allowed_classes' => false]);
  50. $arSitemap['SETTINGS']['IBLOCK_AUTO'] = array();
  51. $dbRes = SitemapIblockTable::getList(array(
  52. "filter" => array("SITEMAP_ID" => $mapId),
  53. "select" => array("IBLOCK_ID"),
  54. ));
  55. while($arRes = $dbRes->fetch())
  56. {
  57. $arSitemap['SETTINGS']['IBLOCK_AUTO'][$arRes['IBLOCK_ID']] = 'Y';
  58. }
  59. $dbRes = SitemapEntityTable::getList(array(
  60. "filter" => array("SITEMAP_ID" => $mapId),
  61. ));
  62. while($arRes = $dbRes->fetch())
  63. {
  64. if (!is_array($arSitemap['SETTINGS'][$arRes["ENTITY_TYPE"].'_AUTO']))
  65. $arSitemap['SETTINGS'][$arRes["ENTITY_TYPE"].'_AUTO'] = array();
  66. $arSitemap['SETTINGS'][$arRes["ENTITY_TYPE"].'_AUTO'][$arRes['ENTITY_ID']] = 'Y';
  67. }
  68. if (empty($arSitemap['SETTINGS']['FILENAME_FORUM']))
  69. $arSitemap['SETTINGS']['FILENAME_FORUM'] = "sitemap_forum_#FORUM_ID#.xml";
  70. $siteId = $arSitemap['SITE_ID'];
  71. }
  72. }
  73. if($siteId <> '')
  74. {
  75. $dbSite = Main\SiteTable::getByPrimary($siteId);
  76. $arSite = $dbSite->fetch();
  77. if(!is_array($arSite))
  78. {
  79. $siteId = '';
  80. }
  81. else
  82. {
  83. $siteId = $arSite['LID'];
  84. $arSite['DOMAINS'] = array();
  85. $robotsFile = new RobotsFile($siteId);
  86. if($robotsFile->isExists())
  87. {
  88. $arHostsList = $robotsFile->getRules('Host');
  89. foreach ($arHostsList as $rule)
  90. {
  91. $host = $rule[1];
  92. if(strncmp($host, 'https://', 8) === 0)
  93. {
  94. $host = mb_substr($host, 8);
  95. $bDefaultHttps = true;
  96. }
  97. $arSite['DOMAINS'][] = $host;
  98. }
  99. }
  100. if($arSite['SERVER_NAME'] != '')
  101. $arSite['DOMAINS'][] = $arSite['SERVER_NAME'];
  102. $dbDomains = Bitrix\Main\SiteDomainTable::getList(
  103. array(
  104. 'filter' => array('LID' => $siteId),
  105. 'select'=>array('DOMAIN')
  106. )
  107. );
  108. while($arDomain = $dbDomains->fetch())
  109. {
  110. $arSite['DOMAINS'][] = $arDomain['DOMAIN'];
  111. }
  112. $arSite['DOMAINS'][] = \Bitrix\Main\Config\Option::get('main', 'server_name', '');
  113. $arSite['DOMAINS'] = array_unique($arSite['DOMAINS']);
  114. }
  115. }
  116. if($siteId == '')
  117. {
  118. require($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/prolog_admin_after.php");
  119. ShowError(Loc::getMessage("SEO_ERROR_SITEMAP_NO_SITE"));
  120. require($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/epilog_admin.php");
  121. }
  122. $aTabs = array(
  123. array("DIV" => "seo_sitemap_common", "TAB" => Loc::getMessage('SEO_SITEMAP_COMMON'), "ICON" => "main_settings", "TITLE" => Loc::getMessage('SEO_SITEMAP_COMMON_TITLE')),
  124. array("DIV" => "seo_sitemap_files", "TAB" => Loc::getMessage('SEO_SITEMAP_FILES'), "ICON" => "main_settings", "TITLE" => Loc::getMessage('SEO_SITEMAP_FILES_TITLE')),
  125. );
  126. if($bIBlock)
  127. {
  128. $aTabs[] = array("DIV" => "seo_sitemap_iblock", "TAB" => Loc::getMessage('SEO_SITEMAP_IBLOCK'), "ICON" => "main_settings", "TITLE" => Loc::getMessage('SEO_SITEMAP_IBLOCK_TITLE'));
  129. }
  130. if($bForum)
  131. {
  132. $aTabs[] = array("DIV" => "seo_sitemap_forum", "TAB" => Loc::getMessage('SEO_SITEMAP_FORUM'), "ICON" => "main_settings", "TITLE" => Loc::getMessage('SEO_SITEMAP_FORUM_TITLE'));
  133. }
  134. $tabControl = new \CAdminTabControl("seoSitemapTabControl", $aTabs, true, true);
  135. $errors = array();
  136. if($_SERVER['REQUEST_METHOD'] == 'POST' && check_bitrix_sessid() && ($_POST["save"] <> '' || $_POST['apply'] <> '' || $_POST['save_and_add'] <> ''))
  137. {
  138. $fileNameIndex = trim($_REQUEST['FILENAME_INDEX']);
  139. $fileNameFiles = trim($_REQUEST['FILENAME_FILES']);
  140. $fileNameForum = trim($_REQUEST['FILENAME_FORUM']);
  141. $fileNameIblock = trim($_REQUEST['FILENAME_IBLOCK']);
  142. if($fileNameIndex == '')
  143. {
  144. $errors[] = Loc::getMessage('SEO_ERROR_SITEMAP_NO_VALUE', array('#FIELD#' => Loc::getMessage('SITEMAP_FILENAME_ADDRESS')));
  145. }
  146. if($fileNameFiles == '')
  147. {
  148. $errors[] = Loc::getMessage('SEO_ERROR_SITEMAP_NO_VALUE', array('#FIELD#' => Loc::getMessage('SITEMAP_FILENAME_FILE')));
  149. }
  150. if($bIBlock && $fileNameIblock == '')
  151. {
  152. $errors[] = Loc::getMessage('SEO_ERROR_SITEMAP_NO_VALUE', array('#FIELD#' => Loc::getMessage('SITEMAP_FILENAME_IBLOCK')));
  153. }
  154. if($bForum && $fileNameForum == '')
  155. {
  156. $errors[] = Loc::getMessage('SEO_ERROR_SITEMAP_NO_VALUE', array('#FIELD#' => Loc::getMessage('SITEMAP_FILENAME_FORUM')));
  157. }
  158. if(empty($errors))
  159. {
  160. $arSitemapSettings = SitemapTable::prepareSettings(array(
  161. 'FILE_MASK' => trim($_REQUEST['FILE_MASK']),
  162. 'ROBOTS' => $_REQUEST['ROBOTS'] == 'N' ? 'N' : 'Y',
  163. 'logical' => $_REQUEST['log'] == 'N' ? 'N' : 'Y',
  164. 'DIR' => $_REQUEST['DIR'],
  165. 'FILE' => $_REQUEST['FILE'],
  166. 'PROTO' => $_REQUEST['PROTO'],
  167. 'DOMAIN' => $_REQUEST['DOMAIN'],
  168. 'FILENAME_INDEX' => $fileNameIndex,
  169. 'FILENAME_FILES' => $fileNameFiles,
  170. 'FILENAME_IBLOCK' => $fileNameIblock,
  171. 'FILENAME_FORUM' => $fileNameForum,
  172. 'IBLOCK_ACTIVE' => $_REQUEST['IBLOCK_ACTIVE'],
  173. 'IBLOCK_LIST' => $_REQUEST['IBLOCK_LIST'],
  174. 'IBLOCK_SECTION' => $_REQUEST['IBLOCK_SECTION'],
  175. 'IBLOCK_ELEMENT' => $_REQUEST['IBLOCK_ELEMENT'],
  176. 'IBLOCK_SECTION_SECTION' => $_REQUEST['IBLOCK_SECTION_SECTION'],
  177. 'IBLOCK_SECTION_ELEMENT' => $_REQUEST['IBLOCK_SECTION_ELEMENT'],
  178. 'FORUM_ACTIVE' => $_REQUEST['FORUM_ACTIVE'],
  179. 'FORUM_TOPIC' => $_REQUEST['FORUM_TOPIC'],
  180. ));
  181. $arSiteMapFields = array(
  182. 'NAME' => trim($_REQUEST['NAME']),
  183. 'ACTIVE' => $_REQUEST['ACTIVE'] == 'N' ? 'N' : 'Y',
  184. 'SITE_ID' => $siteId,
  185. 'SETTINGS' => serialize($arSitemapSettings),
  186. );
  187. if($mapId > 0)
  188. {
  189. $result = SitemapTable::update($mapId, $arSiteMapFields);
  190. }
  191. else
  192. {
  193. $result = SitemapTable::add($arSiteMapFields);
  194. $mapId = $result->getId();
  195. }
  196. if($result->isSuccess())
  197. {
  198. $arSitemapIblock = array();
  199. SitemapIblockTable::clearBySitemap($mapId);
  200. if(is_array($_REQUEST['IBLOCK_AUTO']))
  201. {
  202. foreach($_REQUEST['IBLOCK_AUTO'] as $iblockId => $auto)
  203. {
  204. if($auto === 'Y')
  205. {
  206. $result = SitemapIblockTable::add(array(
  207. 'SITEMAP_ID' => $mapId,
  208. 'IBLOCK_ID' => intval($iblockId),
  209. ));
  210. }
  211. }
  212. }
  213. SitemapForumTable::clearBySitemap($mapId);
  214. if(is_array($_REQUEST['FORUM_AUTO']))
  215. {
  216. foreach($_REQUEST['FORUM_AUTO'] as $forumId => $auto)
  217. {
  218. if($auto === 'Y')
  219. {
  220. $result = SitemapForumTable::add(array('SITEMAP_ID' => $mapId, 'ENTITY_ID' => $forumId));
  221. }
  222. }
  223. }
  224. if($_REQUEST["save"] <> '')
  225. {
  226. LocalRedirect(BX_ROOT."/admin/seo_sitemap.php?lang=".LANGUAGE_ID);
  227. }
  228. elseif($_REQUEST["save_and_add"] <> '')
  229. {
  230. LocalRedirect(BX_ROOT."/admin/seo_sitemap.php?lang=".LANGUAGE_ID."&run=".$mapId."&".bitrix_sessid_get());
  231. }
  232. else
  233. {
  234. LocalRedirect(BX_ROOT."/admin/seo_sitemap_edit.php?lang=".LANGUAGE_ID."&ID=".$mapId."&".$tabControl->ActiveTabParam());
  235. }
  236. }
  237. else
  238. {
  239. $errors = $result->getErrorMessages();
  240. }
  241. }
  242. }
  243. function seo_getDir($bLogical, $site_id, $dir, $depth, $checked, $arChecked = array())
  244. {
  245. if(!is_array($arChecked))
  246. $arChecked = array();
  247. $arDirs = \CSeoUtils::getDirStructure($bLogical, $site_id, $dir);
  248. if(count($arDirs) > 0)
  249. {
  250. foreach ($arDirs as $arDir)
  251. {
  252. $d = Main\IO\Path::combine($dir,$arDir['FILE']);
  253. $bChecked = $arChecked[$d] === 'Y' || $checked && $arChecked[$d] !== 'N';
  254. $d = Converter::getHtmlConverter()->encode($d);
  255. $r = RandString(8);
  256. $varName = $arDir['TYPE'] == 'D' ? 'DIR' : 'FILE';
  257. ?>
  258. <div class="sitemap-dir-item">
  259. <?
  260. if($arDir['TYPE']=='D'):
  261. ?>
  262. <span onclick="loadDir(<?=$bLogical?'true':'false'?>, this, '<?=CUtil::JSEscape($d)?>', '<?=$r?>', '<?=$depth+1?>', BX('DIR_<?=$d?>').checked)" class="sitemap-tree-icon"></span><?
  263. endif;
  264. ?><span class="sitemap-dir-item-text">
  265. <input type="hidden" name="<?=$varName?>[<?=$d?>]" value="N" />
  266. <input type="checkbox" name="<?=$varName?>[<?=$d?>]" id="DIR_<?=$d?>"<?=$bChecked ? ' checked="checked"' : ''?> value="Y" onclick="checkAll('<?=$r?>', this.checked);" />
  267. <label for="DIR_<?=$d?>"><?=Converter::getHtmlConverter()->encode($arDir['NAME'].($bLogical ? (' ('.$arDir['FILE'].')') : ''))?></label>
  268. </span>
  269. <div id="subdirs_<?=$r?>" class="sitemap-dir-item-children"></div>
  270. </div>
  271. <?
  272. }
  273. }
  274. else
  275. {
  276. echo $space.Loc::getMessage('SEO_SITEMAP_NO_DIRS_FOUND');
  277. }
  278. }
  279. function seo_getIblock($iblockId, $sectionId, $sectionChecked, $elementChecked, $arSectionChecked = array(), $arElementChecked = array())
  280. {
  281. $dbIblock = \CIBlock::GetByID($iblockId);
  282. $arIBlock = $dbIblock->Fetch();
  283. if(is_array($arIBlock))
  284. {
  285. $bSection = $arIBlock['SECTION_PAGE_URL'] <> '';
  286. $bElement = $arIBlock['DETAIL_PAGE_URL'] <> '';
  287. $dbRes = \CIBlockSection::GetList(
  288. array('SORT' => 'ASC', 'NAME' => 'ASC'),
  289. array(
  290. 'IBLOCK_ID' => $iblockId,
  291. 'SECTION_ID' => $sectionId,
  292. 'ACTIVE' => 'Y',
  293. 'CHECK_PERMISSIONS' => 'Y'
  294. )
  295. );
  296. $bFound = false;
  297. while ($arRes = $dbRes->Fetch())
  298. {
  299. $r = RandString(8);
  300. $d = $arRes['ID'];
  301. $bSectionChecked = $bSection && ($arSectionChecked[$d] === 'Y' || $sectionChecked && $arSectionChecked[$d] !== 'N');
  302. $bElementChecked = $bElement && ($arElementChecked[$d] === 'Y' || $elementChecked && $arElementChecked[$d] !== 'N');
  303. if(!$bFound)
  304. {
  305. $bFound = true;
  306. ?>
  307. <table class="internal" style="width: 100%;">
  308. <tr class="heading">
  309. <td colspan="2"><?=Loc::getMessage('SEO_SITEMAP_IBLOCK_SECTION_NAME')?></td>
  310. <td width="100"><?=Loc::getMessage('SEO_SITEMAP_IBLOCK_SECTION_SECTION')?></td>
  311. <td width="100"><?=Loc::getMessage('SEO_SITEMAP_IBLOCK_SECTION_ELEMENTS')?></td>
  312. </tr>
  313. <?
  314. }
  315. ?>
  316. <tr>
  317. <td width="20"><span onclick="loadIblock(this, '<?=$arRes['IBLOCK_ID']?>', '<?=$d?>', '<?=$r?>', BX('IBLOCK_SECTION_SECTION_<?=$d?>').checked, BX('IBLOCK_SECTION_ELEMENT_<?=$d?>').checked);" class="sitemap-tree-icon-iblock"></span></td>
  318. <td><a href="iblock_list_admin.php?lang=<?=LANGUAGE_ID?>&amp;IBLOCK_ID=<?=$arRes['IBLOCK_ID']?>&amp;find_section_section=<?=$d?>"><?=Converter::getHtmlConverter()->encode($arRes['NAME'])?></a></td>
  319. <td align="center"><input type="hidden" name="IBLOCK_SECTION_SECTION[<?=$iblockId?>][<?=$d?>]" value="N" /><input type="checkbox" name="IBLOCK_SECTION_SECTION[<?=$iblockId?>][<?=$d?>]" id="IBLOCK_SECTION_SECTION_<?=$d?>" value="Y"<?=$bSection?'':' disabled="disabled"'?><?=$bSectionChecked?' checked="checked"':''?> data-type="section" onclick="checkAllSection('<?=$r?>', this.checked);" />&nbsp;<label for="IBLOCK_SECTION_SECTION_<?=$d?>"><?=Loc::getMessage('MAIN_YES')?></label></td>
  320. <td align="center"><input type="hidden" name="IBLOCK_SECTION_ELEMENT[<?=$iblockId?>][<?=$d?>]" value="N" /><input type="checkbox" name="IBLOCK_SECTION_ELEMENT[<?=$iblockId?>][<?=$d?>]" id="IBLOCK_SECTION_ELEMENT_<?=$d?>" value="Y"<?=$bElement?'':' disabled="disabled"'?><?=$bElementChecked?' checked="checked"':''?> data-type="element" onclick="checkAllElement('<?=$r?>', this.checked);" />&nbsp;<label for="IBLOCK_SECTION_ELEMENT_<?=$d?>"><?=Loc::getMessage('MAIN_YES')?></label></td>
  321. </tr>
  322. <tr style="display: none" id="subdirs_row_<?=$r?>">
  323. <td colspan="4" id="subdirs_<?=$r?>" align="center"></td>
  324. </tr>
  325. <?
  326. }
  327. if(!$bFound)
  328. {
  329. echo Loc::getMessage('SEO_SITEMAP_NO_DIRS_FOUND');
  330. }
  331. }
  332. }
  333. // load directory structure
  334. if(isset($_REQUEST['dir']) && check_bitrix_sessid())
  335. {
  336. $bLogical = $_REQUEST['log'] == 'Y';
  337. $dir = $_REQUEST['dir'];
  338. $depth = intval($_REQUEST['depth']);
  339. $checked = $_REQUEST['checked'] == 'Y';
  340. $APPLICATION->RestartBuffer();
  341. if(!is_array($arSitemap['SETTINGS']['DIR']))
  342. $arSitemap['SETTINGS']['DIR'] = array();
  343. if(!is_array($arSitemap['SETTINGS']['FILE']))
  344. $arSitemap['SETTINGS']['FILE'] = array();
  345. $arChecked = array_merge($arSitemap['SETTINGS']['DIR'], $arSitemap['SETTINGS']['FILE']);
  346. echo seo_getDir($bLogical, $siteId, $dir, $depth, $checked, $arChecked);
  347. die();
  348. }
  349. // load iblock structure
  350. if($bIBlock && isset($_REQUEST['iblock']) && check_bitrix_sessid())
  351. {
  352. $iblock = intval($_REQUEST['iblock']);
  353. $section = intval($_REQUEST['section']);
  354. $sectionChecked = $_REQUEST['section_checked'] == 'Y';
  355. $elementChecked = $_REQUEST['element_checked'] == 'Y';
  356. $APPLICATION->RestartBuffer();
  357. if(is_array($arSitemap['SETTINGS']['IBLOCK_SECTION_SECTION'][$iblock]) || is_array($arSitemap['SETTINGS']['IBLOCK_SECTION_ELEMENT'][$iblock]))
  358. {
  359. echo seo_getIblock($iblock, $section, $sectionChecked, $elementChecked, $arSitemap['SETTINGS']['IBLOCK_SECTION_SECTION'][$iblock], $arSitemap['SETTINGS']['IBLOCK_SECTION_ELEMENT'][$iblock]);
  360. }
  361. else
  362. {
  363. echo seo_getIblock($iblock, $section, $sectionChecked, $elementChecked);
  364. }
  365. die();
  366. }
  367. if($mapId <= 0)
  368. {
  369. $arSitemap = array(
  370. "NAME" => Loc::getMessage('SITEMAP_NAME_DEFAULT', array("#DATE#" => ConvertTimeStamp())),
  371. "ACTIVE" => "Y",
  372. "DATE_RUN" => "",
  373. "SETTINGS" => array(
  374. "ROBOTS" => "Y",
  375. "PROTO" => $bDefaultHttps ? 1 : 0,
  376. "FILE_MASK" => SitemapTable::SETTINGS_DEFAULT_FILE_MASK,
  377. "logical" => 'Y',
  378. "FILENAME_INDEX" => "sitemap.xml",
  379. "FILENAME_FILES" => "sitemap_files.xml",
  380. "FILENAME_IBLOCK" => "sitemap_iblock_#IBLOCK_ID#.xml",
  381. "FILENAME_FORUM" => "sitemap_forum_#FORUM_ID#.xml"
  382. )
  383. );
  384. }
  385. if(!empty($errors))
  386. {
  387. $arSitemap["NAME"] = $_REQUEST['NAME'];
  388. $arSitemap["SETTINGS"]["ROBOTS"] = $_REQUEST['ROBOTS'] == 'N' ? 'N' : 'Y';
  389. $arSitemap["SETTINGS"]["PROTO"] = $_REQUEST['PROTO'];
  390. $arSitemap["SETTINGS"]["DOMAIN"] = $_REQUEST['DOMAIN'];
  391. $arSitemap["SETTINGS"]["FILE_MASK"] = trim($_REQUEST['FILE_MASK']);
  392. $arSitemap["SETTINGS"]["logical"] = $_REQUEST['log'] == 'N' ? 'N' : 'Y';
  393. $arSitemap["SETTINGS"]["FILENAME_INDEX"] = trim($_REQUEST['FILENAME_INDEX']);
  394. $arSitemap["SETTINGS"]["FILENAME_FILES"] = trim($_REQUEST['FILENAME_FILES']);
  395. $arSitemap["SETTINGS"]["FILENAME_IBLOCK"] = trim($_REQUEST['FILENAME_IBLOCK']);
  396. $arSitemap["SETTINGS"]["FILENAME_FORUM"] = trim($_REQUEST['FILENAME_FORUM']);
  397. $arSitemap["SETTINGS"]["DIR"] = $_REQUEST['DIR'];
  398. $arSitemap["SETTINGS"]["FILE"] = $_REQUEST['FILE'];
  399. $arSitemap["SETTINGS"]["IBLOCK_ACTIVE"] = $_REQUEST['IBLOCK_ACTIVE'];
  400. $arSitemap["SETTINGS"]["IBLOCK_LIST"] = $_REQUEST['IBLOCK_LIST'];
  401. $arSitemap["SETTINGS"]["IBLOCK_SECTION"] = $_REQUEST['IBLOCK_SECTION'];
  402. $arSitemap["SETTINGS"]["IBLOCK_ELEMENT"] = $_REQUEST['IBLOCK_ELEMENT'];
  403. $arSitemap["SETTINGS"]["IBLOCK_SECTION_SECTION"] = $_REQUEST['IBLOCK_SECTION_SECTION'];
  404. $arSitemap["SETTINGS"]["IBLOCK_SECTION_ELEMENT"] = $_REQUEST['IBLOCK_SECTION_ELEMENT'];
  405. $arSitemap["SETTINGS"]["FORUM_ACTIVE"] = $_REQUEST['FORUM_ACTIVE'];
  406. $arSitemap["SETTINGS"]["FORUM_TOPIC"] = $_REQUEST['FORUM_TOPIC'];
  407. }
  408. $bLogical = $arSitemap['SETTINGS']['logical'] != 'N';
  409. $APPLICATION->SetAdditionalCSS("/bitrix/panel/seo/sitemap.css");
  410. $APPLICATION->SetTitle($mapId > 0 ? Loc::getMessage("SEO_SITEMAP_EDIT_TITLE") : Loc::getMessage("SEO_SITEMAP_ADD_TITLE"));
  411. require($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/prolog_admin_after.php");
  412. $aMenu = array();
  413. $aMenu[] = array(
  414. "TEXT" => Loc::getMessage("SITEMAP_LIST"),
  415. "LINK" => "/bitrix/admin/seo_sitemap.php?lang=".LANGUAGE_ID,
  416. "ICON" => "btn_list",
  417. "TITLE" => Loc::getMessage("SITEMAP_LIST_TITLE"),
  418. );
  419. if ($mapId > 0)
  420. {
  421. $aMenu[] = array(
  422. "TEXT" => Loc::getMessage("SITEMAP_DELETE"),
  423. "LINK" => "javascript:if(confirm('".Loc::getMessage("SITEMAP_DELETE_CONFIRM")."')) window.location='/bitrix/admin/seo_sitemap_edit.php?action=delete&ID=".$mapId."&lang=".LANGUAGE_ID."&".bitrix_sessid_get()."';",
  424. "ICON" => "btn_delete",
  425. "TITLE" => Loc::getMessage("SITEMAP_DELETE_TITLE"),
  426. );
  427. }
  428. $context = new CAdminContextMenu($aMenu);
  429. $context->Show();
  430. if(!empty($errors))
  431. {
  432. CAdminMessage::ShowMessage(join("\n", $errors));
  433. }
  434. ?>
  435. <form method="POST" action="<?=POST_FORM_ACTION_URI?>" name="sitemap_form">
  436. <input type="hidden" name="ID" value="<?=$mapId?>">
  437. <input type="hidden" name="site_id" value="<?=$siteId?>">
  438. <?
  439. $tabControl->Begin();
  440. $tabControl->BeginNextTab();
  441. ?>
  442. <tr class="adm-detail-required-field">
  443. <td width="40%"><?=Loc::getMessage("SITEMAP_NAME")?>:</td>
  444. <td width="60%"><input type="text" name="NAME" value="<?=Converter::getHtmlConverter()->encode($arSitemap["NAME"])?>" style="width:70%"></td>
  445. </tr>
  446. <tr class="adm-detail-required-field">
  447. <td width="40%"><?=Loc::getMessage("SITEMAP_FILENAME_ADDRESS")?>:</td>
  448. <td width="60%"><select name="PROTO">
  449. <option value="0"<?=$arSitemap['SETTINGS']['PROTO'] == 0 ? ' selected="selected"' : ''?>>http</option>
  450. <option value="1"<?=$arSitemap['SETTINGS']['PROTO'] == 1 ? ' selected="selected"' : ''?>>https</option>
  451. </select> <b>://</b> <select name="DOMAIN">
  452. <?
  453. foreach($arSite['DOMAINS'] as $domain):
  454. $hd = Converter::getHtmlConverter()->encode($domain);
  455. $e = [];
  456. $hdc = Converter::getHtmlConverter()->encode(CBXPunycode::ToUnicode($domain, $e));
  457. ?>
  458. <option value="<?=$hd?>"<?=$domain == $arSitemap['SETTINGS']['DOMAIN'] ? ' selected="selected"' : ''?>><?=$hdc?></option>
  459. <?
  460. endforeach;
  461. ?>
  462. </select> <b><?=Converter::getHtmlConverter()->encode($arSite['DIR']);?></b> <input type="text" name="FILENAME_INDEX" value="<?=Converter::getHtmlConverter()->encode($arSitemap['SETTINGS']["FILENAME_INDEX"])?>" /></td>
  463. </tr>
  464. <tr>
  465. <td></td>
  466. <style>
  467. .adm-info-message{margin-top:0 !important;}
  468. </style>
  469. <td><?echo BeginNote(),Loc::getMessage("SITEMAP_FILENAME_ADDRESS_ATTENTION"),EndNote();?></td>
  470. </tr>
  471. <tr>
  472. <td width="40%"><label for="SITEMAP_ROBOTS_Y"><?echo Loc::getMessage("SITEMAP_ROBOTS")?>:</label></td>
  473. <td width="60%"><input type="hidden" name="ROBOTS" value="N"><input type="checkbox" id="SITEMAP_ROBOTS_Y" name="ROBOTS" value="Y"<?=$arSitemap['SETTINGS']['ROBOTS'] == 'Y' ? ' checked="checked"' : ''?>> <label for="SITEMAP_ROBOTS_Y"><?=Loc::getMessage('MAIN_YES')?></label></td>
  474. </tr>
  475. <tr>
  476. <td width="40%"><?=Loc::getMessage('SITEMAP_DATE_RUN')?>:</td>
  477. <td width="60%"><?=$arSitemap['DATE_RUN'] ? $arSitemap['DATE_RUN'] : Loc::getMessage('SITEMAP_DATE_RUN_NEVER')?></td>
  478. </tr>
  479. <?
  480. $tabControl->BeginNextTab();
  481. $startDir = HtmlFilter::encode($arSite['DIR']);
  482. $bChecked = isset($arSitemap['SETTINGS']['DIR'])
  483. ? $arSitemap['SETTINGS']['DIR'][$startDir] == 'Y'
  484. : true;
  485. ?>
  486. <script>
  487. var loadedDirs = {};
  488. function loadDir(bLogical, sw, dir, div, depth, checked)
  489. {
  490. div = 'subdirs_' + div;
  491. if(!!sw && BX.hasClass(sw, 'sitemap-opened'))
  492. {
  493. BX(div).style.display = 'none';
  494. BX.removeClass(sw, 'sitemap-opened')
  495. }
  496. else if (div != 'subdirs_<?=$startDir?>' && !!loadedDirs[div])
  497. {
  498. if(sw)
  499. {
  500. BX.addClass(sw, 'sitemap-opened');
  501. }
  502. BX(div).style.display = 'block';
  503. }
  504. else
  505. {
  506. BX.ajax.get('<?=$APPLICATION->GetCurPageParam('', array('dir', 'depth'))?>', {dir:dir,depth:depth,checked:checked?'Y':'N',log:bLogical?'Y':'N',sessid:BX.bitrix_sessid()}, function(res)
  507. {
  508. BX(div).innerHTML = res;
  509. BX(div).style.display = 'block';
  510. if(sw)
  511. {
  512. BX.addClass(sw, 'sitemap-opened');
  513. }
  514. loadedDirs[div] = true;
  515. BX.adminFormTools.modifyFormElements(BX(div));
  516. });
  517. }
  518. BX.onCustomEvent('onAdminTabsChange');
  519. }
  520. var bChanged = false;
  521. function switchLogic(l)
  522. {
  523. if(!bChanged || confirm('<?=CUtil::JSEscape(Loc::getMessage('SEO_SITEMAP_LOGIC_WARNING'))?>'))
  524. {
  525. loadDir(l, null, '<?=$startDir?>', '<?=$startDir?>', 0, BX('DIR_<?=$startDir?>').checked);
  526. bChanged = false;
  527. }
  528. else
  529. {
  530. BX('log_' +(l ? 'N' : 'Y')).checked = true;
  531. }
  532. }
  533. function checkAll(div, v)
  534. {
  535. bChanged = true;
  536. _check_all(div, {tagName:'INPUT',property:{type:'checkbox'}}, v);
  537. }
  538. function _check_all(div, isElement, v)
  539. {
  540. var c = BX.findChildren(BX('subdirs_' + div), isElement, true);
  541. for(var i = 0; i < c.length; i++)
  542. {
  543. c[i].checked = v;
  544. }
  545. }
  546. </script>
  547. <tr class="adm-detail-required-field">
  548. <td width="40%"><?=Loc::getMessage("SITEMAP_FILENAME_FILE")?>:</td>
  549. <td width="60%"><input type="text" name="FILENAME_FILES" value="<?=Converter::getHtmlConverter()->encode($arSitemap['SETTINGS']["FILENAME_FILES"])?>" style="width:70%"></td>
  550. </tr>
  551. <tr>
  552. <td width="40%" valign="top"><?=Loc::getMessage('SEO_SITEMAP_STRUCTURE_TYPE')?>:</td>
  553. <td width="60%">
  554. <input type="radio" name="log" id="log_Y" value="Y"<?=$bLogical ? ' checked="checked"' : ''?> onclick="switchLogic(true)" /><label for="log_Y"><?=Loc::getMessage('SEO_SITEMAP_STRUCTURE_TYPE_Y')?></label><br />
  555. <input type="radio" name="log" id="log_N" value="N"<?=$bLogical ? '' : ' checked="checked"'?> onclick="switchLogic(false)" /><label for="log_N"><?=Loc::getMessage('SEO_SITEMAP_STRUCTURE_TYPE_N')?></label>
  556. </td>
  557. </tr>
  558. <tr>
  559. <td width="40%" valign="top"><?=Loc::getMessage('SEO_SITEMAP_STRUCTURE')?>: </td>
  560. <td width="60%">
  561. <input type="hidden" name="DIR[<?=$startDir?>]" value="N" /><input type="checkbox" name="DIR[<?=$startDir?>]" id="DIR_<?=$startDir?>"<?=$bChecked ? ' checked="checked"' : ''?> value="Y" onclick="checkAll('<?=$startDir?>', this.checked);" />&nbsp;<label for="DIR_<?=$startDir?>"><?=$startDir?></label></div>
  562. <div id="subdirs_<?=$startDir?>">
  563. <?
  564. if(is_array($arSitemap['SETTINGS']['FILE']))
  565. {
  566. foreach($arSitemap['SETTINGS']['FILE'] as $dir => $value)
  567. {
  568. ?>
  569. <input type="hidden" name="FILE[<?=Converter::getHtmlConverter()->encode($dir);?>]" value="<?=$value=='N'?'N':'Y'?>" />
  570. <?
  571. }
  572. }
  573. else
  574. {
  575. $arSitemap['SETTINGS']['FILE'] = array();
  576. }
  577. if(is_array($arSitemap['SETTINGS']['DIR']))
  578. {
  579. foreach($arSitemap['SETTINGS']['DIR'] as $dir => $value)
  580. {
  581. if($dir != $startDir)
  582. {
  583. ?>
  584. <input type="hidden" name="DIR[<?=Converter::getHtmlConverter()->encode($dir);?>]" value="<?=$value=='N'?'N':'Y'?>" />
  585. <?
  586. }
  587. }
  588. }
  589. else
  590. {
  591. $arSitemap['SETTINGS']['DIR'] = array();
  592. }
  593. $arChecked = array_merge($arSitemap['SETTINGS']['DIR'], $arSitemap['SETTINGS']['FILE']);
  594. echo seo_getDir($bLogical, $siteId, $startDir, 1, $bChecked, $arChecked);
  595. ?>
  596. </td>
  597. </tr>
  598. <tr>
  599. <td width="40%" valign="top"><?=Loc::getMessage('SEO_SITEMAP_STRUCTURE_FILE_MASK')?>: </td>
  600. <td width="60%"><input type="text" name="FILE_MASK" value="<?=Converter::getHtmlConverter()->encode($arSitemap['SETTINGS']['FILE_MASK'])?>" />
  601. <?
  602. echo BeginNote();
  603. echo Loc::getMessage('SEO_FILE_MASK_HELP');
  604. echo EndNote();
  605. ?>
  606. </td>
  607. </tr>
  608. <?
  609. if($bIBlock)
  610. {
  611. $tabControl->BeginNextTab();
  612. ?>
  613. <tr class="adm-detail-required-field">
  614. <td width="40%"><?=Loc::getMessage("SITEMAP_FILENAME_IBLOCK")?>:</td>
  615. <td width="60%"><input type="text" name="FILENAME_IBLOCK" value="<?=Converter::getHtmlConverter()->encode($arSitemap['SETTINGS']["FILENAME_IBLOCK"])?>" style="width:70%"></td>
  616. </tr>
  617. <tr>
  618. <td colspan="2" align="center">
  619. <?
  620. $dbRes = CIBlock::GetList(array("ID" => "ASC"), array(
  621. 'SITE_ID' => $siteId
  622. ));
  623. $bFound = false;
  624. while ($arRes = $dbRes->Fetch())
  625. {
  626. if(!$bFound)
  627. {
  628. ?>
  629. <script>
  630. var loadedIblocks = {};
  631. function loadIblock(sw, iblock, section, div, section_checked, element_checked)
  632. {
  633. if(!!BX('IBLOCK_ACTIVE_' + div) && !BX('IBLOCK_ACTIVE_' + div).checked)
  634. return;
  635. var row = 'subdirs_row_' + div,
  636. div = 'subdirs_' + div;
  637. if(!!sw && BX.hasClass(sw, 'sitemap-opened'))
  638. {
  639. BX(row).style.display = 'none';
  640. BX.removeClass(sw, 'sitemap-opened');
  641. }
  642. else if (!!loadedIblocks[div])
  643. {
  644. if(sw)
  645. {
  646. BX.addClass(sw, 'sitemap-opened');
  647. }
  648. BX(row).style.display = '';
  649. }
  650. else
  651. {
  652. BX(div).innerHTML = BX.message('JS_CORE_LOADING');
  653. BX.ajax.get('<?=$APPLICATION->GetCurPageParam('', array('dir', 'iblock', 'section', 'depth'))?>', {iblock:iblock,section:section,section_checked:section_checked?'Y':'N',element_checked:element_checked?'Y':'N',sessid:BX.bitrix_sessid()}, function(res)
  654. {
  655. BX(div).innerHTML = res;
  656. BX(row).style.display = '';
  657. if(sw)
  658. {
  659. BX.addClass(sw, 'sitemap-opened');
  660. }
  661. loadedIblocks[div] = true;
  662. BX.adminFormTools.modifyFormElements(BX(div));
  663. });
  664. }
  665. BX.onCustomEvent('onAdminTabsChange');
  666. }
  667. function checkAllSection(div, v)
  668. {
  669. _check_all(div, {tagName:'INPUT',property:{type:'checkbox'}, attribute:{'data-type':'section'}}, v);
  670. }
  671. function checkAllElement(div, v)
  672. {
  673. _check_all(div, {tagName:'INPUT',property:{type:'checkbox'}, attribute:{'data-type':'element'}}, v);
  674. }
  675. function setIblockActive(check, cont)
  676. {
  677. var row = check.parentNode.parentNode;
  678. if(!check.checked)
  679. {
  680. row.cells[1].style.textDecoration = 'line-through';
  681. BX('subdirs_row_' + cont).style.display = 'none';
  682. }
  683. else
  684. {
  685. row.cells[1].style.textDecoration = 'none';
  686. }
  687. }
  688. </script>
  689. <table class="internal" style="width: 80%;">
  690. <tr class="heading">
  691. <td colspan="2"><?=Loc::getMessage('SEO_SITEMAP_IBLOCK_NAME')?></td>
  692. <td width="100"><?=Loc::getMessage('SEO_SITEMAP_IBLOCK_AUTO')?></td>
  693. <td width="100"><?=Loc::getMessage('SEO_SITEMAP_IBLOCK_LIST')?></td>
  694. <td width="100"><?=Loc::getMessage('SEO_SITEMAP_IBLOCK_SECTIONS')?></td>
  695. <td width="120"><?=Loc::getMessage('SEO_SITEMAP_IBLOCK_ELEMENTS')?></td>
  696. </tr>
  697. <?
  698. $bFound = true;
  699. }
  700. $r = RandString(8);
  701. $d = $arRes['ID'];
  702. $bList = $arRes['LIST_PAGE_URL'] <> '';
  703. $bListChecked = $bList && (!is_array($arSitemap['SETTINGS']['IBLOCK_LIST']) || $arSitemap['SETTINGS']['IBLOCK_LIST'][$d] == 'Y');
  704. $bSection = $arRes['SECTION_PAGE_URL'] <> '';
  705. $bSectionChecked = $bSection && (!is_array($arSitemap['SETTINGS']['IBLOCK_SECTION']) || $arSitemap['SETTINGS']['IBLOCK_SECTION'][$d] == 'Y');
  706. $bElement = $arRes['DETAIL_PAGE_URL'] <> '';
  707. $bElementChecked = $bElement && (!is_array($arSitemap['SETTINGS']['IBLOCK_ELEMENT']) || $arSitemap['SETTINGS']['IBLOCK_ELEMENT'][$d] == 'Y');
  708. $bAuto = ($bElementChecked || $bSectionChecked) && $arSitemap['SETTINGS']['IBLOCK_AUTO'][$d] == 'Y';
  709. $bActive = !isset($arSitemap['SETTINGS']['IBLOCK_ACTIVE']) || $arSitemap['SETTINGS']['IBLOCK_ACTIVE'][$d] == 'Y';
  710. ?>
  711. <tr>
  712. <td width="20"><span onclick="loadIblock(this, '<?=$d?>', '0', '<?=$r?>', BX('IBLOCK_SECTION_<?=$d?>').checked, BX('IBLOCK_ELEMENT_<?=$d?>').checked);" class="sitemap-tree-icon-iblock"></span></td>
  713. <td<?=$bActive ? '' : ' style="text-decoration:line-through"'?>>
  714. <input type="hidden" name="IBLOCK_ACTIVE[<?=$d?>]" value="N" />
  715. <input type="checkbox" name="IBLOCK_ACTIVE[<?=$d?>]" id="IBLOCK_ACTIVE_<?=$r?>" onclick="setIblockActive(this, '<?=$r?>')"<?=$bActive ? ' checked="checked"' : ''?> value="Y" />
  716. <a href="iblock_edit.php?lang=<?=LANGUAGE_ID?>&amp;ID=<?=$d?>&amp;type=<?=$arRes['IBLOCK_TYPE_ID']?>&amp;admin=Y">[<?=$arRes['ID']?>] <?=Converter::getHtmlConverter()->encode($arRes['NAME'].' ('.$arRes['CODE'].')')?></a>
  717. </td>
  718. <td align="center"><input type="hidden" name="IBLOCK_AUTO[<?=$d?>]" value="N" /><input type="checkbox" name="IBLOCK_AUTO[<?=$d?>]" id="IBLOCK_AUTO_<?=$d?>" value="Y"<?=$bAuto?' checked="checked"':''?> />&nbsp;<label for="IBLOCK_AUTO_<?=$d?>"><?=Loc::getMessage('MAIN_YES')?></label></td>
  719. <td align="center"><input type="hidden" name="IBLOCK_LIST[<?=$d?>]" value="N" /><input type="checkbox" name="IBLOCK_LIST[<?=$d?>]" id="IBLOCK_LIST_<?=$d?>" value="Y"<?=$bList?'':' disabled="disabled"'?><?=$bListChecked?' checked="checked"':''?> />&nbsp;<label for="IBLOCK_LIST_<?=$d?>"><?=Loc::getMessage('MAIN_YES')?></label></td>
  720. <td align="center"><input type="hidden" name="IBLOCK_SECTION[<?=$d?>]" value="N" /><input type="checkbox" name="IBLOCK_SECTION[<?=$d?>]" id="IBLOCK_SECTION_<?=$d?>" value="Y"<?=$bSection?'':' disabled="disabled"'?><?=$bSectionChecked?' checked="checked"':''?> onclick="checkAllSection('<?=$r?>', this.checked);" />&nbsp;<label for="IBLOCK_SECTION_<?=$d?>"><?=Loc::getMessage('MAIN_YES')?></label></td>
  721. <td align="center"><input type="hidden" name="IBLOCK_ELEMENT[<?=$d?>]" value="N" /><input type="checkbox" name="IBLOCK_ELEMENT[<?=$d?>]" id="IBLOCK_ELEMENT_<?=$d?>" value="Y"<?=$bElement?'':' disabled="disabled"'?><?=$bElementChecked?' checked="checked"':''?> onclick="checkAllElement('<?=$r?>', this.checked);" />&nbsp;<label for="IBLOCK_ELEMENT_<?=$d?>"><?=Loc::getMessage('MAIN_YES')?></label></td>
  722. </tr>
  723. <tr style="display: none" id="subdirs_row_<?=$r?>">
  724. <?
  725. if(is_array($arSitemap['SETTINGS']['IBLOCK_SECTION_SECTION'][$arRes['ID']]))
  726. {
  727. foreach($arSitemap['SETTINGS']['IBLOCK_SECTION_SECTION'][$arRes['ID']] as $dir => $value)
  728. {
  729. ?>
  730. <input type="hidden" name="IBLOCK_SECTION_SECTION[<?=$arRes['ID']?>][<?=Converter::getHtmlConverter()->encode($dir);?>]" value="<?=$value=='N'?'N':'Y'?>" />
  731. <?
  732. }
  733. }
  734. if(is_array($arSitemap['SETTINGS']['IBLOCK_SECTION_ELEMENT'][$arRes['ID']]))
  735. {
  736. foreach($arSitemap['SETTINGS']['IBLOCK_SECTION_ELEMENT'][$arRes['ID']] as $dir => $value)
  737. {
  738. ?>
  739. <input type="hidden" name="IBLOCK_SECTION_ELEMENT[<?=$arRes['ID']?>][<?=Converter::getHtmlConverter()->encode($dir);?>]" value="<?=$value=='N'?'N':'Y'?>" />
  740. <?
  741. }
  742. }
  743. ?>
  744. <td colspan="6" align="center" id="subdirs_<?=$r?>"></td>
  745. </tr>
  746. <?
  747. }
  748. if($bFound)
  749. {
  750. ?>
  751. </table>
  752. <?
  753. }
  754. else
  755. {
  756. echo BeginNote(),Loc::getMessage('SEO_SITEMAP_NO_IBLOCK_FOUND'),EndNote();
  757. }
  758. ?>
  759. </td>
  760. </tr>
  761. <?
  762. }
  763. if($bForum)
  764. {
  765. $tabControl->BeginNextTab();
  766. ?>
  767. <tr class="adm-detail-required-field">
  768. <td width="40%"><?=Loc::getMessage("SITEMAP_FILENAME_FORUM")?>:</td>
  769. <td width="60%"><input type="text" name="FILENAME_FORUM" value="<?=Converter::getHtmlConverter()->encode($arSitemap['SETTINGS']["FILENAME_FORUM"])?>" style="width:70%"></td>
  770. </tr>
  771. <tr>
  772. <td colspan="2" align="center">
  773. <?
  774. $dbRes = CForumNew::GetListEx(array("ID" => "ASC"), array('PERMS' => array(2, 'A'), 'ACTIVE' => 'Y', 'SITE_ID' => $siteId));
  775. $bFound = false;
  776. while (!!$dbRes && ($arRes = $dbRes->Fetch()))
  777. {
  778. if(!$bFound)
  779. {
  780. ?>
  781. <script type="text/javascript">
  782. function setForumActive(check, cont)
  783. {
  784. var row = check.parentNode.parentNode;
  785. if(!check.checked)
  786. {
  787. row.cells[0].style.textDecoration = 'line-through';
  788. }
  789. else
  790. {
  791. row.cells[0].style.textDecoration = 'none';
  792. }
  793. }
  794. </script>
  795. <table class="internal" style="width: 80%;">
  796. <tr class="heading">
  797. <td><?=GetMessage("SEO_SITEMAP_FORUM")?></td>
  798. <td width="100"><?=GetMessage("SEO_SITEMAP_IBLOCK_AUTO")?></td>
  799. <td width="100"><?=GetMessage("SEO_SITEMAP_FORUM_TOPIC")?></td>
  800. </tr>
  801. <?
  802. $bFound = true;
  803. }
  804. $r = RandString(8);
  805. $d = $arRes['ID'];
  806. $bTopic = $arRes['PATH2FORUM_MESSAGE'] <> '';
  807. $bTopicChecked = $bTopic && (!is_array($arSitemap['SETTINGS']['FORUM_TOPIC']) || $arSitemap['SETTINGS']['FORUM_TOPIC'][$d] == 'Y');
  808. $bAuto = $bTopicChecked && $arSitemap['SETTINGS']['FORUM_AUTO'][$d] == 'Y';
  809. $bActive = !isset($arSitemap['SETTINGS']['FORUM_ACTIVE']) || $arSitemap['SETTINGS']['FORUM_ACTIVE'][$d] == 'Y';
  810. ?>
  811. <tr>
  812. <td<?=$bActive ? '' : ' style="text-decoration:line-through"'?>>
  813. <input type="hidden" name="FORUM_ACTIVE[<?=$d?>]" value="N" />
  814. <input type="checkbox" name="FORUM_ACTIVE[<?=$d?>]" id="FORUM_ACTIVE_<?=$r?>" onclick="setForumActive(this, '<?=$r?>')"<?=$bActive ? ' checked="checked"' : ''?> value="Y" />
  815. <a href="forum_edit.php?lang=<?=LANGUAGE_ID?>&amp;ID=<?=$d?>">[<?=$arRes['ID']?>] <?=Converter::getHtmlConverter()->encode($arRes['NAME'])?></a>
  816. </td>
  817. <td align="center"><input type="hidden" name="FORUM_AUTO[<?=$d?>]" value="N" /><input type="checkbox" name="FORUM_AUTO[<?=$d?>]" id="FORUM_AUTO_<?=$d?>" value="Y"<?=$bAuto?' checked="checked"':''?> />&nbsp;<label for="FORUM_AUTO_<?=$d?>"><?=Loc::getMessage('MAIN_YES')?></label></td>
  818. <td align="center"><input type="hidden" name="FORUM_TOPIC[<?=$d?>]" value="N" /><input type="checkbox" name="FORUM_TOPIC[<?=$d?>]" id="FORUM_TOPIC_<?=$d?>" value="Y"<?=$bTopic?'':' disabled="disabled"'?><?=$bTopicChecked?' checked="checked"':''?> />&nbsp;<label for="FORUM_ELEMENT_<?=$d?>"><?=Loc::getMessage('MAIN_YES')?></label></td>
  819. </tr>
  820. <?
  821. }
  822. if($bFound)
  823. {
  824. ?>
  825. </table>
  826. <?
  827. }
  828. else
  829. {
  830. echo BeginNote(),Loc::getMessage('SEO_SITEMAP_NO_FORUM_FOUND'),EndNote();
  831. }
  832. ?>
  833. </td>
  834. </tr>
  835. <?
  836. }
  837. $tabControl->Buttons(array());
  838. ?>
  839. <input type="submit" name="save_and_add" value="<?=Converter::getHtmlConverter()->encode(Loc::getMessage('SEO_SITEMAP_SAVEANDRUN'))?>" />
  840. <?=bitrix_sessid_post();?>
  841. <?
  842. $tabControl->End();
  843. require_once ($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/epilog_admin.php");
  844. ?>