Subversion Repositories Applications.projet

Rev

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

Rev 317 Rev 356
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.5 2008-11-04 17:11:10 aperonnet 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.5 $
35
// +------------------------------------------------------------------------------------------------------+
35
// +------------------------------------------------------------------------------------------------------+
36
*/
36
*/
37
include_once 'ezmlm-php-2.0/ezmlm.php' ;
37
include_once 'ezmlm-php-2.0/ezmlm.php' ;
38
 
38
 
39
 
39
 
40
// Parametrage de la liste
40
// Parametrage de la liste
41
$info = new ezmlm_threads();
41
$info = new ezmlm_threads();
42
if (!$info) return 'Les fichiers de la liste ne sont pas visible sur le serveur' ;
42
if (!$info) return 'Les fichiers de la liste ne sont pas visible sur le serveur' ;
43
$info->forcehref = $url;
43
$info->forcehref = $url;
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 ;
47
 
47
 
48
/** Calcul du cache */
48
/** Calcul du cache */
49
/*
49
/*
50
require_once('Cache/Lite.php');
50
require_once('Cache/Lite.php');
51
 
51
 
52
// Set a id for this cache
52
// Set a id for this cache
53
$id = 'cache_'.$domaine.'_'.$liste;
53
$id = 'cache_'.$domaine.'_'.$liste;
54
 
54
 
55
// Set a few options
55
// Set a few options
56
 
56
 
57
$options = array(
57
$options = array(
58
    'cacheDir' => 'tmp/',
58
    'cacheDir' => 'tmp/',
59
    'lifeTime' => null
59
    'lifeTime' => null
60
);
60
);
61
*/
61
*/
62
include_once 'XML/Util.php' ;
62
include_once 'XML/Util.php' ;
63
$xml = XML_Util::getXMLDeclaration('1.0', 'ISO-8859-15', 'no') ;
63
$xml = XML_Util::getXMLDeclaration('1.0', 'ISO-8859-15', 'no') ;
64
 
64
 
65
if (!file_exists($info->listdir.'/num')) {
65
if (!file_exists($info->listdir.'/num')) {
66
	$xml .= XML_Util::createStartElement ('ezmlm_calendrier_messages', array('domaine' => $domaine, 'liste' => $liste, 'langue' => $langue)) ;
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.]]>';
67
	$xml .= '<![CDATA[il n\'y a pas de messages dans cette liste pour le moment.]]>';
68
	$xml .= XML_Util::createEndElement('ezmlm_calendrier_messages') ;
68
	$xml .= XML_Util::createEndElement('ezmlm_calendrier_messages') ;
69
	header ('Content-type: text/xml');
69
	header ('Content-type: text/xml');
70
	echo $xml;
70
	echo $xml;
71
	exit();
71
	exit();
72
}
72
}
73
/*
73
/*
74
// Create a Cache_Lite object
74
// Create a Cache_Lite object
75
$Cache_Lite = new Cache_Lite($options);
75
$Cache_Lite = new Cache_Lite($options);
76
$recalcule = false ;
76
$recalcule = false ;
77
$Cache_Lite->get($id);
77
$Cache_Lite->get($id);
78
 
78
 
79
 
79
 
80
if (@fileatime($info->listdir.'/num') > (int)$Cache_Lite->lastModified()) {
80
if (@fileatime($info->listdir.'/num') > (int)$Cache_Lite->lastModified()) {
81
	$recalcule = true;
81
	$recalcule = true;
82
}
82
}
83
 
83
 
84
// Test if thereis a valide cache for this id
84
// Test if thereis a valide cache for this id
85
if (!$recalcule) {
85
if (!$recalcule) {
86
	$xml = $Cache_Lite->get($id);
86
	$xml = $Cache_Lite->get($id);
87
} else { // pas de cache, on construit le calendrier
87
} else { // pas de cache, on construit le calendrier
88
*/	
88
*/	
89
	
89
	
90
	$html = $info->listmessages();
90
	$html = $info->listmessages();
91
	if (!$html) {
91
	if (!$html) {
92
    	
92
    	
93
    	$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)) ;
94
    	$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]]>';
95
    	$xml .= XML_Util::createEndElement('ezmlm_erreur') ;
95
    	$xml .= XML_Util::createEndElement('ezmlm_erreur') ;
96
	} else {
96
	} else {
97
		$xml .= XML_Util::createStartElement ('ezmlm_calendrier_messages', array('domaine' => $domaine, 'liste' => $liste, 'langue' => $langue)) ;
97
		$xml .= XML_Util::createStartElement ('ezmlm_calendrier_messages', array('domaine' => $domaine, 'liste' => $liste, 'langue' => $langue)) ;
98
		
98
		
99
		$xml .= '<![CDATA[ '.$html.']]>';
99
		$xml .= '<![CDATA[ '.$html.']]>';
100
		
100
		
101
		$xml .= XML_Util::createEndElement('ezmlm_calendrier_messages') ;
101
		$xml .= XML_Util::createEndElement('ezmlm_calendrier_messages') ;
102
		
102
		
103
		/*
103
		/*
104
		$xml .= XML_Util::createStartElement('cache_time') ;
104
		$xml .= XML_Util::createStartElement('cache_time') ;
105
		$xml .= (int)$Cache_Lite->lastmodified().'#'.fileatime($info->listdir.'/num');
105
		$xml .= (int)$Cache_Lite->lastmodified().'#'.fileatime($info->listdir.'/num');
106
		$xml .= XML_Util::createEndElement('cache_time') ;*/
106
		$xml .= XML_Util::createEndElement('cache_time') ;*/
107
		//$Cache_Lite->save($xml, $id);
107
		//$Cache_Lite->save($xml, $id);
108
	}
108
	}
109
//}
109
//}
-
 
110
 
110
header ('Content-type: text/xml');
111
header ('Content-type: text/xml');
111
echo $xml ;
112
echo $xml ;
112
 
113
 
113
/* +--Fin du code ----------------------------------------------------------------------------------------+
114
/* +--Fin du code ----------------------------------------------------------------------------------------+
114
*
115
*
115
* $Log: not supported by cvs2svn $
116
* $Log: not supported by cvs2svn $
-
 
117
* Revision 1.4  2008-08-25 15:25:47  alexandre_tb
-
 
118
* optimisation et gestion du cache
-
 
119
*
116
* Revision 1.3  2008-06-09 10:05:28  alexandre_tb
120
* Revision 1.3  2008-06-09 10:05:28  alexandre_tb
117
* Ajout de la gestion du cache
121
* Ajout de la gestion du cache
118
* dependance avec Cache_Lite
122
* dependance avec Cache_Lite
119
*
123
*
120
* +-- Fin du code ----------------------------------------------------------------------------------------+
124
* +-- Fin du code ----------------------------------------------------------------------------------------+
121
*/
125
*/
122
 
126
 
123
?>
127
?>