<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><?php header('Content-Type: application/xml');
echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\"".chr(63).">\n";
echo "<?xml-stylesheet title=\"XSL_formatting\" type=\"text/xsl\" href=\"cf_news.xml\"".chr(63).">\n";


?><rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>



<title>News from the Citizenship Foundation</title>
<description>We are an independent education and participation charity in the UK. Our vision is of a just society in which everyone has the knowledge, skills, confidence and motivation to engage effectively in their communities.</description>
<link>http://www.citizenshipfoundation.org.uk/</link>
<copyright>The Citizenship Foundation</copyright>



<?php #feed headlines direct from database
#show all if no arg, match arg, or show none if faulty arg
$kargs=explode(";", preg_replace("/[^a-zA-Z0-9;']/","",$_SERVER['QUERY_STRING'])); #get arg to array, using ; separator

if (empty($kargs[0])) {
 $sql="SELECT nid, title, para1, body, reldate FROM news_live WHERE newspress=0 AND status=0 AND rss>0 AND (startdate<=\"".date("Y-m-d")."\" AND (stopdate>=\"".date("Y-m-d")."\" OR archived>0)) ORDER BY reldate DESC LIMIT 35;"; #NB when changing SQL see this AND line below
 }
else { #decode - using rule that kw is preceded by AND if kw is ALL CAPS else OR (added Jun07)
 $kwsql="";
 foreach ($kargs as $ind=>$kw) {
  if (strtoupper($kw)==$kw) $logsw=" AND "; else $logsw=" OR ";
  $kwsql=$kwsql."news_kw.kword=\"".strtolower($kw)."\" ".$logsw." ";
  }
 $kwsql=substr($kwsql,0,-(strlen($logsw)));
 $sql="SELECT  DISTINCTROW news_live.nid, news_live.title, news_live.para1, news_live.body, news_live.reldate FROM news_kw JOIN news_live ON (news_live.nid=news_kw.nidcode) WHERE (".$kwsql.") AND news_live.newspress=0 AND news_live.status=0 AND news_live.rss>0 AND (startdate<=\"".date("Y-m-d")."\" AND (stopdate>=\"".date("Y-m-d")."\" OR archived>0)) ORDER BY news_live.reldate DESC LIMIT 35;";  #NB when changing SQL see this AND line above

 }


include ("cf_user_functions.inc");

openme();


if($result = mysql_query($sql, $dblink)) {
 while ($irow=mysql_fetch_array($result)) {
  echo "<item>\n";
  echo "<title>".$irow["title"]."</title>\n";
  $irow["para1"]=preg_replace("/[��]/","'",$irow["para1"]); #remove rogue quotes L&R
  $irow["para1"] = html_entity_decode ($irow["para1"]);
  $irow["body"]=str_replace("../","http://www.citizenshipfoundation.org.uk/",$irow["body"]);
  echo "<description>".$irow["para1"]."</description>\n";
  echo "<content:encoded><![CDATA[".$irow["body"]."]]></content:encoded>\n";
  echo "<pubDate>".date("r", strtotime(substr($irow["reldate"],5,2)."/".substr($irow["reldate"],8,2)."/".substr($irow["reldate"],2,2)))."</pubDate>\n";
  echo "<link>http://www.citizenshipfoundation.org.uk/main/news.php?n".$irow["nid"]."</link>\n";
  echo "<guid isPermaLink=\"false\">citizenshipfoundation--".$irow["nid"]."</guid>\n"; #optional but Michael has a validator that says it's required (Aug 07)
  echo "</item>\n\n";
  }
 }

closeme();

#echo "<item>\n";
#echo "<title>SQL:</title>\n";
#echo "<description>".$sql."</description>\n";
#echo "<link></link>\n";
#echo "</item>\n";


#<item>
#<title>Topics of current interest...</title>
#<description>[------]</description>
#<link>http://www.citizenshipfoundation.org.uk/main/news.php</link>
#</item>

?>



<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/citizenshipfoundation_news" /><feedburner:info uri="citizenshipfoundation_news" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><geo:lat>51.52</geo:lat><geo:long>-.10</geo:long><feedburner:emailServiceId>citizenshipfoundation_news</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><feedburner:feedFlare href="http://add.my.yahoo.com/rss?url=http%3A%2F%2Ffeeds.feedburner.com%2Fcitizenshipfoundation_news" src="http://us.i1.yimg.com/us.yimg.com/i/us/my/addtomyyahoo4.gif">Subscribe with My Yahoo!</feedburner:feedFlare><feedburner:feedFlare href="http://feeds.my.aol.com/add.jsp?url=http%3A%2F%2Ffeeds.feedburner.com%2Fcitizenshipfoundation_news" src="http://o.aolcdn.com/favorites.my.aol.com/webmaster/ffclient/webroot/locale/en-US/images/myAOLButtonSmall.gif">Subscribe with My AOL</feedburner:feedFlare><feedburner:feedFlare href="http://www.bloglines.com/sub/http://feeds.feedburner.com/citizenshipfoundation_news" src="http://www.bloglines.com/images/sub_modern11.gif">Subscribe with Bloglines</feedburner:feedFlare><feedburner:feedFlare href="http://fusion.google.com/add?feedurl=http%3A%2F%2Ffeeds.feedburner.com%2Fcitizenshipfoundation_news" src="http://buttons.googlesyndication.com/fusion/add.gif">Subscribe with Google</feedburner:feedFlare><feedburner:feedFlare href="http://www.live.com/?add=http%3A%2F%2Ffeeds.feedburner.com%2Fcitizenshipfoundation_news" src="http://tkfiles.storage.msn.com/x1piYkpqHC_35nIp1gLE68-wvzLZO8iXl_JMledmJQXP-XTBOLfmQv4zhj4MhcWEJh_GtoBIiAl1Mjh-ndp9k47If7hTaFno0mxW9_i3p_5qQw">Subscribe with Live.com</feedburner:feedFlare><feedburner:feedFlare href="http://www.addtoany.com/?linkname=News%20from%20the%20Citizenship%20Foundation&amp;linkurl=http%3A%2F%2Ffeeds.feedburner.com%2Fcitizenshipfoundation_news&amp;type=feed" src="http://www.addtoany.com/addfr-b.gif">Add to Any Feed Reader</feedburner:feedFlare></channel>
</rss>

