Subversion Repositories Applications.papyrus

Rev

Rev 1961 | Rev 2081 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1961 Rev 2059
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';
-
 
61
 
-
 
62
/** Inclusion du fichier de fonctions de cette application.*/
-
 
63
require_once GEN_CHEMIN_APPLETTE.'syndication'.GEN_SEP.'bibliotheque'.GEN_SEP.'syndication.fonct.php';
60
 
64
 
61
// Inclusion des fichiers de traduction de l'applette SYND de Papyrus
65
// 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')) {
66
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.*/
67
    /** 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';
68
    require_once SYND_CHEMIN_LANGUE.'synd_langue_'.$GLOBALS['_GEN_commun']['i18n'].'.inc.php';
65
} else {
69
} else {
66
    /** Inclusion du fichier de traduction par défaut.*/
70
    /** Inclusion du fichier de traduction par défaut.*/
67
    require_once SYND_CHEMIN_LANGUE.'synd_langue_'.SYND_I18N_DEFAUT.'.inc.php';
71
    require_once SYND_CHEMIN_LANGUE.'synd_langue_'.SYND_I18N_DEFAUT.'.inc.php';
68
}
72
}
-
 
73
 
69
/** Inclusion du fichier de la bibliotheque permettant de manipuler les flux RSS.*/
74
/** Inclusion du fichier de la bibliotheque permettant de manipuler les flux RSS.*/
70
//require_once(MAGPIE_DIR.'rss_fetch.inc');
75
//require_once(MAGPIE_DIR.'rss_fetch.inc');
71
require_once PAP_CHEMIN_API_PEAR.'XML/Feed/Parser.php';
76
require_once PAP_CHEMIN_API_PEAR.'XML/Feed/Parser.php';
72
// +------------------------------------------------------------------------------------------------------+
77
// +------------------------------------------------------------------------------------------------------+
73
// |                                            CORPS du PROGRAMME                                        |
78
// |                                            CORPS du PROGRAMME                                        |
74
// +------------------------------------------------------------------------------------------------------+
79
// +------------------------------------------------------------------------------------------------------+
75
/** Fonction afficherSyndication() - Retourne la liste des pages des sites syndiqués.
80
/** Fonction afficherSyndication() - Retourne la liste des pages des sites syndiqués.
76
*
81
*
77
* Cette fonction retourne la liste des pages des sites syndiqués.
82
* Cette fonction retourne la liste des pages des sites syndiqués.
78
*
83
*
79
* @param  array contient les arguments de la fonction.
84
* @param  array contient les arguments de la fonction.
80
* @param  array  tableau global de Papyrus.
85
* @param  array  tableau global de Papyrus.
81
* @return string XHTML la liste des pages.
86
* @return string XHTML la liste des pages.
82
*/
87
*/
83
function afficherSyndication($tab_applette_arguments, $_GEN_commun)
88
function afficherSyndication($tab_applette_arguments, $_GEN_commun)
84
{
89
{
85
	// Initialisation des variables
90
	// Initialisation des variables
86
    $sortie = '';
91
    $sortie = '';
87
	$GLOBALS['_SYNDICATION_']['erreurs'] = array();
92
	$GLOBALS['_SYNDICATION_']['erreurs'] = array();
88
	$GLOBALS['_SYNDICATION_']['informations'] = array();
93
	$GLOBALS['_SYNDICATION_']['informations'] = array();
89
	$GLOBALS['_SYNDICATION_']['sites'] = array();
94
	$GLOBALS['_SYNDICATION_']['sites'] = array();
-
 
95
 
90
	
96
 
-
 
97
		$string_arguments = "";
91
	//+----------------------------------------------------------------------------------------------------------------+
98
	//+----------------------------------------------------------------------------------------------------------------+
92
	// Gestion des arguments
99
	// Gestion des arguments
93
	$balise = $tab_applette_arguments[0];
100
	$balise = $tab_applette_arguments[0];
94
    $tab_arguments = $tab_applette_arguments;
101
    $tab_arguments = $tab_applette_arguments;
95
	unset($tab_arguments[0]);
102
	unset($tab_arguments[0]);
96
    foreach($tab_arguments as $argument) {
103
    foreach($tab_arguments as $argument) {
97
    	if ($argument != '') {
104
    	if ($argument != '') {
-
 
105
	    		$string_arguments .= $argument;
98
	    	$tab_parametres = explode('=', $argument, 2);
106
	    	$tab_parametres = explode('=', $argument, 2);
99
	    	$options[$tab_parametres[0]] = trim($tab_parametres[1], '"');
107
	    	$options[$tab_parametres[0]] = trim($tab_parametres[1], '"');
100
    	}
108
    	}
101
    }
109
    }
-
 
110
 
-
 
111
    $id_cache = md5($string_arguments);
-
 
112
 
-
 
113
	if($contenu_cache = verifierCache($id_cache)) {
-
 
114
		return $contenu_cache;
-
 
115
	}
102
	//
116
	//
103
	//+----------------------------------------------------------------------------------------------------------------+
117
	//+----------------------------------------------------------------------------------------------------------------+
104
    // Gestion des erreurs de paramétrage
118
    // Gestion des erreurs de paramétrage
105
	if (!isset($options['url'])) {
119
	if (!isset($options['url'])) {
106
		$GLOBALS['_SYNDICATION_']['erreurs'][] = sprintf(SYND_LG_ERREUR_URL, $balise);
120
		$GLOBALS['_SYNDICATION_']['erreurs'][] = sprintf(SYND_LG_ERREUR_URL, $balise);
107
	}
121
	}
108
	if (!isset($options['titre'])) {
122
	if (!isset($options['titre'])) {
109
		$options['titre'] = '';
123
		$options['titre'] = '';
110
	}
124
	}
111
	if (!isset($options['nb'])) {
125
	if (!isset($options['nb'])) {
112
		$options['nb'] = SYND_NOMBRE;
126
		$options['nb'] = SYND_NOMBRE;
113
	}
127
	}
-
 
128
	if (!isset($options['nbmax'])) {
-
 
129
		$options['nbmax'] = SYND_NOMBRE_MAX;
-
 
130
	}
114
    if (!isset($options['nouvellefenetre'])) {
131
    if (!isset($options['nouvellefenetre'])) {
115
		$options['nouvellefenetre'] = SYND_OUVRIR_LIEN_RSS_NOUVELLE_FENETRE;
132
		$options['nouvellefenetre'] = SYND_OUVRIR_LIEN_RSS_NOUVELLE_FENETRE;
116
	}
133
	}
117
	if (!isset($options['formatdate'])) {
134
	if (!isset($options['formatdate'])) {
118
		$options['formatdate'] = SYND_FORMAT_DATE;
135
		$options['formatdate'] = SYND_FORMAT_DATE;
119
	}
136
	}
120
	if (!isset($options['formatdatepro'])) {
137
	if (!isset($options['formatdatepro'])) {
121
		$options['formatdatepro'] = false;
138
		$options['formatdatepro'] = false;
122
	}
139
	}
123
	if (!isset($options['template'])) {
140
	if (!isset($options['template'])) {
124
		$options['template'] = SYND_CHEMIN_SQUELETTE.SYND_SQUELETTE_LISTE;
141
		$options['template'] = SYND_CHEMIN_SQUELETTE.SYND_SQUELETTE_LISTE;
125
	} else {
142
	} else {
126
		if (file_exists(SYND_CHEMIN_SQUELETTE.$options['template'])) {
143
		if (file_exists(SYND_CHEMIN_SQUELETTE.$options['template'])) {
127
			$options['template'] = SYND_CHEMIN_SQUELETTE.$options['template'];
144
			$options['template'] = SYND_CHEMIN_SQUELETTE.$options['template'];
128
		}
145
		}
129
	}
146
	}
130
	
147
 
131
    //+----------------------------------------------------------------------------------------------------------------+
148
    //+----------------------------------------------------------------------------------------------------------------+
132
    // Recuperation des donnees
149
    // Recuperation des donnees
133
    if (count($GLOBALS['_SYNDICATION_']['erreurs']) == 0) {
150
    if (count($GLOBALS['_SYNDICATION_']['erreurs']) == 0) {
134
		$tab_url = array_map('trim', explode(',', $options['url']));
151
		$tab_url = array_map('trim', explode(',', $options['url']));
135
        foreach ($tab_url as $cle => $url) {
152
        foreach ($tab_url as $cle => $url) {
136
			if ($url != '') {
153
			if ($url != '') {
137
				$aso_site = array();
154
				$aso_site = array();
138
				// Liste des encodages acceptés pour les flux
155
				// Liste des encodages acceptés pour les flux
139
				$encodages = 'UTF-8, ISO-8859-1, ISO-8859-15';
156
				$encodages = 'UTF-8, ISO-8859-1, ISO-8859-15';
140
				try {
157
				try {
141
					$feed = new XML_Feed_Parser(file_get_contents($url));
158
					$feed = new XML_Feed_Parser(file_get_contents($url));
142
				} catch (XML_Feed_Parser_Exception $e) {
159
				} catch (XML_Feed_Parser_Exception $e) {
143
					return('Le flux RSS est invalide : ' . $e->getMessage());
160
					return('Le flux RSS est invalide : ' . $e->getMessage());
144
				}
161
				}
145
				
162
 
146
				if ($options['template'] != '' && !file_exists($options['template'])) {
163
				if ($options['template'] != '' && !file_exists($options['template'])) {
147
					$i = 0 ;
164
					$i = 0 ;
148
					$res= '';
165
					$res= '';
149
					foreach ($feed as $item) {
166
					foreach ($feed as $item) {
150
						// Le test suivant pour savoir s il faut reduire l excendent de description
167
						// 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
168
						// Si {all} est present dans le template on ne reduit pas
152
						if (preg_match ('/{all}/', $options['template'])) {
169
						if (preg_match ('/{all}/', $options['template'])) {
153
							$template = str_replace('{all}', '', $options['template']);
170
							$template = str_replace('{all}', '', $options['template']);
154
							$all = true ;
171
							$all = true ;
155
						} else {
172
						} else {
156
							$all = false;
173
							$all = false;
157
						}
174
						}
158
						if (isset($item->summary)) {
175
						if (isset($item->summary)) {
159
							$item->description = mb_convert_encoding($item->summary, 'HTML-ENTITIES', $encodages); 
176
							$item->description = mb_convert_encoding($item->summary, 'HTML-ENTITIES', $encodages);
160
						} else {
177
						} else {
161
							if (strlen($item->description) > 200 && !$all) {
178
							if (strlen($item->description) > 200 && !$all) {
162
								$item->description = 	substr(mb_convert_encoding($item->description, 'HTML-ENTITIES', $encodages), 0, 300).
179
								$item->description = 	substr(mb_convert_encoding($item->description, 'HTML-ENTITIES', $encodages), 0, 300).
163
														'... <a href="'.htmlentities($item->link).'">Lire la suite</a>';
180
														'... <a href="'.htmlentities($item->link).'">Lire la suite</a>';
164
							}
181
							}
165
						}
182
						}
166
						if (!isset($item->pubdate)) {
183
						if (!isset($item->pubdate)) {
167
							$item->pubdate = date('dmY');
184
							$item->pubdate = date('dmY');
168
						}
185
						}
169
						// Le code ci-apres est pour rattraper les dates du type 01012005 parsees par magpie
186
						// 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
187
						// 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)) {
188
						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];
189
							$item->pubdate = $match[3].'-'.$match[2].'-'.$match[1];
173
							//echo $item['pubdate'];
190
							//echo $item['pubdate'];
174
						}
191
						}
175
						$res .= str_replace ('{num}', ++$i, 
192
						$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>', 
193
								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)),
194
								str_replace ('{date}', strftime('%d.%m.%Y',strtotime($item->pubdate)),
178
								str_replace ('{description}', mb_convert_encoding($item->description, 'HTML-ENTITIES', $encodages), $options['template'])))) ;
195
								str_replace ('{description}', mb_convert_encoding($item->description, 'HTML-ENTITIES', $encodages), $options['template'])))) ;
179
						$res .= "\n";
196
						$res .= "\n";
180
						if ($i > $options['nb']) {
197
						if ($i > $options['nb']) {
181
							break;
198
							break;
182
						}
199
						}
183
					}
200
					}
184
					return $res;
201
					return $res;
185
				}
