Subversion Repositories eFlore/Archives.herbiers

Rev

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

Rev 12 Rev 14
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: hb_rss.php,v 1.5 2006-10-31 15:06:44 jp_milcent Exp $
22
// CVS : $Id: hb_rss.php,v 1.6 2006-10-31 15:33:15 jp_milcent Exp $
23
/**
23
/**
24
* Générateur de flux RSS pour les Herbiers 
24
* Générateur de flux RSS pour les Herbiers 
25
*
25
*
26
*@package bazar
26
*@package bazar
27
//Auteur original :
27
//Auteur original :
28
*@author        Florian SCHMITT <florian@ecole-et-nature.org>
28
*@author        Florian SCHMITT <florian@ecole-et-nature.org>
29
*@author        Jean-Pascal MILCENT <jpm@tela-botanica.org>
29
*@author        Jean-Pascal MILCENT <jpm@tela-botanica.org>
30
*
30
*
31
*@copyright     Tela-Botanica 2000-2006
31
*@copyright     Tela-Botanica 2000-2006
32
*@version       $Revision: 1.5 $ $Date: 2006-10-31 15:06:44 $
32
*@version       $Revision: 1.6 $ $Date: 2006-10-31 15:33:15 $
33
// +------------------------------------------------------------------------------------------------------+
33
// +------------------------------------------------------------------------------------------------------+
34
*/
34
*/
Line 35... Line 35...
35
 
35
 
36
//==================================== LES FLUX RSS==================================
36
//==================================== LES FLUX RSS==================================
Line 164... Line 164...
164
		$aso_infos = array();
164
		$aso_infos = array();
165
		$aso_infos['title'] = 'Flux RSS : '.$flux;
165
		$aso_infos['title'] = 'Flux RSS : '.$flux;
166
		$GLOBALS['_HERBIER_']['rss']['url']->addQueryString('type', $flux);
166
		$GLOBALS['_HERBIER_']['rss']['url']->addQueryString('type', $flux);
167
		$aso_infos['link'] = str_replace('&', '&amp;', $GLOBALS['_HERBIER_']['rss']['url']->getURL());
167
		$aso_infos['link'] = str_replace('&', '&amp;', $GLOBALS['_HERBIER_']['rss']['url']->getURL());
168
		$aso_infos['description'] = 'Flux RSS sur les '.$flux.'s.';
168
		$aso_infos['description'] = 'Flux RSS sur les '.$flux.'s.';
169
		$aso_infos['pubdate'] = strftime('%d %b %Y %H:%M:%S GMT', strtotime(str_replace('$', '', str_replace('Date: ', '', '$Date: 2006-10-31 15:06:44 $'))));
169
		$aso_infos['pubdate'] = strftime('%d %b %Y %H:%M:%S GMT', strtotime(str_replace('$', '', str_replace('Date: ', '', '$Date: 2006-10-31 15:33:15 $'))));
170
		$tab_infos[] = $aso_infos;
170
		$tab_infos[] = $aso_infos;
171
	} 
171
	} 
172
}
172
}
-
 
173
// En fonction, de l'appel depuis Papyrus ou pas nous affichons du XML ou du XHTML
-
 
174
if (!defined('PAP_VERSION')) {
173
echo html_entity_decode(gen_RSS($aso_meta, $tab_infos, $nbitem));
175
	$sortie = html_entity_decode(gen_RSS($aso_meta, $tab_infos, $limite));
-
 
176
} else {
-
 
177
	$sortie = gen_XHTML($aso_meta, $tab_infos);
-
 
178
}
Line -... Line 179...
-
 
179
 
-
 
180
/** gen_XHTML() - generer la liste des flux en XHTML 
-
 
181
*
-
 
182
* @param   array Les  méta données des flux
-
 
183
* @param   array Les infos sur les flux
-
 
184
* 
-
 
185
* @return  string La liste des flux RSS
-
 
186
*/
-
 
187
function gen_XHTML($meta = '', $infos = '')
-
 
188
{
-
 
189
	$xhtml = '<h1>'.$meta['titre'].'</h1>'."\n";
-
 
190
	$xhtml = '<p>'.$meta['description'].'</p>'."\n";
-
 
191
	$xhtml .= '<ul>'."\n";
-
 
192
	foreach ($infos as $info) {
-
 
193
		$xhtml .= '<li>'."\n";
-
 
194
		$xhtml .= '<a href="'.$meta['link'].'"><strong>'.$info['title'].'</strong></a><br />'."\n";
-
 
195
		$xhtml .= $info['description']."\n";
-
 
196
		$xhtml .= '</li>'."\n";
-
 
197
	}
-
 
198
	$xhtml .= '</ul>'."\n";
-
 
199
	return $xhtml;
Line 174... Line 200...
174
 
200
}
175
 
201
 
176
/** gen_RSS() - generer un fichier de flux RSS par type d'annonce 
-
 
177
*
-
 
178
* @param   string Le type de l'annonce (laisser vide pour tout type d'annonce)
-
 
179
* @param   integer Le nombre d'annonces a regrouper dans le fichier XML (laisser vide pour toutes)
-
 
180
* @param   integer L'identifiant de l'emetteur (laisser vide pour tous)
202
/** gen_RSS() - generer un fichier de flux RSS par type d'annonce 
181
* @param   integer L'etat de validation de l'annonce (laisser 1 pour les annonces validees, 0 pour les non-validees)
203
*
182
* @param   string La requete SQL personnalisee
204
* @param   array Les  méta données du flux
183
* @param   integer La categorie des fiches bazar
205
* @param   array Les items du flux
184
*
206
* 
185
* @return  string Le code du flux RSS
207
* @return  string Le code du flux RSS
-
 
208
*/
186
*/
209
function gen_RSS($meta = '', $infos = '')
187
function gen_RSS($meta = '', $infos = '', $nbitem = '') {
210
{
188
	// En-tete du flux RSS version 2.0
211
	// En-tete du flux RSS version 2.0
189
	$xml = '<?xml version="1.0" encoding="ISO-8859-1"?>'."\n";
212
	$xml = '<?xml version="1.0" encoding="ISO-8859-1"?>'."\n";
190
	$xml .= '<rss version="2.0">'."\n";
213
	$xml .= '<rss version="2.0">'."\n";
Line 232... Line 255...
232
	return $xml;
255
	return $xml;
233
}
256
}
234
/* +--Fin du code ----------------------------------------------------------------------------------------+
257
/* +--Fin du code ----------------------------------------------------------------------------------------+
235
*
258
*
236
* $Log: not supported by cvs2svn $
259
* $Log: not supported by cvs2svn $
-
 
260
* Revision 1.5  2006/10/31 15:06:44  jp_milcent
-
 
261
* Fin de gestion des flux rss.
-
 
262
*
237
* Revision 1.4  2006/10/31 12:42:00  jp_milcent
263
* Revision 1.4  2006/10/31 12:42:00  jp_milcent
238
* Amélioration de la gestion de la date des flux via les infos cvs.
264
* Amélioration de la gestion de la date des flux via les infos cvs.
239
*
265
*
240
* Revision 1.3  2006/10/31 12:39:23  jp_milcent
266
* Revision 1.3  2006/10/31 12:39:23  jp_milcent
241
* Modification de la gestion de la date des flux via les infos cvs.
267
* Modification de la gestion de la date des flux via les infos cvs.