<?
	if (ereg("MSIE 6.0",$_SERVER['HTTP_USER_AGENT'])) {
		header("Location: ajuda_rss.php");
		exit;
	}
	header("Content-type: application/xml");
 echo '<?xml version="1.0" encoding="ISO-8859-1"?>'."\n";
 define("SERVER_ROOT","http://www3.uberlandia.mg.gov.br/"); include("connect.inc"); include("funcoes.php"); $tipo = $_GET['tipo']; $itens = array(); function ctime($d,$h) { $h = explode(":",$h); $d = explode("-",$d); return mktime($h[0],$h[1],$h[2],$d[1],$d[2],$d[0]); }

	// Tipo da RSS
	// Padrão = últimas notícias, mas dá pra melhor muito mais tarde
	if (1) {
		$res = mysql_query("SELECT * FROM artigo ORDER BY id_artigo DESC LIMIT 25");
		while ($row = mysql_fetch_assoc($res)) {
			array_push($itens,array(
				'titulo' => $row['titulo'],
				'link' => SERVER_ROOT."noticia.php?id=".$row['id_artigo'],
				'desc' => '<div style="font-family: Trebuchet MS, Helvetica, Arial, sans-serif; font-size: 11pt;"><span style="font-size: 10pt; font-style: italic;">'.$row['subtitulo'].'</span><br/><br/>'.wordcount(striphtml($row['conteudo']),600).'<br/><br/><br/><span style="font-family: Verdana, Helvetica, Arial, sans-serif; font-weight: bold"><a href="'.SERVER_ROOT.'agencia.php">Visite nossa Agência de Notícias</a> e leia esta notícia na íntegra.</span>'.'</div>',
				'data' => ctime($row['data_criacao'],$row['hora_criacao'])
			));
		}
	}
	mysql_free_result($res); mysql_close($connect);
?>
<rss version="2.0">
	<channel>
		<title>Prefeitura de Uberlândia</title>
		<link><?=SERVER_ROOT;?></link>
		<description>Notícias do Portal da Prefeitura de Uberlândia</description>
		<image><?=SERVER_ROOT."css/image/pmu-logo-css.png"?></image>
		<language>pt-br</language>
		<pubDate><?=date("r");?></pubDate>
		<lastBuildDate><?=date("r");?></lastBuildDate>
		<docs>http://www.rssboard.org/rss-specification</docs>
		<generator>Secretaria de Comunicação</generator>
		<managingEditor>secom@uberlandia.mg.gov.br</managingEditor>
		<webMaster>secom@uberlandia.mg.gov.br</webMaster>
<?
	for ($x = 0;$x < count($itens);$x++) {
		echo "\n";
?>
		<item>
			<title><?=$itens[$x]['titulo'];?></title>
			<link><?=$itens[$x]['link'];?></link>
			<description><![CDATA[<?=$itens[$x]['desc'];?>]]></description>
			<pubDate><?=date("r",$itens[$x]['data']);?></pubDate>
			<guid><?=$itens[$x]['link'];?></guid>
		</item>
<?
		echo "\n";
	}
?>
	</channel>
</rss>
<?
	$f = fopen("_rsslog.txt","a");
	fwrite($f,"rss.xml ".time()." ".ip2long($_SERVER['REMOTE_ADDR'])." ¬ ".$_SERVER['HTTP_USER_AGENT']." ¬ ".$_SERVER['HTTP_REFERER']."\n");
	fclose($f);
?>