Subversion Repositories Applications.projet

Rev

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

Rev 208 Rev 291
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.3 2008-06-09 10:05:28 alexandre_tb Exp $
-
 
23
/**
-
 
24
* Application projet
2
 
25
*
-
 
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.3 $
-
 
35
// +------------------------------------------------------------------------------------------------------+
-
 
36
*/
3
include_once 'ezmlm-php-2.0/ezmlm.php' ;
37
include_once 'ezmlm-php-2.0/ezmlm.php' ;
Line 4... Line 38...
4
 
38
 
5
 
39
 
Line 9... Line 43...
9
$info->forcehref = $url;
43
$info->forcehref = $url;
10
$info->listdir = '/home/vpopmail/domains/'.$domaine.'/'.$liste ;
44
$info->listdir = '/home/vpopmail/domains/'.$domaine.'/'.$liste ;
11
$info->listname = $liste;
45
$info->listname = $liste;
12
$info->listdomain = $domaine ;
46
$info->listdomain = $domaine ;
Line 13... Line -...
13
 
-
 
14
ob_start() ;
-
 
15
if (!$info->listmessages()) {
-
 
16
    if (!$info) return 'Les fichiers de la liste ne sont pas visible sur le serveur' ;
-
 
17
}
-
 
18
$html = ob_get_contents() ;
47
 
19
ob_end_clean() ;
-
 
20
 
48
/** Calcul du cache */
21
include_once 'XML/Util.php' ;
-
 
22
 
-
 
Line -... Line 49...
-
 
49
require_once('Cache/Lite.php');
23
$xml = XML_Util::getXMLDeclaration('1.0', 'ISO-8859-15', 'no') ;
50
 
Line 24... Line 51...
24
 
51
// Set a id for this cache
Line -... Line 52...
-
 
52
$id = 'cache_'.$domaine.'_'.$liste;
-
 
53
 
-
 
54
// Set a few options
-
 
55
 
-
 
56
$options = array(
-
 
57
    'cacheDir' => 'tmp/',
-
 
58
    'lifeTime' => null
-
 
59
);
-
 
60
 
-
 
61
// Create a Cache_Lite object
-
 
62
$Cache_Lite = new Cache_Lite($options);
-
 
63
$recalcule = false ;
-
 
64
$Cache_Lite->get($id);
-
 
65
if (fileatime($info->listdir.'/num') > (int)$Cache_Lite->lastModified()) {
-
 
66
	$recalcule = true;
-
 
67
}
-
 
68
// Test if thereis a valide cache for this id
-
 
69
if (!$recalcule) {
-
 
70
	$xml = $Cache_Lite->get($id);
-
 
71
} else { // pas de cache, on construit le calendrier
-
 
72
	include_once 'XML/Util.php' ;
-
 
73
	$xml = XML_Util::getXMLDeclaration('1.0', 'ISO-8859-15', 'no') ;
-
 
74
	
-
 
75
	$html = $info->listmessages();
-
 
76
	if (!$html) {
-
 
77
    	$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]]>';
-
 
79
    	$xml .= XML_Util::createEndElement('ezmlm_erreur') ;
-
 
80
	} else {
25
$xml .= XML_Util::createStartElement ('ezmlm_calendrier_messages', array('domaine' => $domaine, 'liste' => $liste, 'langue' => $langue)) ;
81
		$xml .= XML_Util::createStartElement ('ezmlm_calendrier_messages', array('domaine' => $domaine, 'liste' => $liste, 'langue' => $langue)) ;
-
 
82
		
-
 
83
		$xml .= '<![CDATA[ '.$html.']]>';
-
 
84
		
-
 
85
		$xml .= XML_Util::createEndElement('ezmlm_calendrier_messages') ;
-
 
86
		
-
 
87
		/*
-
 
88
		$xml .= XML_Util::createStartElement('cache_time') ;
-
 
89
		$xml .= (int)$Cache_Lite->lastmodified().'#'.fileatime($info->listdir.'/num');
26
 
90
		$xml .= XML_Util::createEndElement('cache_time') ;*/
27
$xml .= '<![CDATA[ '.$html.']]>';
91
		$Cache_Lite->save($xml, $id);
-
 
92
	}
-
 
93
}
-
 
94
header ('Content-type: text/xml');
-
 
95
echo $xml ;
-
 
96
 
-
 
97
/* +--Fin du code ----------------------------------------------------------------------------------------+
-
 
98
*
28
 
99
* $Log: not supported by cvs2svn $
29
$xml .= XML_Util::createEndElement('ezmlm_calendrier_messages') ;
100
* +-- Fin du code ----------------------------------------------------------------------------------------+