<?
error_reporting(0);
if($_SERVER['REQUEST_METHOD'] != "GET"){
	header("HTTP/1.0 404 Not Found");
 	echo "404 Not Found";
   exit;
}
header("Cache-Control: no-cache, must-revalidate");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Content-Type: application/xml; charset=utf-8");
define('SOFTPUBS_IN', true);
require_once(dirname(__FILE__) . '/includes/init.php');

$software_name		=	$_GET['software_name'];

$sql					=	"SELECT * FROM {$db_obj->db_pre}software WHERE software_name='".$db_obj->escape($software_name)."' ORDER BY software_id DESC LIMIT 1";
$software_res		=	$db_obj->getRecord($sql);
$list_thumb_size	=	explode('X',$glo_config_arr['list_thumb']['image_size']);
$list_thumb_width	=	$list_thumb_size[0];
$list_thumb_height=	$list_thumb_size[1];


$rss_str			='<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
<channel>
<title>'.htmlspecialchars($glo_config_arr['site_title']['value'],ENT_QUOTES).'  -  '.htmlspecialchars($software_res['software_name'],ENT_QUOTES).'</title>
<description>
'.htmlspecialchars($glo_config_arr['site_desc']['value'],ENT_QUOTES).'
</description>

<copyright>'.htmlspecialchars($glo_config_arr['site_name']['value'],ENT_QUOTES).'</copyright>
<managingEditor>'.htmlspecialchars($glo_config_arr['admin_email']['value'],ENT_QUOTES).'</managingEditor>
<language>En</language>
<generator>'.htmlspecialchars($glo_config_arr['site_name']['value'],ENT_QUOTES).'</generator>

<item>
	<title>'.htmlspecialchars($software_res['software_name'],ENT_QUOTES).' '.htmlspecialchars($software_res['software_version'],ENT_QUOTES).'</title>
	<description>
		<![CDATA[
			'.htmlspecialchars($software_res['software_brief'],ENT_QUOTES).'		
		]]>
	</description>
	<image>
			<title>'.htmlspecialchars($software_res['software_name'],ENT_QUOTES).' '.htmlspecialchars($software_res['software_version'],ENT_QUOTES).'</title>
			<url>'.htmlspecialchars($software_res['software_list_image'],ENT_QUOTES).'</url>
			<link>/soft.php?software_id='.$software_res['software_id'].'</link>
			<width>'.htmlspecialchars($list_thumb_width,ENT_QUOTES).'</width>
			<height>'.htmlspecialchars($list_thumb_height,ENT_QUOTES).'</height>
	</image>
	<pubDate>'.date('Y-m-d H:i:s',$software_res['last_update']).'</pubDate>

</item>
</channel>
</rss>
';
echo $rss_str;
