Line 35... |
Line 35... |
35 |
if ($md5 != $this->md5_of_file($this->listdir . "/archive/threads/" . $month)) {
|
35 |
if ($md5 != $this->md5_of_file($this->listdir . "/archive/threads/" . $month)) {
|
36 |
print "<!-- $md5 ne " . $this->md5_of_file($this->listdir . "/archive/threads/" . $month) . " -->\n";
|
36 |
print "<!-- $md5 ne " . $this->md5_of_file($this->listdir . "/archive/threads/" . $month) . " -->\n";
|
37 |
$this->build($month);
|
37 |
$this->build($month);
|
38 |
}
|
38 |
}
|
39 |
}
|
39 |
}
|
40 |
$html = $this->display($month);
|
40 |
$html = $this->display($month);
|
41 |
return $html ;
|
41 |
return $html ;
|
42 |
}
|
42 |
}
|
Line 43... |
Line 43... |
43 |
|
43 |
|
44 |
// display: this loads each cache file sequentially and displays the messages in them
|
44 |
// display: this loads each cache file sequentially and displays the messages in them
|
Line 56... |
Line 56... |
56 |
$html .= '[ '.$this->makelink('action=show_month&actionargs[]='.$month, 'par date').' ]' ;
|
56 |
$html .= '[ '.$this->makelink('action=show_month&actionargs[]='.$month, 'par date').' ]' ;
|
57 |
$months = array(1 => 'January', 2 => 'February', 3 => 'March', 4 => 'April', 5 => 'May', 6 => 'June', 7 => 'July', 8 => 'August',
|
57 |
$months = array(1 => 'January', 2 => 'February', 3 => 'March', 4 => 'April', 5 => 'May', 6 => 'June', 7 => 'July', 8 => 'August',
|
58 |
9 => 'September', 10 => 'October', 11 => 'November', 12 => 'December');
|
58 |
9 => 'September', 10 => 'October', 11 => 'November', 12 => 'December');
|
59 |
// remplacé par le tableau globals $mois dans ezmlm.php
|
59 |
// remplacé par le tableau globals $mois dans ezmlm.php
|
60 |
$html .= '<h2>'.FIL_DE_DISCUSSION.' pour '.$GLOBALS['mois'][((int)substr($month,4,2) / 1) -1] .', ' . substr($month,0,4) . '</h2>'."\n";
|
60 |
$html .= '<h2>'.FIL_DE_DISCUSSION.' pour '.$GLOBALS['mois'][((int)substr($month,4,2) / 1) -1] .', ' . substr($month,0,4) . '</h2>'."\n";
|
61 |
|
61 |
|
62 |
$html .= '<table class="table_cadre">'."\n";
|
62 |
$html .= '<table class="table_cadre">'."\n";
|
63 |
$html .= '<tr><th>Num</th><th>De</th><th>Sujet</th><th>Date</th></tr>'."\n";
|
63 |
$html .= '<tr><th>Num</th><th>De</th><th>Sujet</th><th>Date</th></tr>'."\n";
|
64 |
$html .= '<tr><td colspan="3"><hr /></td></tr>'."\n";
|
64 |
$html .= '<tr><td colspan="3"><hr /></td></tr>'."\n";
|
65 |
$ctc .= 0;
|
65 |
$ctc .= 0;
|
Line 66... |
Line 66... |
66 |
|
66 |
|
67 |
if (is_file($cache)) {
|
67 |
if (is_file($cache)) {
|
68 |
file_get_contents($cache);
|
68 |
file_get_contents($cache);
|
69 |
}
|
69 |
}
|
70 |
$html .= '<tr><td colspan="3"></td></tr>'."\n";
|
70 |
$html .= '<tr><td colspan="3"></td></tr>'."\n";
|
71 |
$html .= '</table>'."\n";
|
71 |
$html .= '</table>'."\n";
|
72 |
|
72 |
|
73 |
return $html ;
|
73 |
return $html ;
|
Line 74... |
Line 74... |
74 |
}
|
74 |
}
|
Line 86... |
Line 86... |
86 |
$message = file_get_contents($this->listdir . "/archive/" . $msgdir . "/" . $msgfile) ;
|
86 |
$message = file_get_contents($this->listdir . "/archive/" . $msgdir . "/" . $msgfile) ;
|
87 |
$mimeDecode = new Mail_mimeDecode($message) ;
|
87 |
$mimeDecode = new Mail_mimeDecode($message) ;
|
88 |
$mailDecode = $mimeDecode->decode() ;
|
88 |
$mailDecode = $mimeDecode->decode() ;
|
89 |
//$msg = new ezmlm_parser();
|
89 |
//$msg = new ezmlm_parser();
|
90 |
//$msg->parse_file($this->listdir . $thread_curr->file, TRUE);
|
90 |
//$msg->parse_file($this->listdir . $thread_curr->file, TRUE);
|
91 |
|
91 |
|
92 |
} else {
|
92 |
} else {
|
93 |
$mailDecode = $GLOBALS['fichiers_analyses'][$match[1]][$match[2]] ;
|
93 |
$mailDecode = $GLOBALS['fichiers_analyses'][$match[1]][$match[2]] ;
|
94 |
}
|
94 |
}
|
95 |
$actionargs = preg_split("/\//", $thread_curr->file);
|
95 |
$actionargs = preg_split("/\//", $thread_curr->file);
|
96 |
$html .= '<tr class="'.$class[$ctc].'">'."\n";
|
96 |
$html .= '<tr class="'.$class[$ctc].'">'."\n";
|
97 |
$html .= '<td>'.$actionargs[2].$actionargs[3].'</td><td>';
|
97 |
$html .= '<td>'.$actionargs[2].$actionargs[3].'</td><td>';
|
98 |
$html .= $this->makelink('action=show_author_msgs&actionargs[]='.
|
98 |
$html .= $this->makelink('action=show_author_msgs&actionargs[]='.
|
99 |
$this->makehash($this->decode_iso($mailDecode->headers['from'])),$this->decode_iso($this->protect_email($mailDecode->headers['from'],TRUE)));
|
99 |
$this->makehash($this->decode_iso($mailDecode->headers['from'])),$this->decode_iso($this->protect_email($mailDecode->headers['from'],TRUE)));
|
100 |
$html .= '</td>'."\n";
|
100 |
$html .= '</td>'."\n";
|
101 |
$html .= '<td><b>';
|
101 |
$html .= '<td><b>';
|
102 |
//$html .= " <a name=\"" . urlencode($thread_curr->file) . "\">"; A quoi ça sert ?
|
102 |
//$html .= " <a name=\"" . urlencode($thread_curr->file) . "\">"; A quoi ça sert ?
|
103 |
for ($i = 0; $i < $thread_curr->depth; $i++) {
|
103 |
for ($i = 0; $i < $thread_curr->depth; $i++) {
|
Line 108... |
Line 108... |
108 |
$subject = $subject . "...";
|
108 |
$subject = $subject . "...";
|
109 |
} else {
|
109 |
} else {
|
110 |
$subject = $this->decode_iso($mailDecode->headers['subject']);
|
110 |
$subject = $this->decode_iso($mailDecode->headers['subject']);
|
111 |
}
|
111 |
}
|
Line 112... |
Line 112... |
112 |
|
112 |
|
113 |
|
113 |
|
114 |
$subject = preg_replace("/\[" . $this->listname . "\]/", "", $subject);
|
114 |
$subject = preg_replace("/\[" . $this->listname . "\]/", "", $subject);
|
115 |
$html .= $this->makelink("action=show_msg&actionargs[]=" . $actionargs[2] . "&actionargs[]=" . $actionargs[3], $subject);
|
115 |
$html .= $this->makelink("action=show_msg&actionargs[]=" . $actionargs[2] . "&actionargs[]=" . $actionargs[3], $subject);
|
116 |
$html .= "</b></td>\n";
|
116 |
$html .= "</b></td>\n";
|
117 |
$html .= '<td>' .$this->date_francaise($mailDecode->headers['date']).'</td>'."\n";
|
117 |
$html .= '<td>' .$this->date_francaise($mailDecode->headers['date']).'</td>'."\n";
|
Line 125... |
Line 125... |
125 |
}
|
125 |
}
|
Line 126... |
Line 126... |
126 |
|
126 |
|
127 |
$html .= '<tr><td colspan="3"><hr noshade size="1" /></td></tr>'."\n";
|
127 |
$html .= '<tr><td colspan="3"><hr noshade size="1" /></td></tr>'."\n";
|
128 |
return $html;
|
128 |
return $html;
|
129 |
}
|
129 |
}
|
130 |
|
130 |
|
131 |
// TODO: Fonction à tester et compléter
|
131 |
// TODO: Fonction à tester et compléter
|
132 |
// Construit un index de tous les messages envoyés dans une liste donnée pour un mois
|
132 |
// Construit un index de tous les messages envoyés dans une liste donnée pour un mois
|
133 |
// au format YYYYMM
|
133 |
// au format YYYYMM
|
134 |
/* // commenté sur le serveur
|
134 |
/* // commenté sur le serveur
|
135 |
function build_month_list($date)
|
135 |
function build_month_list($date)
|
136 |
{
|
136 |
{
|
137 |
$months = array(1 => 'Jan', 2 => 'Feb', 3 => 'Mar', 4 => 'Apr', 5 => 'May', 6 => 'Jun', 7 => 'Jul', 8 => 'Aug',
|
137 |
$months = array(1 => 'Jan', 2 => 'Feb', 3 => 'Mar', 4 => 'Apr', 5 => 'May', 6 => 'Jun', 7 => 'Jul', 8 => 'Aug',
|
138 |
9 => 'Sep', 10 => 'Oct', 11 => 'Nov', 12 => 'Dec');
|
138 |
9 => 'Sep', 10 => 'Oct', 11 => 'Nov', 12 => 'Dec');
|
139 |
|
139 |
|
140 |
$month = $months[((int)substr($month,4,2) / 1) -1] ;
|
140 |
$month = $months[((int)substr($month,4,2) / 1) -1] ;
|
141 |
$year = substr($month,0,4) ;
|
141 |
$year = substr($month,0,4) ;
|
142 |
$numArchive = $this->getNumArchive();
|
142 |
$numArchive = $this->getNumArchive();
|
143 |
$dernierRepertoire = floor($numArchive / 100);
|
143 |
$dernierRepertoire = floor($numArchive / 100);
|
144 |
|
144 |
|
145 |
$threads = array();
|
145 |
$threads = array();
|
146 |
|
146 |
|
147 |
for ($rep_courant = $dernierRepertoire; $rep_courant >= 0; $rep_courant--) {
|
147 |
for ($rep_courant = $dernierRepertoire; $rep_courant >= 0; $rep_courant--) {
|
Line 148... |
Line 148... |
148 |
$fichier_index = file ($this->listdir.'/archive/'.$rep_courant.'/index', FILE_IGNORE_NEW_LINES);
|
148 |
$fichier_index = file ($this->listdir.'/archive/'.$rep_courant.'/index', FILE_IGNORE_NEW_LINES);
|
149 |
|
149 |
|
150 |
// On parcourt le fichier a l envers
|
150 |
// On parcourt le fichier a l envers
|
151 |
for ($j = count($fichier_index)-1; $j >= 0; $j-=2) {
|
151 |
for ($j = count($fichier_index)-1; $j >= 0; $j-=2) {
|
152 |
$match = strpos($fichier_index[$j],$month.' '.$year) ;
|
152 |
$match = strpos($fichier_index[$j],$month.' '.$year) ;
|
153 |
if ($match) {
|
153 |
if ($match) {
|
154 |
|
154 |
|
155 |
$threads[] = $fichier_index[$j-1] ;
|
155 |
$threads[] = $fichier_index[$j-1] ;
|
156 |
|
156 |
|
157 |
}
|
157 |
}
|
158 |
}
|
158 |
}
|
159 |
}
|
159 |
}
|
160 |
}
|
160 |
}
|
161 |
*/
|
161 |
*/
|
162 |
|
162 |
|
163 |
// build: takes one argument in the format YYYYMM and builds the thread cache file
|
163 |
// build: takes one argument in the format YYYYMM and builds the thread cache file
|
164 |
// for that month if the ezmlm thread file exists. The resulting cache file is then
|
164 |
// for that month if the ezmlm thread file exists. The resulting cache file is then
|
165 |
// stored in $this->tmpdir;
|
165 |
// stored in $this->tmpdir;
|
Line 178... |
Line 178... |
178 |
$fd1 = fopen($this->listdir . "/archive/threads/" . $month, "r");
|
178 |
$fd1 = fopen($this->listdir . "/archive/threads/" . $month, "r");
|
179 |
while (!feof($fd1)) {
|
179 |
while (!feof($fd1)) {
|
180 |
$line = fgets($fd1,4096);
|
180 |
$line = fgets($fd1,4096);
|
181 |
if (preg_match('/^[0-9]*\:[a-z]* \[.*/', $line)) {
|
181 |
if (preg_match('/^[0-9]*\:[a-z]* \[.*/', $line)) {
|
182 |
// valid ezmlm thread file entry
|
182 |
// valid ezmlm thread file entry
|
183 |
|
183 |
|
184 |
// On place dans $subjectfile le chemin vers le fichier sujet
|
184 |
// On place dans $subjectfile le chemin vers le fichier sujet
|
185 |
$subjectfile = preg_replace("/^[0-9]*\:([a-z]*) \[.*/", "\\1", $line);
|
185 |
$subjectfile = preg_replace("/^[0-9]*\:([a-z]*) \[.*/", "\\1", $line);
|
186 |
$subjectfile = substr($subjectfile,0,2) . '/' . substr($subjectfile,2,18);
|
186 |
$subjectfile = substr($subjectfile,0,2) . '/' . substr($subjectfile,2,18);
|
Line 187... |
Line 187... |
187 |
|
187 |
|
188 |
$thread_head = NULL;
|
188 |
$thread_head = NULL;
|
189 |
$thread_curr = NULL;
|
189 |
$thread_curr = NULL;
|
190 |
$thread_temp = NULL;
|
190 |
$thread_temp = NULL;
|
Line 191... |
Line 191... |
191 |
$thread_depth = 1;
|
191 |
$thread_depth = 1;
|
192 |
|
192 |
|
193 |
if (!is_file($this->listdir . "/archive/subjects/" . $subjectfile)) { continue; }
|
193 |
if (!is_file($this->listdir . "/archive/subjects/" . $subjectfile)) { continue; }
|
194 |
// on ouvre le fichier sujet
|
194 |
// on ouvre le fichier sujet
|
195 |
// Celui-ci contient sur la première ligne le hash du sujet puis le sujet
|
195 |
// Celui-ci contient sur la première ligne le hash du sujet puis le sujet
|
196 |
// sur les autres lignes :
|
196 |
// sur les autres lignes :
|
197 |
// num_message:annéemois:hash_auteur nom_auteur
|
197 |
// num_message:annéemois:hash_auteur nom_auteur
|
Line 203... |
Line 203... |
203 |
$msgfile = $msgnum % 100;
|
203 |
$msgfile = $msgnum % 100;
|
204 |
$msgdir = (int)($msgnum / 100);
|
204 |
$msgdir = (int)($msgnum / 100);
|
205 |
if ($msgfile < 10) { $msgfile = "0" . $msgfile; }
|
205 |
if ($msgfile < 10) { $msgfile = "0" . $msgfile; }
|
206 |
//$msg = new ezmlm_parser();
|
206 |
//$msg = new ezmlm_parser();
|
207 |
//$msg->parse_file_headers($this->listdir . "/archive/" . $msgdir . "/" . $msgfile, TRUE);
|
207 |
//$msg->parse_file_headers($this->listdir . "/archive/" . $msgdir . "/" . $msgfile, TRUE);
|
208 |
|
208 |
|
209 |
$message = file_get_contents($this->listdir . "/archive/" . $msgdir . "/" . $msgfile) ;
|
209 |
$message = file_get_contents($this->listdir . "/archive/" . $msgdir . "/" . $msgfile) ;
|
210 |
$mimeDecode = new Mail_mimeDecode($message) ;
|
210 |
$mimeDecode = new Mail_mimeDecode($message) ;
|
211 |
$mailDecode = $mimeDecode->decode() ;
|
211 |
$mailDecode = $mimeDecode->decode() ;
|
212 |
|
212 |
|
213 |
|
213 |
|
214 |
|
214 |
|
215 |
// On stocke le fichier analysée pour réutilisation ultàrieure
|
215 |
// On stocke le fichier analysée pour réutilisation ultàrieure
|
216 |
$GLOBALS['fichiers_analyses'][$msgdir][$msgfile] = $mailDecode ;
|
216 |
$GLOBALS['fichiers_analyses'][$msgdir][$msgfile] = $mailDecode ;
|
217 |
$msgid = (isset ($mailDecode->headers['message-id']) ? $mailDecode->headers['message-id'] : '');
|
217 |
$msgid = (isset ($mailDecode->headers['message-id']) ? $mailDecode->headers['message-id'] : '');
|
218 |
$inreply = (isset($mailDecode->headers['in-reply-to']) ? $mailDecode->headers['in-reply-to'] : '');
|
218 |
$inreply = (isset($mailDecode->headers['in-reply-to']) ? $mailDecode->headers['in-reply-to'] : '');
|
219 |
$references = (isset ($mailDecode->headers['references']) ? $mailDecode->headers['references'] : '') ;
|
219 |
$references = (isset ($mailDecode->headers['references']) ? $mailDecode->headers['references'] : '') ;
|
Line 287... |
Line 287... |
287 |
return TRUE;
|
287 |
return TRUE;
|
288 |
}
|
288 |
}
|
Line 289... |
Line 289... |
289 |
|
289 |
|
290 |
// listmessages: prints out a nice little calendar and displays the message
|
290 |
// listmessages: prints out a nice little calendar and displays the message
|
291 |
// totals for each month. The link jumps to the thread listing.
|
291 |
// totals for each month. The link jumps to the thread listing.
|
292 |
// On lit le repertoire archive/threads/ qui contient un fichier par mois avec tous les thread, par sujet
|
292 |
// On lit le repertoire archive/threads/ qui contient un fichier par mois avec tous les thread, par sujet
|
293 |
// Presentes comme suit
|
293 |
// Presentes comme suit
|
294 |
// num_thread:hash [taille_du_thread] Sujet du thread (le dernier)
|
294 |
// num_thread:hash [taille_du_thread] Sujet du thread (le dernier)
|
295 |
// les messages sont ranges par leur numero
|
295 |
// les messages sont ranges par leur numero
|
296 |
function listmessages() {
|
296 |
function listmessages() {
|
297 |
if (!is_dir($this->listdir . "/archive/threads/")) {
|
297 |
if (!is_dir($this->listdir . "/archive/threads/")) {
|
298 |
return false ;
|
298 |
return false ;
|
299 |
}
|
299 |
}
|
300 |
|
300 |
|
301 |
$res = '<table id="petit_calendrier">'."\n";
|
301 |
$res = '<table id="petit_calendrier">'."\n";
|
302 |
$res .= " <tr>\n";
|
302 |
$res .= " <tr>\n";
|
303 |
$res .= " <td></td>" ;
|
303 |
$res .= " <td></td>" ;
|
304 |
foreach ($GLOBALS['mois'] as $valeur) $res .= '<th>'.$valeur.'</th>' ;
|
304 |
foreach ($GLOBALS['mois'] as $valeur) $res .= '<th>'.$valeur.'</th>' ;
|
Line 318... |
Line 318... |
318 |
|
318 |
|
319 |
if (preg_match('/[0-9]+/', $item)) {
|
319 |
if (preg_match('/[0-9]+/', $item)) {
|
320 |
// on ouvre le fichier d index de chaque repertoire
|
320 |
// on ouvre le fichier d index de chaque repertoire
|
321 |
$fichier_index = fopen($this->listdir.'/archive/'.$item.'/index', 'r');
|
321 |
$fichier_index = fopen($this->listdir.'/archive/'.$item.'/index', 'r');
|
322 |
$compteur = 0 ;
|
322 |
$compteur = 0 ;
|
323 |
|
323 |
|
324 |
while (!feof($fichier_index)) {
|
324 |
while (!feof($fichier_index)) {
|
325 |
// On ignore la premiere ligne
|
325 |
// On ignore la premiere ligne
|
326 |
$temp = fgets($fichier_index, 4096);
|
326 |
$temp = fgets($fichier_index, 4096);
|
327 |
// dans la seconde on recupere la date
|
327 |
// dans la seconde on recupere la date
|
328 |
$temp = fgets($fichier_index, 4096);
|
328 |
$temp = fgets($fichier_index, 4096);
|
329 |
preg_match('/\t([0-9]+) ([a-zA-Z][a-zA-Z][a-zA-Z]) ([0-9][0-9][0-9][0-9])/', $temp, $match) ;
|
329 |
preg_match('/\t([0-9]+) ([a-zA-Z][a-zA-Z][a-zA-Z]) ([0-9][0-9][0-9][0-9])/', $temp, $match) ;
|
330 |
if ($match[0] != '') {
|
330 |
if ($match[0] != '') {
|
331 |
|
331 |
|
332 |
$threadmonth = date('n', strtotime($match[0])) ;
|
332 |
$threadmonth = date('n', strtotime($match[0])) ;
|
333 |
$threadyear = date('Y', strtotime($match[0])) ;
|
333 |
$threadyear = date('Y', strtotime($match[0])) ;
|
334 |
$threadcount[$threadyear][$threadmonth]++;
|
334 |
$threadcount[$threadyear][$threadmonth]++;
|
335 |
if (!in_array($threadyear, $tableau_annee)) array_push ($tableau_annee, $threadyear);
|
335 |
if (!in_array($threadyear, $tableau_annee)) array_push ($tableau_annee, $threadyear);
|
Line 351... |
Line 351... |
351 |
$res .= ' <td class="col_annee">'.$annee.'</td>';
|
351 |
$res .= ' <td class="col_annee">'.$annee.'</td>';
|
352 |
for ($i = 1; $i <= 12; $i++) {
|
352 |
for ($i = 1; $i <= 12; $i++) {
|
353 |
$res .= '<td class="mois">';
|
353 |
$res .= '<td class="mois">';
|
354 |
if (isset($threadcount[$annee][$i]) && $threadcount[$annee][$i] > 0) {
|
354 |
if (isset($threadcount[$annee][$i]) && $threadcount[$annee][$i] > 0) {
|
355 |
$res .= $this->makelink('action=show_month&actionargs[]='.$annee.($i < 10 ? '0'.$i:$i),$threadcount[$annee][$i]);
|
355 |
$res .= $this->makelink('action=show_month&actionargs[]='.$annee.($i < 10 ? '0'.$i:$i),$threadcount[$annee][$i]);
|
356 |
}
|
356 |
}
|
357 |
$res .= '</td>';
|
357 |
$res .= '</td>';
|
358 |
}
|
358 |
}
|
359 |
$res .= '</tr>'."\n";
|
359 |
$res .= '</tr>'."\n";
|
360 |
}
|
360 |
}
|
361 |
$res .= "</table>\n";
|
361 |
$res .= "</table>\n";
|
362 |
return $res ;
|
362 |
return $res ;
|
363 |
*/
|
363 |
*/
|
364 |
}
|
364 |
}
|
365 |
/*
|
365 |
/*
|
366 |
* Cree un fichier liste.calendrierPermanent qui contient
|
366 |
* Cree un fichier liste.calendrierPermanent qui contient
|
367 |
* le nombre de message par mois pour toutes les annees
|
367 |
* le nombre de message par mois pour toutes les annees
|
368 |
* depuis le debut de la liste sauf la derniere
|
368 |
* depuis le debut de la liste sauf la derniere
|
369 |
*
|
369 |
*
|
370 |
*/
|
370 |
*/
|
371 |
function calculeCalendrierPermanent($Annnee = '') {
|
371 |
function calculeCalendrierPermanent($Annnee = '') {
|
372 |
$numArchive = $this->getNumArchive();
|
372 |
$numArchive = $this->getNumArchive();
|
373 |
$dernierRepertoire = floor($numArchive / 100);
|
373 |
$dernierRepertoire = floor($numArchive / 100);
|
374 |
|
374 |
|
375 |
$threadcount = array();
|
375 |
$threadcount = array();
|
376 |
$tableau_annee = array();
|
376 |
$tableau_annee = array();
|
377 |
|
377 |
|
378 |
for ($rep_courant = $dernierRepertoire; $rep_courant >= 0; $rep_courant--) {
|
378 |
for ($rep_courant = $dernierRepertoire; $rep_courant >= 0; $rep_courant--) {
|
379 |
$fichier_index = file ($this->listdir.'/archive/'.$rep_courant.'/index', FILE_IGNORE_NEW_LINES);
|
379 |
$fichier_index = file ($this->listdir.'/archive/'.$rep_courant.'/index', FILE_IGNORE_NEW_LINES);
|
Line 380... |
Line 380... |
380 |
|
380 |
|
381 |
// On parcours le fichier a l envers
|
381 |
// On parcours le fichier a l envers
|
382 |
for ($j = count($fichier_index)-1; $j >= 0; $j-=2) {
|
382 |
for ($j = count($fichier_index)-1; $j >= 0; $j-=2) {
|
383 |
preg_match('/\t([0-9]+) ([a-zA-Z][a-zA-Z][a-zA-Z]) ([0-9][0-9][0-9][0-9])/', $fichier_index[$j], $match) ;
|
383 |
preg_match('/\t([0-9]+) ([a-zA-Z]{3}) ([0-9]{4})/', $fichier_index[$j], $match) ;
|
384 |
if ($match[0] != '') {
|
384 |
if ($match[0] != '') {
|
385 |
$threadmonth = date('n', strtotime($match[0])) ;
|
385 |
$threadmonth = date('n', strtotime($match[0]));
|
386 |
$threadyear = date('Y', strtotime($match[0])) ;
|
386 |
$threadyear = date('Y', strtotime($match[0]));
|
387 |
if ($Annnee != '') {
|
387 |
if ($Annnee != '') {
|
388 |
if ($threadyear < date('Y')) {
|
388 |
if ($threadyear < date('Y')) {
|
389 |
$sortir = true;
|
389 |
$sortir = true;
|
390 |
break;
|
390 |
break;
|
391 |
}
|
391 |
}
|
392 |
} else {
|
392 |
} else {
|
393 |
if ($threadyear == date('Y')) continue;
|
393 |
if ($threadyear == date('Y')) continue;
|
394 |
}
|
394 |
}
|
395 |
$threadcount[$threadyear][$threadmonth]++;
|
395 |
$threadcount[$threadyear][$threadmonth]++;
|
396 |
if (!in_array($threadyear, $tableau_annee)) array_push ($tableau_annee, $threadyear);
|
396 |
if (!in_array($threadyear, $tableau_annee)) array_push ($tableau_annee, $threadyear);
|
397 |
}
|
397 |
}
|
398 |
}
|
398 |
}
|
399 |
if ($sortir) break;
|
399 |
if ($sortir) break;
|
400 |
}
|
400 |
}
|
401 |
$res = '';
|
401 |
$res = '';
|
402 |
arsort($tableau_annee);
|
402 |
arsort($tableau_annee);
|
403 |
foreach ($tableau_annee as $annee) {
|
403 |
foreach ($tableau_annee as $annee) {
|
404 |
$res .= " <tr>\n";
|
404 |
$res .= " <tr>\n";
|
405 |
$res .= ' <td class="col_annee">'.$annee.'</td>';
|
405 |
$res .= ' <td class="col_annee">'.$annee.'</td>';
|
406 |
for ($i = 1; $i <= 12; $i++) {
|
406 |
for ($i = 1; $i <= 12; $i++) {
|
407 |
$res .= '<td class="mois">';
|
407 |
$res .= '<td class="mois">';
|
408 |
if (isset($threadcount[$annee][$i]) && $threadcount[$annee][$i] > 0) {
|
408 |
if (isset($threadcount[$annee][$i]) && $threadcount[$annee][$i] > 0) {
|
409 |
$res .= $this->makelink('action=show_month&actionargs[]='.$annee.($i < 10 ? '0'.$i:$i),$threadcount[$annee][$i]);
|
409 |
$res .= $this->makelink('action=show_month&actionargs[]='.$annee.($i < 10 ? '0'.$i:$i),$threadcount[$annee][$i]);
|
410 |
}
|
410 |
}
|
411 |
$res .= '</td>';
|
411 |
$res .= '</td>';
|
412 |
}
|
412 |
}
|
413 |
$res .= '</tr>'."\n";
|
413 |
$res .= '</tr>'."\n";
|
414 |
}
|
414 |
}
|
Line 419... |
Line 419... |
419 |
$f = fopen ('tmp/'.$this->listname.'.calendrier', 'w') ;
|
419 |
$f = fopen ('tmp/'.$this->listname.'.calendrier', 'w') ;
|
420 |
fwrite ($f, $html);
|
420 |
fwrite ($f, $html);
|
421 |
fclose($f);
|
421 |
fclose($f);
|
422 |
return $html;
|
422 |
return $html;
|
423 |
}
|
423 |
}
|
424 |
|
424 |
|
425 |
function calendrierMessage() {
|
425 |
function calendrierMessage() {
|
426 |
$html = '';
|
426 |
$html = '';
|
427 |
// On ajoute la derniere annee
|
427 |
// On ajoute la derniere annee
|
428 |
$html .= $this->calculeCalendrierPermanent(date ('Y'));
|
428 |
$html .= $this->calculeCalendrierPermanent(date ('Y'));
|
Line 435... |
Line 435... |
435 |
/* $annees = $this->getAnneesARecalculer();
|
435 |
/* $annees = $this->getAnneesARecalculer();
|
436 |
$html .= $this->calculeCalendrierPermanent($annees); */
|
436 |
$html .= $this->calculeCalendrierPermanent($annees); */
|
Line 437... |
Line 437... |
437 |
|
437 |
|
438 |
return $html . file_get_contents('tmp/'.$this->listname.'.calendrier');
|
438 |
return $html . file_get_contents('tmp/'.$this->listname.'.calendrier');
|
439 |
}
|
439 |
}
|
440 |
|
440 |
|
441 |
function isFichierCalendrierExiste() {
|
441 |
function isFichierCalendrierExiste() {
|
442 |
if (file_exists('tmp/'.$this->listname.'.calendrier')) {
|
442 |
if (file_exists('tmp/'.$this->listname.'.calendrier')) {
|
443 |
return true;
|
443 |
return true;
|
444 |
}
|
444 |
}
|
445 |
return false;
|
445 |
return false;
|
446 |
}
|
446 |
}
|
447 |
function isDoitRecalculerCalendrier() {
|
447 |
function isDoitRecalculerCalendrier() {
|
448 |
return (date ('Y', filemtime('tmp/'.$this->listname.'.calendrier')) <= date('Y') - 1);
|
448 |
return (date ('Y', filemtime('tmp/'.$this->listname.'.calendrier')) <= date('Y') - 1);
|
449 |
}
|
449 |
}
|
450 |
|
450 |
|
451 |
function getAnneesARecalculer() {
|
451 |
function getAnneesARecalculer() {
|
452 |
// On suppose que l index de ezmlm est correct
|
452 |
// On suppose que l index de ezmlm est correct
|
453 |
$anneeFichierCalendrier = date ('Y', filemtime('tmp/'.$this->listname.'.calendrier'));
|
453 |
$anneeFichierCalendrier = date ('Y', filemtime('tmp/'.$this->listname.'.calendrier'));
|
454 |
return $anneeFichierCalendrier + 1;
|
454 |
return $anneeFichierCalendrier + 1;
|
455 |
}
|
455 |
}
|
456 |
|
456 |
|
Line 457... |
Line 457... |
457 |
}
|
457 |
}
|
458 |
|
458 |
|
459 |
// CLASS: ezmlm-thread is a quick little class to allow us to define
|
459 |
// CLASS: ezmlm-thread is a quick little class to allow us to define
|