| 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: ezmlm-parser.php,v 1.3 2007-04-19 15:34:35 neiluj Exp $
|
22 |
// CVS : $Id: ezmlm-parser.php,v 1.4 2008-08-25 15:20:54 alexandre_tb Exp $
|
| 23 |
/**
|
23 |
/**
|
| 24 |
* Application projet
|
24 |
* Application projet
|
| 25 |
*
|
25 |
*
|
| 26 |
* classe ezmlm_parser pour lire les fichiers d index de ezmlm-idx
|
26 |
* classe ezmlm_parser pour lire les fichiers d index de ezmlm-idx
|
| 27 |
*
|
27 |
*
|
| 28 |
*@package projet
|
28 |
*@package projet
|
| 29 |
//Auteur original : ?? recupere dans ezmlm-php
|
29 |
//Auteur original : ?? recupere dans ezmlm-php
|
| 30 |
*@author Alexandre Granier <alexandre@tela-botanica.org>
|
30 |
*@author Alexandre Granier <alexandre@tela-botanica.org>
|
| 31 |
*@copyright Tela-Botanica 2000-2004
|
31 |
*@copyright Tela-Botanica 2000-2004
|
| 32 |
*@version $Revision: 1.3 $
|
32 |
*@version $Revision: 1.4 $
|
| 33 |
// +------------------------------------------------------------------------------------------------------+
|
33 |
// +------------------------------------------------------------------------------------------------------+
|
| 34 |
*/
|
34 |
*/
|
| Line 35... |
Line 35... |
| 35 |
|
35 |
|
| 36 |
|
36 |
|
| 37 |
// +------------------------------------------------------------------------------------------------------+
|
37 |
// +------------------------------------------------------------------------------------------------------+
|
| Line 38... |
Line 38... |
| 38 |
// | ENTETE du PROGRAMME |
|
38 |
// | ENTETE du PROGRAMME |
|
| 39 |
// +------------------------------------------------------------------------------------------------------+
|
39 |
// +------------------------------------------------------------------------------------------------------+
|
| Line 40... |
Line 40... |
| 40 |
|
40 |
|
| 41 |
// $Id: ezmlm-parser.php,v 1.3 2007-04-19 15:34:35 neiluj Exp $
|
41 |
// $Id: ezmlm-parser.php,v 1.4 2008-08-25 15:20:54 alexandre_tb Exp $
|
| 42 |
//
|
42 |
//
|
| Line 85... |
Line 85... |
| 85 |
function recent_msgs($show = 20, $month = "") {
|
85 |
function recent_msgs($show = 20, $month = "") {
|
| Line 86... |
Line 86... |
| 86 |
|
86 |
|
| Line 87... |
Line 87... |
| 87 |
$repertoire_archive = opendir($this->listdir . "/archive/");
|
87 |
$repertoire_archive = opendir($this->listdir . "/archive/");
|
| 88 |
|
- |
|
| 89 |
$repertoire_message = array() ;
|
- |
|
| 90 |
$dernier_repertoire = 0 ;
|
- |
|
| 91 |
while (false !== ($item = readdir($repertoire_archive))) {
|
- |
|
| Line 92... |
Line 88... |
| 92 |
// $item contient les noms des repertoires
|
88 |
|
| 93 |
// on ne garde que ceux qui sont des chiffres
|
- |
|
| 94 |
|
89 |
$repertoire_message = array() ;
|
| 95 |
if (preg_match('/[0-9]+/', $item)) {
|
90 |
|
| 96 |
// on ouvre le fichier d index de chaque repertoire
|
- |
|
| 97 |
if ((int) $item > $dernier_repertoire) $dernier_repertoire = (int) $item;
|
- |
|
| 98 |
|
91 |
$numArchive = $this->getNumArchive();
|
| 99 |
}
|
92 |
$dernier_repertoire = floor($numArchive / 100);
|
| 100 |
}
|
93 |
|
| 101 |
$tableau_message = array() ;
|
94 |
$tableau_message = array() ;
|
| 102 |
$compteur_message = 0 ;
|
95 |
$compteur_message = 0 ;
|
| Line 158... |
Line 151... |
| 158 |
|
151 |
|
| 159 |
return $tableau_message ;
|
152 |
return $tableau_message ;
|
| Line -... |
Line 153... |
| - |
|
153 |
}
|
| - |
|
154 |
|
| - |
|
155 |
|
| - |
|
156 |
/**
|
| - |
|
157 |
* num_msg_lest_week renvoie le nombre de messages echanges la derniere semaine
|
| - |
|
158 |
*
|
| - |
|
159 |
* @return int un entier
|
| - |
|
160 |
* @access public
|
| - |
|
161 |
*/
|
| - |
|
162 |
function num_msg_last_week() {
|
| - |
|
163 |
|
| - |
|
164 |
$repertoire_archive = opendir($this->listdir . "/archive/");
|
| - |
|
165 |
|
| - |
|
166 |
$repertoire_message = array() ;
|
| - |
|
167 |
$dernier_repertoire = 0 ;
|
| - |
|
168 |
|
| - |
|
169 |
|
| - |
|
170 |
// Recherche du dernier repertorie
|
| - |
|
171 |
while (false !== ($item = readdir($repertoire_archive))) {
|
| - |
|
172 |
// $item contient les noms des repertoires
|
| - |
|
173 |
// on ne garde que ceux qui sont des chiffres
|
| - |
|
174 |
|
| - |
|
175 |
if (preg_match('/[0-9]+/', $item)) {
|
| - |
|
176 |
// on ouvre le fichier d index de chaque repertoire
|
| - |
|
177 |
if ((int) $item > $dernier_repertoire) $dernier_repertoire = (int) $item;
|
| - |
|
178 |
|
| - |
|
179 |
}
|
| - |
|
180 |
}
|
| - |
|
181 |
$tableau_date = array() ;
|
| - |
|
182 |
$tableau_final = array();
|
| - |
|
183 |
$compteur_message = '0' ;
|
| - |
|
184 |
|
| - |
|
185 |
while ($dernier_repertoire != -1) {
|
| - |
|
186 |
if (!file_exists($this->listdir.'/archive/'.$dernier_repertoire.'/index')) return '0';
|
| - |
|
187 |
|
| - |
|
188 |
// Si le fichier index est vide, c'est probable que la liste soit nouvelle,
|
| - |
|
189 |
// on retourne 0
|
| - |
|
190 |
if (filesize($this->listdir.'/archive/'.$dernier_repertoire.'/index') == 0) return '0';
|
| - |
|
191 |
|
| - |
|
192 |
$fichier_index = fopen ($this->listdir.'/archive/'.$dernier_repertoire.'/index', 'r') ;
|
| - |
|
193 |
|
| - |
|
194 |
while (!feof($fichier_index)) {
|
| - |
|
195 |
// Recuperation du numero de message, du hash du sujet et du sujet
|
| - |
|
196 |
$temp = fgets($fichier_index, 4096);
|
| - |
|
197 |
preg_match('/([0-9]+): ([a-z]+) (.*)/', $temp, $match) ;
|
| - |
|
198 |
|
| - |
|
199 |
// dans la seconde on recupere la date, hash auteur et auteur
|
| - |
|
200 |
$temp = fgets($fichier_index, 4096);
|
| - |
|
201 |
preg_match('/\t([0-9]+) ([a-zA-Z][a-zA-Z][a-zA-Z]) ([0-9][0-9][0-9][0-9]) ([0-9][0-9]:[0-9][0-9]:[0-9][0-9]) ([^;]+);([^ ]*) (.*)/', $temp, $match_deuxieme_ligne) ;
|
| - |
|
202 |
if ($match[1] != '') {
|
| - |
|
203 |
$date = $match_deuxieme_ligne[1].' '.$match_deuxieme_ligne[2].' '.$match_deuxieme_ligne[3].' '.$match_deuxieme_ligne[4];
|
| - |
|
204 |
|
| - |
|
205 |
$tableau_date[] = $date;
|
| - |
|
206 |
}
|
| - |
|
207 |
}
|
| - |
|
208 |
fclose ($fichier_index);
|
| - |
|
209 |
$tableau_date = array_reverse($tableau_date);
|
| - |
|
210 |
foreach ($tableau_date as $date) {
|
| - |
|
211 |
|
| - |
|
212 |
if (strtotime ($date) > time() - 7 * 24 * 60 *60) {
|
| - |
|
213 |
$tableau_final[] = $date;
|
| - |
|
214 |
$compteur_message++;
|
| - |
|
215 |
} else {
|
| - |
|
216 |
return $compteur_message;
|
| - |
|
217 |
}
|
| - |
|
218 |
}
|
| - |
|
219 |
$dernier_repertoire--;
|
| 160 |
}
|
220 |
}
|
| 161 |
|
221 |
}
|
| 162 |
|
222 |
|
| 163 |
// parse_file - opens a file and feeds the data to parse, file can be relative to the listdir
|
223 |
// parse_file - opens a file and feeds the data to parse, file can be relative to the listdir
|
| 164 |
function parse_file($file,$simple = FALSE) {
|
224 |
function parse_file($file,$simple = FALSE) {
|