Subversion Repositories Applications.projet

Rev

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

Rev 291 Rev 317
Line 17... Line 17...
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.3 2008-06-09 10:05:28 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
*
Line 29... Line 29...
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.3 $
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' ;
Line 44... Line 44...
44
$info->listdir = '/home/vpopmail/domains/'.$domaine.'/'.$liste ;
44
$info->listdir = '/home/vpopmail/domains/'.$domaine.'/'.$liste ;
45
$info->listname = $liste;
45
$info->listname = $liste;
46
$info->listdomain = $domaine ;
46
$info->listdomain = $domaine ;
Line 47... Line 47...
47
 
47
 
-
 
48
/** Calcul du cache */
48
/** Calcul du cache */
49
/*
Line 49... Line 50...
49
require_once('Cache/Lite.php');
50
require_once('Cache/Lite.php');
50
 
51
 
Line 55... Line 56...
55
 
56
 
56
$options = array(
57
$options = array(
57
    'cacheDir' => 'tmp/',
58
    'cacheDir' => 'tmp/',
58
    'lifeTime' => null
59
    'lifeTime' => null
-
 
60
);
-
 
61
*/
-
 
62
include_once 'XML/Util.php' ;
Line -... Line 63...
-
 
63
$xml = XML_Util::getXMLDeclaration('1.0', 'ISO-8859-15', 'no') ;
-
 
64
 
-
 
65
if (!file_exists($info->listdir.'/num')) {
-
 
66
	$xml .= XML_Util::createStartElement ('ezmlm_calendrier_messages', array('domaine' => $domaine, 'liste' => $liste, 'langue' => $langue)) ;
-
 
67
	$xml .= '<![CDATA[il n\'y a pas de messages dans cette liste pour le moment.]]>';
-
 
68
	$xml .= XML_Util::createEndElement('ezmlm_calendrier_messages') ;
-
 
69
	header ('Content-type: text/xml');
-
 
70
	echo $xml;
-
 
71
	exit();
59
);
72
}
60
 
73
/*
61
// Create a Cache_Lite object
74
// Create a Cache_Lite object
62
$Cache_Lite = new Cache_Lite($options);
75
$Cache_Lite = new Cache_Lite($options);
-
 
76
$recalcule = false ;
-
 
77
$Cache_Lite->get($id);
63
$recalcule = false ;
78
 
64
$Cache_Lite->get($id);
79
 
65
if (fileatime($info->listdir.'/num') > (int)$Cache_Lite->lastModified()) {
80
if (@fileatime($info->listdir.'/num') > (int)$Cache_Lite->lastModified()) {
-
 
81
	$recalcule = true;
66
	$recalcule = true;
82
}
67
}
83
 
68
// Test if thereis a valide cache for this id
84
// Test if thereis a valide cache for this id
69
if (!$recalcule) {
85
if (!$recalcule) {
70
	$xml = $Cache_Lite->get($id);
-
 
71
} else { // pas de cache, on construit le calendrier
-
 
-
 
86
	$xml = $Cache_Lite->get($id);
Line 72... Line 87...
72
	include_once 'XML/Util.php' ;
87
} else { // pas de cache, on construit le calendrier
73
	$xml = XML_Util::getXMLDeclaration('1.0', 'ISO-8859-15', 'no') ;
88
*/	
-
 
89
	
74
	
90
	$html = $info->listmessages();
75
	$html = $info->listmessages();
91
	if (!$html) {
76
	if (!$html) {
92
    	
77
    	$xml .= XML_Util::createStartElement ('ezmlm_erreur', array('domaine' => $domaine, 'liste' => $liste, 'langue' => $langue)) ;
93
    	$xml .= XML_Util::createStartElement ('ezmlm_erreur', array('domaine' => $domaine, 'liste' => $liste, 'langue' => $langue)) ;
78
    	$xml .= '<![CDATA[Les fichiers de la liste ne sont pas visibles sur le serveur]]>';
94
    	$xml .= '<![CDATA[Les fichiers de la liste ne sont pas visibles sur le serveur]]>';
Line 86... Line 102...
86
		
102
		
87
		/*
103
		/*
88
		$xml .= XML_Util::createStartElement('cache_time') ;
104
		$xml .= XML_Util::createStartElement('cache_time') ;
89
		$xml .= (int)$Cache_Lite->lastmodified().'#'.fileatime($info->listdir.'/num');
105
		$xml .= (int)$Cache_Lite->lastmodified().'#'.fileatime($info->listdir.'/num');
90
		$xml .= XML_Util::createEndElement('cache_time') ;*/
106
		$xml .= XML_Util::createEndElement('cache_time') ;*/
91
		$Cache_Lite->save($xml, $id);
107
		//$Cache_Lite->save($xml, $id);
92
	}
108
	}
93
}
109
//}
94
header ('Content-type: text/xml');
110
header ('Content-type: text/xml');
Line 95... Line 111...
95
echo $xml ;
111
echo $xml ;
96
 
112
 
97
/* +--Fin du code ----------------------------------------------------------------------------------------+
113
/* +--Fin du code ----------------------------------------------------------------------------------------+
-
 
114
*
-
 
115
* $Log: not supported by cvs2svn $
-
 
116
* Revision 1.3  2008-06-09 10:05:28  alexandre_tb
-
 
117
* Ajout de la gestion du cache
98
*
118
* dependance avec Cache_Lite
99
* $Log: not supported by cvs2svn $
119
*
Line 100... Line 120...
100
* +-- Fin du code ----------------------------------------------------------------------------------------+
120
* +-- Fin du code ----------------------------------------------------------------------------------------+
101
*/
121
*/