Subversion Repositories Applications.bazar

Compare Revisions

Ignore whitespace Rev 187 → Rev 188

/branches/livraison_menes/bibliotheque/bazar.fonct.rss.php
19,7 → 19,7
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: bazar.fonct.rss.php,v 1.60.2.7 2007-02-15 17:39:00 jp_milcent Exp $
// CVS : $Id: bazar.fonct.rss.php,v 1.60.2.8 2007-02-27 15:11:00 alexandre_tb Exp $
/**
*
*@package bazar
28,7 → 28,7
*@author Florian Schmitt <florian@ecole-et-nature.org>
//Autres auteurs :
*@copyright Tela-Botanica 2000-2006
*@version $Revision: 1.60.2.7 $
*@version $Revision: 1.60.2.8 $
// +------------------------------------------------------------------------------------------------------+
*/
 
552,7 → 552,7
$nomflux=BAZ_DERNIERE_ACTU;
if (!is_array ($typeannonce) && $typeannonce!='' and $typeannonce!='toutes') {
if ($req_where==1) {$requete .= ' AND ';}
$requete .= 'bf_ce_nature='.$typeannonce;
$requete .= 'bf_ce_nature='.$typeannonce.' and bf_ce_nature=bn_id_nature ';;
$req_where=1;
//le nom du flux devient le type d'annonce
$requete_nom_flux = 'select bn_label_nature from bazar_nature where bn_id_nature = '.$typeannonce;
612,48 → 612,62
if (DB::isError($resultat)) {
die ($resultat->getMessage().$resultat->getDebugInfo()) ;
}
// En-tete du flux RSS version 2.0
$xml = '<?xml version="1.0" encoding="ISO-8859-1"?>'."\n".'<rss version="2.0">'."\n";
$xml .= '<channel>'."\n".'<title>'.$nomflux.'</title>'."\n".'<link>'.BAZ_RSS_ADRESSESITE.'</link>'."\n";
$xml .= '<description>'.BAZ_RSS_DESCRIPTIONSITE.'</description>'."\n".'<language>fr-FR</language>'."\n".
'<copyright>Copyright 2005 '.BAZ_RSS_NOMSITE.'</copyright>'."\n";
// Ajout de la date actuelle de publication (suivant la DTD RSS)
$xml .= '<lastBuildDate>'.strftime('%d %b %Y %H:%M:%S GMT').'</lastBuildDate>'."\n";
// En-tete suite et fin
$xml .= '<docs>http://www.stervinou.com/projets/rss/</docs>'."\n".'<category>'.BAZ_RSS_CATEGORIE.'</category>'."\n".
'<managingEditor>'.BAZ_RSS_MANAGINGEDITOR.'</managingEditor>'."\n".'<webMaster>'.BAZ_RSS_WEBMASTER.'</webMaster>'."\n";
$xml .= '<ttl>60</ttl>'."\n".'<image>'."\n".'<title>'.BAZ_RSS_NOMSITE.'</title>'."\n".'<url>'.BAZ_RSS_LOGOSITE.'</url>'."\n".
'<link>'.BAZ_RSS_ADRESSESITE.'</link>'."\n".'</image>'."\n";
 
include_once 'XML/Util.php' ;
 
$xml = XML_Util::getXMLDeclaration('1.0', 'ISO-8859-1', 'no') ;
$xml .= XML_Util::createStartElement ('rss', array('version' => '2.0')) ;
$xml .= XML_Util::createStartElement ('channel');
$xml .= XML_Util::createTag ('title', null, $nomflux, null, false);
$xml .= XML_Util::createTag ('link', null, BAZ_RSS_ADRESSESITE);
$xml .= XML_Util::createTag ('description', null, BAZ_RSS_DESCRIPTIONSITE);
$xml .= XML_Util::createTag ('language', null, 'fr-FR');
$xml .= XML_Util::createTag ('copyright', null, 'Copyright 2005 '.BAZ_RSS_NOMSITE);
$xml .= XML_Util::createTag ('lastBuildDate', null, strftime('%d %b %Y %H:%M:%S GMT'));
$xml .= XML_Util::createTag ('docs', null, 'http://www.stervinou.com/projets/rss/');
$xml .= XML_Util::createTag ('category', null, BAZ_RSS_CATEGORIE);
$xml .= XML_Util::createTag ('managingEditor', null, BAZ_RSS_MANAGINGEDITOR);
$xml .= XML_Util::createTag ('webMaster', null, BAZ_RSS_WEBMASTER);
$xml .= XML_Util::createTag ('ttl', null, '60');
$xml .= XML_Util::createStartElement ('image');
$xml .= XML_Util::createTag ('title', null, BAZ_RSS_NOMSITE);
$xml .= XML_Util::createTag ('url', null, BAZ_RSS_LOGOSITE);
$xml .= XML_Util::createTag ('link', null, BAZ_RSS_ADRESSESITE);
$xml .= XML_Util::createEndElement ('image');
if ($resultat->numRows()>0) {
// Creation des items : titre + lien + description + date de publication
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
$xml .= '<item>'."\n";
$xml .= '<title>'.$ligne['bf_titre'].'</title>'."\n";
$xml .= XML_Util::createStartElement ('item');
$xml .= XML_Util::createTag ('title', null, $ligne['bf_titre']);
$lien=$GLOBALS['_BAZAR_']['url'];
$lien->addQueryString('action', BAZ_VOIR_FICHE);
$lien->addQueryString('id_fiche', $ligne['bf_id_fiche']);
$xml .= '<link>'.str_replace ('&', '&amp;', $lien->getURL()).'</link>'."\n";
$xml .= '<description>'."\n".'<![CDATA[' ;
$xml .= XML_Util::createTag ('link', null, $lien->getURL());
$xml .= XML_Util::createTag ('guid', null, $lien->getURL());
$xml .= XML_Util::createStartElement ('description');
if ($_GET['action'] != BAZ_VOIR_TOUTES_ANNONCES) {
//$xml .= baz_voir_fiche(0,$ligne['bf_id_fiche']) ;
$xml .= $ligne['bf_description'] ;
$xml .= XML_Util::createCDataSection ($ligne['bf_description']);
}
$xml .= ']]>'."\n".'</description>'."\n";
$xml .= XML_Util::createEndElement ('description');
if ($ligne['bf_date_debut_validite_fiche'] == '0000-00-00') $date_pub = $ligne[' bf_date_creation_fiche'] ; else
$date_pub = $ligne['bf_date_debut_validite_fiche'];
$xml .= '<pubDate>'.strftime('%d %b %Y %H:%M:%S GMT',strtotime($date_pub)).'</pubDate>'."\n";
$xml .= '</item>'."\n";
$xml .= XML_Util::createTag ('pubDate', null, strftime('%d %b %Y %H:%M:%S GMT',strtotime($date_pub)));
$xml .= XML_Util::createEndElement ('item');
}
}
else {//pas d'annonces
$xml .= '<item>'."\n";
$xml .= '<title>'.BAZ_PAS_D_ANNONCES.'</title>'."\n";
$xml .= '<link>#</link>'."\n";
$xml .= '<description>'.BAZ_PAS_D_ANNONCES.'</description>'."\n";
$xml .= '<pubDate>'.strftime('%d %b %Y %H:%M:%S GMT',strtotime('12/12/2004')).'</pubDate>'."\n";
$xml .= XML_Util::createStartElement ('item');
$xml .= XML_Util::createTag ('title', null, BAZ_PAS_D_ANNONCES);
$xml .= XML_Util::createTag ('link', null, '#');
$xml .= XML_Util::createTag ('description', null, BAZ_PAS_D_ANNONCES);
$xml .= XML_Util::createTag ('pubDate', null, strftime('%d %b %Y %H:%M:%S GMT',strtotime('12/12/2004')));
$xml .= XML_Util::createEndElement ('item');
$xml .= '</item>'."\n";
}
$xml .= '</channel>'."\n".'</rss>'."\n";
$xml .= XML_Util::createEndElement ('channel');
$xml .= XML_Util::createEndElement('rss') ;
return $xml;
}
 
1022,6 → 1036,10
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.60.2.7 2007/02/15 17:39:00 jp_milcent
* Remise dans le code d'un bogue...
* A corriger!
*
* Revision 1.60.2.6 2007/02/15 13:42:16 jp_milcent
* Utilisation de IN à la place du = dans les requêtes traitant les catégories de fiches.
* Permet d'utiliser la syntaxe 1,2,3 dans la configuration de categorie_nature.