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.71 2007-03-19 15:17:37 alexandre_tb Exp $ |
// CVS : $Id: bazar.fonct.rss.php,v 1.72 2007-03-28 08:51:22 neiluj 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.71 $ |
*@version $Revision: 1.72 $ |
// +------------------------------------------------------------------------------------------------------+ |
*/ |
|
207,7 → 207,7 |
} |
//on affiche ligne par ligne sinon |
else { |
//cas d'une image personalisée |
//cas d'une image personnalisée |
if (isset($ligne['bf_url_image'])) { |
$res .= '<div id="fiche_image">'."\n"; |
$res .= '<img src="client/bazar/upload/'.$ligne['bf_url_image'].'" border=0 alt="'.BAZ_TEXTE_IMG_ALTERNATIF.'" />'."\n"; |
637,64 → 637,102 |
return $s; |
} |
|
include_once 'XML/Util.php' ; |
|
$xml = XML_Util::getXMLDeclaration('1.0', 'ISO-8859-1', 'no') ; |
include_once PAP_CHEMIN_API_PEAR . 'XML/Util.php' ; |
|
// passage en utf-8 --julien |
// -- |
// TODO: retour à la ligne (CRLF) et indentation du code pour la lisibilité |
|
// setlocale() pour avoir les formats de date valides (w3c) --julien |
setlocale(LC_TIME, "C"); |
|
$xml = XML_Util::getXMLDeclaration('1.0', 'UTF-8', 'yes') ; |
$xml .= "\r\n "; |
$xml .= XML_Util::createStartElement ('rss', array('version' => '2.0')) ; |
$xml .= "\r\n "; |
$xml .= XML_Util::createStartElement ('channel'); |
$xml .= XML_Util::createTag ('title', null, $nomflux, null, false); |
$xml .= "\r\n "; |
$xml .= XML_Util::createTag ('title', null, utf8_encode($nomflux)); |
$xml .= "\r\n "; |
$xml .= XML_Util::createTag ('link', null, BAZ_RSS_ADRESSESITE); |
$xml .= "\r\n "; |
$xml .= XML_Util::createTag ('description', null, BAZ_RSS_DESCRIPTIONSITE); |
$xml .= "\r\n "; |
$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 .= "\r\n "; |
$xml .= XML_Util::createTag ('copyright', null, 'Copyright (c) '. date('Y') .' '. BAZ_RSS_NOMSITE); |
$xml .= "\r\n "; |
$xml .= XML_Util::createTag ('lastBuildDate', null, strftime('%a, %d %b %Y %H:%M:%S GMT')); |
$xml .= "\r\n "; |
$xml .= XML_Util::createTag ('docs', null, 'http://www.stervinou.com/projets/rss/'); |
$xml .= "\r\n "; |
$xml .= XML_Util::createTag ('category', null, BAZ_RSS_CATEGORIE); |
$xml .= "\r\n "; |
$xml .= XML_Util::createTag ('managingEditor', null, BAZ_RSS_MANAGINGEDITOR); |
$xml .= "\r\n "; |
$xml .= XML_Util::createTag ('webMaster', null, BAZ_RSS_WEBMASTER); |
$xml .= "\r\n "; |
$xml .= XML_Util::createTag ('ttl', null, '60'); |
$xml .= "\r\n "; |
$xml .= XML_Util::createStartElement ('image'); |
$xml .= XML_Util::createTag ('title', null, BAZ_RSS_NOMSITE); |
$xml .= "\r\n "; |
$xml .= XML_Util::createTag ('title', null, utf8_encode(BAZ_RSS_NOMSITE)); |
$xml .= "\r\n "; |
$xml .= XML_Util::createTag ('url', null, BAZ_RSS_LOGOSITE); |
$xml .= "\r\n "; |
$xml .= XML_Util::createTag ('link', null, BAZ_RSS_ADRESSESITE); |
$xml .= "\r\n "; |
$xml .= XML_Util::createEndElement ('image'); |
if ($resultat->numRows()>0) { |
if ($resultat->numRows() > 0) { |
// Creation des items : titre + lien + description + date de publication |
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) { |
$xml .= "\r\n "; |
$xml .= XML_Util::createStartElement ('item'); |
$caractere = array('/\x92/', '/\x85/', '/\x80/', '/\x97/', '/\x96/'); |
$caractere_remplacement = array ('’', '…', '€', '—', '–'); |
$xml .= XML_Util::createTag ('title', null, preg_replace ($caractere, $caractere_remplacement, |
XML_Util::replaceEntities($ligne['bf_titre']))); |
$xml .= "\r\n "; |
$xml .= XML_Util::createTag ('title', null, utf8_encode($ligne['bf_titre']) ); |
$xml .= "\r\n "; |
$lien=$GLOBALS['_BAZAR_']['url']; |
$lien->addQueryString('action', BAZ_VOIR_FICHE); |
$lien->addQueryString('id_fiche', $ligne['bf_id_fiche']); |
$xml .= XML_Util::createTag ('link', null, $lien->getURL()); |
$xml .= "\r\n "; |
$xml .= XML_Util::createTag ('guid', null, $lien->getURL()); |
$xml .= "\r\n "; |
$xml .= XML_Util::createStartElement ('description'); |
$xml .= "\r\n "; |
if ($_GET['action'] != BAZ_VOIR_TOUTES_ANNONCES) { |
$xml .= XML_Util::createCDataSection (preg_replace ($caractere, $caractere_remplacement, $ligne['bf_description'])); |
$xml .= XML_Util::createCDataSection ( utf8_encode($ligne['bf_description']) ); |
} |
$xml .= "\r\n "; |
$xml .= XML_Util::createEndElement ('description'); |
$xml .= "\r\n "; |
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 .= XML_Util::createTag ('pubDate', null, strftime('%d %b %Y %H:%M:%S GMT',strtotime($date_pub))); |
$xml .= XML_Util::createTag ('pubDate', null, strftime('%a, %d %b %Y %H:%M:%S GMT',strtotime($date_pub))); |
$xml .= "\r\n "; |
$xml .= XML_Util::createEndElement ('item'); |
} |
} |
else {//pas d'annonces |
$xml .= "\r\n "; |
$xml .= XML_Util::createStartElement ('item'); |
$xml .= "\r\n "; |
$xml .= XML_Util::createTag ('title', null, BAZ_PAS_D_ANNONCES); |
$xml .= XML_Util::createTag ('link', null, '#'); |
$xml .= "\r\n "; |
$xml .= XML_Util::createTag ('link', null, $GLOBALS['_BAZAR_']['url']->getUrl()); |
$xml .= "\r\n "; |
$xml .= XML_Util::createTag ('guid', null, $GLOBALS['_BAZAR_']['url']->getUrl()); |
$xml .= "\r\n "; |
$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 .= "\r\n "; |
$xml .= XML_Util::createTag ('pubDate', null, strftime('%a, %d %b %Y %H:%M:%S GMT',strtotime("01/01/%Y"))); |
$xml .= "\r\n "; |
$xml .= XML_Util::createEndElement ('item'); |
|
} |
$xml .= "\r\n "; |
$xml .= XML_Util::createEndElement ('channel'); |
$xml .= "\r\n "; |
$xml .= XML_Util::createEndElement('rss') ; |
$xml .= XML_Util::createEndElement ('channel'); |
$xml .= XML_Util::createEndElement('rss') ; |
|
// Nettoyage de l'url |
$GLOBALS['_BAZAR_']['url']->removeQueryString('action'); |
1076,6 → 1114,9 |
/* +--Fin du code ----------------------------------------------------------------------------------------+ |
* |
* $Log: not supported by cvs2svn $ |
* Revision 1.71 2007/03/19 15:17:37 alexandre_tb |
* correction de la requete de recherche |
* |
* Revision 1.70 2007/03/08 15:12:13 jp_milcent |
* Fusion avec la livraison Menes : 08 mars 2007 |
* |