<?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;
$where = 'WHERE active!=0';
$order = 'c.date DESC';
$queryDB = $core->select_data('content', $where, $order, 'c.*, l.*', 'as c LEFT JOIN ' . DB_PREFIX . '_langs as l on(l.postId=c.id and l.module="content")');
if ($db->numRows($queryDB) > 0) {
    while ($static = $db->getRow($queryDB)) {
        $link = $static['cat'] !== ',0,' ? 'content/' . $core->getCat('content', $static['cat'], 'development') . '/' : 'content/';
        $core->ins_data('sitemap', 'id,name,url', 'NULL,"' . $static['title'] . '","' . $config['url'] . '/' . $link . $static['translate'] . '.html"');
    }
}