You are not registered.
Registration allows you to subscribe to projects, open projects, and more. Click here to register.Website Source Code
<< Back
rss.php
rss.php
<?php
function xml_format($str)
{
global $ascii2uni;
$str = str_replace('&', '&', $str);
$str = str_replace('<', '<', $str);
$str = str_replace('>', '>', $str);
$str = str_replace('\'', ''', $str);
$str = str_replace('"', '"', $str);
$str = str_replace('\r', '', $str);
$str = strtr($str, $ascii2uni);
return $str;
}
function remove_html($str)
{
return preg_replace('/<[a-zA-Z\/][^>]*>/', '', str_replace('<br />', "\n", $str));
}
include('config.php');
include('db.php');
include('news.php');
$path = substr($_SERVER['PHP_SELF'], 0, strlen($_SERVER['PHP_SELF']) - (strlen($_SERVER['PHP_SELF']) - strpos($_SERVER['PHP_SELF'], 'index.php')));
$categories = array('Educational', 'Medical', 'Simulation', 'Tools', 'Other', 'Action', 'Adventure', 'Driving', 'Games for Kids', 'MMORPG', 'Puzzle Games', 'Role-Playing', 'Strategy', 'Other');
db_connect();
if (isset($_GET['id']))
{
$id = intval($_GET['id']);
$result = mysql_query('SELECT `name`, `category` FROM `projects` WHERE `id` = ' . $id . ' LIMIT 1');
if (mysql_num_rows($result) == 0)
die();
$row = mysql_fetch_row($result);
$link = $url . create_link($row[1], $id, $row[0]);
$name = $row[0] . ' News (TVProjects)';
$results = mysql_query('SELECT `news`.`id` AS \'news_id\', `news`.`title`, `news`.`text`, `news`.`date`, `projects`.`id` AS \'project_id\', `projects`.`name`, `projects`.`category` FROM `news`, `projects` WHERE `news`.`project` = ' . $id . ' AND `projects`.`id` = `news`.`project` ORDER BY `date` DESC LIMIT 10;');
}
else
{
$name = 'TVProjects News';
$link = $url;
$results = mysql_query('SELECT `news`.`id` AS \'news_id\', `news`.`title`, `news`.`text`, `news`.`date`, `projects`.`id` AS \'project_id\', `projects`.`name`, `projects`.`category` FROM `news`, `projects` WHERE `projects`.`id` = `news`.`project` ORDER BY `date` DESC LIMIT 10;');
}
echo '<?xml version="1.0"?>
<rss version="2.0">
<channel>
<title>' . $name . '</title>
<link>' . $link . '</link>
<language>en-us</language>
<generator>TVProjects</generator>';
$ascii2uni = array();
for ($i = 128; $i < 256; $i++)
{
$ascii2uni[chr($i)] = '&#x' . dechex($i) . ';';
}
while ($row = mysql_fetch_assoc($results))
{
echo '
<item>
<title>' . xml_format($row['title'] . (isset($_GET['id']) ? '' : ' [' . $row['name'] . ']')) . '</title>
<link>' . xml_format($url . create_link($row['category'], $row['project_id'], $row['name']) . 'news/' . $row['news_id'] . '-' . format_title_address($row['title'])) . '</link>
<description>' . xml_format(make_shorter(remove_html($row['text']), 500)) . '</description>
<pubDate>' . date('r', $row['date']) . '</pubDate>
<guid>' . $row['project_id'] . '-' . $row['news_id'] . '</guid>
</item>';
}
echo '</channel>
</rss>'
?>


