2148 |
aperonnet |
1 |
<?php
|
|
|
2 |
/*vim: set expandtab tabstop=4 shiftwidth=4: */
|
|
|
3 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
4 |
// | PHP version 5.1 |
|
|
|
5 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
6 |
// | Copyright (C) 1999-2006 Tela Botanica (accueil@tela-botanica.org) |
|
|
|
7 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
8 |
// | This file is part of papyrus_bp. |
|
|
|
9 |
// | |
|
|
|
10 |
// | Foobar is free software; you can redistribute it and/or modify |
|
|
|
11 |
// | it under the terms of the GNU General Public License as published by |
|
|
|
12 |
// | the Free Software Foundation; either version 2 of the License, or |
|
|
|
13 |
// | (at your option) any later version. |
|
|
|
14 |
// | |
|
|
|
15 |
// | Foobar is distributed in the hope that it will be useful, |
|
|
|
16 |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
|
|
17 |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
|
|
18 |
// | GNU General Public License for more details. |
|
|
|
19 |
// | |
|
|
|
20 |
// | You should have received a copy of the GNU General Public License |
|
|
|
21 |
// | along with Foobar; if not, write to the Free Software |
|
|
|
22 |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
|
|
23 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
24 |
// CVS : $Id: syndication.php,v 1.11 2008-10-29 15:55:56 alexandre_tb Exp $
|
|
|
25 |
/**
|
|
|
26 |
* papyrus_bp - syndication.php
|
|
|
27 |
*
|
|
|
28 |
* Description :
|
|
|
29 |
*
|
|
|
30 |
*@package papyrus_bp
|
|
|
31 |
//Auteur original :
|
|
|
32 |
*@author Jean-Pascal MILCENT <jpm@tela-botanica.org>
|
|
|
33 |
//Autres auteurs :
|
|
|
34 |
*@author Aucun
|
|
|
35 |
*@copyright Tela-Botanica 1999-2006
|
|
|
36 |
*@version $Revision: 1.11 $ $Date: 2008-10-29 15:55:56 $
|
|
|
37 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
38 |
*/
|
|
|
39 |
|
|
|
40 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
41 |
// | ENTÊTE du PROGRAMME |
|
|
|
42 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
43 |
$GLOBALS['_GEN_commun']['info_applette_nom_fonction'] = 'afficherSyndication';
|
|
|
44 |
$GLOBALS['_GEN_commun']['info_applette_balise'] = '\{\{[Ss]yndication'.
|
|
|
45 |
'(?:\s*'.
|
|
|
46 |
'(?:'.
|
|
|
47 |
'(url="[^"]*")|'.
|
|
|
48 |
'(titre="[^"]*")|'.
|
|
|
49 |
'(nb="?\d+"?)|'.
|
|
|
50 |
'(tailledesc="?\d+"?)|'.
|
|
|
51 |
'(voirsuite="[^"]*")|'.
|
|
|
52 |
'(dureecache="?\d+"?)|'.
|
|
|
53 |
'(id="[^"]*")|'.
|
|
|
54 |
'(nbmax="?\d+"?)|'.
|
|
|
55 |
'(nouvellefenetre="?(?:0|1)"?)|'.
|
|
|
56 |
'(formatdate="[^"]*")|'.
|
|
|
57 |
'(formatdatepro="[^"]*")|'.
|
|
|
58 |
'(template=".*")|'.
|
|
|
59 |
')'.
|
|
|
60 |
')+'.
|
|
|
61 |
'\s*\}\}';
|
|
|
62 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
63 |
/** Inclusion du fichier de configuration de cette application.*/
|
|
|
64 |
require_once GEN_CHEMIN_APPLETTE.'syndication'.GEN_SEP.'configuration'.GEN_SEP.'synd_configuration.inc.php';
|
|
|
65 |
|
|
|
66 |
/** Inclusion du fichier de fonctions de cette application.*/
|
|
|
67 |
require_once GEN_CHEMIN_APPLETTE.'syndication'.GEN_SEP.'bibliotheque'.GEN_SEP.'syndication.fonct.php';
|
|
|
68 |
|
|
|
69 |
// Inclusion des fichiers de traduction de l'applette SYND de Papyrus
|
|
|
70 |
if (file_exists(SYND_CHEMIN_LANGUE.'synd_langue_'.$GLOBALS['_GEN_commun']['i18n'].'.inc.php')) {
|
|
|
71 |
/** Inclusion du fichier de traduction suite à la transaction avec le navigateur.*/
|
|
|
72 |
require_once SYND_CHEMIN_LANGUE.'synd_langue_'.$GLOBALS['_GEN_commun']['i18n'].'.inc.php';
|
|
|
73 |
} else {
|
|
|
74 |
/** Inclusion du fichier de traduction par défaut.*/
|
|
|
75 |
require_once SYND_CHEMIN_LANGUE.'synd_langue_'.SYND_I18N_DEFAUT.'.inc.php';
|
|
|
76 |
}
|
|
|
77 |
|
|
|
78 |
/** Inclusion du fichier de la bibliotheque permettant de manipuler les flux RSS.*/
|
|
|
79 |
//require_once(MAGPIE_DIR.'rss_fetch.inc');
|
|
|
80 |
require_once PAP_CHEMIN_API_PEAR.'XML/Feed/Parser.php';
|
|
|
81 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
82 |
// | CORPS du PROGRAMME |
|
|
|
83 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
84 |
|
|
|
85 |
// l'applette est un peu teubée et ne comprend pas certains flux
|
|
|
86 |
// pourtant valides, par sécurité, on supprime donc certains caractères
|
|
|
87 |
function supprimerXmlDangereux($xml)
|
|
|
88 |
{
|
|
|
89 |
$ret = "";
|
|
|
90 |
$encours;
|
|
|
91 |
if (empty($xml))
|
|
|
92 |
{
|
|
|
93 |
return $ret;
|
|
|
94 |
}
|
|
|
95 |
|
|
|
96 |
$lg = strlen($xml);
|
|
|
97 |
for ($i=0; $i < $lg; $i++)
|
|
|
98 |
{
|
|
|
99 |
$encours = ord($xml{$i});
|
|
|
100 |
if (($encours == 0x9) ||
|
|
|
101 |
($encours == 0xA) ||
|
|
|
102 |
($encours == 0xD) ||
|
|
|
103 |
(($encours >= 0x20) && ($encours <= 0xD7FF)) ||
|
|
|
104 |
(($encours >= 0xE000) && ($encours <= 0xFFFD)) ||
|
|
|
105 |
(($encours >= 0x10000) && ($encours <= 0x10FFFF)))
|
|
|
106 |
{
|
|
|
107 |
$ret .= chr($encours);
|
|
|
108 |
}
|
|
|
109 |
else
|
|
|
110 |
{
|
|
|
111 |
$ret .= " ";
|
|
|
112 |
}
|
|
|
113 |
}
|
|
|
114 |
return $ret;
|
|
|
115 |
}
|
|
|
116 |
|
|
|
117 |
/** Fonction afficherSyndication() - Retourne la liste des pages des sites syndiqués.
|
|
|
118 |
*
|
|
|
119 |
* Cette fonction retourne la liste des pages des sites syndiqués.
|
|
|
120 |
*
|
|
|
121 |
* @param array contient les arguments de la fonction.
|
|
|
122 |
* @param array tableau global de Papyrus.
|
|
|
123 |
* @return string XHTML la liste des pages.
|
|
|
124 |
*/
|
|
|
125 |
function afficherSyndication($tab_applette_arguments, $_GEN_commun)
|
|
|
126 |
{
|
|
|
127 |
// Initialisation des variables
|
|
|
128 |
$sortie = '';
|
|
|
129 |
$GLOBALS['_SYNDICATION_']['erreurs'] = array();
|
|
|
130 |
$GLOBALS['_SYNDICATION_']['informations'] = array();
|
|
|
131 |
$GLOBALS['_SYNDICATION_']['sites'] = array();
|
|
|
132 |
|
|
|
133 |
|
|
|
134 |
$string_arguments = "";
|
|
|
135 |
//+----------------------------------------------------------------------------------------------------------------+
|
|
|
136 |
// Gestion des arguments
|
|
|
137 |
$balise = $tab_applette_arguments[0];
|
|
|
138 |
$tab_arguments = $tab_applette_arguments;
|
|
|
139 |
|
|
|
140 |
unset($tab_arguments[0]);
|
|
|
141 |
foreach($tab_arguments as $argument) {
|
|
|
142 |
if ($argument != '') {
|
|
|
143 |
$string_arguments .= $argument;
|
|
|
144 |
$tab_parametres = explode('=', $argument, 2);
|
|
|
145 |
$options[$tab_parametres[0]] = trim($tab_parametres[1], '"');
|
|
|
146 |
}
|
|
|
147 |
}
|
|
|
148 |
|
|
|
149 |
$id_cache = md5($string_arguments);
|
|
|
150 |
//Greg : possibilité d'ajouter une durée au cache
|
|
|
151 |
if (!isset($options['dureecache'])) {
|
|
|
152 |
$options['dureecache'] = CACHE_LIFETIME;
|
|
|
153 |
}
|
|
|
154 |
|
|
|
155 |
if($contenu_cache = verifierCache($id_cache, $options['dureecache'])) {
|
|
|
156 |
return $contenu_cache;
|
|
|
157 |
}
|
|
|
158 |
//
|
|
|
159 |
//+----------------------------------------------------------------------------------------------------------------+
|
|
|
160 |
// Gestion des erreurs de paramétrage
|
|
|
161 |
|
|
|
162 |
if (!isset($options['url'])) {
|
|
|
163 |
$GLOBALS['_SYNDICATION_']['erreurs'][] = sprintf(SYND_LG_ERREUR_URL, $balise);
|
|
|
164 |
}
|
|
|
165 |
if (!isset($options['titre'])) {
|
|
|
166 |
$options['titre'] = '';
|
|
|
167 |
}
|
|
|
168 |
if (!isset($options['nb'])) {
|
|
|
169 |
$options['nb'] = SYND_NOMBRE;
|
|
|
170 |
}
|
|
|
171 |
if (!isset($options['nbmax'])) {
|
|
|
172 |
$options['nbmax'] = SYND_NOMBRE_MAX;
|
|
|
173 |
}
|
|
|
174 |
if (!isset($options['nouvellefenetre'])) {
|
|
|
175 |
$options['nouvellefenetre'] = SYND_OUVRIR_LIEN_RSS_NOUVELLE_FENETRE;
|
|
|
176 |
}
|
|
|
177 |
if (!isset($options['formatdate'])) {
|
|
|
178 |
$options['formatdate'] = SYND_FORMAT_DATE;
|
|
|
179 |
}
|
|
|
180 |
if (!isset($options['formatdatepro'])) {
|
|
|
181 |
$options['formatdatepro'] = false;
|
|
|
182 |
}
|
|
|
183 |
if (!isset($options['template'])) {
|
|
|
184 |
$options['template'] = SYND_CHEMIN_SQUELETTE.SYND_SQUELETTE_LISTE;
|
|
|
185 |
} else {
|
|
|
186 |
if (file_exists(SYND_CHEMIN_SQUELETTE.$options['template'])) {
|
|
|
187 |
$options['template'] = SYND_CHEMIN_SQUELETTE.$options['template'];
|
|
|
188 |
}
|
|
|
189 |
}
|
|
|
190 |
|
|
|
191 |
|
|
|
192 |
|
|
|
193 |
|
|
|
194 |
//+----------------------------------------------------------------------------------------------------------------+
|
|
|
195 |
// Recuperation des donnees
|
|
|
196 |
if (count($GLOBALS['_SYNDICATION_']['erreurs']) == 0) {
|
|
|
197 |
$tab_url = array_map('trim', explode(',', $options['url']));
|
|
|
198 |
foreach ($tab_url as $cle => $url) {
|
|
|
199 |
if ($url != '') {
|
|
|
200 |
$aso_site = array();
|
|
|
201 |
// Liste des encodages acceptés pour les flux
|
|
|
202 |
$encodages = 'UTF-8, ISO-8859-1, ISO-8859-15';
|
|
|
203 |
try {
|
|
|
204 |
$xml = file_get_contents($url);
|
|
|
205 |
$xml = supprimerXmlDangereux($xml);
|
|
|
206 |
$feed = new XML_Feed_Parser($xml);
|
|
|
207 |
} catch (XML_Feed_Parser_Exception $e) {
|
|
|
208 |
creer_cache('erreur', $xml, 86400);
|
|
|
209 |
return('Le flux RSS est invalide : ' . $e->getMessage());
|
|
|
210 |
}
|
|
|
211 |
|
|
|
212 |
if ($options['template'] != '' && !file_exists($options['template'])) {
|
|
|
213 |
$i = 0 ;
|
|
|
214 |
$res= '';
|
|
|
215 |
foreach ($feed as $item) {
|
|
|
216 |
// Le test suivant pour savoir s il faut reduire l excendent de description
|
|
|
217 |
// Si {all} est present dans le template on ne reduit pas
|
|
|
218 |
if (preg_match ('/{all}/', $options['template'])) {
|
|
|
219 |
$template = str_replace('{all}', '', $options['template']);
|
|
|
220 |
$all = true ;
|
|
|
221 |
} else {
|
|
|
222 |
$all = false;
|
|
|
223 |
}
|
|
|
224 |
if (isset($item->summary)) {
|
|
|
225 |
$item->description = mb_convert_encoding($item->summary, 'HTML-ENTITIES', $encodages);
|
|
|
226 |
} else {
|
|
|
227 |
if (strlen($item->description) > 200 && !$all) {
|
|
|
228 |
$item->description = substr(mb_convert_encoding($item->description, 'HTML-ENTITIES', $encodages), 0, 300).
|
|
|
229 |
'... <a href="'.htmlentities($item->link).'">Lire la suite</a>';
|
|
|
230 |
}
|
|
|
231 |
}
|
|
|
232 |
if (!isset($item->pubdate)) {
|
|
|
233 |
$item->pubdate = date('dmY');
|
|
|
234 |
}
|
|
|
235 |
// Le code ci-apres est pour rattraper les dates du type 01012005 parsees par magpie
|
|
|
236 |
// lorsque les flux donne des dates au format iso
|
|
|
237 |
if (preg_match('/^([0-3][0-9])([0-1][0-9])([0-9][0-9][0-9][0-9])$/', $item->pubdate, $match)) {
|
|
|
238 |
$item->pubdate = $match[3].'-'.$match[2].'-'.$match[1];
|
|
|
239 |
//echo $item['pubdate'];
|
|
|
240 |
}
|
|
|
241 |
$res .= str_replace ('{num}', ++$i,
|
|
|
242 |
str_replace ('{item}', '<a href="'.htmlentities($item->link).'" target="_top">'.mb_convert_encoding($item->title, 'HTML-ENTITIES', $encodages).'</a>',
|
|
|
243 |
str_replace ('{date}', strftime('%d.%m.%Y',strtotime($item->pubdate)),
|
|
|
244 |
str_replace ('{description}', mb_convert_encoding($item->description, 'HTML-ENTITIES', $encodages), $options['template'])))) ;
|
|
|
245 |
$res .= "\n";
|
|
|
246 |
if ($i > $options['nb']) {
|
|
|
247 |
break;
|
|
|
248 |
}
|
|
|
249 |
}
|
|
|
250 |
return $res;
|
|
|
251 |
}
|
|
|
252 |
// Gestion du titre
|
|
|
253 |
if ( $options['titre'] == '' ) {
|
|
|
254 |
$aso_site['titre'] = mb_convert_encoding($feed->title, 'HTML-ENTITIES', $encodages);
|
|
|
255 |
} else if ( $options['titre'] != '0' ) {
|
|
|
256 |
$aso_site['titre'] = $options['titre'];
|
|
|
257 |
}
|
|
|
258 |
|
|
|
259 |
//Gestion de l'ID
|
|
|
260 |
if ( $options['id'] != '' ) {
|
|
|
261 |
$aso_site['id'] = $options['id'];
|
|
|
262 |
}
|
|
|
263 |
|
|
|
264 |
//Gestion du lien vers la suite
|
|
|
265 |
if ( $options['voirsuite'] != '' ) {
|
|
|
266 |
$aso_site['voirsuite'] = $options['voirsuite'];
|
|
|
267 |
}
|
|
|
268 |
|
|
|
269 |
// Gestion de l'url du site
|
|
|
270 |
$aso_site['url'] = htmlentities($feed->link);
|
|
|
271 |
|
|
|
272 |
// Ouverture du lien dans une nouvelle fenetre
|
|
|
273 |
$aso_site['ext'] = false;
|
|
|
274 |
if ($options['nouvellefenetre'] == 1) {
|
|
|
275 |
$aso_site['ext'] = true;
|
|
|
276 |
}
|
|
|
277 |
// Gestion des pages syndiquees
|
|
|
278 |
$i = 0;
|
|
|
279 |
$nb_item = $feed->numberEntries;
|
|
|
280 |
|
|
|
281 |
foreach ($feed as $item) {
|
|
|
282 |
|
|
|
283 |
if ($options['nb'] != 0 && $nb_item >= $options['nb'] && $i >= $options['nb']) {
|
|
|
284 |
break;
|
|
|
285 |
}
|
|
|
286 |
$i++;
|
|
|
287 |
|
|
|
288 |
$aso_page = array();
|
|
|
289 |
$aso_page['site'] = $aso_site;
|
|
|
290 |
$aso_page['url'] = htmlentities($item->link);
|
|
|
291 |
$aso_page['titre'] = mb_convert_encoding($item->title, 'HTML-ENTITIES', $encodages);
|
|
|
292 |
$aso_page['description'] = mb_convert_encoding($item->description, 'HTML-ENTITIES', $encodages);
|
|
|
293 |
|
|
|
294 |
/* Extraction de l'image si incluse dans description */
|
|
|
295 |
$image = "";
|
|
|
296 |
$description = $aso_page['description'];
|
|
|
297 |
|
|
|
298 |
$taille = $options['tailledesc'];
|
|
|
299 |
|
|
|
300 |
if (!(strpos($description, '<img') === false)) {
|
|
|
301 |
$pos_debut = strpos($description, '<img');
|
|
|
302 |
$pos_fin_image = strpos($description, '>', $posimage) + 1;
|
|
|
303 |
$image = substr($description, $pos_debut, ($pos_fin_image - $pos_debut));
|
|
|
304 |
$description = substr_replace($description,' ', $pos_debut, ($pos_fin_image - $pos_debut));
|
|
|
305 |
}
|
|
|
306 |
|
|
|
307 |
$aso_page['image'] = $image;
|
|
|
308 |
$aso_page['description_sans_image'] = $description;
|
|
|
309 |
|
|
|
310 |
if ($taille != null) {
|
|
|
311 |
|
|
|
312 |
//Attention : si on coupe simplement, on peut couper une balise en plein milieu.
|
|
|
313 |
//On va donc vérifier
|
|
|
314 |
//1. recherche de tags simples <i> ou <b>
|
|
|
315 |
$description = html_entity_decode($description);
|
|
|
316 |
$description = strip_tags($description, "<i><b>");
|
|
|
317 |
|
|
|
318 |
//Va-ton couper un mot ?
|
|
|
319 |
|
|
|
320 |
if ($description[$taille] != ' ' && $description[$taille+1] != ' ' && $description[$taille-1] != ' ') {
|
|
|
321 |
$strpos = strpos($description, ' ', $taille);
|
|
|
322 |
if ($strpos === true) {
|
|
|
323 |
$taille = $strpos;
|
|
|
324 |
}
|
|
|
325 |
}
|
|
|
326 |
|
|
|
327 |
|
|
|
328 |
$description = substr($description, 0, $taille);
|
|
|
329 |
$description.='(...)';
|
|
|
330 |
|
|
|
331 |
$pattern = '#<([ib])[ ]*[a-z]*>(.*?)</\1>#i';
|
|
|
332 |
//1. remplacer toutes le s balises fermées
|
|
|
333 |
$chaine = preg_replace($pattern, '$2', $description);
|
|
|
334 |
$nb_occurences_i = substr_count($chaine, '<i');
|
|
|
335 |
for ($occurences = 0; $occurences < $nb_occurences_i; $occurences++) {
|
|
|
336 |
$description .= "</i>";
|
|
|
337 |
}
|
|
|
338 |
|
|
|
339 |
$nb_occurences_b = substr_count($chaine, '<b');
|
|
|
340 |
for ($occurences = 0; $occurences < $nb_occurences_b; $occurences++) {
|
|
|
341 |
$description .= "</b>";
|
|
|
342 |
}
|
|
|
343 |
}
|
|
|
344 |
|
|
|
345 |
$aso_page['description_light'] = $description;
|
|
|
346 |
|
|
|
347 |
//Greg : ajout GUID
|
|
|
348 |
$aso_page['guid'] = mb_convert_encoding($item->model->getElementsByTagName('guid')->item(0)->nodeValue, 'HTML-ENTITIES', $encodages);
|
|
|
349 |
|
|
|
350 |
$aso_page['category'] = mb_convert_encoding($item->model->getElementsByTagName('category')->item(0)->nodeValue, 'HTML-ENTITIES', $encodages);
|
|
|
351 |
$aso_page['author'] = mb_convert_encoding($item->author, 'HTML-ENTITIES', $encodages);
|
|
|
352 |
|
|
|
353 |
|
|
|
354 |
$aso_page['date'] = $item->pubDate;
|
|
|
355 |
if ($options['formatdatepro']) {
|
|
|
356 |
switch ($options['formatdatepro']) {
|
|
|
357 |
case 'jm' :
|
|
|
358 |
$aso_page['date'] = strftime('%d.%m', $aso_page['date']);
|
|
|
359 |
break;
|
|
|
360 |
case 'jma' :
|
|
|
361 |
$aso_page['date'] = strftime('%d.%m.%Y', $aso_page['date']);
|
|
|
362 |
break;
|
|
|
363 |
case 'jmh' :
|
|
|
364 |
$aso_page['date'] = strftime('%d.%m %H:%M', $aso_page['date']);
|
|
|
365 |
break;
|
|
|
366 |
case 'jmah' :
|
|
|
367 |
$aso_page['date'] = strftime('%d.%m.%Y %H:%M', $aso_page['date']);
|
|
|
368 |
break;
|
|
|
369 |
default :
|
|
|
370 |
$aso_page['date'] = strftime('%d.%m.%Y %H:%M', $aso_page['date']);
|
|
|
371 |
}
|
|
|
372 |
} else {
|
|
|
373 |
switch ($options['formatdate']) {
|
|
|
374 |
case 'jm' :
|
|
|
375 |
$aso_page['date'] = strftime('%d.%m', $aso_page['date']);
|
|
|
376 |
break;
|
|
|
377 |
case 'jma' :
|
|
|
378 |
$aso_page['date'] = strftime('%d.%m.%Y', $aso_page['date']);
|
|
|
379 |
break;
|
|
|
380 |
case 'jmh' :
|
|
|
381 |
$aso_page['date'] = strftime('%d.%m %H:%M', $aso_page['date']);
|
|
|
382 |
break;
|
|
|
383 |
case 'jmah' :
|
|
|
384 |
$aso_page['date'] = strftime('%d.%m.%Y %H:%M', $aso_page['date']);
|
|
|
385 |
break;
|
|
|
386 |
default :
|
|
|
387 |
$aso_page['date'] = strftime('%d.%m.%Y %H:%M', $aso_page['date']);
|
|
|
388 |
}
|
|
|
389 |
}
|
|
|
390 |
$aso_site['pages'][] = $aso_page;
|
|
|
391 |
$GLOBALS['_SYNDICATION_']['pages'][strtotime($aso_page['date'])] = $aso_page;
|
|
|
392 |
}
|
|
|
393 |
$GLOBALS['_SYNDICATION_']['sites'][] = $aso_site;
|
|
|
394 |
}
|
|
|
395 |
}
|
|
|
396 |
}
|
|
|
397 |
// Trie des pages par date
|
|
|
398 |
krsort($GLOBALS['_SYNDICATION_']['pages']);
|
|
|
399 |
|
|
|
400 |
$GLOBALS['_SYNDICATION_']['sites'] = array_slice($GLOBALS['_SYNDICATION_']['sites'],0,$options['nbmax'],true) ;
|
|
|
401 |
$GLOBALS['_SYNDICATION_']['pages'] = array_slice($GLOBALS['_SYNDICATION_']['pages'],0,$options['nbmax'],true) ;
|
|
|
402 |
|
|
|
403 |
//+----------------------------------------------------------------------------------------------------------------+
|
|
|
404 |
// Extrait les variables et les ajoutes a l'espace de noms local
|
|
|
405 |
// Gestion des squelettes
|
|
|
406 |
extract($GLOBALS['_SYNDICATION_']);
|
|
|
407 |
// Demarre le buffer
|
|
|
408 |
ob_start();
|
|
|
409 |
// Inclusion du fichier
|
|
|
410 |
include($options['template']);
|
|
|
411 |
// Recuperer le contenu du buffer
|
|
|
412 |
$sortie = ob_get_contents();
|
|
|
413 |
creer_cache($id_cache,$sortie, $options['dureecache']);
|
|
|
414 |
// Arrete et detruit le buffer
|
|
|
415 |
ob_end_clean();
|
|
|
416 |
|
|
|
417 |
//+----------------------------------------------------------------------------------------------------------------+
|
|
|
418 |
// Sortie
|
|
|
419 |
return $sortie;
|
|
|
420 |
}
|
|
|
421 |
|
|
|
422 |
function transcribe_cp1252_to_latin1($cp1252) {
|
|
|
423 |
return strtr(
|
|
|
424 |
$cp1252,
|
|
|
425 |
array(
|
|
|
426 |
"\x80" => "e", "\x81" => " ", "\x82" => "'", "\x83" => 'f',
|
|
|
427 |
"\x84" => '"', "\x85" => "...", "\x86" => "+", "\x87" => "#",
|
|
|
428 |
"\x88" => "^", "\x89" => "0/00", "\x8A" => "S", "\x8B" => "<",
|
|
|
429 |
"\x8C" => "OE", "\x8D" => " ", "\x8E" => "Z", "\x8F" => " ",
|
|
|
430 |
"\x90" => " ", "\x91" => "`", "\x92" => "'", "\x93" => '"',
|
|
|
431 |
"\x94" => '"', "\x95" => "*", "\x96" => "-", "\x97" => "--",
|
|
|
432 |
"\x98" => "~", "\x99" => "(TM)", "\x9A" => "s", "\x9B" => ">",
|
|
|
433 |
"\x9C" => "oe", "\x9D" => " ", "\x9E" => "z", "\x9F" => "Y"));
|
|
|
434 |
}
|
|
|
435 |
|
|
|
436 |
/* +--Fin du code ----------------------------------------------------------------------------------------+
|
|
|
437 |
*
|
|
|
438 |
* $Log: not supported by cvs2svn $
|
|
|
439 |
* Revision 1.10 2007-12-13 14:10:51 alexandre_tb
|
|
|
440 |
* Fusion avec la livraison AHA : 13 decembre 2007
|
|
|
441 |
*
|
|
|
442 |
* Revision 1.9 2007-12-03 14:54:14 jp_milcent
|
|
|
443 |
* Fusion avec la livraison AHA : 3 décembre 2007
|
|
|
444 |
*
|
|
|
445 |
* Revision 1.7.2.2 2007-12-03 14:52:21 jp_milcent
|
|
|
446 |
* Correction bogue : & dans les urls.
|
|
|
447 |
*
|
|
|
448 |
* Revision 1.8 2007-11-30 14:17:30 jp_milcent
|
|
|
449 |
* Fusion avec la livraison AHA : 30 novembre 2007
|
|
|
450 |
*
|
|
|
451 |
* Revision 1.7.2.1 2007-11-30 14:15:02 jp_milcent
|
|
|
452 |
* Amélioration du décodage utf8.
|
|
|
453 |
*
|
|
|
454 |
* Revision 1.7 2007-07-25 15:09:44 jp_milcent
|
|
|
455 |
* Fusion avec la livraison Narmer.
|
|
|
456 |
*
|
|
|
457 |
* Revision 1.5.2.4 2007-07-25 15:07:52 jp_milcent
|
|
|
458 |
* Correction problème url.
|
|
|
459 |
*
|
|
|
460 |
* Revision 1.5.2.3 2007-07-25 14:50:21 jp_milcent
|
|
|
461 |
* Corrections, meilleure utilisation de XML_Feed_Parser.
|
|
|
462 |
*
|
|
|
463 |
* Revision 1.5.2.2 2007-07-25 09:45:07 jp_milcent
|
|
|
464 |
* Utilisation de XML_Feed_Parser de Pear pour l'applette Syndication.
|
|
|
465 |
*
|
|
|
466 |
* Revision 1.6 2007-06-25 12:15:07 alexandre_tb
|
|
|
467 |
* merge from narmer
|
|
|
468 |
*
|
|
|
469 |
* Revision 1.5.2.1 2007-06-06 15:24:37 jp_milcent
|
|
|
470 |
* Amélioration de la compatibilité avec les anciennes version des balises de l'applette syndication.
|
|
|
471 |
*
|
|
|
472 |
* Revision 1.5 2007-04-20 12:50:18 florian
|
|
|
473 |
* correction bugs suite au merge
|
|
|
474 |
*
|
|
|
475 |
* Revision 1.4 2007/03/28 15:53:27 florian
|
|
|
476 |
* correction pb date, encodage utf-8
|
|
|
477 |
*
|
|
|
478 |
* Revision 1.3 2007/01/23 14:17:19 alexandre_tb
|
|
|
479 |
* backport : hack pour rattraper les dates du type 01012005 parsees par magpie
|
|
|
480 |
* lorsque les flux donne des dates au format iso
|
|
|
481 |
*
|
|
|
482 |
* Revision 1.2 2006/12/13 17:20:51 jp_milcent
|
|
|
483 |
* Correction bogue : paramètre nb non pris en compte
|
|
|
484 |
*
|
|
|
485 |
* Revision 1.1 2006/12/13 17:06:36 jp_milcent
|
|
|
486 |
* Ajout de l'applette Syndication.
|
|
|
487 |
*
|
|
|
488 |
*
|
|
|
489 |
* +-- Fin du code ----------------------------------------------------------------------------------------+
|
|
|
490 |
*/
|
|
|
491 |
?>
|