} global $sitemap_show_objects, $sitemap_articles; $sitemap_show_objects = System::config('general/sitemap_show_objects') ? '___SitemapPluginArticles2' : null; $sitemap_articles = array(); if (isset($sitemap_show_objects)) { $articles = System::database()->Select('articles', "`active` = '1' and `view` = '4'", null, 'public'); // Только включенные и доступные гостям foreach ($articles as $art) { $sitemap_articles[$art['cat_id']][] = array($art['title'], Ufu('index.php?name=articles&op=read&art=' . SafeDB($art['id'], 11, int) . '&cat=' . SafeDB($art['cat_id'], 11, int), 'articles/{cat}/{art}/')); } unset($articles); } function ___SitemapPluginArticles($Cat, $Level) { SitemapAddObject($Level, $Cat['title'], Ufu('index.php?name=articles&cat=' . SafeDB($Cat['id'], 11, int), 'articles/{cat}')); } function ___SitemapPluginArticles2($CatId, $Level) { global $sitemap_articles; if (isset($sitemap_articles[$CatId])) { foreach ($sitemap_articles[$CatId] as $art) { SitemapAddObject($Level, $art[0], $art[1], ''); } } } $articles_cats = new Tree('articles_cats'); if (count($articles_cats->IdCats) > 0) { SitemapAddCategory('Статьи'); $articles_cats->ListingTree(0, '___SitemapPluginArticles', $sitemap_show_objects); } unset($articles_cats, $sitemap_articles);
// $link = SafeDB($p['text'], 255, str); // if(substr($link, 0, 6) == 'mod://'){ // $link = Ufu('index.php?name='.substr($link, 6), '{name}/'); // } // } $p['link'] = $link; $pages[] = $p; } function ___SitemapPagesPlugin($Page, $Level) { global $pages_tree; if ($Page['type'] != 'page') { $child_ids = $pages_tree->GetAllChildId($Page['id']); $find_page = false; foreach ($child_ids as $cid) { if ($pages_tree->IdCats[$cid]['type'] == 'page') { $find_page = true; } } if (!$find_page) { return false; // Останавливаем вывод дочерних элементов } } SitemapAddObject($Level, $Page['title'], $Page['link']); } $pages_tree = new Tree($pages); if (count($pages_tree->IdCats) > 0) { SitemapAddCategory('Страницы'); $pages_tree->ListingTree(0, '___SitemapPagesPlugin'); }
$sitemap_gallery = array(); if (isset($sitemap_show_objects)) { $gallery_images = System::database()->Select('gallery', "`show` = '1' and `view` = '4'", null, 'order'); // Только включенные и доступные гостям foreach ($gallery_images as $img) { $sitemap_gallery[$img['cat_id']][] = array($img['title'], Ufu('index.php?name=gallery&op=view&img=' . SafeDB($img['id'], 11, int) . '&cat=' . SafeDB($img['cat_id'], 11, int), 'gallery/{cat}/{img}/')); } unset($gallery_images); } function ___SitemapPluginGallery($Cat, $Level) { SitemapAddObject($Level, $Cat['title'], Ufu('index.php?name=gallery&cat=' . SafeDB($Cat['id'], 11, int), 'gallery/{cat}')); } function ___SitemapPluginGalleryImages($CatId, $Level) { global $sitemap_gallery; if (isset($sitemap_gallery[$CatId])) { foreach ($sitemap_gallery[$CatId] as $index => $img) { if ($img[0] == '') { $img[0] = 'Изображение ' . strval($index + 1); } SitemapAddObject($Level, $img[0], $img[1], ''); } } } $gallery_cats = new Tree('gallery_cats'); if (count($gallery_cats->IdCats) > 0) { SitemapAddCategory('Фотогалерея'); $gallery_cats->ListingTree(0, '___SitemapPluginGallery', $sitemap_show_objects); } unset($gallery_cats, $sitemap_gallery);
} global $sitemap_show_objects, $sitemap_downloads; $sitemap_show_objects = System::config('general/sitemap_show_objects') ? '___SitemapPluginDownloads2' : null; $sitemap_downloads = array(); if (isset($sitemap_show_objects)) { $downloads = System::database()->Select('downloads', "`active` = '1' and `view` = '4'", null, 'public'); // Только включенные и доступные гостям foreach ($downloads as $d) { $sitemap_downloads[$d['category']][] = array(SafeDB($d['title'], 250, str), Ufu('index.php?name=downloads&op=full&file=' . SafeDB($d['id'], 11, int) . '&cat=' . SafeDB($d['category'], 11, int), 'downloads/{cat}/{file}/')); } unset($downloads); } function ___SitemapPluginDownloads($Cat, $Level) { SitemapAddObject($Level, $Cat['title'], Ufu('index.php?name=downloads&cat=' . SafeDB($Cat['id'], 11, int), 'downloads/{cat}')); } function ___SitemapPluginDownloads2($CatId, $Level) { global $sitemap_downloads; if (isset($sitemap_downloads[$CatId])) { foreach ($sitemap_downloads[$CatId] as $d) { SitemapAddObject($Level, $d[0], $d[1], ''); } } } $downloads_cats = new Tree('downloads_cats'); if (count($downloads_cats->IdCats) > 0) { SitemapAddCategory('Загрузки'); $downloads_cats->ListingTree(0, '___SitemapPluginDownloads', $sitemap_show_objects); } unset($downloads_cats, $sitemap_downloads);
if (isset($sitemap_show_objects)) { $forum_topics = System::database()->Select('forum_topics', "`delete` = '0'", null, 'start_date'); // Только включенные и доступные гостям foreach ($forum_topics as $topic) { $sitemap_forum_topics[$topic['forum_id']][] = array($topic['title'], Ufu('index.php?name=forum&op=showtopic&topic=' . SafeDB($topic['id'], 11, int), 'forum/topic{topic}.html')); } unset($forum_topics); } function ___SitemapPluginForum($Forum, $Level, $i, $c) { global $forums_tree; $forum_config = $forums_tree->GetForumConfigRecursive($Forum['id'], ACCESS_ALL); if (!$forum_config['access']) { return false; } SitemapAddObject($Level, $Forum['title'], Ufu('index.php?name=forum&op=showforum&forum=' . SafeDB($Forum['id'], 11, int), 'forum/{forum}/')); } function ___SitemapPluginForumTopics($ForumId, $Level) { global $sitemap_forum_topics; if (isset($sitemap_forum_topics[$ForumId])) { foreach ($sitemap_forum_topics[$ForumId] as $topic) { SitemapAddObject($Level, $topic[0], $topic[1], ''); } } } if (count($forums_tree->IdCats) > 0) { SitemapAddCategory('Форум'); $forums_tree->ListingTree(0, '___SitemapPluginForum', $sitemap_show_objects); } unset($forums_tree, $sitemap_forum_topics);
global $sitemap_show_objects; $sitemap_show_objects = System::config('general/sitemap_show_objects'); $sitemap_news_topics = array(); $sitemap_news = array(); // Получаем разделы и новости $news_topicsdb = System::database()->Select('news_topics'); foreach ($news_topicsdb as $t) { $sitemap_news_topics[] = array($t['id'], $t['title'], Ufu('index.php?name=news&topic=' . SafeDB($t['id'], 11, int), 'news/{topic}/')); } if ($sitemap_show_objects) { // Загружаем новости $newsdb = System::database()->Select('news', "`enabled`='1' and `view`='4'", null, 'date'); foreach ($newsdb as $n) { $sitemap_news[$n['topic_id']][] = array($n['title'], Ufu('index.php?name=news&op=readfull&news=' . SafeDB($n['id'], 11, int) . '&topic=' . SafeDB($n['topic_id'], 11, int), 'news/{topic}/{news}/')); } unset($newsdb); } // Выводим if (count($sitemap_news_topics) > 0) { SitemapAddCategory('Новости'); foreach ($sitemap_news_topics as $t) { global $sitemap_show_objects; SitemapAddObject(0, $t[1], $t[2]); if ($sitemap_show_objects && isset($sitemap_news[$t[0]])) { foreach ($sitemap_news[$t[0]] as $n) { SitemapAddObject(1, $n[0], $n[1], ''); } } } } unset($sitemap_news, $sitemap_news_topics);