<?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;
}
loadConfigBLOCK('calendar');
global $cache, $core, $lang, $calendar_conf;
$core->loadblockLang('calendar');
if ($calendar_conf['on']) {
    $calContent = $cache->do_get('calendar_block_' . $core->lang);
    if (empty($calContent)) {
        if (!function_exists('calendar')) require ROOT . 'usr/plugins/calendar.plugin.php';
        $calContent = calendar('', '');
        $cache->do_put('calendar_block_' . $core->lang, $calContent, 1200);
    }
    if ($calendar_conf['old']) {
        echo '<div class="calendar">' . $calContent . '</div>';
    } else {
        $core->tpl->loadFile('blocks/calendar');
        $core->tpl->setVar('CALENDAR', $calContent);
        $core->tpl->end();
    }
} else {
    if ($calendar_conf['info_off']) $core->tpl->info($lang['calendar_off']);
}