<?
require_once('../../lib/common.php');
$group = str_replace(',','/',$_GET['group']);
if (!in_array($group,$CATEGORIES)) {
	header('HTTP/1.1 404 Not Found');
	header('Content-type: text/html');
	echo '<html><body>Channel not found</body></html>';
	exit;
}
if (substr($_SERVER['HTTP_USER_AGENT'],0,10) != 'FeedBurner') {
	header('HTTP/1.1 301 Moved Permanently');
	$feed = preg_replace('/\W+/','-',strtolower(urldecode(preg_replace('/.*\/rss\/|\.xml/','',$_SERVER['REQUEST_URI']))));
	header("Location: http://feeds.feedburner.com/lawyersandsettlements/$feed");
	exit;
}
header('Content-type: text/xml; charset=UTF-8');
echo '<?xml version="1.0" encoding="UTF-8"?>';
?>

<rss version="2.0">
	<channel>
		<title>Lawyers and Settlements - <?=$group?></title>
		<link>https://www.lawyersandsettlements.com/</link>
		<description>Most recent <?=$group?> lawsuits and settlements added to www.LawyersandSettlements.com</description>
		<pubDate><?=date("r")?></pubDate>
		<copyright>Copyright 2001-<?=date('Y')?> Online Legal Media</copyright>
		<language>en-us</language>
		<lastBuildDate>Tue, 1 Nov 2005 22:22:05 GMT</lastBuildDate>
		<image>
			<title>Lawyers and Settlements - <?=$group?></title>
			<url>https://www.lawyersandsettlements.com/images/rss_logo.gif</url>
			<link>https://www.lawyersandsettlements.com/</link>
		</image>
<?
$items = mysql_query("SELECT CONCAT(CASE status WHEN 2 THEN 'Settlement: ' WHEN 1 THEN 'Law Suit Filed: ' ELSE 'Possible Lawsuit: ' END,title) AS title, label, long_blurb AS description, entered FROM Actions AS A INNER JOIN Action_Display AS C USING(actionID) WHERE closed!=1 AND preview=0 AND published<=NOW() AND (expires>CURRENT_DATE() OR expires IS NULL OR expires='0000-00-00') AND display_group='".addslashes($group)."' ORDER BY A.published DESC,A.actionID DESC LIMIT 10");
while($item = mysql_fetch_assoc($items)) {
	$item['description'] = preg_replace('/<(.+?)>/','$1',$item['description']);
?>
		<item>
			<title><?=htmlspecialchars($item['title'])?></title>
			<link>https://www.lawyersandsettlements.com/lawsuit/<?=$item['label']?>.html?ref=rss</link>
			<description><?=nl2br(htmlspecialchars($item['description']))?></description>
			<guid isPermaLink="true">https://www.lawyersandsettlements.com/lawsuit/<?=$item['label']?>.html?ref=rss</guid>
			<pubDate><?=date("r",strtotime($item['entered']))?></pubDate>
		</item>
<? } ?>
	</channel>
</rss>
