<?php

/*
 * @name        JMY CMS
 * @link        https://jmy.su/
 * @copyright   Copyright (C) 2012-2025 JMY LTD
 * @license     LICENSE.txt (see attached file)
 * @version     VERSION.txt (see attached file)
 * @author      Komarov Ivan
 * @edited      Orlov Alexsey
 */

if (!defined('ACCESS')) {
    header('Location: /');
    exit;
}
global $core, $db, $config;
$query = $core->select_data('board_forums', false, 'id ASC');
if ($db->numRows($query) > 0) {
    while ($board = $db->getRow($query)) {
        $core->ins_data('sitemap', 'id,name,url', 'NULL,"' . $board['title'] . '","' . $config['url'] . '/board/forum-' . $board['id'] . '"');
        $queryPOST = $core->select_data('board_threads', 'forum ="' . $board['id'] . '"', 'id ASC');
        if ($db->numRows($queryPOST) > 0) {
            while ($board_threads = $db->getRow($queryPOST)) {
                $core->ins_data('sitemap', 'id,name,url', 'NULL,"' . $board_threads['title'] . '","' . $config['url'] . '/board/topic-' . $board_threads['id'] . '"');
            }
        }
    }
}