Skip to content

Commit

Permalink
RSS fixes...now works with Firefox/Thunderbird.
Browse files Browse the repository at this point in the history
  • Loading branch information
icculus committed Dec 11, 2004
1 parent 0f11081 commit f9f58a9
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 36 deletions.
85 changes: 50 additions & 35 deletions IcculusNews_daemon.pl
Expand Up @@ -501,32 +501,19 @@ sub generate_rdf {
$sth = $link->prepare($sql);
$sth->execute() or die "can't execute the query: $sth->errstr";

my $rdf = <<__EOF__;
<?xml version="1.0" encoding="utf-8"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns="http://purl.org/rss/1.0/">
<channel rdf:about="$rdfurl">
<title>$queuename</title>
<link>$siteurl</link>
<archives>$itemarcurl</archives>
<description>$queuedesc</description>
</channel>
__EOF__

my $channelimg = '';
my $rdfimg = '';
if (defined $rdfimgurl) {
$rdf .= <<__EOF__;
<image>
<title>$queuename</title>
<url>$rdfimgurl</url>
<link>$siteurl</link>
</image>
__EOF__
$channelimg = "<image rdf:resource=\"$rdfimgurl\" />";
$rdfimg .= "<image>\n";
$rdfimg .= " <title>$queuename</title>\n";
$rdfimg .= " <url>$rdfimgurl</url>\n";
$rdfimg .= " <link>$siteurl</link>\n";
$rdfimg .= " </image>";
}

my $rdfitems = '';
my $digestitems = '';
while (my @row = $sth->fetchrow_array()) {
my $authorid = $row[0];
my $itemid = $row[1];
Expand All @@ -539,21 +526,49 @@ sub generate_rdf {
my $viewurl = $itemviewurl;
1 while ($viewurl =~ s/\%id/$itemid/);

$rdf .= " <item rdf:about=\"$viewurl\">\n";
$rdf .= " <title>$itemtitle</title>\n";
$rdf .= " <link>$viewurl</link>\n";
$rdf .= " <author>$authorname</author>\n";
$rdf .= " <authorid>$authorid</authorid>\n";
$rdf .= " <itemid>$itemid</itemid>\n";
$rdf .= " <postdate>$itempostdate</postdate>\n";
$rdf .= " <ipaddr>$ipaddr</ipaddr>\n";
$rdf .= " <approved>$approved</approved>\n";
$rdf .= " <deleted>$deleted</deleted>\n";
$rdf .= " </item>\n";
$digestitems .= "<rdf:li rdf:resource=\"$viewurl\" />\n ";

$rdfitems .= "\n";
$rdfitems .= " <item rdf:about=\"$viewurl\">\n";
$rdfitems .= " <title>$itemtitle</title>\n";
$rdfitems .= " <link>$viewurl</link>\n";
$rdfitems .= " <author>$authorname</author>\n";
$rdfitems .= " <authorid>$authorid</authorid>\n";
$rdfitems .= " <itemid>$itemid</itemid>\n";
$rdfitems .= " <postdate>$itempostdate</postdate>\n";
$rdfitems .= " <ipaddr>$ipaddr</ipaddr>\n";
$rdfitems .= " <approved>$approved</approved>\n";
$rdfitems .= " <deleted>$deleted</deleted>\n";
$rdfitems .= " </item>";
}
$sth->finish();

$rdf .= "</rdf:RDF>\n\n";
my $rdf = <<__EOF__;
<?xml version="1.0" encoding="utf-8"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns="http://purl.org/rss/1.0/">
<channel rdf:about="$rdfurl">
<title>$queuename</title>
<link>$siteurl</link>
<archives>$itemarcurl</archives>
<description>$queuedesc</description>
$channelimg
<items>
<rdf:Seq>
$digestitems
</rdf:Seq>
</items>
</channel>
$rdfimg
$rdfitems
</rdf:RDF>
__EOF__

return(undef, $rdf, $rdffile);
}

Expand Down
2 changes: 1 addition & 1 deletion php_interface/IcculusNews.php
Expand Up @@ -413,7 +413,7 @@ function news_parse_rdf($filename, &$digestarray, $max_items = 5)

while ($count < $max_items)
{
while (strstr(fgets($in, 4096), "<item") == false)
while (strstr(fgets($in, 4096), "<item rdf") == false)
{
if (feof($in))
break;
Expand Down

0 comments on commit f9f58a9

Please sign in to comment.