Subversion Repositories Applications.papyrus

Rev

Rev 1988 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1988 Rev 1998
1
<?php
1
<?php
2
/*vim: set expandtab tabstop=4 shiftwidth=4: */
2
/*vim: set expandtab tabstop=4 shiftwidth=4: */
3
// +------------------------------------------------------------------------------------------------------+
3
// +------------------------------------------------------------------------------------------------------+
4
// | PHP version 5.1                                                                                      |
4
// | PHP version 5.1                                                                                      |
5
// +------------------------------------------------------------------------------------------------------+
5
// +------------------------------------------------------------------------------------------------------+
6
// | Copyright (C) 1999-2006 Tela Botanica (accueil@tela-botanica.org)                                    |
6
// | Copyright (C) 1999-2006 Tela Botanica (accueil@tela-botanica.org)                                    |
7
// +------------------------------------------------------------------------------------------------------+
7
// +------------------------------------------------------------------------------------------------------+
8
// | This file is part of papyrus_bp.                                                                     |
8
// | This file is part of papyrus_bp.                                                                     |
9
// |                                                                                                      |
9
// |                                                                                                      |
10
// | Foobar is free software; you can redistribute it and/or modify                                       |
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                                 |
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                                    |
12
// | the Free Software Foundation; either version 2 of the License, or                                    |
13
// | (at your option) any later version.                                                                  |
13
// | (at your option) any later version.                                                                  |
14
// |                                                                                                      |
14
// |                                                                                                      |
15
// | Foobar is distributed in the hope that it will be useful,                                            |
15
// | Foobar is distributed in the hope that it will be useful,                                            |
16
// | but WITHOUT ANY WARRANTY; without even the implied warranty of                                       |
16
// | but WITHOUT ANY WARRANTY; without even the implied warranty of                                       |
17
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                        |
17
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                        |
18
// | GNU General Public License for more details.                                                         |
18
// | GNU General Public License for more details.                                                         |
19
// |                                                                                                      |
19
// |                                                                                                      |
20
// | You should have received a copy of the GNU General Public License                                    |
20
// | You should have received a copy of the GNU General Public License                                    |
21
// | along with Foobar; if not, write to the Free Software                                                |
21
// | along with Foobar; if not, write to the Free Software                                                |
22
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
22
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
23
// +------------------------------------------------------------------------------------------------------+
23
// +------------------------------------------------------------------------------------------------------+
24
// CVS : $Id: syndication.php,v 1.11 2008-10-29 15:55:56 alexandre_tb Exp $
24
// CVS : $Id: syndication.php,v 1.11 2008-10-29 15:55:56 alexandre_tb Exp $
25
/**
25
/**
26
* papyrus_bp - syndication.php
26
* papyrus_bp - syndication.php
27
*
27
*
28
* Description :
28
* Description :
29
*
29
*
30
*@package papyrus_bp
30
*@package papyrus_bp
31
//Auteur original :
31
//Auteur original :
32
*@author        Jean-Pascal MILCENT <jpm@tela-botanica.org>
32
*@author        Jean-Pascal MILCENT <jpm@tela-botanica.org>
33
//Autres auteurs :
33
//Autres auteurs :
34
*@author        Aucun
34
*@author        Aucun
35
*@copyright     Tela-Botanica 1999-2006
35
*@copyright     Tela-Botanica 1999-2006
36
*@version       $Revision: 1.11 $ $Date: 2008-10-29 15:55:56 $
36
*@version       $Revision: 1.11 $ $Date: 2008-10-29 15:55:56 $
37
// +------------------------------------------------------------------------------------------------------+
37
// +------------------------------------------------------------------------------------------------------+
38
*/
38
*/
39
 
39
 
40
// +------------------------------------------------------------------------------------------------------+
40
// +------------------------------------------------------------------------------------------------------+
41
// |                                            ENTÊTE du PROGRAMME                                       |
41
// |                                            ENTÊTE du PROGRAMME                                       |
42
// +------------------------------------------------------------------------------------------------------+
42
// +------------------------------------------------------------------------------------------------------+
43
$GLOBALS['_GEN_commun']['info_applette_nom_fonction'] = 'afficherSyndication';
43
$GLOBALS['_GEN_commun']['info_applette_nom_fonction'] = 'afficherSyndication';
44
$GLOBALS['_GEN_commun']['info_applette_balise'] = 	'\{\{[Ss]yndication'.
44
$GLOBALS['_GEN_commun']['info_applette_balise'] = 	'\{\{[Ss]yndication'.
45
													'(?:\s*'.
