Location: PHPKode > projects > BibCiter > bibciter/feed_contact_rss20.php
<?php require('connection.php');?>
<?php $idp_aux=$_GET[idp]; if ($idp == NULL) {$idp = 1;} $idc=$_GET[idc]; ?>
<?php

$feedprojects1 = "SELECT projects.id_project FROM projects,cross_contacts_projects,contacts,types_authors 
	WHERE projects.id_project=cross_contacts_projects.id_project
	AND contacts.id_contact=cross_contacts_projects.id_contact
	AND cross_contacts_projects.id_type_author=types_authors.id_type_author
	AND contacts.id_contact='$idc'
	GROUP BY projects.id_project	
	ORDER BY projects.dateregister_project DESC LIMIT 0 , 20";
		
$feedprojects1 = mysql_query($feedprojects1) or die("error feed_contact_rss20.php line 13");
while ($feedprojects2 = mysql_fetch_array($feedprojects1))
	{
	extract($feedprojects2);
//			if ($_SESSION['authenticated']=="yes") {require('reports/includes/projects_getbibliographies.php');} 
	$idp = $feedprojects2[0];
	unset($includer_name_aux);

	if ($year_project == 0)
	{$year_project = NULL;}
	else {$year_project = "($year_project)";}

	if ($name_project_aux == NULL)	
	{$name_project_aux = "<li><a href='$bibciterurl/reports/projects.php?idp=$id_project'>$name_project $year_project [$name_type_author]</a></li>\n";}
	else {$name_project_aux .= "<br><li><a href='$bibciterurl/reports/projects.php?idp=$id_project'>$name_project $year_project [$name_type_author]</a></li>\n";}
	#### BEGIN GETDATA
	require('reports/includes/projects_getdata.php'); #get projects data  
	$name_project = cleanstring($name_project);
	$name_project_aux = cleanstring($name_project_aux);
	$dummyname_contact_aux_clean = cleanstring($dummyname_contact_aux_clean);
	
	if ($includer_year_project == 0)
		{$includer_year_project = "($year_project). ";} 
		else {$includer_year_project = "($includer_year_project). ";}
	if ($year_project == 0)
		{$year_project = "";} 
		else {$year_project = "($year_project). ";}


		################## PRINT BIBLIOGRAPHIC CITATION
		$feedbody = $feedbody."<item>";
		$feedbody = $feedbody."<title>$name_project</title>";
		$feedbody = $feedbody."<link>$bibciterurl/reports/projects.php?idp=$id_project</link>";		
		$datepubitem = dateformat_pubdate($dateregister_project);
		$feedbody = $feedbody."<pubDate>$datepubitem</pubDate>";
		$feedbody = $feedbody."<guid isPermaLink=\"true\">$bibciterurl/reports/projects.php?idp=$id_project</guid>";		
		$feedbody = $feedbody."<description>";

		if ($includer_name_aux <> NULL)
			{$year_project = $includer_year_project;}
		if ($dummyname_contact_aux_clean <> NULL)
			{
			$feedbody = $feedbody."$dummyname_contact_aux_clean $year_project$name_project. ";
			}
			else
				{
				$feedbody .= "$name_project. $year_project";} // if there is no author, name of project goes first

		if ($city_project <> NULL)
			{
			$feedbody = $feedbody."$city_project";}
		if ($city_project <> NULL AND $editor_project <> NULL)
			{
			$feedbody = $feedbody.": ";}
		if ($editor_project <> NULL)
			{
			$feedbody = $feedbody."$editor_project. ";}
			$feedbody = $feedbody."</description>";
			$feedbody = $feedbody."</item>";
			#### END GETDATA
			}

$contact = "SELECT dummyname_contact FROM contacts WHERE (id_contact=$idc) ORDER BY dummyname_contact";
$contact = mysql_query($contact) or die("error export_feed_author_rss20.php line 76");
$contact = mysql_fetch_array($contact);
extract($contact);
$title = $sitetitle.": ".$dummyname_contact;
$pubdate = date("D, d M Y H:i:s +0000");
$feedheader = "<rss version=\"2.0\">
<channel>
	<title>$title</title>
	<link>$bibciterurl</link>
	<description>$sitemotto</description>
	<pubDate>".$pubdate."</pubDate>
	<language>en</language>";

$feedfooter = "</channel></rss>";
$exportfile ="../rss20.xml";
/*
$exportrss20 = fopen($exportfile,'w+');
		fwrite($exportrss20,$feedheader);
		fwrite($exportrss20,$feedbody);
		fwrite($exportrss20,$feedfooter);
		fclose($exportrss20);
		*/
		echo $feedheader;
		echo $feedbody;
		echo $feedfooter;
?>
Return current item: BibCiter