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 4.1 |
|
4 |
// | PHP version 4.1 |
|
5 |
// +------------------------------------------------------------------------------------------------------+
|
5 |
// +------------------------------------------------------------------------------------------------------+
|
6 |
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
|
6 |
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
|
7 |
// +------------------------------------------------------------------------------------------------------+
|
7 |
// +------------------------------------------------------------------------------------------------------+
|
8 |
// | This library is free software; you can redistribute it and/or |
|
8 |
// | This library is free software; you can redistribute it and/or |
|
9 |
// | modify it under the terms of the GNU General Public |
|
9 |
// | modify it under the terms of the GNU General Public |
|
10 |
// | License as published by the Free Software Foundation; either |
|
10 |
// | License as published by the Free Software Foundation; either |
|
11 |
// | version 2.1 of the License, or (at your option) any later version. |
|
11 |
// | version 2.1 of the License, or (at your option) any later version. |
|
12 |
// | |
|
12 |
// | |
|
13 |
// | This library is distributed in the hope that it will be useful, |
|
13 |
// | This library is distributed in the hope that it will be useful, |
|
14 |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
14 |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
15 |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
15 |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
16 |
// | General Public License for more details. |
|
16 |
// | General Public License for more details. |
|
17 |
// | |
|
17 |
// | |
|
18 |
// | You should have received a copy of the GNU General Public |
|
18 |
// | You should have received a copy of the GNU 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: calendrier_messages.php,v 1.4 2008-08-25 15:25:47 alexandre_tb Exp $
|
22 |
// CVS : $Id: calendrier_messages.php,v 1.4 2008-08-25 15:25:47 alexandre_tb Exp $
|
23 |
/**
|
23 |
/**
|
24 |
* Application projet
|
24 |
* Application projet
|
25 |
*
|
25 |
*
|
26 |
* Action forums
|
26 |
* Action forums
|
27 |
*
|
27 |
*
|
28 |
*@package projet
|
28 |
*@package projet
|
29 |
//Auteur original :
|
29 |
//Auteur original :
|
30 |
*@author Alexandre Granier <alexandre@tela-botanica.org>
|
30 |
*@author Alexandre Granier <alexandre@tela-botanica.org>
|
31 |
//Autres auteurs :
|
31 |
//Autres auteurs :
|
32 |
*@author Aucun
|
32 |
*@author Aucun
|
33 |
*@copyright Tela-Botanica 2000-2008
|
33 |
*@copyright Tela-Botanica 2000-2008
|
34 |
*@version $Revision: 1.4 $
|
34 |
*@version $Revision: 1.4 $
|
35 |
// +------------------------------------------------------------------------------------------------------+
|
35 |
// +------------------------------------------------------------------------------------------------------+
|
36 |
*/
|
36 |
*/
|
37 |
include_once 'ezmlm-php-2.0/ezmlm.php' ;
|
37 |
include_once 'ezmlm-php-2.0/ezmlm.php' ;
|
- |
|
38 |
|
- |
|
39 |
error_reporting(E_ALL ^ E_NOTICE ^ E_DEPRECATED ^ E_STRICT);
|
- |
|
40 |
date_default_timezone_set("Europe/Paris");
|
38 |
|
41 |
// extract($_GET); // PHP-5.4, sans register_globals
|
39 |
|
42 |
|
40 |
// Parametrage de la liste
|
43 |
// Parametrage de la liste
|
41 |
$info = new ezmlm_threads();
|
44 |
$info = new ezmlm_threads();
|
42 |
if (!$info) return 'Les fichiers de la liste ne sont pas visible sur le serveur' ;
|
45 |
if (!$info) return 'Les fichiers de la liste ne sont pas visible sur le serveur' ;
|
43 |
$info->forcehref = $url;
|
46 |
$info->forcehref = $url;
|
44 |
$info->listdir = '/home/vpopmail/domains/'.$domaine.'/'.$liste ;
|
47 |
$info->listdir = '/home/vpopmail/domains/'.$domaine.'/'.$liste ;
|
45 |
$info->listname = $liste;
|
48 |
$info->listname = $liste;
|
46 |
$info->listdomain = $domaine ;
|
49 |
$info->listdomain = $domaine ;
|
47 |
|
50 |
|
48 |
/** Calcul du cache */
|
51 |
/** Calcul du cache */
|
49 |
/*
|
52 |
/*
|
50 |
require_once('Cache/Lite.php');
|
53 |
require_once('Cache/Lite.php');
|
51 |
|
54 |
|
52 |
// Set a id for this cache
|
55 |
// Set a id for this cache
|
53 |
$id = 'cache_'.$domaine.'_'.$liste;
|
56 |
$id = 'cache_'.$domaine.'_'.$liste;
|
54 |
|
57 |
|
55 |
// Set a few options
|
58 |
// Set a few options
|
56 |
|
59 |
|
57 |
$options = array(
|
60 |
$options = array(
|
58 |
'cacheDir' => 'tmp/',
|
61 |
'cacheDir' => 'tmp/',
|
59 |
'lifeTime' => null
|
62 |
'lifeTime' => null
|
60 |
);
|
63 |
);
|
61 |
*/
|
64 |
*/
|
62 |
|
65 |
|
63 |
include_once 'XML/Util.php' ;
|
66 |
include_once 'XML/Util.php' ;
|
64 |
$xml = XML_Util::getXMLDeclaration('1.0', 'ISO-8859-15', 'no') ;
|
67 |
$xml = XML_Util::getXMLDeclaration('1.0', 'ISO-8859-15', 'no') ;
|
65 |
|
68 |
|
66 |
if (!file_exists($info->listdir.'/num')) {
|
69 |
if (!file_exists($info->listdir.'/num')) {
|
67 |
$xml .= XML_Util::createStartElement ('ezmlm_calendrier_messages', array('domaine' => $domaine, 'liste' => $liste, 'langue' => $langue)) ;
|
70 |
$xml .= XML_Util::createStartElement ('ezmlm_calendrier_messages', array('domaine' => $domaine, 'liste' => $liste, 'langue' => $langue)) ;
|
68 |
$xml .= '<![CDATA[il n\'y a pas de messages dans cette liste pour le moment.]]>';
|
71 |
$xml .= '<![CDATA[il n\'y a pas de messages dans cette liste pour le moment.]]>';
|
69 |
$xml .= XML_Util::createEndElement('ezmlm_calendrier_messages') ;
|
72 |
$xml .= XML_Util::createEndElement('ezmlm_calendrier_messages') ;
|
70 |
header ('Content-type: text/xml');
|
73 |
header ('Content-type: text/xml');
|
71 |
echo $xml;
|
74 |
echo $xml;
|
72 |
exit();
|
75 |
exit();
|
73 |
}
|
76 |
}
|
74 |
/*
|
77 |
/*
|
75 |
// Create a Cache_Lite object
|
78 |
// Create a Cache_Lite object
|
76 |
$Cache_Lite = new Cache_Lite($options);
|
79 |
$Cache_Lite = new Cache_Lite($options);
|
77 |
$recalcule = false ;
|
80 |
$recalcule = false ;
|
78 |
$Cache_Lite->get($id);
|
81 |
$Cache_Lite->get($id);
|
79 |
|
82 |
|
80 |
|
83 |
|
81 |
if (@fileatime($info->listdir.'/num') > (int)$Cache_Lite->lastModified()) {
|
84 |
if (@fileatime($info->listdir.'/num') > (int)$Cache_Lite->lastModified()) {
|
82 |
$recalcule = true;
|
85 |
$recalcule = true;
|
83 |
}
|
86 |
}
|
84 |
|
87 |
|
85 |
// Test if thereis a valide cache for this id
|
88 |
// Test if thereis a valide cache for this id
|
86 |
if (!$recalcule) {
|
89 |
if (!$recalcule) {
|
87 |
$xml = $Cache_Lite->get($id);
|
90 |
$xml = $Cache_Lite->get($id);
|
88 |
} else { // pas de cache, on construit le calendrier
|
91 |
} else { // pas de cache, on construit le calendrier
|
89 |
*/
|
92 |
*/
|
90 |
|
93 |
|
91 |
$html = $info->listmessages();
|
94 |
$html = $info->listmessages();
|
92 |
|
95 |
|
93 |
if (!$html) {
|
96 |
if (!$html) {
|
94 |
|
97 |
|
95 |
$xml .= XML_Util::createStartElement ('ezmlm_erreur', array('domaine' => $domaine, 'liste' => $liste, 'langue' => $langue)) ;
|
98 |
$xml .= XML_Util::createStartElement ('ezmlm_erreur', array('domaine' => $domaine, 'liste' => $liste, 'langue' => $langue)) ;
|
96 |
$xml .= '<![CDATA[Les fichiers de la liste ne sont pas visibles sur le serveur]]>';
|
99 |
$xml .= '<![CDATA[Les fichiers de la liste ne sont pas visibles sur le serveur]]>';
|
97 |
$xml .= XML_Util::createEndElement('ezmlm_erreur') ;
|
100 |
$xml .= XML_Util::createEndElement('ezmlm_erreur') ;
|
98 |
} else {
|
101 |
} else {
|
99 |
$xml .= XML_Util::createStartElement ('ezmlm_calendrier_messages', array('domaine' => $domaine, 'liste' => $liste, 'langue' => $langue)) ;
|
102 |
$xml .= XML_Util::createStartElement ('ezmlm_calendrier_messages', array('domaine' => $domaine, 'liste' => $liste, 'langue' => $langue)) ;
|
100 |
|
103 |
|
101 |
$xml .= '<![CDATA[ '.$html.']]>';
|
104 |
$xml .= '<![CDATA[ '.$html.']]>';
|
102 |
|
105 |
|
103 |
$xml .= XML_Util::createEndElement('ezmlm_calendrier_messages') ;
|
106 |
$xml .= XML_Util::createEndElement('ezmlm_calendrier_messages') ;
|
104 |
|
107 |
|
105 |
/*
|
108 |
/*
|
106 |
$xml .= XML_Util::createStartElement('cache_time') ;
|
109 |
$xml .= XML_Util::createStartElement('cache_time') ;
|
107 |
$xml .= (int)$Cache_Lite->lastmodified().'#'.fileatime($info->listdir.'/num');
|
110 |
$xml .= (int)$Cache_Lite->lastmodified().'#'.fileatime($info->listdir.'/num');
|
108 |
$xml .= XML_Util::createEndElement('cache_time') ;*/
|
111 |
$xml .= XML_Util::createEndElement('cache_time') ;*/
|
109 |
//$Cache_Lite->save($xml, $id);
|
112 |
//$Cache_Lite->save($xml, $id);
|
110 |
}
|
113 |
}
|
111 |
//}
|
114 |
//}
|
112 |
|
115 |
|
113 |
header ('Content-type: text/xml');
|
116 |
header ('Content-type: text/xml');
|
114 |
echo $xml ;
|
117 |
echo $xml ;
|
115 |
|
118 |
|
116 |
/* +--Fin du code ----------------------------------------------------------------------------------------+
|
119 |
/* +--Fin du code ----------------------------------------------------------------------------------------+
|
117 |
*
|
120 |
*
|
118 |
* $Log: calendrier_messages.php,v $
|
121 |
* $Log: calendrier_messages.php,v $
|
119 |
* Revision 1.4 2008-08-25 15:25:47 alexandre_tb
|
122 |
* Revision 1.4 2008-08-25 15:25:47 alexandre_tb
|
120 |
* optimisation et gestion du cache
|
123 |
* optimisation et gestion du cache
|
121 |
*
|
124 |
*
|
122 |
* Revision 1.3 2008-06-09 10:05:28 alexandre_tb
|
125 |
* Revision 1.3 2008-06-09 10:05:28 alexandre_tb
|
123 |
* Ajout de la gestion du cache
|
126 |
* Ajout de la gestion du cache
|
124 |
* dependance avec Cache_Lite
|
127 |
* dependance avec Cache_Lite
|
125 |
*
|
128 |
*
|
126 |
* +-- Fin du code ----------------------------------------------------------------------------------------+
|
129 |
* +-- Fin du code ----------------------------------------------------------------------------------------+
|
127 |
*/
|
130 |
*/
|
128 |
|
131 |
|
129 |
?>
|
132 |
?>
|