Subversion Repositories Applications.bazar

Rev

Rev 188 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 188 Rev 189
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.8 2007-02-27 15:11:00 alexandre_tb Exp $
22
// CVS : $Id: bazar.fonct.rss.php,v 1.60.2.9 2007-02-27 15:32:40 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.8 $
31
*@version       $Revision: 1.60.2.9 $
32
// +------------------------------------------------------------------------------------------------------+
32
// +------------------------------------------------------------------------------------------------------+
33
*/
33
*/
Line 34... Line 34...
34
 
34
 
35
// +------------------------------------------------------------------------------------------------------+
35
// +------------------------------------------------------------------------------------------------------+
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
	
-
 
616
	function xmlEntities($s){
-
 
617
		//build first an assoc. array with the entities we want to match
-
 
618
		$table1 = get_html_translation_table(HTML_ENTITIES, ENT_QUOTES);
-
 
619
		
-
 
620
		//now build another assoc. array with the entities we want to replace (numeric entities)
-
 
621
		foreach ($table1 as $k=>$v){
-
 
622
		  $table1[$k] = "/$v/";
-
 
623
		  $c = htmlentities($k,ENT_QUOTES,"UTF-8");
-
 
624
		  $table2[$c] = "&#".ord($k).";";
-
 
625
		}
-
 
626
		
-
 
627
		//now perform a replacement using preg_replace
-
 
628
		//each matched value in array 1 will be replaced with the corresponding value in array 2
-
 
629
		$s = preg_replace($table1,$table2,$s);
-
 
630
		return $s;
-
 
631
	}
-
 
632
	
616
	include_once 'XML/Util.php' ;
633
	include_once 'XML/Util.php' ;
Line 617... Line 634...
617
 
634
 
618
	$xml = XML_Util::getXMLDeclaration('1.0', 'ISO-8859-1', 'no') ; 
635
	$xml = XML_Util::getXMLDeclaration('1.0', 'ISO-8859-1', 'no') ; 
619
	$xml .= XML_Util::createStartElement ('rss', array('version' => '2.0')) ;
636
	$xml .= XML_Util::createStartElement ('rss', array('version' => '2.0')) ;
Line 637... Line 654...
637
	if ($resultat->numRows()>0) {
654
	if ($resultat->numRows()>0) {
638
		// Creation des items : titre + lien + description + date de publication
655
		// Creation des items : titre + lien + description + date de publication
639
		while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
656
		while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
640
			$xml .= XML_Util::createStartElement ('item');
657
			$xml .= XML_Util::createStartElement ('item');
Line 641... Line 658...
641
			
658
			
Line 642... Line 659...
642
			$xml .= XML_Util::createTag ('title', null, $ligne['bf_titre']);
659
			$xml .= XML_Util::createTag ('title', null, xmlEntities($ligne['bf_titre']));
643
			
660
			
644
			$lien=$GLOBALS['_BAZAR_']['url'];
661
			$lien=$GLOBALS['_BAZAR_']['url'];
645
			$lien->addQueryString('action', BAZ_VOIR_FICHE);
662
			$lien->addQueryString('action', BAZ_VOIR_FICHE);
Line 1034... Line 1051...
1034
}
1051
}
Line 1035... Line 1052...
1035
 
1052
 
1036
/* +--Fin du code ----------------------------------------------------------------------------------------+
1053
/* +--Fin du code ----------------------------------------------------------------------------------------+
1037
*
1054
*
-
 
1055
* $Log: not supported by cvs2svn $
-
 
1056
* Revision 1.60.2.8  2007/02/27 15:11:00  alexandre_tb
-
 
1057
* correction d une jointure dans la requete pour les flux rss
-
 
1058
* utilisation de la librairie XML_Util de pear pour generer le flux RSS -> plus clair
1038
* $Log: not supported by cvs2svn $
1059
*
1039
* Revision 1.60.2.7  2007/02/15 17:39:00  jp_milcent
1060
* Revision 1.60.2.7  2007/02/15 17:39:00  jp_milcent
1040
* Remise dans le code d'un bogue...
1061
* Remise dans le code d'un bogue...
1041
* A corriger!
1062
* A corriger!
1042
*
1063
*