<?php
/*******************************************************************************
** File : xml_view.php **
** Author : G.Ramkumar **
** Description : Xml view **
** Date : 14/07/2005 **
** Last Modified : 02/08/2005 **
** PHP Version : 5.0.3 **
** **
*******************************************************************************/
include('dbconnect.php');
$lang=$_REQUEST['lang'];
$id__=$_REQUEST['id'];
//$xml_qry="select * from rssurl_newsitem where language='$lang' order by url_newsitem_id desc";
$xml_qry="select * from rssurl_newsitem where rss_channel_id=$id__ order by url_newsitem_id desc";
$xml_res=$pg_sql->query_pass($xml_qry,"4");
header("Content-type: text/xml");
$xmlString='<?xml version="1.0" encoding="utf-8"?>';
$xmlString .='<rss version="2.0">';
$xmlString .="<channel>";
$xmlString .="<title>news.belgium.be</title>";
$xmlString .="<link>http://newsmanager.avalonnet.com</link>";
$xmlString .="<description>news.belgium.be</description>";
$xmlString .="<language>".$xml_res[0]['language']."</language>";
for($i=0;$i<count($xml_res);$i++)
{
$title=str_replace("||","'",$xml_res[$i][news_title]);
$image=trim($xml_res[$i][image]);
$desc=str_replace("||","'",$xml_res[$i][description]);
$url=trim($xml_res[$i][url]);
$author=trim($xml_res[$i][author]);
$pubdate=trim($xml_res[$i][pubdate]);
$lastdate=trim($xml_res[$i][last_builddate]);
$hour=trim($xml_res[$i][hour]);
$copy=trim($xml_res[$i][copyright]);
$webmaster=trim($xml_res[$i][webmaster]);
$title=eregi_replace("é","é",$title);
$title=eregi_replace("É","é",$title);
$title=str_replace("â","",$title);
$title=str_replace("â","",$title);
$title=str_replace("â¦","...",$title);
$desc=str_replace("â","",$desc);
$desc=str_replace("â","",$desc);
$desc=eregi_replace("é","é",$desc);
$desc=eregi_replace("É","é",$desc);
$arr1 = array("Ã","£","Â","µ","¼","·","´","³","¦","¶","®","¯","¥","¨","°","¿","Ä","¡","¢",
"¤","©","§","ª","«","¬","±","²","¹","¸",
"º","»","½","¾","À","Á","Å","Æ","Ç",
"È","É","Ê","Ë","Ì","Í","Î","Ï","Ð","Ñ",
"Ò","Ó","Ô","Õ","Ö","×","Ø","Ù","Ú","Û",
"Ü","Ý","Þ","ß","à","á","ã","ä","å","æ",
"ç","è","é","ê","ì","í","î","ï","ð","ñ","ò",
"ó","ô","õ","ö","÷","ø","ù","ú","û","ý","þ","ÿ","£","­"," ","ü","","","â");
$arr2 = array("Ã","£","Â","µ","¼","·","´","³","¦","¶","®","¯","¥","¨"," ","¿","Ä","¡","¢","¤",
"©","§","ª","«","¬","±","²","¹","¸","º","»","½",
"¾","À","Á","Â","Å","Æ","Ç","È","É","Ê","Ë","Ì",
"Í","Î","Ï","Ð","Ñ","Ò","Ó","Ô","Õ","Ö","×","Ø",
"Ù","Ú","Û","Ü","Ý","Þ","ß","à","á","ã","ä","å",
"æ","ç","è","é","ê","ë","ì","í","î","ï","ð","ñ","ò",
"ó","ô","õ","ö","÷","ø","ù","ú","û","ý","þ","ÿ","€","­","°","ü","‘","’","â");
$j=0;
foreach ($arr1 as $element)
{
$title = eregi_replace($element,$arr2[$j],$title);
$desc = eregi_replace($element,$arr2[$j],$desc);
$j = $j + 1;
}
/*
echo $title."<br>";
echo $desc."<br>";
echo "<hr>";
*/
if($desc!="" && $title!="")
{
$xmlString .="<item>";
$xmlString .="<title>".$title."</title>";
$xmlString .="<description>".$desc."</description>";
if($url!="")
$xmlString .="<link>".$url."</link>";
if($image!="")
$xmlString .="<image>".$image."</image>";
if($author!="")
$xmlString .="<author>".$author."</author>";
if($pubdate!="")
$xmlString .="<pubdate>".$pubdate."</pubdate>";
if($pubdate!="")
$xmlString .="<lastbuilddate>".$lastdate."</lastbuilddate>";
if($hour!="")
$xmlString .="<hour>".$hour."</hour>";
if($copy!="")
$xmlString .="<copyright>".$copy."</copyright>";
if($webmaster!="")
$xmlString .="<webmaster>".$webmaster."</webmaster>";
$xmlString .="</item>";
}
}
$xmlString .="</channel>";
$xmlString .="</rss>";
echo $xmlString ;
?>