require "library/db.php3";
function items(&$result,&$seq,$url,$title,$description,$date)
{
$seq.= "\n\t\t\t";
$result .= "\n\t- ";
$result .= "\n\t\t\n\t\t\t$title\n\t\t";
$result .= "\n\t\t\n\t\t\t$url\n\t\t";
$result .= "\n\t\t";
if(strlen($date)==8)
$result .= "\n\t".$date."T12:00:00+00:00";
else
$result .= "\n\t".str_replace(' ','T',$date)."+00:00";
$result .= "\n\t
\n";
}
function botwItem(&$result,&$seq,$row)
{
$url= "http://www.nicecupofteaandasitdown.com/biscuits/week.php3?id=".$row['id']."#".$row['id'];
$image = explode(',',$row['image']);
items($result,$seq,$url,"BOTW: ".htmlentities($row['name']),"
".substr($row['review'],0,strpos($row['review'],"\n")),$row['date']);
}
function newsItem(&$result,&$seq,$row)
{
$url= "http://www.nicecupofteaandasitdown.com/news/index.php3?id=".$row['id']."#".$row['id'];
foreach( explode('[section]',$row['content']) as $section )
{
if($section[0]!='@' && $section!='' && substr($section,-3)!='jpg' )
{
$para = strpos($section,"\n");
if($para) $section = substr($section,0,$para);
items($result,$seq,$url,"NEWS: ".htmlentities($row['title']),$section,$row['date']);
break;
}
}
}
function wifeItem(&$result,&$seq,$row)
{
$url= "http://www.nicecupofteaandasitdown.com/theWife/?item=".$row['id']."#".$row['id'];
items($result,$seq,$url,"WIFE: ".htmlentities($row['subject']),substr($row['message'],0,strpos($row['message'],"\n")),$row['date']);
}
function fpitem(&$result,&$seq,$row)
{
$url= "http://www.nicecupofteaandasitdown.com/?id=".$row['id']."#".$row['id'];
$snip = explode("\n",strip_tags($row['content']));
foreach($snip as $message)
{
if(str_word_count($message)>5) break;
}
items($result,$seq,$url,"HOME: ".htmlentities($row['title']),$message,$row['date']);
}
header ("Content-Type: application/rdf+xml");
$db = new db();
$r = $db->query("SELECT * FROM frontpage WHERE date IS NOT NULL ORDER BY id DESC LIMIT 0,5");
while($row = mysql_fetch_array($r)) fpItem($result,$seq,$row);
$r = $db->query("SELECT name,id,review,date,image FROM biscuitoftheweek ORDER BY id DESC LIMIT 0,5");
while($row = mysql_fetch_array($r)) botwItem($result,$seq,$row);
$r = $db->query("SELECT title,id,content,date FROM news ORDER BY id DESC LIMIT 0,5");
while($row = mysql_fetch_array($r)) newsItem($result,$seq,$row);
$r = $db->query("SELECT subject,id,message,date FROM thewife ORDER BY id DESC LIMIT 0,5");
while($row = mysql_fetch_array($r)) wifeItem($result,$seq,$row);
$seq = "\n\t\t$seq\n\t\t\n\t";
mysql_free_result($r);
echo "\n";
echo "\n";
echo "";
echo "\n\tNiceCupOfTeaAndASitDown";
echo "\n\thttp://www.nicecupofteaandasitdown.com/";
echo "\n\t";
echo "\n\t\thttp://www.nicecupofteaandasitdown.com/media/tea.gif";
echo "\n\t\tNiceCupOfTeaAndASitDown";
echo "\n\t\thttp://www.nicecupofteaandasitdown.com/";
echo "\n\t";
echo "\n\t\nTea, biscuits, a little bit of cake and sit downs\n\t";
echo "\n\ten-gb";
echo "\n\thttp://www.nicecupofteaandasitdown.com/";
echo "\n\t".date("Y-m-d\TH:i:s+00:00",time())."";
echo "\n\t\n\t";
echo $seq;
echo "\n\n";
echo $result;
echo "\n";
?>