<?PHP

// setup the main rss information
global $RSS_CONFIG;

// title / description
if($rss_sub_type != ''){
    
$title 'Newest Ebuilds: ' $rss_sub_type;
    
$description 'The newest ebuilds to portage that are under the keyword: ' $rss_sub_type;
    
$file 'newest.'.$rss_sub_type;
}else{
    
$title 'Newest Ebuilds';
    
$description 'The newest ebuilds to portage';
    
$file 'newest';
}
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
    
$latest = new latest_ebuilds(time() - 24*60*60trim($rss_sub_type), time());

    foreach(
$latest->data as $row){
        
$rss->itemTitle($row['ebuild_display']);
        
$rss->itemLink($RSS_CONFIG['website'].'/'.$row['category_title'].'/'.$row['package_title']);
        
$rss->itemDescription(htmlspecialchars($row['ebuild_description']));
        
$rss->itemGuid($RSS_CONFIG['website'].'/'.$row['category_title'].'/'.$row['package_title'].'?'.$row['ebuild_p']);
        
$rss->itemSource($title$RSS_CONFIG['website'].'/RSS/Newest/'.$rss_sub_type);
        
$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');
?>