202
				}
186
				// Gestion du titre
203
				// Gestion du titre
187
				if ( $options['titre'] == '' ) {
204
				if ( $options['titre'] == '' ) {
188
					$aso_site['titre'] = mb_convert_encoding($feed->title, 'HTML-ENTITIES', $encodages);
205
					$aso_site['titre'] = mb_convert_encoding($feed->title, 'HTML-ENTITIES', $encodages);
189
				} else if ( $options['titre'] != '0' ) {
206
				} else if ( $options['titre'] != '0' ) {
190
					$aso_site['titre'] = $options['titre'];
207
					$aso_site['titre'] = $options['titre'];
191
				}
208
				}
192
				// Gestion de l'url du site
209
				// Gestion de l'url du site
193
				$aso_site['url'] = htmlentities($feed->link);
210
				$aso_site['url'] = htmlentities($feed->link);
194
 
211
 
195
				// Ouverture du lien dans une nouvelle fenetre
212
				// Ouverture du lien dans une nouvelle fenetre
196
				$aso_site['ext'] = false;
213
				$aso_site['ext'] = false;
197
				if ($options['nouvellefenetre'] == 1) {
214
				if ($options['nouvellefenetre'] == 1) {
198
					$aso_site['ext'] = true;
215
					$aso_site['ext'] = true;
199
				}
216
				}
