<?php
include_once("admin/functions.php");
include('admin/config.php');
include('admin/loadsettings.php');
header('Content-type: text/xml');
/* Written by Gerben Schmidt, http://scripts.zomp.nl */
/*----------------------------------------------------------------------------*/
/* Some information about your site, used for the XML-parser */
/* Change these thjrough the Zomplog settings-panel */
// Site description
if($settings[rss_description]){
$sitedescription = $settings[rss_description];
}
else
{
$sitedescription = "This is a Zomplog-powered site";
}
// Copyright
$copyright = "Copyright 2006, Gerben Schmidt";
if($settings[rss_category]){
$channelcat = $settings[rss_category];
}
else
{
$channelcat = "Blogging";
}
if($settings[rss_language]){
$language = $settings[rss_language];
}
else
{
$language = "en";
}
if($settings[rss_language]){
$language = $settings[rss_language];
}
else
{
$language = "en";
}
if($settings[rss_url]){
$siteurl = $settings[rss_url];
}
else
{
$host = $_SERVER['HTTP_HOST'];
$siteurl = "http://$host";
}
if($settings[rss_email]){
$email = $settings[rss_email];
}
else
{
$email = "hide@address.com";
}
/*----------------------------------------------------------------------------*/
// xml generator
echo "<?xml version='1.0' encoding='iso-8859-1'?><!-- generator='Zomplog' --><rss version='0.91'>
<channel>";
echo "<title>$settings[weblog_title]</title>
<link>$siteurl</link>
<description><![CDATA[$sitedescription]]></description>
<language>$language</language>
<webMaster>$email</webMaster>
<pubDate>Tue, 03 Jan 2006 00:22:17 +0100</pubDate>
<copyright>$copyright</copyright>
<category>$channelcat</category>
<generator>Zomplog</generator>";
$query = "SELECT * FROM $table ORDER BY id DESC LIMIT 55";
$result = mysql_query ($query, $link) or die("Died getting info from db. Error returned if any: ".mysql_error());
$myentry = arrayMaker($result);
foreach ($myentry as $entry) {
$author = "$email";
// converting timestamp to current user-formatted date
$q = mysql_query("SELECT date, UNIX_TIMESTAMP(date) AS timestamp FROM $table WHERE id = '$entry[id]'");
$row = mysql_fetch_array($q);
// then use PHP's date() function :
$postdate = date("r", $row['timestamp']);
if($entry['catid']){
$query = "SELECT * FROM $table_cat WHERE id = $entry[catid]";
$result = mysql_query ($query, $link) or die("Died getting info from db. Error returned if any: ".mysql_error());
$cat = mysql_fetch_array($result,MYSQL_ASSOC);
$category = "$cat[name]";
}
else
{
$category = "uncategorized";
}
$title = htmlspecialchars($entry[title]);
$text = htmlspecialchars($entry[text]);
echo "<item>
<title>$title</title>
<link>$siteurl/?content=detail&id=$entry[id]</link>
<description><![CDATA[$entry[text]]]></description>
<author>$author</author>
<category>$category</category>
<pubDate>$postdate</pubDate>
<comments>$siteurl/?content=detail&id=$entry[id]</comments>";
if($entry[podcast]){
$query = "SELECT * FROM $table_files WHERE entry_id = '$entry[id]' AND type = 'audio/mpeg' OR entry_id = '$entry[id]' AND type = 'video/quicktime' LIMIT 1";
$result = mysql_query($query, $link);
while($row = mysql_fetch_array($result)){
if($row[type] == 'audio/mpeg' || $row[type] == 'video/quicktime'){
// podcast url cannot contain spaces
$mediafile = urlencode($row[name]);
echo "<guid>$siteurl/upload/$mediafile</guid>
<enclosure url='$siteurl/upload/$mediafile' length='600' type='$type'/>";
}
}
}
echo "</item>";
}
echo "</channel></rss>";
?>