Subversion Repositories Applications.bazar

Compare Revisions

Ignore whitespace Rev 219 → Rev 220

/trunk/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.73 2007-03-28 10:01:47 florian Exp $
// CVS : $Id: bazar.fonct.rss.php,v 1.74 2007-03-28 15:54:32 florian 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.73 $
*@version $Revision: 1.74 $
// +------------------------------------------------------------------------------------------------------+
*/
 
620,23 → 620,6
die ($resultat->getMessage().$resultat->getDebugInfo()) ;
}
function xmlEntities($s){
//build first an assoc. array with the entities we want to match
$table1 = get_html_translation_table(HTML_ENTITIES, ENT_QUOTES);
//now build another assoc. array with the entities we want to replace (numeric entities)
foreach ($table1 as $k=>$v){
$table1[$k] = "/$v/";
$c = htmlentities($k,ENT_QUOTES,"UTF-8");
$table2[$c] = "&#".ord($k).";";
}
//now perform a replacement using preg_replace
//each matched value in array 1 will be replaced with the corresponding value in array 2
$s = preg_replace($table1,$table2,$s);
return $s;
}
include_once PAP_CHEMIN_API_PEAR . 'XML/Util.php' ;
// passage en utf-8 --julien
651,7 → 634,7
$xml .= "\r\n ";
$xml .= XML_Util::createStartElement ('channel');
$xml .= "\r\n ";
$xml .= XML_Util::createTag ('title', null, utf8_encode($nomflux));
$xml .= XML_Util::createTag ('title', null, utf8_encode(html_entity_decode($nomflux)));
$xml .= "\r\n ";
$xml .= XML_Util::createTag ('link', null, BAZ_RSS_ADRESSESITE);
$xml .= "\r\n ";
675,7 → 658,7
$xml .= "\r\n ";
$xml .= XML_Util::createStartElement ('image');
$xml .= "\r\n ";
$xml .= XML_Util::createTag ('title', null, utf8_encode(BAZ_RSS_NOMSITE));
$xml .= XML_Util::createTag ('title', null, utf8_encode(html_entity_decode(BAZ_RSS_NOMSITE)));
$xml .= "\r\n ";
$xml .= XML_Util::createTag ('url', null, BAZ_RSS_LOGOSITE);
$xml .= "\r\n ";
688,25 → 671,27
$xml .= "\r\n ";
$xml .= XML_Util::createStartElement ('item');
$xml .= "\r\n ";
$xml .= XML_Util::createTag ('title', null, utf8_encode($ligne['bf_titre']) );
$xml .= XML_Util::createTag ('title', null, utf8_encode(html_entity_decode(($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 .= XML_Util::createTag ('link', null, utf8_encode(html_entity_decode($lien->getURL())));
$xml .= "\r\n ";
$xml .= XML_Util::createTag ('guid', null, $lien->getURL());
$xml .= XML_Util::createTag ('guid', null, utf8_encode(html_entity_decode($lien->getURL())));
$xml .= "\r\n ";
$xml .= XML_Util::createStartElement ('description');
$xml .= "\r\n ";
if ($_GET['action'] != BAZ_VOIR_TOUTES_ANNONCES) {
$xml .= XML_Util::createCDataSection ( utf8_encode($ligne['bf_description']) );
$xml .= XML_Util::createCDataSection ( utf8_encode(html_entity_decode(($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'];
if ($ligne['bf_date_debut_validite_fiche'] != '0000-00-00' &&
$ligne['bf_date_debut_validite_fiche']>$ligne['bf_date_creation_fiche']) {
$date_pub = $ligne['bf_date_debut_validite_fiche'];
} else $date_pub = $ligne['bf_date_creation_fiche'] ;
$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');
716,13 → 701,13
$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 ('title', null, utf8_encode(html_entity_decode(BAZ_PAS_D_ANNONCES)));
$xml .= "\r\n ";
$xml .= XML_Util::createTag ('link', null, $GLOBALS['_BAZAR_']['url']->getUrl());
$xml .= XML_Util::createTag ('link', null, utf8_encode(html_entity_decode($GLOBALS['_BAZAR_']['url']->getUrl())));
$xml .= "\r\n ";
$xml .= XML_Util::createTag ('guid', null, $GLOBALS['_BAZAR_']['url']->getUrl());
$xml .= XML_Util::createTag ('guid', null, utf8_encode(html_entity_decode($GLOBALS['_BAZAR_']['url']->getUrl())));
$xml .= "\r\n ";
$xml .= XML_Util::createTag ('description', null, BAZ_PAS_D_ANNONCES);
$xml .= XML_Util::createTag ('description', null, utf8_encode(html_entity_decode(BAZ_PAS_D_ANNONCES)));
$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 ";
974,7 → 959,10
$res .= $formtemplate->toHTML();
if (!isset($_REQUEST['recherche_effectuee'])) {
$res .= '<p class="zone_info">'.BAZ_ENTRER_VOS_CRITERES_DE_RECHERCHE.'</p>'."\n";
$res .= '{{Syndication titre="Derni&egrave;res actualit&eacute;s" url="http://localhost/papyrus/papyrus.php?menu=13&action=18" nb=10 nouvellefenetre=0 formatdate="jma"}}';
$GLOBALS['_BAZAR_']['url']->addQueryString('action',BAZ_VOIR_FLUX_RSS);
$GLOBALS['_BAZAR_']['url']->addQueryString('annonce',$GLOBALS['_BAZAR_']['id_typeannonce']);
if ($GLOBALS['_BAZAR_']['categorie_nature']!=0) $GLOBALS['_BAZAR_']['url']->addQueryString('categorie_nature',$GLOBALS['_BAZAR_']['categorie_nature']);
$res .= '{{Syndication titre="Derni&egrave;res actualit&eacute;s" url="'.$GLOBALS['_BAZAR_']['url']->getURL().'" nb=10 nouvellefenetre=0 formatdate="'.BAZ_FORMAT_DATE_DEFAUT.'"}}';
}
}
1077,7 → 1065,7
$donnees = array();
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
$GLOBALS['_BAZAR_']['url']->addQueryString('id_fiche', $ligne->bf_id_fiche) ;
$GLOBALS['_BAZAR_']['url']->addQueryString('id_fiche', $ligne['bf_id_fiche']) ;
array_push ($donnees, $ligne);
}
// Mise en place du Pager
1125,7 → 1113,6
$res .='<a href="'.$GLOBALS['_BAZAR_']['url']->getURL().'" onclick="javascript:return confirm(\''.BAZ_SUPPRIMER.'\');">('.BAZ_SUPPRIMER.')</a>';
$GLOBALS['_BAZAR_']['url']->removeQueryString('action');
}
$res .= '<ul><li>'.$valeur['bf_etablissement'].'</li></ul>'."\n".'</li>';
}
$res .= '</ul>'."\n".'<div class="bazar_numero">'.$pager->links.'</div>'."\n";
}
1143,6 → 1130,9
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.73 2007/03/28 10:01:47 florian
* ajout de la constante BAZ_UTILISE_TEMPLATE, pour utiliser ou non les templates pour l'affichage du moteur de recherche
*
* Revision 1.72 2007/03/28 08:51:22 neiluj
* passage des flux RSS en UTF-8
* ajout de l'indentation du code