This repository was archived by the owner on Mar 26, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrss_displayer.php
More file actions
59 lines (43 loc) · 1.99 KB
/
rss_displayer.php
File metadata and controls
59 lines (43 loc) · 1.99 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
<?php
require getcwd() . '/vendor/autoload.php'; // Composer
header("Last-Modified: " . gmdate('D, d M Y H:i:s') . " GMT");
header("Content-Type: text/plain; charset=utf-8");
$httpModSince = !empty($_SERVER['HTTP_IF_MODIFIED_SINCE']) ? strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) : 0;
$feed = new SimplePie();
$feed->set_feed_url(str_replace("]]", "", str_replace("![CDATA[", "", $_REQUEST["feedurl"])));
$feed->init();
$feed->handle_content_type();
$wc24mimebounary = "BoundaryForDL" . date("YmdHi") . "/" . rand(1000000, 9999999);
echo "--".$wc24mimebounary."\r\n";
echo "Content-Type: text/plain\r\n\r\n";
echo "This part is ignored.\r\n\r\n\r\n";
foreach($feed->get_items() as $item) {
if (strtotime($item->get_date()) - $httpModSince < 0) {
continue;
}
/* Create the main body text. */
echo "--".$wc24mimebounary."\r\n".
"Content-Type: text/plain\r\n\r\n".
"Date: " . gmdate('D, d M Y H:i:s') . " +0000 (UTC)\r\n".
//"Date: " . $item->get_gmdate("D, d M Y H:i:s") . " +0000 (UTC)\r\n".
"From: w9999999900000000@rc24.xyz\r\n".
"To: allusers@rc24.xyz\r\n".
"Subject: \r\n".
"MIME-Version: 1.0\r\n".
"Content-Type: text/plain; charset=utf-8\r\n".
"Content-Transfer-Encoding: 7bit\r\n".
"X-Wii-AltName: " . base64_encode(mb_convert_encoding($_REQUEST["title"], "UTF-16", "auto")) . "\r\n".
"X-Wii-MB-NoReply: 1\r\n\r\n";
$raw_description = \Soundasleep\Html2Text::convert($item->get_content(), array("drop_links" => true));
$description = mb_convert_encoding($item->get_title(), "UTF-8", "auto") . "\r\n";
$description .= "-- " . $item->get_link() . "\r\n\r\n";
$description .= mb_convert_encoding($raw_description, "UTF-8", "auto");
// Message text can't be longer than ~3000 characters
$description = strlen($description) > 2900 ? substr($description,0,2900)."[...]" : $description;
echo $description . "\r\n\r\n";
if ($httpModSince == 0) {
break; // Show only one entry for first request
}
}
echo "--".$wc24mimebounary."--"."\r\n\r\n";
?>