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.71 2007-03-19 15:17:37 alexandre_tb Exp $
|
22 |
// CVS : $Id: bazar.fonct.rss.php,v 1.72 2007-03-28 08:51:22 neiluj 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.71 $
|
31 |
*@version $Revision: 1.72 $
|
32 |
// +------------------------------------------------------------------------------------------------------+
|
32 |
// +------------------------------------------------------------------------------------------------------+
|
33 |
*/
|
33 |
*/
|
Line 34... |
Line 34... |
34 |
|
34 |
|
35 |
// +------------------------------------------------------------------------------------------------------+
|
35 |
// +------------------------------------------------------------------------------------------------------+
|
Line 205... |
Line 205... |
205 |
include_once(BAZ_CHEMIN_APPLI.'templates/'.$GLOBALS['_BAZAR_']['typeannonce'].'-fiche.php');
|
205 |
include_once(BAZ_CHEMIN_APPLI.'templates/'.$GLOBALS['_BAZAR_']['typeannonce'].'-fiche.php');
|
206 |
$res .=genere_fiche($ligne);
|
206 |
$res .=genere_fiche($ligne);
|
207 |
}
|
207 |
}
|
208 |
//on affiche ligne par ligne sinon
|
208 |
//on affiche ligne par ligne sinon
|
209 |
else {
|
209 |
else {
|
210 |
//cas d'une image personalisée
|
210 |
//cas d'une image personnalisée
|
211 |
if (isset($ligne['bf_url_image'])) {
|
211 |
if (isset($ligne['bf_url_image'])) {
|
212 |
$res .= '<div id="fiche_image">'."\n";
|
212 |
$res .= '<div id="fiche_image">'."\n";
|
213 |
$res .= '<img src="client/bazar/upload/'.$ligne['bf_url_image'].'" border=0 alt="'.BAZ_TEXTE_IMG_ALTERNATIF.'" />'."\n";
|
213 |
$res .= '<img src="client/bazar/upload/'.$ligne['bf_url_image'].'" border=0 alt="'.BAZ_TEXTE_IMG_ALTERNATIF.'" />'."\n";
|
214 |
$res .= '</div>'."\n";
|
214 |
$res .= '</div>'."\n";
|
215 |
}
|
215 |
}
|
Line 635... |
Line 635... |
635 |
//each matched value in array 1 will be replaced with the corresponding value in array 2
|
635 |
//each matched value in array 1 will be replaced with the corresponding value in array 2
|
636 |
$s = preg_replace($table1,$table2,$s);
|
636 |
$s = preg_replace($table1,$table2,$s);
|
637 |
return $s;
|
637 |
return $s;
|
638 |
}
|
638 |
}
|
Line 639... |
Line 639... |
639 |
|
639 |
|
- |
|
640 |
include_once PAP_CHEMIN_API_PEAR . 'XML/Util.php' ;
|
- |
|
641 |
|
- |
|
642 |
// passage en utf-8 --julien
|
- |
|
643 |
// --
|
- |
|
644 |
// TODO: retour à la ligne (CRLF) et indentation du code pour la lisibilité
|
- |
|
645 |
|
- |
|
646 |
// setlocale() pour avoir les formats de date valides (w3c) --julien
|
640 |
include_once 'XML/Util.php' ;
|
647 |
setlocale(LC_TIME, "C");
|
641 |
|
648 |
|
- |
|
649 |
$xml = XML_Util::getXMLDeclaration('1.0', 'UTF-8', 'yes') ;
|
642 |
$xml = XML_Util::getXMLDeclaration('1.0', 'ISO-8859-1', 'no') ;
|
650 |
$xml .= "\r\n ";
|
- |
|
651 |
$xml .= XML_Util::createStartElement ('rss', array('version' => '2.0')) ;
|
643 |
$xml .= XML_Util::createStartElement ('rss', array('version' => '2.0')) ;
|
652 |
$xml .= "\r\n ";
|
- |
|
653 |
$xml .= XML_Util::createStartElement ('channel');
|
644 |
$xml .= XML_Util::createStartElement ('channel');
|
654 |
$xml .= "\r\n ";
|
- |
|
655 |
$xml .= XML_Util::createTag ('title', null, utf8_encode($nomflux));
|
645 |
$xml .= XML_Util::createTag ('title', null, $nomflux, null, false);
|
656 |
$xml .= "\r\n ";
|
- |
|
657 |
$xml .= XML_Util::createTag ('link', null, BAZ_RSS_ADRESSESITE);
|
646 |
$xml .= XML_Util::createTag ('link', null, BAZ_RSS_ADRESSESITE);
|
658 |
$xml .= "\r\n ";
|
- |
|
659 |
$xml .= XML_Util::createTag ('description', null, BAZ_RSS_DESCRIPTIONSITE);
|
647 |
$xml .= XML_Util::createTag ('description', null, BAZ_RSS_DESCRIPTIONSITE);
|
660 |
$xml .= "\r\n ";
|
- |
|
661 |
$xml .= XML_Util::createTag ('language', null, 'fr-FR');
|
648 |
$xml .= XML_Util::createTag ('language', null, 'fr-FR');
|
662 |
$xml .= "\r\n ";
|
- |
|
663 |
$xml .= XML_Util::createTag ('copyright', null, 'Copyright (c) '. date('Y') .' '. BAZ_RSS_NOMSITE);
|
649 |
$xml .= XML_Util::createTag ('copyright', null, 'Copyright 2005 '.BAZ_RSS_NOMSITE);
|
664 |
$xml .= "\r\n ";
|
- |
|
665 |
$xml .= XML_Util::createTag ('lastBuildDate', null, strftime('%a, %d %b %Y %H:%M:%S GMT'));
|
650 |
$xml .= XML_Util::createTag ('lastBuildDate', null, strftime('%d %b %Y %H:%M:%S GMT'));
|
666 |
$xml .= "\r\n ";
|
- |
|
667 |
$xml .= XML_Util::createTag ('docs', null, 'http://www.stervinou.com/projets/rss/');
|
651 |
$xml .= XML_Util::createTag ('docs', null, 'http://www.stervinou.com/projets/rss/');
|
668 |
$xml .= "\r\n ";
|
- |
|
669 |
$xml .= XML_Util::createTag ('category', null, BAZ_RSS_CATEGORIE);
|
652 |
$xml .= XML_Util::createTag ('category', null, BAZ_RSS_CATEGORIE);
|
670 |
$xml .= "\r\n ";
|
- |
|
671 |
$xml .= XML_Util::createTag ('managingEditor', null, BAZ_RSS_MANAGINGEDITOR);
|
653 |
$xml .= XML_Util::createTag ('managingEditor', null, BAZ_RSS_MANAGINGEDITOR);
|
672 |
$xml .= "\r\n ";
|
- |
|
673 |
$xml .= XML_Util::createTag ('webMaster', null, BAZ_RSS_WEBMASTER);
|
654 |
$xml .= XML_Util::createTag ('webMaster', null, BAZ_RSS_WEBMASTER);
|
674 |
$xml .= "\r\n ";
|
- |
|
675 |
$xml .= XML_Util::createTag ('ttl', null, '60');
|
655 |
$xml .= XML_Util::createTag ('ttl', null, '60');
|
676 |
$xml .= "\r\n ";
|
- |
|
677 |
$xml .= XML_Util::createStartElement ('image');
|
656 |
$xml .= XML_Util::createStartElement ('image');
|
678 |
$xml .= "\r\n ";
|
- |
|
679 |
$xml .= XML_Util::createTag ('title', null, utf8_encode(BAZ_RSS_NOMSITE));
|
657 |
$xml .= XML_Util::createTag ('title', null, BAZ_RSS_NOMSITE);
|
680 |
$xml .= "\r\n ";
|
- |
|
681 |
$xml .= XML_Util::createTag ('url', null, BAZ_RSS_LOGOSITE);
|
658 |
$xml .= XML_Util::createTag ('url', null, BAZ_RSS_LOGOSITE);
|
682 |
$xml .= "\r\n ";
|
- |
|
683 |
$xml .= XML_Util::createTag ('link', null, BAZ_RSS_ADRESSESITE);
|
659 |
$xml .= XML_Util::createTag ('link', null, BAZ_RSS_ADRESSESITE);
|
684 |
$xml .= "\r\n ";
|
660 |
$xml .= XML_Util::createEndElement ('image');
|
685 |
$xml .= XML_Util::createEndElement ('image');
|
661 |
if ($resultat->numRows()>0) {
|
686 |
if ($resultat->numRows() > 0) {
|
662 |
// Creation des items : titre + lien + description + date de publication
|
687 |
// Creation des items : titre + lien + description + date de publication
|
- |
|
688 |
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
|
663 |
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
|
689 |
$xml .= "\r\n ";
|
664 |
$xml .= XML_Util::createStartElement ('item');
|
690 |
$xml .= XML_Util::createStartElement ('item');
|
665 |
$caractere = array('/\x92/', '/\x85/', '/\x80/', '/\x97/', '/\x96/');
|
- |
|
666 |
$caractere_remplacement = array ('’', '…', '€', '—', '–');
|
691 |
$xml .= "\r\n ";
|
667 |
$xml .= XML_Util::createTag ('title', null, preg_replace ($caractere, $caractere_remplacement,
|
692 |
$xml .= XML_Util::createTag ('title', null, utf8_encode($ligne['bf_titre']) );
|
668 |
XML_Util::replaceEntities($ligne['bf_titre'])));
|
693 |
$xml .= "\r\n ";
|
669 |
$lien=$GLOBALS['_BAZAR_']['url'];
|
694 |
$lien=$GLOBALS['_BAZAR_']['url'];
|
670 |
$lien->addQueryString('action', BAZ_VOIR_FICHE);
|
695 |
$lien->addQueryString('action', BAZ_VOIR_FICHE);
|
671 |
$lien->addQueryString('id_fiche', $ligne['bf_id_fiche']);
|
696 |
$lien->addQueryString('id_fiche', $ligne['bf_id_fiche']);
|
- |
|
697 |
$xml .= XML_Util::createTag ('link', null, $lien->getURL());
|
672 |
$xml .= XML_Util::createTag ('link', null, $lien->getURL());
|
698 |
$xml .= "\r\n ";
|
- |
|
699 |
$xml .= XML_Util::createTag ('guid', null, $lien->getURL());
|
673 |
$xml .= XML_Util::createTag ('guid', null, $lien->getURL());
|
700 |
$xml .= "\r\n ";
|
- |
|
701 |
$xml .= XML_Util::createStartElement ('description');
|
674 |
$xml .= XML_Util::createStartElement ('description');
|
702 |
$xml .= "\r\n ";
|
675 |
if ($_GET['action'] != BAZ_VOIR_TOUTES_ANNONCES) {
|
703 |
if ($_GET['action'] != BAZ_VOIR_TOUTES_ANNONCES) {
|
676 |
$xml .= XML_Util::createCDataSection (preg_replace ($caractere, $caractere_remplacement, $ligne['bf_description']));
|
704 |
$xml .= XML_Util::createCDataSection ( utf8_encode($ligne['bf_description']) );
|
- |
|
705 |
}
|
677 |
}
|
706 |
$xml .= "\r\n ";
|
- |
|
707 |
$xml .= XML_Util::createEndElement ('description');
|
678 |
$xml .= XML_Util::createEndElement ('description');
|
708 |
$xml .= "\r\n ";
|
679 |
if ($ligne['bf_date_debut_validite_fiche'] == '0000-00-00') $date_pub = $ligne[' bf_date_creation_fiche'] ; else
|
709 |
if ($ligne['bf_date_debut_validite_fiche'] == '0000-00-00') $date_pub = $ligne[' bf_date_creation_fiche'] ; else
|
680 |
$date_pub = $ligne['bf_date_debut_validite_fiche'];
|
710 |
$date_pub = $ligne['bf_date_debut_validite_fiche'];
|
- |
|
711 |
$xml .= XML_Util::createTag ('pubDate', null, strftime('%a, %d %b %Y %H:%M:%S GMT',strtotime($date_pub)));
|
681 |
$xml .= XML_Util::createTag ('pubDate', null, strftime('%d %b %Y %H:%M:%S GMT',strtotime($date_pub)));
|
712 |
$xml .= "\r\n ";
|
682 |
$xml .= XML_Util::createEndElement ('item');
|
713 |
$xml .= XML_Util::createEndElement ('item');
|
683 |
}
|
714 |
}
|
684 |
}
|
715 |
}
|
- |
|
716 |
else {//pas d'annonces
|
685 |
else {//pas d'annonces
|
717 |
$xml .= "\r\n ";
|
- |
|
718 |
$xml .= XML_Util::createStartElement ('item');
|
686 |
$xml .= XML_Util::createStartElement ('item');
|
719 |
$xml .= "\r\n ";
|
- |
|
720 |
$xml .= XML_Util::createTag ('title', null, BAZ_PAS_D_ANNONCES);
|
687 |
$xml .= XML_Util::createTag ('title', null, BAZ_PAS_D_ANNONCES);
|
721 |
$xml .= "\r\n ";
|
- |
|
722 |
$xml .= XML_Util::createTag ('link', null, $GLOBALS['_BAZAR_']['url']->getUrl());
|
- |
|
723 |
$xml .= "\r\n ";
|
- |
|
724 |
$xml .= XML_Util::createTag ('guid', null, $GLOBALS['_BAZAR_']['url']->getUrl());
|
688 |
$xml .= XML_Util::createTag ('link', null, '#');
|
725 |
$xml .= "\r\n ";
|
- |
|
726 |
$xml .= XML_Util::createTag ('description', null, BAZ_PAS_D_ANNONCES);
|
689 |
$xml .= XML_Util::createTag ('description', null, BAZ_PAS_D_ANNONCES);
|
727 |
$xml .= "\r\n ";
|
- |
|
728 |
$xml .= XML_Util::createTag ('pubDate', null, strftime('%a, %d %b %Y %H:%M:%S GMT',strtotime("01/01/%Y")));
|
690 |
$xml .= XML_Util::createTag ('pubDate', null, strftime('%d %b %Y %H:%M:%S GMT',strtotime('12/12/2004')));
|
729 |
$xml .= "\r\n ";
|
691 |
$xml .= XML_Util::createEndElement ('item');
|
- |
|
692 |
|
730 |
$xml .= XML_Util::createEndElement ('item');
|
- |
|
731 |
}
|
693 |
}
|
732 |
$xml .= "\r\n ";
|
694 |
$xml .= XML_Util::createEndElement ('channel');
|
733 |
$xml .= XML_Util::createEndElement ('channel');
|
695 |
$xml .= XML_Util::createEndElement('rss') ;
|
- |
|
696 |
$xml .= XML_Util::createEndElement ('channel');
|
734 |
$xml .= "\r\n ";
|
Line 697... |
Line 735... |
697 |
$xml .= XML_Util::createEndElement('rss') ;
|
735 |
$xml .= XML_Util::createEndElement('rss') ;
|
698 |
|
736 |
|
699 |
// Nettoyage de l'url
|
737 |
// Nettoyage de l'url
|
Line 1074... |
Line 1112... |
1074 |
}
|
1112 |
}
|
Line 1075... |
Line 1113... |
1075 |
|
1113 |
|
1076 |
/* +--Fin du code ----------------------------------------------------------------------------------------+
|
1114 |
/* +--Fin du code ----------------------------------------------------------------------------------------+
|
1077 |
*
|
1115 |
*
|
- |
|
1116 |
* $Log: not supported by cvs2svn $
|
- |
|
1117 |
* Revision 1.71 2007/03/19 15:17:37 alexandre_tb
|
- |
|
1118 |
* correction de la requete de recherche
|
1078 |
* $Log: not supported by cvs2svn $
|
1119 |
*
|
1079 |
* Revision 1.70 2007/03/08 15:12:13 jp_milcent
|
1120 |
* Revision 1.70 2007/03/08 15:12:13 jp_milcent
|
1080 |
* Fusion avec la livraison Menes : 08 mars 2007
|
1121 |
* Fusion avec la livraison Menes : 08 mars 2007
|
1081 |
*
|
1122 |
*
|
1082 |
* Revision 1.60.2.11 2007/03/07 17:20:19 jp_milcent
|
1123 |
* Revision 1.60.2.11 2007/03/07 17:20:19 jp_milcent
|