45
													'(?:\s*'.
46
														'(?:'.
46
														'(?:'.
47
															'(url="[^"]*")|'.
47
															'(url="[^"]*")|'.
48
															'(titre="[^"]*")|'.
48
															'(titre="[^"]*")|'.
49
															'(nb="?\d+"?)|'.
49
															'(nb="?\d+"?)|'.
-
 
50
															'(nbmax="?\d+"?)|'.
50
															'(nouvellefenetre="?(?:0|1)"?)|'.
51
															'(nouvellefenetre="?(?:0|1)"?)|'.
51
															'(formatdate="[^"]*")|'.
52
															'(formatdate="[^"]*")|'.
52
															'(formatdatepro="[^"]*")|'.
53
															'(formatdatepro="[^"]*")|'.
53
															'(template=".*")|'.
54
															'(template=".*")|'.
54
														')'.
55
														')'.
55
													')+'.
56
													')+'.
56
													'\s*\}\}';
57
													'\s*\}\}';
57
// +------------------------------------------------------------------------------------------------------+
58
// +------------------------------------------------------------------------------------------------------+
58
/** Inclusion du fichier de configuration de cette application.*/
59
/** Inclusion du fichier de configuration de cette application.*/
59
require_once GEN_CHEMIN_APPLETTE.'syndication'.GEN_SEP.'configuration'.GEN_SEP.'synd_configuration.inc.php';
60
require_once GEN_CHEMIN_APPLETTE.'syndication'.GEN_SEP.'configuration'.GEN_SEP.'synd_configuration.inc.php';
60
 
61
 
