<?php
header('Content-type: application/rss+xml; charset=iso-8859-1');
require_once('../../class/mysql.php');
$blogPageId = $mysql->get_array($mysql->query("value", "fs_settings", "name = 'blog_page' LIMIT 1"));
$company = $mysql->get_array($mysql->query("value", "fs_settings", "name = 'company_name' LIMIT 1"));
$host = str_replace("www.", "", $_SERVER['SERVER_NAME']);
$host = ($host == 'demo.freesites.com.au') ? 'demo.freesites.com.au' : 'www.'.$host;
$xml = '<?xml version="1.0" encoding="ISO-8859-1" ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<atom:link href="http://'.$host.'/inc/blog/blog.xml" rel="self" type="application/rss+xml" />
<title>Blog Posts from '.stripslashes($company['value']).'</title>
<link>http://'.$host.'</link>
<description>The most recent blog posts from '.$host.'</description>
<language>en-us</language>
<pubDate>'.date('r').'</pubDate>
<lastBuildDate>'.date('r').'</lastBuildDate>
<copyright>'.stripslashes($company['value']).'</copyright>';
$query = $mysql->query("title,stamp,content,url_key", "fs_blog_entries", "status = 'Publish' ORDER BY stamp DESC");
while($data = $mysql->get_array($query))
{
$xml .= '<item>
<title><![CDATA['.htmlentities(stripslashes($data['title'])).']]></title>
<guid isPermaLink="true">http://'.$host.'/'.$blogPageId['value'].'/'.$data['url_key'].'</guid>
<link>http://'.$host.'/'.$blogPageId['value'].'/'.$data['url_key'].'</link>
<description><![CDATA['.htmlentities(stripslashes($data['content'])).']]></description>
<pubDate>'.date('r', $data['stamp']).'</pubDate>
</item>';
}
$xml .= '</channel></rss>';
echo $xml;
?>