} 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);
$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);
// $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'); }
} 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);