61
// Inclusion des fichiers de traduction de l'applette SYND de Papyrus
62
// Inclusion des fichiers de traduction de l'applette SYND de Papyrus
62
if (file_exists(SYND_CHEMIN_LANGUE.'synd_langue_'.$GLOBALS['_GEN_commun']['i18n'].'.inc.php')) {
63
if (file_exists(SYND_CHEMIN_LANGUE.'synd_langue_'.$GLOBALS['_GEN_commun']['i18n'].'.inc.php')) {
63
    /** Inclusion du fichier de traduction suite à la transaction avec le navigateur.*/
64
    /** Inclusion du fichier de traduction suite à la transaction avec le navigateur.*/
64
    require_once SYND_CHEMIN_LANGUE.'synd_langue_'.$GLOBALS['_GEN_commun']['i18n'].'.inc.php';
65
    require_once SYND_CHEMIN_LANGUE.'synd_langue_'.$GLOBALS['_GEN_commun']['i18n'].'.inc.php';
65
} else {
66
} else {
66
    /** Inclusion du fichier de traduction par défaut.*/
67
    /** Inclusion du fichier de traduction par défaut.*/
67
    require_once SYND_CHEMIN_LANGUE.'synd_langue_'.SYND_I18N_DEFAUT.'.inc.php';
68
    require_once SYND_CHEMIN_LANGUE.'synd_langue_'.SYND_I18N_DEFAUT.'.inc.php';
68
}
69
}
69
/** Inclusion du fichier de la bibliotheque permettant de manipuler les flux RSS.*/
70
/** Inclusion du fichier de la bibliotheque permettant de manipuler les flux RSS.*/
70
//require_once(MAGPIE_DIR.'rss_fetch.inc');
71
//require_once(MAGPIE_DIR.'rss_fetch.inc');
71
require_once PAP_CHEMIN_API_PEAR.'XML/Feed/Parser.php';
72
require_once PAP_CHEMIN_API_PEAR.'XML/Feed/Parser.php';
72
// +------------------------------------------------------------------------------------------------------+
73
// +------------------------------------------------------------------------------------------------------+
73
// |                                            CORPS du PROGRAMME                                        |
74
// |                                            CORPS du PROGRAMME                                        |
74
// +------------------------------------------------------------------------------------------------------+
75
// +------------------------------------------------------------------------------------------------------+
75
/** Fonction afficherSyndication() - Retourne la liste des pages des sites syndiqués.
76
/** Fonction afficherSyndication() - Retourne la liste des pages des sites syndiqués.
76
*
77
*
77
* Cette fonction retourne la liste des pages des sites syndiqués.
78
* Cette fonction retourne la liste des pages des sites syndiqués.
78
*
79
*
79
* @param  array contient les arguments de la fonction.
80
* @param  array contient les arguments de la fonction.
80
* @param  array  tableau global de Papyrus.
81
* @param  array  tableau global de Papyrus.
81
* @return string XHTML la liste des pages.
82
* @return string XHTML la liste des pages.
82
*/
83
*/
83
function afficherSyndication($tab_applette_arguments, $_GEN_commun)
84
function afficherSyndication($tab_applette_arguments, $_GEN_commun)
84
{
85
{
85
	// Initialisation des variables
86
	// Initialisation des variables
86
    $sortie = '';
87
    $sortie = '';
87
	$GLOBALS['_SYNDICATION_']['erreurs'] = array();
88
	$GLOBALS['_SYNDICATION_']['erreurs'] = array();
88
	$GLOBALS['_SYNDICATION_']['informations'] = array();
89
	$GLOBALS['_SYNDICATION_']['informations'] = array();
89
	$GLOBALS['_SYNDICATION_']['sites'] = array();
90
	$GLOBALS['_SYNDICATION_']['sites'] = array();
90
	
91
	
91
	//+----------------------------------------------------------------------------------------------------------------+
92
	//+----------------------------------------------------------------------------------------------------------------+
92
	// Gestion des arguments
93
	// Gestion des arguments
93
	$balise = $tab_applette_arguments[0];
94
	$balise = $tab_applette_arguments[0];
94
    $tab_arguments = $tab_applette_arguments;
95
    $tab_arguments = $tab_applette_arguments;
95
	unset($tab_arguments[0]);
96
	unset($tab_arguments[0]);
96
    foreach($tab_arguments as $argument) {
97
    foreach($tab_arguments as $argument) {
97
    	if ($argument != '') {
98
    	if ($argument != '') {
98
	    	$tab_parametres = explode('=', $argument, 2);
99
	    	$tab_parametres = explode('=', $argument, 2);
99
	    	$options[$tab_parametres[0]] = trim($tab_parametres[1], '"');
100
	    	$options[$tab_parametres[0]] = trim($tab_parametres[1], '"');
100
    	}
101
    	}
101
    }
102
    }
102
	//
103
	//
103
	//+----------------------------------------------------------------------------------------------------------------+
104
	//+----------------------------------------------------------------------------------------------------------------+
104
    // Gestion des erreurs de paramétrage
105
    // Gestion des erreurs de paramétrage
105
	if (!isset($options['url'])) {
106
	if (!isset($options['url'])) {
106
		$GLOBALS['_SYNDICATION_']['erreurs'][] = sprintf(SYND_LG_ERREUR_URL, $balise);
107
		$GLOBALS['_SYNDICATION_']['erreurs'][] = sprintf(SYND_LG_ERREUR_URL, $balise);
107
	}
108
	}
108
	if (!isset($options['titre'])) {
109
	if (!isset($options['titre'])) {
109
		$options['titre'] = '';
110
		$options['titre'] = '';
110
	}
111
	}
111
	if (!isset($options['nb'])) {
112
	if (!isset($options['nb'])) {
112
		$options['nb'] = SYND_NOMBRE;
113
		$options['nb'] = SYND_NOMBRE;
113
	}
114
	}
-
 
115
	if (!isset($options['nbmax'])) {
-
 
116
		$options['nbmax'] = SYND_NOMBRE_MAX;
-
 
117
	}
114
    if (!isset($options['nouvellefenetre'])) {
118
    if (!isset($options['nouvellefenetre'])) {
115
		$options['nouvellefenetre'] = SYND_OUVRIR_LIEN_RSS_NOUVELLE_FENETRE;
119
		$options['nouvellefenetre'] = SYND_OUVRIR_LIEN_RSS_NOUVELLE_FENETRE;
116
	}
120
	}
117
	if (!isset($options['formatdate'])) {
121
	if (!isset($options['formatdate'])) {
118
		$options['formatdate'] = SYND_FORMAT_DATE;
122
		$options['formatdate'] = SYND_FORMAT_DATE;
119
	}
123
	}
120
	if (!isset($options['formatdatepro'])) {
124
	if (!isset($options['formatdatepro'])) {
121
		$options['formatdatepro'] = false;
125
		$options['formatdatepro'] = false;
122
	}
126
	}
123
	if (!isset($options['template'])) {
127
	if (!isset($options['template'])) {
124
		$options['template'] = SYND_CHEMIN_SQUELETTE.SYND_SQUELETTE_LISTE;
128
		$options['template'] = SYND_CHEMIN_SQUELETTE.SYND_SQUELETTE_LISTE;
125
	} else {
129
	} else {
126
		if (file_exists(SYND_CHEMIN_SQUELETTE.$options['template'])) {
130
		if (file_exists(SYND_CHEMIN_SQUELETTE.$options['template'])) {
127
			$options['template'] = SYND_CHEMIN_SQUELETTE.$options['template'];
131
			$options['template'] = SYND_CHEMIN_SQUELETTE.$options['template'];
128
		}
132
		}
129
	}
133
	}
130
	
134
	
131
    //+----------------------------------------------------------------------------------------------------------------+
135
    //+----------------------------------------------------------------------------------------------------------------+
132
    // Recuperation des donnees
136
    // Recuperation des donnees
133
    if (count($GLOBALS['_SYNDICATION_']['erreurs']) == 0) {
137
    if (count($GLOBALS['_SYNDICATION_']['erreurs']) == 0) {
134
		$tab_url = array_map('trim', explode(',', $options['url']));
138
		$tab_url = array_map('trim', explode(',', $options['url']));
135
        foreach ($tab_url as $cle => $url) {
139
        foreach ($tab_url as $cle => $url) {
136
			if ($url != '') {
140
			if ($url != '') {
137
				$aso_site = array();
141
				$aso_site = array();
138
				// Liste des encodages acceptés pour les flux
142
				// Liste des encodages acceptés pour les flux
139
				$encodages = 'UTF-8, ISO-8859-1, ISO-8859-15';
143
				$encodages = 'UTF-8, ISO-8859-1, ISO-8859-15';
140
				try {
144
				try {
141
					$feed = new XML_Feed_Parser(file_get_contents($url));
145
					$feed = new XML_Feed_Parser(file_get_contents($url));
142
				} catch (XML_Feed_Parser_Exception $e) {
146
				} catch (XML_Feed_Parser_Exception $e) {
143
					return('Le flux RSS est invalide : ' . $e->getMessage());
147
					return('Le flux RSS est invalide : ' . $e->getMessage());
144
				}
148
				}
145
				
149
				
146
				if ($options['template'] != '' && !file_exists($options['template'])) {
150
				if ($options['template'] != '' && !file_exists($options['template'])) {
147
					$i = 0 ;
151
					$i = 0 ;
148
					$res= '';
152
					$res= '';
149
					foreach ($feed as $item) {
153
					foreach ($feed as $item) {
150
						// Le test suivant pour savoir s il faut reduire l excendent de description
154
						// Le test suivant pour savoir s il faut reduire l excendent de description
151
						// Si {all} est present dans le template on ne reduit pas
155
						// Si {all} est present dans le template on ne reduit pas
152
						if (preg_match ('/{all}/', $options['template'])) {
156
						if (preg_match ('/{all}/', $options['template'])) {
153
							$template = str_replace('{all}', '', $options['template']);
157
							$template = str_replace('{all}', '', $options['template']);
154
							$all = true ;
158
							$all = true ;
155
						} else {
159
						} else {
156
							$all = false;
160
							$all = false;
157
						}
161
						}
158
						if (isset($item->summary)) {
162
						if (isset($item->summary)) {
159
							$item->description = mb_convert_encoding($item->summary, 'HTML-ENTITIES', $encodages); 
163
							$item->description = mb_convert_encoding($item->summary, 'HTML-ENTITIES', $encodages); 
160
						} else {
164
						} else {
161
							if (strlen($item->description) > 200 && !$all) {
165
							if (strlen($item->description) > 200 && !$all) {
162
								$item->description = 	substr(mb_convert_encoding($item->description, 'HTML-ENTITIES', $encodages), 0, 300).
166
								$item->description = 	substr(mb_convert_encoding($item->description, 'HTML-ENTITIES', $encodages), 0, 300).
163
														'... <a href="'.htmlentities($item->link).'">Lire la suite</a>';
167
														'... <a href="'.htmlentities($item->link).'">Lire la suite</a>';
164
							}
168
							}
165
						}
169
						}
166
						if (!isset($item->pubdate)) {
170
						if (!isset($item->pubdate)) {
167
							$item->pubdate = date('dmY');
171
							$item->pubdate = date('dmY');
168
						}
172
						}
169
						// Le code ci-apres est pour rattraper les dates du type 01012005 parsees par magpie
173
						// Le code ci-apres est pour rattraper les dates du type 01012005 parsees par magpie
170
						// lorsque les flux donne des dates au format iso
174
						// lorsque les flux donne des dates au format iso
171
						if (preg_match('/^([0-3][0-9])([0-1][0-9])([0-9][0-9][0-9][0-9])$/', $item->pubdate, $match)) {
175
						if (preg_match('/^([0-3][0-9])([0-1][0-9])([0-9][0-9][0-9][0-9])$/', $item->pubdate, $match)) {
172
							$item->pubdate = $match[3].'-'.$match[2].'-'.$match[1];
176
							$item->pubdate = $match[3].'-'.$match[2].'-'.$match[1];
173
							//echo $item['pubdate'];
177
							//echo $item['pubdate'];
174
						}
178
						}
175
						$res .= str_replace ('{num}', ++$i, 
179
						$res .= str_replace ('{num}', ++$i, 
176
								str_replace ('{item}', '<a href="'.htmlentities($item->link).'" target="_top">'.mb_convert_encoding($item->title, 'HTML-ENTITIES', $encodages).'</a>', 
180
								str_replace ('{item}', '<a href="'.htmlentities($item->link).'" target="_top">'.mb_convert_encoding($item->title, 'HTML-ENTITIES', $encodages).'</a>', 
177
								str_replace ('{date}', strftime('%d.%m.%Y',strtotime($item->pubdate)),
181
								str_replace ('{date}', strftime('%d.%m.%Y',strtotime($item->pubdate)),
178
								str_replace ('{description}', mb_convert_encoding($item->description, 'HTML-ENTITIES', $encodages), $options['template'])))) ;
182
								str_replace ('{description}', mb_convert_encoding($item->description, 'HTML-ENTITIES', $encodages), $options['template'])))) ;
179
						$res .= "\n";
183
						$res .= "\n";
180
						if ($i > $options['nb']) {
184
						if ($i > $options['nb']) {
181
							break;
185
							break;
182
						}
186
						}
183
					}
187
					}
184
					return $res;
188
					return $res;
185
				}
189
				}
186
				// Gestion du titre
190
				// Gestion du titre
187
				if ( $options['titre'] == '' ) {
191
				if ( $options['titre'] == '' ) {
188
					$aso_site['titre'] = mb_convert_encoding($feed->title, 'HTML-ENTITIES', $encodages);
192
					$aso_site['titre'] = mb_convert_encoding($feed->title, 'HTML-ENTITIES', $encodages);
189
				} else if ( $options['titre'] != '0' ) {
193
				} else if ( $options['titre'] != '0' ) {
190
					$aso_site['titre'] = $options['titre'];
194
					$aso_site['titre'] = $options['titre'];
191
				}
195
				}
192
				// Gestion de l'url du site
196
				// Gestion de l'url du site
193
				$aso_site['url'] = htmlentities($feed->link);
197
				$aso_site['url'] = htmlentities($feed->link);
194
 
198
 
195
				// Ouverture du lien dans une nouvelle fenetre
199
				// Ouverture du lien dans une nouvelle fenetre
196
				$aso_site['ext'] = false;
200
				$aso_site['ext'] = false;
197
				if ($options['nouvellefenetre'] == 1) {
201
				if ($options['nouvellefenetre'] == 1) {
198
					$aso_site['ext'] = true;
202
					$aso_site['ext'] = true;
199
				}
203
				}
200
				// Gestion des pages syndiquees
204
				// Gestion des pages syndiquees
201
				$i = 0;
205
				$i = 0;
202
			    $nb_item = $feed->numberEntries;
206
			    $nb_item = $feed->numberEntries;
203
 
207
 
204
				foreach ($feed as $item) {
208
				foreach ($feed as $item) {
205
					
209
					
206
					if ($options['nb'] != 0 && $nb_item >= $options['nb'] && $i >= $options['nb']) {
210
					if ($options['nb'] != 0 && $nb_item >= $options['nb'] && $i >= $options['nb']) {
207
						break;
211
						break;
208
					}
212
					}
209
					$i++;
213
					$i++;
210
					
214
					
211
					$aso_page = array();
215
					$aso_page = array();
212
					$aso_page['site'] = $aso_site;
216
					$aso_page['site'] = $aso_site;
213
					$aso_page['url'] = htmlentities($item->link);
217
					$aso_page['url'] = htmlentities($item->link);
214
					$aso_page['titre'] = mb_convert_encoding($item->title, 'HTML-ENTITIES', $encodages);
218
					$aso_page['titre'] = mb_convert_encoding($item->title, 'HTML-ENTITIES', $encodages);
215
					$aso_page['description'] = mb_convert_encoding($item->description, 'HTML-ENTITIES', $encodages);
219
					$aso_page['description'] = mb_convert_encoding($item->description, 'HTML-ENTITIES', $encodages);
216
					$aso_page['category'] = mb_convert_encoding($item->model->getElementsByTagName('category')->item(0)->nodeValue, 'HTML-ENTITIES', $encodages);
220
					$aso_page['category'] = mb_convert_encoding($item->model->getElementsByTagName('category')->item(0)->nodeValue, 'HTML-ENTITIES', $encodages);
217
					$aso_page['author'] = mb_convert_encoding($item->author, 'HTML-ENTITIES', $encodages);
221
					$aso_page['author'] = mb_convert_encoding($item->author, 'HTML-ENTITIES', $encodages);
218
					$aso_page['date'] = $item->pubDate;	
222
					$aso_page['date'] = $item->pubDate;	
219
					if ($options['formatdatepro']) {
223
					if ($options['formatdatepro']) {
220
						switch ($options['formatdatepro']) {
224
						switch ($options['formatdatepro']) {
221
							case 'jm' :
225
							case 'jm' :
222
								$aso_page['date'] = strftime('%d.%m', $aso_page['date']);
226
								$aso_page['date'] = strftime('%d.%m', $aso_page['date']);
223
								break;
227
								break;
224
							case 'jma' :
228
							case 'jma' :
225
								$aso_page['date'] = strftime('%d.%m.%Y', $aso_page['date']);
229
								$aso_page['date'] = strftime('%d.%m.%Y', $aso_page['date']);
226
								break;
230
								break;
227
							case 'jmh' :
231
							case 'jmh' :
228
								$aso_page['date'] = strftime('%d.%m %H:%M', $aso_page['date']);
232
								$aso_page['date'] = strftime('%d.%m %H:%M', $aso_page['date']);
229
								break;
233
								break;
230
							case 'jmah' :
234
							case 'jmah' :
231
								$aso_page['date'] = strftime('%d.%m.%Y %H:%M', $aso_page['date']);
235
								$aso_page['date'] = strftime('%d.%m.%Y %H:%M', $aso_page['date']);
232
								break;
236
								break;
233
							default :
237
							default :
234
								$aso_page['date'] = strftime('%d.%m.%Y %H:%M', $aso_page['date']);
238
								$aso_page['date'] = strftime('%d.%m.%Y %H:%M', $aso_page['date']);
235
						}
239
						}
236
					} else {
240
					} else {
237
						switch ($options['formatdate']) {
241
						switch ($options['formatdate']) {
238
							case 'jm' :
242
							case 'jm' :
239
								$aso_page['date'] = strftime('%d.%m', $aso_page['date']);
243
								$aso_page['date'] = strftime('%d.%m', $aso_page['date']);
240
								break;
244
								break;
241
							case 'jma' :
245
							case 'jma' :
242
								$aso_page['date'] = strftime('%d.%m.%Y', $aso_page['date']);
246
								$aso_page['date'] = strftime('%d.%m.%Y', $aso_page['date']);
243
								break;
247
								break;
244
							case 'jmh' :
248
							case 'jmh' :
245
								$aso_page['date'] = strftime('%d.%m %H:%M', $aso_page['date']);
249
								$aso_page['date'] = strftime('%d.%m %H:%M', $aso_page['date']);
246
								break;
250
								break;
247
							case 'jmah' :
251
							case 'jmah' :
248
								$aso_page['date'] = strftime('%d.%m.%Y %H:%M', $aso_page['date']);
252
								$aso_page['date'] = strftime('%d.%m.%Y %H:%M', $aso_page['date']);
249
								break;
253
								break;
250
							default :
254
							default :
251
								$aso_page['date'] = strftime('%d.%m.%Y %H:%M', $aso_page['date']);
255
								$aso_page['date'] = strftime('%d.%m.%Y %H:%M', $aso_page['date']);
252
						}
256
						}
253
					}
257
					}
254
					$aso_site['pages'][] = $aso_page;
258
					$aso_site['pages'][] = $aso_page;
255
					$GLOBALS['_SYNDICATION_']['pages'][strtotime($aso_page['date'])] = $aso_page;
259
					$GLOBALS['_SYNDICATION_']['pages'][strtotime($aso_page['date'])] = $aso_page;
256
				}
260
				}
257
				$GLOBALS['_SYNDICATION_']['sites'][] = $aso_site;
261
				$GLOBALS['_SYNDICATION_']['sites'][] = $aso_site;
258
			}
262
			}
259
        }
263
        }
260
    }
264
    }
261
	// Trie des pages par date
265
	// Trie des pages par date
262
	//var_dump($GLOBALS['_SYNDICATION_']['pages']);
-
 
263
	krsort($GLOBALS['_SYNDICATION_']['pages']);
266
	krsort($GLOBALS['_SYNDICATION_']['pages']);
-
 
267
	
-
 
268
	$GLOBALS['_SYNDICATION_']['sites'] = array_slice($GLOBALS['_SYNDICATION_']['sites'],0,$options['nbmax'],true) ;
-
 
269
	$GLOBALS['_SYNDICATION_']['pages'] = array_slice($GLOBALS['_SYNDICATION_']['pages'],0,$options['nbmax'],true) ;
264
	 
270
	 
265
	//+----------------------------------------------------------------------------------------------------------------+
271
	//+----------------------------------------------------------------------------------------------------------------+
266
    // Extrait les variables et les ajoutes a l'espace de noms local
272
    // Extrait les variables et les ajoutes a l'espace de noms local
267
	// Gestion des squelettes
273
	// Gestion des squelettes
268
	extract($GLOBALS['_SYNDICATION_']);
274
	extract($GLOBALS['_SYNDICATION_']);
269
	// Demarre le buffer
275
	// Demarre le buffer
270
	ob_start();
276
	ob_start();
271
	// Inclusion du fichier
277
	// Inclusion du fichier
272
	include($options['template']);
278
	include($options['template']);
273
	// Recuperer le  contenu du buffer
279
	// Recuperer le  contenu du buffer
274
	$sortie = ob_get_contents();
280
	$sortie = ob_get_contents();
275
	// Arrete et detruit le buffer
281
	// Arrete et detruit le buffer
276
	ob_end_clean();
282
	ob_end_clean();
277
	
283
	
278
	//+----------------------------------------------------------------------------------------------------------------+
284
	//+----------------------------------------------------------------------------------------------------------------+
279
	// Sortie
285
	// Sortie
280
    return $sortie;
286
    return $sortie;
281
}
287
}
282
 
