<?php
/*
 * @name           JMY CORE
 * @link           https://jmy.su/
 * @copyright      Copyright (C) 2012-2021 JMY LTD
 * @license        LICENSE.txt (see attached file)
 * @version        VERSION.txt (see attached file)
 * @author         Komarov Ivan
 */
if (!defined('ACCESS')) {
    header('Location: /');
    exit;
}
global $core, $db, $config;
$where = 'WHERE active = 1';
$order = 'date DESC';
$queryDB = $core->select_data('news', $where, $order, 'n.*, c.*', 'as n LEFT JOIN ' . DB_PREFIX . '_langs as c on(c.postId=n.id and c.module="news")');
if ($db->numRows($queryDB) > 0) {
    while ($news = $db->getRow($queryDB)) {
        $news_link = $news['cat'] !== ',0,' ? 'news/' . $core->getCat('news', $news['cat'], 'development') . '/' : 'news/';
        $core->ins_data('sitemap', 'id,name,url', 'NULL,"' . $news['title'] . '","' . $config['url'] . '/' . $news_link . $news['altname'] . '.html"');
    }
}