<?php  
  header("Content-Type: text/xml");                   // Nutné pokud soubor nemá příponu .xml
  include 'includes/Configuration.php';  //nastavení
  include 'includes/DatabaseConection.php';   //třída databáze
  $db = new Database($DatabaseAddres,$DatabaseUser,$DatabasePass);  //vytvoření proměné a připojení do databáze
  $db->SelectDatabase($DatabaseName);   //nastavení databáze
//  $db->SQLCommand('SET character_set_results='.$CharSET);
//  $db->SQLCommand('SET character_set_connection='.$CharSET);
//  $db->SQLCommand('SET character_set_client='.$CharSET);
  $db->SQLCommand('SET NAMES '.$CharSET);
//  $db->SQLCommand('SET CHARACTER SET '.$CharSET);
         
  function GetHtmlChar($TestString)
  { // BEGIN function GetHtmlChar
		$TestString=str_replace("\r", "", $TestString);
		$TestString=str_replace("\n", "<br>", $TestString);
    //str_replace("\r", "<br>", $Line[2])
    $TestString = htmlspecialchars($TestString);
  	return $TestString;
  } // END function GetHtmlChar


  echo '<?xml version="1.0" encoding="windows-1250" ?';
  echo ">";
  echo '
<rss version="2.0">
  <channel>
    <title>Obec Zděchov - novinky</title>
    <link>http://obec.zdechov.net</link>
    <description>Aktuality webové stránky obec.zdechov.net</description>
    <language>cs</language>
    <pubDate>Tue, 31 Jul 2007 14:06:06 +0200</pubDate>
    <webMaster>maron2@centrum.cz</webMaster>
    <ttl>20</ttl>';

  $sql = "SELECT * FROM news order by 3 DESC LIMIT 10";
  $ID = $db->SQLCommand($sql);
  while($Line = mysql_fetch_array($ID)) {
    echo '
   <item>
     <title>'.$Line['Name'].'</title>
     <pubDate>'.$Line['Date'].'</pubDate>
     <author>'.$Line['User'].'</author>
     <link>http://obec.zdechov.net</link>
     <description>'.GetHtmlChar($Line['Text']).'</description>
   </item>';
  }   //
    echo '
 </channel>
</rss>';
?>