288
 
283
/* +--Fin du code ----------------------------------------------------------------------------------------+
289
/* +--Fin du code ----------------------------------------------------------------------------------------+
284
*
290
*
285
* $Log: not supported by cvs2svn $
291
* $Log: not supported by cvs2svn $
286
* Revision 1.10  2007-12-13 14:10:51  alexandre_tb
292
* Revision 1.10  2007-12-13 14:10:51  alexandre_tb
287
* Fusion avec la livraison AHA : 13 decembre 2007
293
* Fusion avec la livraison AHA : 13 decembre 2007
288
*
294
*
289
* Revision 1.9  2007-12-03 14:54:14  jp_milcent
295
* Revision 1.9  2007-12-03 14:54:14  jp_milcent
290
* Fusion avec la livraison AHA : 3 décembre 2007
296
* Fusion avec la livraison AHA : 3 décembre 2007
291
*
297
*
292
* Revision 1.7.2.2  2007-12-03 14:52:21  jp_milcent
298
* Revision 1.7.2.2  2007-12-03 14:52:21  jp_milcent
293
* Correction bogue : & dans les urls.
299
* Correction bogue : & dans les urls.
294
*
300
*
295
* Revision 1.8  2007-11-30 14:17:30  jp_milcent
301
* Revision 1.8  2007-11-30 14:17:30  jp_milcent
296
* Fusion avec la livraison AHA : 30 novembre 2007
302
* Fusion avec la livraison AHA : 30 novembre 2007
297
*
303
*
298
* Revision 1.7.2.1  2007-11-30 14:15:02  jp_milcent
304
* Revision 1.7.2.1  2007-11-30 14:15:02  jp_milcent
299
* Amélioration du décodage utf8.
305
* Amélioration du décodage utf8.
300
*
306
*
301
* Revision 1.7  2007-07-25 15:09:44  jp_milcent
307
* Revision 1.7  2007-07-25 15:09:44  jp_milcent
302
* Fusion avec la livraison Narmer.
308
* Fusion avec la livraison Narmer.
303
*
309
*
304
* Revision 1.5.2.4  2007-07-25 15:07:52  jp_milcent
310
* Revision 1.5.2.4  2007-07-25 15:07:52  jp_milcent
305
* Correction problème url.
311
* Correction problème url.
306
*
312
*
307
* Revision 1.5.2.3  2007-07-25 14:50:21  jp_milcent
313
* Revision 1.5.2.3  2007-07-25 14:50:21  jp_milcent
308
* Corrections, meilleure utilisation de XML_Feed_Parser.
314
* Corrections, meilleure utilisation de XML_Feed_Parser.
309
*
315
*
310
* Revision 1.5.2.2  2007-07-25 09:45:07  jp_milcent
316
* Revision 1.5.2.2  2007-07-25 09:45:07  jp_milcent
311
* Utilisation de XML_Feed_Parser de Pear pour l'applette Syndication.
317
* Utilisation de XML_Feed_Parser de Pear pour l'applette Syndication.
312
*
318
*
313
* Revision 1.6  2007-06-25 12:15:07  alexandre_tb
319
* Revision 1.6  2007-06-25 12:15:07  alexandre_tb
314
* merge from narmer
320
* merge from narmer
315
*
321
*
316
* Revision 1.5.2.1  2007-06-06 15:24:37  jp_milcent
322
* Revision 1.5.2.1  2007-06-06 15:24:37  jp_milcent
317
* Amélioration de la compatibilité avec les anciennes version des balises de l'applette syndication.
323
* Amélioration de la compatibilité avec les anciennes version des balises de l'applette syndication.
318
*
324
*
319
* Revision 1.5  2007-04-20 12:50:18  florian
325
* Revision 1.5  2007-04-20 12:50:18  florian
320
* correction bugs suite au merge
326
* correction bugs suite au merge
321
*
327
*
322
* Revision 1.4  2007/03/28 15:53:27  florian
328
* Revision 1.4  2007/03/28 15:53:27  florian
323
* correction pb date, encodage utf-8
329
* correction pb date, encodage utf-8
324
*
330
*
325
* Revision 1.3  2007/01/23 14:17:19  alexandre_tb
331
* Revision 1.3  2007/01/23 14:17:19  alexandre_tb
326
* backport : hack pour rattraper les dates du type 01012005 parsees par magpie
332
* backport : hack pour rattraper les dates du type 01012005 parsees par magpie
327
* lorsque les flux donne des dates au format iso
333
* lorsque les flux donne des dates au format iso
328
*
334
*
329
* Revision 1.2  2006/12/13 17:20:51  jp_milcent
335
* Revision 1.2  2006/12/13 17:20:51  jp_milcent
330
* Correction bogue : paramètre nb non pris en compte
336
* Correction bogue : paramètre nb non pris en compte
331
*
337
*
332
* Revision 1.1  2006/12/13 17:06:36  jp_milcent
338
* Revision 1.1  2006/12/13 17:06:36  jp_milcent
333
* Ajout de l'applette Syndication.
339
* Ajout de l'applette Syndication.
334
*
340
*
335
*
341
*
336
* +-- Fin du code ----------------------------------------------------------------------------------------+
342
* +-- Fin du code ----------------------------------------------------------------------------------------+
337
*/
343
*/
338
?>
344
?>