Line 17... |
Line 17... |
17 |
// | |
|
17 |
// | |
|
18 |
// | You should have received a copy of the GNU Lesser General Public |
|
18 |
// | You should have received a copy of the GNU Lesser General Public |
|
19 |
// | License along with this library; if not, write to the Free Software |
|
19 |
// | License along with this library; if not, write to the Free Software |
|
20 |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
20 |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
21 |
// +------------------------------------------------------------------------------------------------------+
|
21 |
// +------------------------------------------------------------------------------------------------------+
|
22 |
// CVS : $Id: bazar.fonct.rss.php,v 1.60.2.7 2007-02-15 17:39:00 jp_milcent Exp $
|
22 |
// CVS : $Id: bazar.fonct.rss.php,v 1.60.2.8 2007-02-27 15:11:00 alexandre_tb Exp $
|
23 |
/**
|
23 |
/**
|
24 |
*
|
24 |
*
|
25 |
*@package bazar
|
25 |
*@package bazar
|
26 |
//Auteur original :
|
26 |
//Auteur original :
|
27 |
*@author Alexandre GRANIER <alexandre@tela-botanica.org>
|
27 |
*@author Alexandre GRANIER <alexandre@tela-botanica.org>
|
28 |
*@author Florian Schmitt <florian@ecole-et-nature.org>
|
28 |
*@author Florian Schmitt <florian@ecole-et-nature.org>
|
29 |
//Autres auteurs :
|
29 |
//Autres auteurs :
|
30 |
*@copyright Tela-Botanica 2000-2006
|
30 |
*@copyright Tela-Botanica 2000-2006
|
31 |
*@version $Revision: 1.60.2.7 $
|
31 |
*@version $Revision: 1.60.2.8 $
|
32 |
// +------------------------------------------------------------------------------------------------------+
|
32 |
// +------------------------------------------------------------------------------------------------------+
|
33 |
*/
|
33 |
*/
|
Line 34... |
Line 34... |
34 |
|
34 |
|
35 |
// +------------------------------------------------------------------------------------------------------+
|
35 |
// +------------------------------------------------------------------------------------------------------+
|
Line 550... |
Line 550... |
550 |
$req_where=1;
|
550 |
$req_where=1;
|
551 |
}
|
551 |
}
|
552 |
$nomflux=BAZ_DERNIERE_ACTU;
|
552 |
$nomflux=BAZ_DERNIERE_ACTU;
|
553 |
if (!is_array ($typeannonce) && $typeannonce!='' and $typeannonce!='toutes') {
|
553 |
if (!is_array ($typeannonce) && $typeannonce!='' and $typeannonce!='toutes') {
|
554 |
if ($req_where==1) {$requete .= ' AND ';}
|
554 |
if ($req_where==1) {$requete .= ' AND ';}
|
555 |
$requete .= 'bf_ce_nature='.$typeannonce;
|
555 |
$requete .= 'bf_ce_nature='.$typeannonce.' and bf_ce_nature=bn_id_nature ';;
|
556 |
$req_where=1;
|
556 |
$req_where=1;
|
557 |
//le nom du flux devient le type d'annonce
|
557 |
//le nom du flux devient le type d'annonce
|
558 |
$requete_nom_flux = 'select bn_label_nature from bazar_nature where bn_id_nature = '.$typeannonce;
|
558 |
$requete_nom_flux = 'select bn_label_nature from bazar_nature where bn_id_nature = '.$typeannonce;
|
559 |
$nomflux = $GLOBALS['_BAZAR_']['db']->getOne($requete_nom_flux) ;
|
559 |
$nomflux = $GLOBALS['_BAZAR_']['db']->getOne($requete_nom_flux) ;
|
560 |
}
|
560 |
}
|
Line 610... |
Line 610... |
610 |
if ($nbitem!='') {$requete .= ' LIMIT 0,'.$nbitem;}
|
610 |
if ($nbitem!='') {$requete .= ' LIMIT 0,'.$nbitem;}
|
611 |
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
|
611 |
$resultat = $GLOBALS['_BAZAR_']['db']->query($requete) ;
|
612 |
if (DB::isError($resultat)) {
|
612 |
if (DB::isError($resultat)) {
|
613 |
die ($resultat->getMessage().$resultat->getDebugInfo()) ;
|
613 |
die ($resultat->getMessage().$resultat->getDebugInfo()) ;
|
614 |
}
|
614 |
}
|
- |
|
615 |
|
615 |
// En-tete du flux RSS version 2.0
|
616 |
include_once 'XML/Util.php' ;
|
- |
|
617 |
|
- |
|
618 |
$xml = XML_Util::getXMLDeclaration('1.0', 'ISO-8859-1', 'no') ;
|
616 |
$xml = '<?xml version="1.0" encoding="ISO-8859-1"?>'."\n".'<rss version="2.0">'."\n";
|
619 |
$xml .= XML_Util::createStartElement ('rss', array('version' => '2.0')) ;
|
- |
|
620 |
$xml .= XML_Util::createStartElement ('channel');
|
- |
|
621 |
$xml .= XML_Util::createTag ('title', null, $nomflux, null, false);
|
617 |
$xml .= '<channel>'."\n".'<title>'.$nomflux.'</title>'."\n".'<link>'.BAZ_RSS_ADRESSESITE.'</link>'."\n";
|
622 |
$xml .= XML_Util::createTag ('link', null, BAZ_RSS_ADRESSESITE);
|
618 |
$xml .= '<description>'.BAZ_RSS_DESCRIPTIONSITE.'</description>'."\n".'<language>fr-FR</language>'."\n".
|
623 |
$xml .= XML_Util::createTag ('description', null, BAZ_RSS_DESCRIPTIONSITE);
|
- |
|
624 |
$xml .= XML_Util::createTag ('language', null, 'fr-FR');
|
619 |
'<copyright>Copyright 2005 '.BAZ_RSS_NOMSITE.'</copyright>'."\n";
|
625 |
$xml .= XML_Util::createTag ('copyright', null, 'Copyright 2005 '.BAZ_RSS_NOMSITE);
|
620 |
// Ajout de la date actuelle de publication (suivant la DTD RSS)
|
626 |
$xml .= XML_Util::createTag ('lastBuildDate', null, strftime('%d %b %Y %H:%M:%S GMT'));
|
621 |
$xml .= '<lastBuildDate>'.strftime('%d %b %Y %H:%M:%S GMT').'</lastBuildDate>'."\n";
|
627 |
$xml .= XML_Util::createTag ('docs', null, 'http://www.stervinou.com/projets/rss/');
|
622 |
// En-tete suite et fin
|
628 |
$xml .= XML_Util::createTag ('category', null, BAZ_RSS_CATEGORIE);
|
623 |
$xml .= '<docs>http://www.stervinou.com/projets/rss/</docs>'."\n".'<category>'.BAZ_RSS_CATEGORIE.'</category>'."\n".
|
629 |
$xml .= XML_Util::createTag ('managingEditor', null, BAZ_RSS_MANAGINGEDITOR);
|
624 |
'<managingEditor>'.BAZ_RSS_MANAGINGEDITOR.'</managingEditor>'."\n".'<webMaster>'.BAZ_RSS_WEBMASTER.'</webMaster>'."\n";
|
630 |
$xml .= XML_Util::createTag ('webMaster', null, BAZ_RSS_WEBMASTER);
|
- |
|
631 |
$xml .= XML_Util::createTag ('ttl', null, '60');
|
- |
|
632 |
$xml .= XML_Util::createStartElement ('image');
|
625 |
$xml .= '<ttl>60</ttl>'."\n".'<image>'."\n".'<title>'.BAZ_RSS_NOMSITE.'</title>'."\n".'<url>'.BAZ_RSS_LOGOSITE.'</url>'."\n".
|
633 |
$xml .= XML_Util::createTag ('title', null, BAZ_RSS_NOMSITE);
|
- |
|
634 |
$xml .= XML_Util::createTag ('url', null, BAZ_RSS_LOGOSITE);
|
- |
|
635 |
$xml .= XML_Util::createTag ('link', null, BAZ_RSS_ADRESSESITE);
|
626 |
'<link>'.BAZ_RSS_ADRESSESITE.'</link>'."\n".'</image>'."\n";
|
636 |
$xml .= XML_Util::createEndElement ('image');
|
627 |
if ($resultat->numRows()>0) {
|
637 |
if ($resultat->numRows()>0) {
|
628 |
// Creation des items : titre + lien + description + date de publication
|
638 |
// Creation des items : titre + lien + description + date de publication
|
629 |
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
|
639 |
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
|
630 |
$xml .= '<item>'."\n";
|
640 |
$xml .= XML_Util::createStartElement ('item');
|
- |
|
641 |
|
631 |
$xml .= '<title>'.$ligne['bf_titre'].'</title>'."\n";
|
642 |
$xml .= XML_Util::createTag ('title', null, $ligne['bf_titre']);
|
- |
|
643 |
|
632 |
$lien=$GLOBALS['_BAZAR_']['url'];
|
644 |
$lien=$GLOBALS['_BAZAR_']['url'];
|
633 |
$lien->addQueryString('action', BAZ_VOIR_FICHE);
|
645 |
$lien->addQueryString('action', BAZ_VOIR_FICHE);
|
634 |
$lien->addQueryString('id_fiche', $ligne['bf_id_fiche']);
|
646 |
$lien->addQueryString('id_fiche', $ligne['bf_id_fiche']);
|
- |
|
647 |
$xml .= XML_Util::createTag ('link', null, $lien->getURL());
|
635 |
$xml .= '<link>'.str_replace ('&', '&', $lien->getURL()).'</link>'."\n";
|
648 |
$xml .= XML_Util::createTag ('guid', null, $lien->getURL());
|
636 |
$xml .= '<description>'."\n".'<![CDATA[' ;
|
649 |
$xml .= XML_Util::createStartElement ('description');
|
637 |
if ($_GET['action'] != BAZ_VOIR_TOUTES_ANNONCES) {
|
650 |
if ($_GET['action'] != BAZ_VOIR_TOUTES_ANNONCES) {
|
638 |
//$xml .= baz_voir_fiche(0,$ligne['bf_id_fiche']) ;
|
- |
|
639 |
$xml .= $ligne['bf_description'] ;
|
651 |
$xml .= XML_Util::createCDataSection ($ligne['bf_description']);
|
640 |
}
|
652 |
}
|
641 |
$xml .= ']]>'."\n".'</description>'."\n";
|
653 |
$xml .= XML_Util::createEndElement ('description');
|
642 |
if ($ligne['bf_date_debut_validite_fiche'] == '0000-00-00') $date_pub = $ligne[' bf_date_creation_fiche'] ; else
|
654 |
if ($ligne['bf_date_debut_validite_fiche'] == '0000-00-00') $date_pub = $ligne[' bf_date_creation_fiche'] ; else
|
643 |
$date_pub = $ligne['bf_date_debut_validite_fiche'];
|
655 |
$date_pub = $ligne['bf_date_debut_validite_fiche'];
|
644 |
$xml .= '<pubDate>'.strftime('%d %b %Y %H:%M:%S GMT',strtotime($date_pub)).'</pubDate>'."\n";
|
656 |
$xml .= XML_Util::createTag ('pubDate', null, strftime('%d %b %Y %H:%M:%S GMT',strtotime($date_pub)));
|
645 |
$xml .= '</item>'."\n";
|
657 |
$xml .= XML_Util::createEndElement ('item');
|
646 |
}
|
658 |
}
|
647 |
}
|
659 |
}
|
648 |
else {//pas d'annonces
|
660 |
else {//pas d'annonces
|
649 |
$xml .= '<item>'."\n";
|
661 |
$xml .= XML_Util::createStartElement ('item');
|
650 |
$xml .= '<title>'.BAZ_PAS_D_ANNONCES.'</title>'."\n";
|
662 |
$xml .= XML_Util::createTag ('title', null, BAZ_PAS_D_ANNONCES);
|
651 |
$xml .= '<link>#</link>'."\n";
|
663 |
$xml .= XML_Util::createTag ('link', null, '#');
|
652 |
$xml .= '<description>'.BAZ_PAS_D_ANNONCES.'</description>'."\n";
|
664 |
$xml .= XML_Util::createTag ('description', null, BAZ_PAS_D_ANNONCES);
|
653 |
$xml .= '<pubDate>'.strftime('%d %b %Y %H:%M:%S GMT',strtotime('12/12/2004')).'</pubDate>'."\n";
|
665 |
$xml .= XML_Util::createTag ('pubDate', null, strftime('%d %b %Y %H:%M:%S GMT',strtotime('12/12/2004')));
|
- |
|
666 |
$xml .= XML_Util::createEndElement ('item');
|
654 |
$xml .= '</item>'."\n";
|
667 |
$xml .= '</item>'."\n";
|
655 |
}
|
668 |
}
|
- |
|
669 |
$xml .= XML_Util::createEndElement ('channel');
|
656 |
$xml .= '</channel>'."\n".'</rss>'."\n";
|
670 |
$xml .= XML_Util::createEndElement('rss') ;
|
657 |
return $xml;
|
671 |
return $xml;
|
658 |
}
|
672 |
}
|
Line 659... |
Line 673... |
659 |
|
673 |
|
Line 1020... |
Line 1034... |
1020 |
}
|
1034 |
}
|
Line 1021... |
Line 1035... |
1021 |
|
1035 |
|
1022 |
/* +--Fin du code ----------------------------------------------------------------------------------------+
|
1036 |
/* +--Fin du code ----------------------------------------------------------------------------------------+
|
1023 |
*
|
1037 |
*
|
- |
|
1038 |
* $Log: not supported by cvs2svn $
|
- |
|
1039 |
* Revision 1.60.2.7 2007/02/15 17:39:00 jp_milcent
|
- |
|
1040 |
* Remise dans le code d'un bogue...
|
- |
|
1041 |
* A corriger!
|
1024 |
* $Log: not supported by cvs2svn $
|
1042 |
*
|
1025 |
* Revision 1.60.2.6 2007/02/15 13:42:16 jp_milcent
|
1043 |
* Revision 1.60.2.6 2007/02/15 13:42:16 jp_milcent
|
1026 |
* Utilisation de IN à la place du = dans les requêtes traitant les catégories de fiches.
|
1044 |
* Utilisation de IN à la place du = dans les requêtes traitant les catégories de fiches.
|
1027 |
* Permet d'utiliser la syntaxe 1,2,3 dans la configuration de categorie_nature.
|
1045 |
* Permet d'utiliser la syntaxe 1,2,3 dans la configuration de categorie_nature.
|
1028 |
*
|
1046 |
*
|