Initial commit.
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
<?
|
||||
require_once('./open_db.lib.php');
|
||||
open_db('open');
|
||||
require_once('./get_data.lib.php');
|
||||
include_once('./lib/convert_entities.inc.php');
|
||||
|
||||
if (!isset($num_stories) || !is_numeric($num_stories)) $num_stories = 10;
|
||||
$start = get_start_num();
|
||||
$show = get_show_num();
|
||||
$table = "xxx";
|
||||
|
||||
header("Content-Type: application/rss+xml");
|
||||
|
||||
// Set up a RSS "header"
|
||||
$query = "SELECT MAX(`date`) FROM $table;";
|
||||
$result = $db->query($query) or die("Query failed : ".$db->error());
|
||||
$most_recent = $result->fetch_row();
|
||||
$now = date("D, d M Y H:i:s O");
|
||||
|
||||
echo '<?xml version="1.0"?>'."\n";
|
||||
echo '<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom">'."\n";
|
||||
echo '<channel>'."\n";
|
||||
echo '<title>x.x.x</title>'."\n";
|
||||
echo '<link>http://xxx.org.za/</link>'."\n";
|
||||
echo '<description>Most recent articles from xxx.org.za</description>'."\n";
|
||||
echo '<language>en-za</language>'."\n";
|
||||
echo '<pubDate>'.$now.'</pubDate>'."\n";
|
||||
echo '<lastBuildDate>'.date("D, d M Y H:i:s O", strtotime($most_recent[0])).'</lastBuildDate>'."\n";
|
||||
echo '<managingEditor>editor@xxx.org.za (Editors)</managingEditor>'."\n";
|
||||
echo '<webMaster>webmaster@xxx.org.za (Webmasters)</webMaster>'."\n";
|
||||
echo '<atom:link href="http://xxx.org.za/feed" rel="self" type="application/rss+xml" />'."\n";
|
||||
echo '<item>'."\n";
|
||||
echo '<title>Front Page</title>'."\n";
|
||||
echo '<link>http://xxx.org.za/</link>'."\n";
|
||||
echo '<pubDate>'.date("D, d M Y H:i:s O", strtotime($most_recent[0])).'</pubDate>'."\n";
|
||||
echo '<guid>http://xxx.org.za/</guid>'."\n";
|
||||
echo '</item>'."\n";
|
||||
|
||||
$result = get_query();
|
||||
|
||||
foreach ($result as $entry) {
|
||||
echo '<item>'."\n";
|
||||
echo '<title>'.$entry['title'].'</title>'."\n";
|
||||
echo '<link>http://xxx.org.za/article?id='.$entry['id'].'</link>'."\n";
|
||||
echo '<pubDate>'.date("D, d M Y H:i:s O", strtotime($entry['date'])).'</pubDate>'."\n";
|
||||
if ($entry['img'])
|
||||
echo '<description>Image: '.$entry['title'].'</description>'."\n";
|
||||
else
|
||||
echo '<description>'.strip_tags(html_entity_decode_full($entry['story'])).'</description>'."\n";
|
||||
echo '<dc:creator>'.$entry['author'].'</dc:creator>'."\n";
|
||||
echo '<guid>http://xxx.org.za/article?id='.$entry['id'].'</guid>'."\n";
|
||||
echo '</item>'."\n";
|
||||
}
|
||||
|
||||
echo '</channel>'."\n";
|
||||
echo '</rss>'."\n";
|
||||
open_db('close');
|
||||
Reference in New Issue
Block a user