<?

define('ICD_DIR', dirname(__FILE__).'/');

$page['active_lang'] = 'ro';

include(ICD_DIR.'inc/init.php');
include(ICD_DIR.'inc/deinit.php');
sql_connect();

$page['theme'] = 'xml';
define('ICD_THEME_DIR', ICD_DIR.'themes/'.$page['theme'].'/');

include(ICD_THEME_DIR.'header.php');


require(ICD_DIR.'lib/class.rss.write.php');

$items =& $db->GetAll('select *, unix_timestamp(date) dt from '.$db_tables['structure_items'].' WHERE type=\'art\' ORDER BY date desc LIMIT 10');


$rss = new rssWriter();
$rss->addChannel(array(
	'title' => get_config_var('site_name').' - Ultimele articole',
	'link' => ICD_URL_FULL,
	'description' => 'Ultimele articole publicate pe '.get_config_var('site_name')
));

foreach ($items as $item) {
	$item['title'] = str_replace('&', '&amp;', $item['name']);
	$item['link'] = get_item_link($item);
	$item['link'] = 'http://www.'.get_config_var('site_name').preg_replace_callback($urlOld, 'URL_replace_callback', $item['link']);
	$item['description'] = $item['description'];
	$item['pubDate'] = date('D, d M Y H:i:s O', $item['dt']);
	$rss->addItem($item);
}

$output = $rss->get();

echo $output;


include(ICD_THEME_DIR.'footer.php');
//include_once(ICD_DIR.'inc/deinit.php');

?>
