<? header('Content-type: text/xml'); 
include("inc.php"); ////accrediteer uzelf chez le DB 	
include("inc_queries.php"); ////accrediteer uzelf chez le DB 

function xmlEntities($str)
{
    $xml = array('&#34;','&#38;','&#38;','&#60;','&#62;','&#160;','&#161;','&#162;','&#163;','&#164;','&#165;','&#166;','&#167;','&#168;','&#169;','&#170;','&#171;','&#172;','&#173;','&#174;','&#175;','&#176;','&#177;','&#178;','&#179;','&#180;','&#181;','&#182;','&#183;','&#184;','&#185;','&#186;','&#187;','&#188;','&#189;','&#190;','&#191;','&#192;','&#193;','&#194;','&#195;','&#196;','&#197;','&#198;','&#199;','&#200;','&#201;','&#202;','&#203;','&#204;','&#205;','&#206;','&#207;','&#208;','&#209;','&#210;','&#211;','&#212;','&#213;','&#214;','&#215;','&#216;','&#217;','&#218;','&#219;','&#220;','&#221;','&#222;','&#223;','&#224;','&#225;','&#226;','&#227;','&#228;','&#229;','&#230;','&#231;','&#232;','&#233;','&#234;','&#235;','&#236;','&#237;','&#238;','&#239;','&#240;','&#241;','&#242;','&#243;','&#244;','&#245;','&#246;','&#247;','&#248;','&#249;','&#250;','&#251;','&#252;','&#253;','&#254;','&#255;');
    $html = array('&quot;','&amp;','&amp;','&lt;','&gt;','&nbsp;','&iexcl;','&cent;','&pound;','&curren;','&yen;','&brvbar;','&sect;','&uml;','&copy;','&ordf;','&laquo;','&not;','&shy;','&reg;','&macr;','&deg;','&plusmn;','&sup2;','&sup3;','&acute;','&micro;','&para;','&middot;','&cedil;','&sup1;','&ordm;','&raquo;','&frac14;','&frac12;','&frac34;','&iquest;','&Agrave;','&Aacute;','&Acirc;','&Atilde;','&Auml;','&Aring;','&AElig;','&Ccedil;','&Egrave;','&Eacute;','&Ecirc;','&Euml;','&Igrave;','&Iacute;','&Icirc;','&Iuml;','&ETH;','&Ntilde;','&Ograve;','&Oacute;','&Ocirc;','&Otilde;','&Ouml;','&times;','&Oslash;','&Ugrave;','&Uacute;','&Ucirc;','&Uuml;','&Yacute;','&THORN;','&szlig;','&agrave;','&aacute;','&acirc;','&atilde;','&auml;','&aring;','&aelig;','&ccedil;','&egrave;','&eacute;','&ecirc;','&euml;','&igrave;','&iacute;','&icirc;','&iuml;','&eth;','&ntilde;','&ograve;','&oacute;','&ocirc;','&otilde;','&ouml;','&divide;','&oslash;','&ugrave;','&uacute;','&ucirc;','&uuml;','&yacute;','&thorn;','&yuml;');
    $str = str_replace($html,$xml,$str);
   // $str = str_ireplace($html,$xml,$str);
    return $str;
}

/// check lastbuilddate
$q1="SELECT ID,UNIX_TIMESTAMP(tijd) AS tijd FROM artist WHERE publish!= '0' ORDER BY tijd DESC LIMIT 1";
$doGet1=mysql_query($q1);
while($result1 = mysql_fetch_array($doGet1)){
$lastbuilddate =  strftime( "%a, %d %b %Y %T" , $result1['tijd']); 
}
?>
<rss version="2.0">
<channel>
<title>TodaysArt Festival 2007 - Artist Updates</title>
<description>A description of your site</description>
<link>http://todaysart.nl</link>
<copyright>Feel free to spread the word on TodaysArt Festival wherever you like! </copyright>
<pubDate> GMT +0100</pubDate>
<lastBuildDate> GMT +0100</lastBuildDate>
<language>en-us</language>
<ttl>10</ttl>

<image>
<title>TodaysArt Festival 2007</title>
<url>http://todaysart.nl/2007/adz/online-images/feedheader-500x98.jpg</url>
<link>http://todaysart.nl</link>
</image>
<?
//$q="SELECT ID,title_nl,actname,description_nl, description_en, picID, UNIX_TIMESTAMP(tijd) AS pubDate FROM site2007.artist WHERE publish!= '0' LIMIT 0,15 ORDER BY pubDate DESC";
$q="SELECT ID,title_nl,act_name,description_nl, description_en, picID,UNIX_TIMESTAMP(tijd) AS tijd FROM artist WHERE publish!= '0' ORDER BY tijd DESC";

$doGet=mysql_query($q);

 while($result = mysql_fetch_array($doGet)){
$picID = $result[picID];
			if(!$picID){ $picID = "0"; }
			$picID = explode(" ",$picID);
			shuffle($picID);
			$picID = $picID[0];
$key = $result['ID'];
$artiest = $result['title_nl'];

 ///start linkchecker movies
$video = '';
$sql2 = mysql_query("SELECT * FROM artist_links WHERE link LIKE '%youtube%' AND ARID = '".$key."' ORDER BY RAND() LIMIT 1");
while($row2 = mysql_fetch_array($sql2)) { 
			$videolink = str_replace('www.','',$row2['link']);
			$videolink = str_replace('http://youtube.com/watch?v=','',$videolink); 
			
			$video .= '<object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/'.$videolink.'"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/'.$videolink.'" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed></object>';
			 }
			
?>
     <item>
        <title><? echo strip_tags(''.xmlEntities($result['title_nl']).' - '.xmlEntities($result['act_name']).''); ?></title>
        <description><![CDATA[<img src="http://www.todaysart.nl/2007/IMAGES/square/100//IMAGE.jpg" width="100" height="100" border="1" align="left" hspace="5" alt="<? echo htmlentities(strip_tags(''.$result['title_nl'].' - '.$result['act_name'].'')); ?>"><? echo nl2br($result['description_nl']);?><br /><br /><? echo $video; ?>]]></description>
        <link>http://www.todaysart.nl/2007/artists/