200
				// Gestion des pages syndiquees
217
				// Gestion des pages syndiquees
201
				$i = 0;
218
				$i = 0;
202
			    $nb_item = $feed->numberEntries;
219
			    $nb_item = $feed->numberEntries;
203
 
220
 
204
				foreach ($feed as $item) {
221
				foreach ($feed as $item) {
205
					
222
 
206
					if ($options['nb'] != 0 && $nb_item >= $options['nb'] && $i >= $options['nb']) {
223
					if ($options['nb'] != 0 && $nb_item >= $options['nb'] && $i >= $options['nb']) {
207
						break;
224
						break;
208
					}
225
					}
209
					$i++;
226
					$i++;
210
					
227
 
211
					$aso_page = array();
228
					$aso_page = array();
212
					$aso_page['site'] = $aso_site;
229
					$aso_page['site'] = $aso_site;
213
					$aso_page['url'] = htmlentities($item->link);
230
					$aso_page['url'] = htmlentities($item->link);
214
					$aso_page['titre'] = mb_convert_encoding($item->title, 'HTML-ENTITIES', $encodages);
231
					$aso_page['titre'] = mb_convert_encoding($item->title, 'HTML-ENTITIES', $encodages);
215
					$aso_page['description'] = mb_convert_encoding($item->description, 'HTML-ENTITIES', $encodages);
232
					$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);
233
					$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);
