hpr_hub/social_media_rss.php

112 lines
4.1 KiB
PHP
Raw Normal View History

2023-12-23 10:24:21 +00:00
<?php
$atomurl=$_SERVER['PHP_SELF'];
require "/home/hpr/php/include.php";
$query = "SELECT
hosts.host as host,
eps.id as id,
eps.title as title,
eps.summary as summary,
eps.date as date,
hosts.email as email,
eps.hostid as hostid,
eps.explicit as explicit,
eps.version as version,
eps.valid as valid
FROM
eps,
hosts
WHERE
eps.valid = 1
AND eps.hostid = hosts.hostid
AND eps.date <= UTC_DATE()
ORDER BY
id DESC
Limit 10";
header("Content-type: application/xml");
header("Pragma: public");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
date_default_timezone_set('UTC');
?>
<rss version="2.0" xmlns:atom="https://www.w3.org/2005/Atom" xmlns:itunes="https://www.itunes.com/dtds/podcast-1.0.dtd" >
<channel>
<title>Hacker Public Radio</title>
<link>https://hackerpublicradio.org/about.html</link>
<itunes:subtitle>A daily show hosted the community on topics that are of interest to hackers and hobbyists.</itunes:subtitle>
<description>Hacker Public Radio is an podcast that releases shows every weekday Monday through Friday. Our shows are produced by the community (you) and can be on any topic that are of interest to hackers and hobbyists.</description>
<language>en-us</language>
<itunes:category text="Technology">
<itunes:category text="Tech News"/>
</itunes:category>
<itunes:category text="Education">
<itunes:category text="Training"/>
</itunes:category>
<itunes:image href="https://hackerpublicradio.org/images/hpr_feed_itunes.png"/>
<itunes:explicit>yes</itunes:explicit>
<itunes:keywords>Community Radio, Tech Interviews, Linux, Open, Hobby, Software Freedom</itunes:keywords>
<copyright>Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) License</copyright>
<managingEditor>feedback@NOSPAM-hackerpublicradio.org (HPR Feedback)</managingEditor>
<itunes:owner>
<itunes:name>HPR Webmaster</itunes:name>
<itunes:email>admin@hackerpublicradio.org</itunes:email>
</itunes:owner>
<webMaster>admin@NOSPAM-hackerpublicradio.org (HPR Webmaster)</webMaster>
<generator>kate</generator>
<docs>https://www.rssboard.org/rss-specification</docs>
<ttl>43200</ttl>
<skipDays>
<day>Saturday</day>
<day>Sunday</day>
</skipDays>
<image>
<url>https://hackerpublicradio.org/images/hpr_feed_small.png</url>
<title>Hacker Public Radio</title>
<link>https://hackerpublicradio.org/about.html</link>
<description>The Hacker Public Radio Old Microphone Logo</description>
<height>164</height>
<width>144</width>
</image>
<?php
print " <atom:link href=\"https://hub.hackerpublicradio.org". str_replace('&', '&amp;', $_SERVER["REQUEST_URI"]) ."\" rel=\"self\" type=\"application/rss+xml\" />\n";
print " <pubDate>".date(DATE_RFC1123, strtotime(date('Y-m-d')))."</pubDate>\n";
//Set $r to SQL query for execution agains the table
if ($result = mysqli_query($connection, $query)) {
while ($row = mysqli_fetch_array($result)) {
$id = fixid(stripslashes($row['id']));
$version = fixid(stripslashes($row['version']));
$url="https://hackerpublicradio.org/eps/hpr".$id."/index.html";
$itunes_summary = htmlspecialchars(stripslashes(strip_tags(substr($row["summary"],0,100))));
$show_summary = $itunes_summary;
echo " <item>\n";
echo " <title>HPR$id: " . stripslashes(strip_tags($row["title"])) . "</title>\n";
// echo "<description> " . ($row["title"]) . "</description>\n";
$email_padded = formatemail($row['email']);
echo " <author>".$email_padded . " (" . htmlspecialchars(stripslashes(strip_tags($row["host"]))) .")</author>\n";
echo " <link>" . $url . "</link>\n";
echo " <description>" . $show_summary . "</description>\n";
echo " <pubDate>" .date(DATE_RFC1123, strtotime($row['date'])) . "</pubDate>\n";
echo " <guid>" . $url . "</guid>\n";
$explicit = $row['id'];
if ( $explicit === "0" ) {
echo " <itunes:explicit>clean</itunes:explicit>\n";
}
else {
echo " <itunes:explicit>yes</itunes:explicit>\n";
}
echo " </item>\n";
}
}
//Display non-connection errors
//Close sql connection
mysqli_close($connection);
echo " </channel>
</rss>
";
?>