blob: 775127c4ac65953ea9753bb727e03adfc5261b32 (
plain)
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
|
<?php
header('Content-Type: text/xml');
echo '<rss version="2.0"><channel>';
echo '<title>bugwo.men guestbook</title>';
echo '<description>The guestbook and blog comments on bugwo.men</description>';
echo '<language>en-us</language>';
echo '<link>https://bugwo.men/guestbook/</link>';
echo '<generator>My crappy PHP code</generator>';
include($_SERVER['DOCUMENT_ROOT']."/Parsedown.php");
$Parsedown = new Parsedown();
$Parsedown->setSafeMode(true);
include($_SERVER['DOCUMENT_ROOT'] . '/common.php');
$postlist = json_decode(file_get_contents($datadir."posts.json"));
$index = 1;
$totaloutput = "";
foreach($postlist as $post) {
if($post->modstatus == 1) {
$output = "";
$entry = $post->entry;
$date = date("D, d M Y H:m:s", $post->date) . " GMT";
$name = $post->name;
$message = $Parsedown->text($post->message);
$found = $post->found;
$website = $post->website;
$cool = $post->cool;
$reply = $Parsedown->text($post->reply);
if($website) { $output = $output."<p><a href='$website'>$name</a>:</p>"; }
else { $output = $output."</p>$name:</p>"; }
if($cool) {
$output = $output."<p><b>cool thing</b>: <a href='$cool'>$cool</a></p>";
}
if($found) {
$output = $output."<p><b>How did you find me?</b><br>$found</p>";
}
$output = $output.$message;
if($reply) {
$output = $output."<hr><p><b>Reply</b>:</p>$reply";
}
$output_sanitized = preg_replace("/&gt;/", ">", preg_replace("/&lt;/", "<", htmlspecialchars($output)));
$totaloutput = "<item><title>Entry #" . $index . " on " . $entry . " - " . $name . "</title><link>https://bugwo.men/guestbook/</link><pubDate>" . $date . "</pubDate><description>".$output_sanitized."</description><guid isPermaLink='false'>" . $index . $post->date . $name . "</guid></item>\n".$totaloutput;
$index++;
}
}
echo $totaloutput;
echo "</channel></rss>";
|