234
					$aso_page['author'] = mb_convert_encoding($item->author, 'HTML-ENTITIES', $encodages);
218
					$aso_page['date'] = $item->pubDate;	
235
					$aso_page['date'] = $item->pubDate;
219
					if ($options['formatdatepro']) {
236
					if ($options['formatdatepro']) {
220
						switch ($options['formatdatepro']) {
237
						switch ($options['formatdatepro']) {
221
							case 'jm' :
238
							case 'jm' :
222
								$aso_page['date'] = strftime('%d.%m', $aso_page['date']);
239
								$aso_page['date'] = strftime('%d.%m', $aso_page['date']);
223
								break;
240
								break;
224
							case 'jma' :
241
							case 'jma' :
225
								$aso_page['date'] = strftime('%d.%m.%Y', $aso_page['date']);
242
								$aso_page['date'] = strftime('%d.%m.%Y', $aso_page['date']);
226
								break;
243
								break;
227
							case 'jmh' :
244
							case 'jmh' :
228
								$aso_page['date'] = strftime('%d.%m %H:%M', $aso_page['date']);
245
								$aso_page['date'] = strftime('%d.%m %H:%M', $aso_page['date']);
229
								break;
246
								break;
230
							case 'jmah' :
247
							case 'jmah' :
231
								$aso_page['date'] = strftime('%d.%m.%Y %H:%M', $aso_page['date']);
248
								$aso_page['date'] = strftime('%d.%m.%Y %H:%M', $aso_page['date']);
232
								break;
249
								break;
233
							default :
250
							default :
234
								$aso_page['date'] = strftime('%d.%m.%Y %H:%M', $aso_page['date']);
251
								$aso_page['date'] = strftime('%d.%m.%Y %H:%M', $aso_page['date']);
235
						}
252
						}
236
					} else {
253
					} else {
237
						switch ($options['formatdate']) {
254
						switch ($options['formatdate']) {
238
							case 'jm' :
255
							case 'jm' :
239
								$aso_page['date'] = strftime('%d.%m', $aso_page['date']);
256
								$aso_page['date'] = strftime('%d.%m', $aso_page['date']);
240
								break;
257
								break;
241
							case 'jma' :
258
							case 'jma' :
242
								$aso_page['date'] = strftime('%d.%m.%Y', $aso_page['date']);
259
								$aso_page['date'] = strftime('%d.%m.%Y', $aso_page['date']);
243
								break;
260
								break;
244
							case 'jmh' :
261
							case 'jmh' :
245
								$aso_page['date'] = strftime('%d.%m %H:%M', $aso_page['date']);
262
								$aso_page['date'] = strftime('%d.%m %H:%M', $aso_page['date']);
246
								break;
263
								break;
247
							case 'jmah' :
264
							case 'jmah' :
248
								$aso_page['date'] = strftime('%d.%m.%Y %H:%M', $aso_page['date']);
265
								$aso_page['date'] = strftime('%d.%m.%Y %H:%M', $aso_page['date']);
249
								break;
266
								break;
250
							default :
267
							default :
251
								$aso_page['date'] = strftime('%d.%m.%Y %H:%M', $aso_page['date']);
268
								$aso_page['date'] = strftime('%d.%m.%Y %H:%M', $aso_page['date']);
252
						}
269
						}
253
					}
270
					}
