Subversion Repositories Applications.projet

Rev

Rev 417 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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