<?php 
	$PPath="";
	if (!isset($DEFREADY))   require_once "../include/defaults.php";
	header('Content-Type: text/xml; charset=ISO-8859-1');

	echo "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?> ";
    	echo "<rss version=\"2.0\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:content=\"http://purl.org/rss/1.0/modules/content/\"> ";

?>
	<channel>
		<title>SHAPE Services News</title>
		<link>http://www.shapeservices.com</link>
		<description>SHAPE Services.</description>
		<language>en</language>
		<lastBuildDate>Sat, 16 Dec 2006 19:08:21 GMT</lastBuildDate>
		<generator>SHAPE News</generator>
		<ttl>60</ttl>


<?php 
	$DBLink = mysql_connect($DBHost, $DBUser, $DBPass);
	mysql_select_db($DBName, $DBLink);

    	$PGKPlus  = array("news");
    	$PGKMinus = array();
    	$Like = keys2like("keywords");
        
	$CYear = (isset($_GET['year']))? $_GET['year'] : date("Y");
        
    	$Query = "select * from en_news where ";
    	if ($Like) $Query .= $Like;
    	$Query .= "and (display = 1 or hot = 1) and dateshow >= '" . $CYear . "-01-01' and dateshow < '"  . ($CYear + 1) . "-01-01' order by dateshow desc, dateinsert desc";
    	$Result = mysql_query($Query);

	while ($Newz = mysql_fetch_array($Result)) {
		$NewsDate=strtotime($Newz['dateshow']);
		if ($NewsDate<strtotime("-4 months"))
			break;
                if (is_readable($PPath . "news/content/news.content." . $Newz['id'] . ".html")) {     
		    $CP="http://www.shapeservices.com/en/news.php?id=" . $Newz['id'] ;
                }  else {
                    $CP=extractURL(stripslashes($Newz['resume']));
	            $CP=htmlspecialchars($CP);
                }
?>
		
		<item>
			<guid isPermaLink="false"><?php echo md5($Newz['id']);?></guid>
        	<title><?php echo "<![CDATA[" . stripslashes($Newz['title']) . "]]>";?></title>
        	<description>
<?php 
	$Desc=strip_tags(stripslashes($Newz['resume']), "<p><b><i><u><string>");
	$pos=strpos($Desc, "More...");
        if ($pos!=false) {
		$Desc=substr($Desc,0,$pos);
	}
	echo "<![CDATA[" . $Desc . "]]>";
?>
		</description>
			<?php
			if( isset($CP) && $CP!='' )
			{?>
        		<link><?php echo $CP ; ?></link>
				<?php
			}
			?>
		<pubDate><?php echo strftime("%a, %d %b %Y 00:00:00 GMT",$NewsDate); ?></pubDate>
			<?php
			if(strlen(trim($Newz['url']))>0)
			{?>
				<link><?php echo htmlspecialchars( $Newz['url'], ENT_QUOTES);?></link>
				<?php
			}?>
		</item>
<?php
	}
?>
 	</channel>
<?php
	echo "</rss>";
	mysql_close($DBLink);
?>
