<?PHP

// setup the main rss information
global $RSS_CONFIG;

// title / description

$title 'Newest Categories';
$description 'New package categories added to Portage';
$file 'new_categories';

if(!
is_file('../cache/rss/'.$file.'.xml') || filemtime('../cache/rss/'.$file.'.xml') < time() - 20*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
    
$sql "SELECT category_title , `_added` FROM category ORDER BY `_added` DESC  LIMIT 0,10";
    
$results mysql_query($sql) or die(mysql_error());

    while(
$row mysql_fetch_assoc($results)){
        
$rss->itemTitle('New Category: ' $row['category_title']);
        
$rss->itemLink($RSS_CONFIG['website'].'/'.$row['category_title']);
        
$rss->itemDescription('New Category: ' $row['category_title']);
        
$rss->itemGuid($RSS_CONFIG['website'].'/'.$row['category_title']);
        
$rss->itemSource($title$RSS_CONFIG['website'].'/RSS/New_Categories');
        
$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');
?>