254
					$aso_site['pages'][] = $aso_page;
271
					$aso_site['pages'][] = $aso_page;
255
					$GLOBALS['_SYNDICATION_']['pages'][strtotime($aso_page['date'])] = $aso_page;
272
					$GLOBALS['_SYNDICATION_']['pages'][strtotime($aso_page['date'])] = $aso_page;
256
				}
273
				}
257
				$GLOBALS['_SYNDICATION_']['sites'][] = $aso_site;
274
				$GLOBALS['_SYNDICATION_']['sites'][] = $aso_site;
258
			}
275
			}
259
        }
276
        }
260
    }
277
    }
261
	// Trie des pages par date
278
	// Trie des pages par date
262
	//var_dump($GLOBALS['_SYNDICATION_']['pages']);
-
 
263
	krsort($GLOBALS['_SYNDICATION_']['pages']);
279
	krsort($GLOBALS['_SYNDICATION_']['pages']);
264
	 
280
 
-
 
281
	$GLOBALS['_SYNDICATION_']['sites'] = array_slice($GLOBALS['_SYNDICATION_']['sites'],0,$options['nbmax'],true) ;
-
 
282
	$GLOBALS['_SYNDICATION_']['pages'] = array_slice($GLOBALS['_SYNDICATION_']['pages'],0,$options['nbmax'],true) ;
-
 
283
 
265
	//+----------------------------------------------------------------------------------------------------------------+
284
	//+----------------------------------------------------------------------------------------------------------------+
266
    // Extrait les variables et les ajoutes a l'espace de noms local
285
    // Extrait les variables et les ajoutes a l'espace de noms local
267
	// Gestion des squelettes
286
	// Gestion des squelettes
268
	extract($GLOBALS['_SYNDICATION_']);
287
	extract($GLOBALS['_SYNDICATION_']);
269
	// Demarre le buffer
288
	// Demarre le buffer
270
	ob_start();
289
	ob_start();
271
	// Inclusion du fichier
290
	// Inclusion du fichier
272
	include($options['template']);
291
	include($options['template']);
273
	// Recuperer le  contenu du buffer
292
	// Recuperer le  contenu du buffer
274
	$sortie = ob_get_contents();
293
	$sortie = ob_get_contents();
-
 
294
	creer_cache($id_cache,$sortie);
275
	// Arrete et detruit le buffer
295
	// Arrete et detruit le buffer
276
	ob_end_clean();
296
	ob_end_clean();
277
	
297
 
278
	//+----------------------------------------------------------------------------------------------------------------+
298
	//+----------------------------------------------------------------------------------------------------------------+
279
	// Sortie
299
	// Sortie
280
    return $sortie;
300
    return $sortie;
281
}
301
}
282
 
302
 
