Exemplo n.º 1
0
 protected static function checkParams($arMessage = array(), &$arTopic, &$arForum)
 {
     if (\Bitrix\Main\Loader::includeModule('forum')) {
         $arTopic = !empty($arTopic) ? $arTopic : \CForumTopic::GetByID($arMessage["TOPIC_ID"]);
         if (empty($arTopic)) {
             return false;
         }
         $arSitemaps = SitemapForumTable::getSitemapsByEntityId($arTopic["FORUM_ID"]);
         if (!empty($arSitemaps) && ($arForum = \CForumNew::GetByIDEx($arTopic["FORUM_ID"])) && $arForum) {
             $arForum["PATH2FORUM_MESSAGE"] = \CForumNew::GetSites($arTopic["FORUM_ID"]);
             $date = MakeTimeStamp($arTopic['LAST_POST_DATE']);
             $result = array();
             foreach ($arSitemaps as $arSitemap) {
                 $path = $arForum["PATH2FORUM_MESSAGE"][$arSitemap["SITE_ID"]];
                 if (!empty($path)) {
                     $arSitemap["fileName"] = str_replace("#FORUM_ID#", $arForum["ID"], $arSitemap['SITEMAP_FILE_FORUM']);
                     $arSitemap["url"] = \CForumNew::PreparePath2Message($path, array("FORUM_ID" => $arForum["ID"], "TOPIC_ID" => $arTopic["ID"], "TITLE_SEO" => $arTopic["TITLE_SEO"], "MESSAGE_ID" => "s", "SOCNET_GROUP_ID" => $arTopic["SOCNET_GROUP_ID"], "OWNER_ID" => $arTopic["OWNER_ID"], "PARAM1" => $arTopic["PARAM1"], "PARAM2" => $arTopic["PARAM2"]));
                     $arSitemap["date"] = $date;
                     $result[] = $arSitemap;
                 }
             }
             return empty($result) ? false : $result;
         }
     }
     return false;
 }
Exemplo n.º 2
0
        }
        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)));
                    }
                }
            }
            SitemapForumTable::clearBySitemap($ID);
            if (is_array($_REQUEST['FORUM_AUTO'])) {
                foreach ($_REQUEST['FORUM_AUTO'] as $forumId => $auto) {
                    if ($auto === 'Y') {
                        $result = SitemapForumTable::add($ID, $forumId);
                    }
                }
            }
            if ($_REQUEST["save"] != '') {
                LocalRedirect(BX_ROOT . "/admin/seo_sitemap.php?lang=" . LANGUAGE_ID);
            } elseif ($_REQUEST["save_and_add"] != '') {
                LocalRedirect(BX_ROOT . "/admin/seo_sitemap.php?lang=" . LANGUAGE_ID . "&run=" . $ID . "&" . bitrix_sessid_get());
            } else {
                LocalRedirect(BX_ROOT . "/admin/seo_sitemap_edit.php?lang=" . LANGUAGE_ID . "&ID=" . $ID . "&" . $tabControl->ActiveTabParam());
            }
        } else {
            $errors = $result->getErrorMessages();
        }
    }
}