1<?php
2/**
3 * XOOPS feed creator
4 *
5 * You may not change or alter any portion of this comment or credits
6 * of supporting developers from this source code or any supporting source code
7 * which is considered copyrighted (c) material of the original comment or credit authors.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11 *
12 * @copyright       (c) 2000-2016 XOOPS Project (www.xoops.org)
13 * @license             GNU GPL 2 (http://www.gnu.org/licenses/gpl-2.0.html)
14 * @since               2.0.0
15 */
16
17include __DIR__ . '/mainfile.php';
18
19$GLOBALS['xoopsLogger']->activated = false;
20if (function_exists('mb_http_output')) {
21    mb_http_output('pass');
22}
23header('Content-Type:text/xml; charset=utf-8');
24
25include_once $GLOBALS['xoops']->path('class/template.php');
26$tpl                 = new XoopsTpl();
27$tpl->caching        = 2;
28$tpl->cache_lifetime = 3600;
29if (!$tpl->is_cached('db:system_rss.tpl')) {
30    xoops_load('XoopsLocal');
31    $tpl->assign('channel_title', XoopsLocal::convert_encoding(htmlspecialchars($xoopsConfig['sitename'], ENT_QUOTES)));
32    $tpl->assign('channel_link', XOOPS_URL . '/');
33    $tpl->assign('channel_desc', XoopsLocal::convert_encoding(htmlspecialchars($xoopsConfig['slogan'], ENT_QUOTES)));
34    $tpl->assign('channel_lastbuild', formatTimestamp(time(), 'rss'));
35    $tpl->assign('channel_webmaster', checkEmail($xoopsConfig['adminmail'], true));
36    $tpl->assign('channel_editor', checkEmail($xoopsConfig['adminmail'], true));
37    $tpl->assign('channel_category', 'News');
38    $tpl->assign('channel_generator', 'XOOPS');
39    $tpl->assign('channel_language', _LANGCODE);
40    $tpl->assign('image_url', XOOPS_URL . '/images/logo.png');
41    $dimension = getimagesize(XOOPS_ROOT_PATH . '/images/logo.png');
42    if (empty($dimension[0])) {
43        $width = 88;
44    } else {
45        $width = ($dimension[0] > 144) ? 144 : $dimension[0];
46    }
47    if (empty($dimension[1])) {
48        $height = 31;
49    } else {
50        $height = ($dimension[1] > 400) ? 400 : $dimension[1];
51    }
52    $tpl->assign('image_width', $width);
53    $tpl->assign('image_height', $height);
54    if (file_exists($fileinc = $GLOBALS['xoops']->path('modules/news/class/class.newsstory.php'))) {
55        include $fileinc;
56        $sarray = NewsStory::getAllPublished(10, 0, true);
57    }
58    if (!empty($sarray) && is_array($sarray)) {
59        foreach ($sarray as $story) {
60            $tpl->append('items', array(
61                'title'       => XoopsLocal::convert_encoding(htmlspecialchars($story->title(), ENT_QUOTES)),
62                'link'        => XOOPS_URL . '/modules/news/article.php?storyid=' . $story->storyid(),
63                'guid'        => XOOPS_URL . '/modules/news/article.php?storyid=' . $story->storyid(),
64                'pubdate'     => formatTimestamp($story->published(), 'rss'),
65                'description' => XoopsLocal::convert_encoding(htmlspecialchars($story->hometext(), ENT_QUOTES))));
66        }
67    }
68}
69$tpl->display('db:system_rss.tpl');
70