-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathrss.php
More file actions
73 lines (71 loc) · 4.17 KB
/
rss.php
File metadata and controls
73 lines (71 loc) · 4.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<?php
###############################################################################
# my little forum #
# Copyright (C) 2004-2008 Alex #
# http://www.mylittlehomepage.net/ #
# Copyright (C) 2009-2019 H. August #
# https://www.projekt-mlf.de/ #
# #
# This program is free software; you can redistribute it and/or #
# modify it under the terms of the GNU General Public License #
# as published by the Free Software Foundation; either version 2 #
# of the License, or (at your option) any later version. #
# #
# This program is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with this program; if not, write to the Free Software #
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #
###############################################################################
include("inc.php");
// database request
if ($categories == false)
{
$result=mysqli_query($connid, "SELECT id, pid, UNIX_TIMESTAMP(time + INTERVAL ". $time_difference ." HOUR) AS xtime, UNIX_TIMESTAMP(time + INTERVAL ". $time_difference ." HOUR) AS rss_time, name, subject, text FROM ". $db_settings['forum_table'] ." ORDER BY time DESC LIMIT 15");
if(!$result) die($lang['db_error']);
}
elseif (is_array($categories))
{
$result=mysqli_query($connid, "SELECT id, pid, UNIX_TIMESTAMP(time + INTERVAL ". $time_difference ." HOUR) AS xtime, UNIX_TIMESTAMP(time + INTERVAL ". $time_difference ." HOUR) AS rss_time, name, subject, text FROM ". $db_settings['forum_table'] ." WHERE category IN (". $category_ids_query .") ORDER BY time DESC LIMIT 15");
if(!$result) die($lang['db_error']);
}
$result_count = mysqli_num_rows($result);
header("Content-Type: text/xml; charset=utf-8");
?><?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
<title><?php echo $settings['forum_name']; ?></title>
<link><?php echo $settings['forum_address']; ?></link>
<description><?php echo $settings['forum_name']; ?></description>
<language><?php echo $lang['language']; ?></language>
<?php
if ($result_count > 0 && $settings['provide_rssfeed'] == 1 && $settings['access_for_users_only'] == 0)
{
while ($zeile = mysqli_fetch_assoc($result))
{
$ftext = htmlsc($zeile["text"]);
$ftext = make_link($ftext);
$ftext = preg_replace("#\[msg\](.+?)\[/msg\]#is", "\\1", $ftext);
$ftext = preg_replace("#\[msg=(.+?)\](.+?)\[/msg\]#is", "\\2 --> \\1", $ftext);
$ftext = bbcode($ftext, true);
$ftext = nl2br($ftext);
$ftext = rss_quote($ftext);
$title = $zeile['subject'];
$title = htmlsc($title);
$name = $zeile['name'];
$name = htmlsc($name);
?><item>
<title><?php echo $title; ?></title>
<content:encoded><![CDATA[<i><?php if ($zeile['pid']==0) { $rss_author_info = str_replace("[name]", $name, $lang['rss_posting_by']); echo str_replace("[time]", strftime($lang['time_format'],$zeile["xtime"]), $rss_author_info); } else { $rss_author_info = str_replace("[name]", $name, $lang['rss_reply_by']); echo str_replace("[time]", strftime($lang['time_format'],$zeile["xtime"]), $rss_author_info); } ?></i><br /><br /><?php echo $ftext; ?>]]></content:encoded>
<link><?php echo $settings['forum_address']."forum_entry.php?id=".$zeile['id']; ?></link>
<pubDate><?php setlocale(LC_TIME, "C"); echo strftime($lang['rss_time'],$zeile['rss_time']); setlocale(LC_TIME, $lang['locale']); ?></pubDate>
</item>
<?php
}
}
?>
</channel>
</rss>