283
/* +--Fin du code ----------------------------------------------------------------------------------------+
303
/* +--Fin du code ----------------------------------------------------------------------------------------+
284
*
304
*
285
* $Log: not supported by cvs2svn $
305
* $Log: not supported by cvs2svn $
286
* Revision 1.10  2007-12-13 14:10:51  alexandre_tb
306
* Revision 1.10  2007-12-13 14:10:51  alexandre_tb
287
* Fusion avec la livraison AHA : 13 decembre 2007
307
* Fusion avec la livraison AHA : 13 decembre 2007
288
*
308
*
289
* Revision 1.9  2007-12-03 14:54:14  jp_milcent
309
* Revision 1.9  2007-12-03 14:54:14  jp_milcent
290
* Fusion avec la livraison AHA : 3 décembre 2007
310
* Fusion avec la livraison AHA : 3 décembre 2007
291
*
311
*
292
* Revision 1.7.2.2  2007-12-03 14:52:21  jp_milcent
312
* Revision 1.7.2.2  2007-12-03 14:52:21  jp_milcent
293
* Correction bogue : & dans les urls.
313
* Correction bogue : & dans les urls.
294
*
314
*
295
* Revision 1.8  2007-11-30 14:17:30  jp_milcent
315
* Revision 1.8  2007-11-30 14:17:30  jp_milcent
296
* Fusion avec la livraison AHA : 30 novembre 2007
316
* Fusion avec la livraison AHA : 30 novembre 2007
297
*
317
*
298
* Revision 1.7.2.1  2007-11-30 14:15:02  jp_milcent
318
* Revision 1.7.2.1  2007-11-30 14:15:02  jp_milcent
299
* Amélioration du décodage utf8.
319
* Amélioration du décodage utf8.
300
*
320
*
301
* Revision 1.7  2007-07-25 15:09:44  jp_milcent
321
* Revision 1.7  2007-07-25 15:09:44  jp_milcent
302
* Fusion avec la livraison Narmer.
322
* Fusion avec la livraison Narmer.
303
*
323
*
304
* Revision 1.5.2.4  2007-07-25 15:07:52  jp_milcent
324
* Revision 1.5.2.4  2007-07-25 15:07:52  jp_milcent
305
* Correction problème url.
325
* Correction problème url.
306
*
326
*
307
* Revision 1.5.2.3  2007-07-25 14:50:21  jp_milcent
327
* Revision 1.5.2.3  2007-07-25 14:50:21  jp_milcent
308
* Corrections, meilleure utilisation de XML_Feed_Parser.
328
* Corrections, meilleure utilisation de XML_Feed_Parser.
309
*
329
*
310
* Revision 1.5.2.2  2007-07-25 09:45:07  jp_milcent
330
* 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.
331
* Utilisation de XML_Feed_Parser de Pear pour l'applette Syndication.
312
*
332
*
313
* Revision 1.6  2007-06-25 12:15:07  alexandre_tb
333
* Revision 1.6  2007-06-25 12:15:07  alexandre_tb
314
* merge from narmer
334
* merge from narmer
315
*
335
*
316
* Revision 1.5.2.1  2007-06-06 15:24:37  jp_milcent
336
* 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.
337
* Amélioration de la compatibilité avec les anciennes version des balises de l'applette syndication.
318
*
338
*
319
* Revision 1.5  2007-04-20 12:50:18  florian
339
* Revision 1.5  2007-04-20 12:50:18  florian
320
* correction bugs suite au merge
340
* correction bugs suite au merge
321
*
341
*
322
* Revision 1.4  2007/03/28 15:53:27  florian
342
* Revision 1.4  2007/03/28 15:53:27  florian
323
* correction pb date, encodage utf-8
343
* correction pb date, encodage utf-8
324
*
344
*
325
* Revision 1.3  2007/01/23 14:17:19  alexandre_tb
345
* Revision 1.3  2007/01/23 14:17:19  alexandre_tb
326
* backport : hack pour rattraper les dates du type 01012005 parsees par magpie
346
* backport : hack pour rattraper les dates du type 01012005 parsees par magpie
327
* lorsque les flux donne des dates au format iso
347
* lorsque les flux donne des dates au format iso
328
*
348
*
329
* Revision 1.2  2006/12/13 17:20:51  jp_milcent
349
* Revision 1.2  2006/12/13 17:20:51  jp_milcent
330
* Correction bogue : paramètre nb non pris en compte
350
* Correction bogue : paramètre nb non pris en compte
331
*
351
*
332
* Revision 1.1  2006/12/13 17:06:36  jp_milcent
352
* Revision 1.1  2006/12/13 17:06:36  jp_milcent
333
* Ajout de l'applette Syndication.
353
* Ajout de l'applette Syndication.
334
*
354
*
335
*
355
*
336
* +-- Fin du code ----------------------------------------------------------------------------------------+
356
* +-- Fin du code ----------------------------------------------------------------------------------------+
337
*/
357
*/
338
?>
358
?>