<?PHP

// setup the main rss information
global $RSS_CONFIG;

$title 'Gentoo-Portage.com News';
$description 'The latest information and additions to the website';
$file 'news';

if(!
is_file('../cache/rss/'.$file.'.xml') || filemtime('../cache/rss/'.$file.'.xml') < time() - 5*60){
    
// make the feed
    
$rss = new rss('utf-8');

    
$rss->channel($title
                
$RSS_CONFIG['website'], 
                
$description);
    
$rss->language($RSS_CONFIG['language']);
    
$rss->copyright($RSS_CONFIG['copyright']);
    
$rss->managingEditor($RSS_CONFIG['author']);
    
$rss->category($RSS_CONFIG['category']);
    
$rss->ttl($RSS_CONFIG['ttl']);
    
$rss->pubDate(parse_date(false'r'));
    
// $rss->image($url, $title, $link);
    
$rss->startRSS('../cache/rss'$file);

    
// add the data
    
$news = new news();
    
$recent $news->recent();

    foreach(
$recent as $row){
        
$rss->itemTitle($row['news_title']);
        
$rss->itemLink($RSS_CONFIG['website'].'/News/'.$row['news_p']);
        
$rss->itemDescription(htmlspecialchars($row['news_content']));
        
$rss->itemGuid($RSS_CONFIG['website'].'/News/'.$row['news_p']);
        
$rss->itemSource($title$RSS_CONFIG['website'].'/RSS/News');
        
$rss->itemPubDate(parse_date($row['_added'], 'r'));

        
$rss->addItem();
    }

    
$rss->RSSdone();
}


// write out the file created
header('Last-Modified: 'date('r'filemtime('../cache/rss/'.$file.'.xml')));
header('Cache-Control: s-maxage=1800, must-revalidate, max-age=0');
header("Content-Type: application/xml; charset=utf-8");
readfile('../cache/rss/'.$file.'.xml');
?>