37,7 → 37,7 |
$this->build($month); |
} |
} |
$html = $this->display($month); |
$html = $this->display($month); |
return $html ; |
} |
|
58,7 → 58,7 |
9 => 'September', 10 => 'October', 11 => 'November', 12 => 'December'); |
// remplacé par le tableau globals $mois dans ezmlm.php |
$html .= '<h2>'.FIL_DE_DISCUSSION.' pour '.$GLOBALS['mois'][((int)substr($month,4,2) / 1) -1] .', ' . substr($month,0,4) . '</h2>'."\n"; |
|
|
$html .= '<table class="table_cadre">'."\n"; |
$html .= '<tr><th>Num</th><th>De</th><th>Sujet</th><th>Date</th></tr>'."\n"; |
$html .= '<tr><td colspan="3"><hr /></td></tr>'."\n"; |
69,7 → 69,7 |
} |
$html .= '<tr><td colspan="3"></td></tr>'."\n"; |
$html .= '</table>'."\n"; |
|
|
return $html ; |
} |
|
88,14 → 88,14 |
$mailDecode = $mimeDecode->decode() ; |
//$msg = new ezmlm_parser(); |
//$msg->parse_file($this->listdir . $thread_curr->file, TRUE); |
|
|
} else { |
$mailDecode = $GLOBALS['fichiers_analyses'][$match[1]][$match[2]] ; |
} |
} |
$actionargs = preg_split("/\//", $thread_curr->file); |
$html .= '<tr class="'.$class[$ctc].'">'."\n"; |
$html .= '<td>'.$actionargs[2].$actionargs[3].'</td><td>'; |
$html .= $this->makelink('action=show_author_msgs&actionargs[]='. |
$html .= $this->makelink('action=show_author_msgs&actionargs[]='. |
$this->makehash($this->decode_iso($mailDecode->headers['from'])),$this->decode_iso($this->protect_email($mailDecode->headers['from'],TRUE))); |
$html .= '</td>'."\n"; |
$html .= '<td><b>'; |
110,7 → 110,7 |
$subject = $this->decode_iso($mailDecode->headers['subject']); |
} |
|
|
|
$subject = preg_replace("/\[" . $this->listname . "\]/", "", $subject); |
$html .= $this->makelink("action=show_msg&actionargs[]=" . $actionargs[2] . "&actionargs[]=" . $actionargs[3], $subject); |
$html .= "</b></td>\n"; |
127,23 → 127,23 |
$html .= '<tr><td colspan="3"><hr noshade size="1" /></td></tr>'."\n"; |
return $html; |
} |
|
|
// TODO: Fonction à tester et compléter |
// Construit un index de tous les messages envoyés dans une liste donnée pour un mois |
// au format YYYYMM |
/* // commenté sur le serveur |
function build_month_list($date) |
{ |
{ |
$months = array(1 => 'Jan', 2 => 'Feb', 3 => 'Mar', 4 => 'Apr', 5 => 'May', 6 => 'Jun', 7 => 'Jul', 8 => 'Aug', |
9 => 'Sep', 10 => 'Oct', 11 => 'Nov', 12 => 'Dec'); |
|
|
$month = $months[((int)substr($month,4,2) / 1) -1] ; |
$year = substr($month,0,4) ; |
$numArchive = $this->getNumArchive(); |
$dernierRepertoire = floor($numArchive / 100); |
|
|
$threads = array(); |
|
|
for ($rep_courant = $dernierRepertoire; $rep_courant >= 0; $rep_courant--) { |
$fichier_index = file ($this->listdir.'/archive/'.$rep_courant.'/index', FILE_IGNORE_NEW_LINES); |
|
151,15 → 151,15 |
for ($j = count($fichier_index)-1; $j >= 0; $j-=2) { |
$match = strpos($fichier_index[$j],$month.' '.$year) ; |
if ($match) { |
|
|
$threads[] = $fichier_index[$j-1] ; |
|
|
} |
} |
} |
} |
*/ |
|
|
// build: takes one argument in the format YYYYMM and builds the thread cache file |
// for that month if the ezmlm thread file exists. The resulting cache file is then |
// stored in $this->tmpdir; |
180,8 → 180,8 |
$line = fgets($fd1,4096); |
if (preg_match('/^[0-9]*\:[a-z]* \[.*/', $line)) { |
// valid ezmlm thread file entry |
|
// On place dans $subjectfile le chemin vers le fichier sujet |
|
// On place dans $subjectfile le chemin vers le fichier sujet |
$subjectfile = preg_replace("/^[0-9]*\:([a-z]*) \[.*/", "\\1", $line); |
$subjectfile = substr($subjectfile,0,2) . '/' . substr($subjectfile,2,18); |
|
191,7 → 191,7 |
$thread_depth = 1; |
|
if (!is_file($this->listdir . "/archive/subjects/" . $subjectfile)) { continue; } |
// on ouvre le fichier sujet |
// on ouvre le fichier sujet |
// Celui-ci contient sur la première ligne le hash du sujet puis le sujet |
// sur les autres lignes : |
// num_message:annéemois:hash_auteur nom_auteur |
205,13 → 205,13 |
if ($msgfile < 10) { $msgfile = "0" . $msgfile; } |
//$msg = new ezmlm_parser(); |
//$msg->parse_file_headers($this->listdir . "/archive/" . $msgdir . "/" . $msgfile, TRUE); |
|
|
$message = file_get_contents($this->listdir . "/archive/" . $msgdir . "/" . $msgfile) ; |
$mimeDecode = new Mail_mimeDecode($message) ; |
$mailDecode = $mimeDecode->decode() ; |
|
|
|
|
|
|
// On stocke le fichier analysée pour réutilisation ultàrieure |
$GLOBALS['fichiers_analyses'][$msgdir][$msgfile] = $mailDecode ; |
$msgid = (isset ($mailDecode->headers['message-id']) ? $mailDecode->headers['message-id'] : ''); |
289,8 → 289,8 |
|
// listmessages: prints out a nice little calendar and displays the message |
// totals for each month. The link jumps to the thread listing. |
// On lit le repertoire archive/threads/ qui contient un fichier par mois avec tous les thread, par sujet |
// Presentes comme suit |
// On lit le repertoire archive/threads/ qui contient un fichier par mois avec tous les thread, par sujet |
// Presentes comme suit |
// num_thread:hash [taille_du_thread] Sujet du thread (le dernier) |
// les messages sont ranges par leur numero |
function listmessages() { |
297,7 → 297,7 |
if (!is_dir($this->listdir . "/archive/threads/")) { |
return false ; |
} |
|
|
$res = '<table id="petit_calendrier">'."\n"; |
$res .= " <tr>\n"; |
$res .= " <td></td>" ; |
320,7 → 320,7 |
// on ouvre le fichier d index de chaque repertoire |
$fichier_index = fopen($this->listdir.'/archive/'.$item.'/index', 'r'); |
$compteur = 0 ; |
|
|
while (!feof($fichier_index)) { |
// On ignore la premiere ligne |
$temp = fgets($fichier_index, 4096); |
328,7 → 328,7 |
$temp = fgets($fichier_index, 4096); |
preg_match('/\t([0-9]+) ([a-zA-Z][a-zA-Z][a-zA-Z]) ([0-9][0-9][0-9][0-9])/', $temp, $match) ; |
if ($match[0] != '') { |
|
|
$threadmonth = date('n', strtotime($match[0])) ; |
$threadyear = date('Y', strtotime($match[0])) ; |
$threadcount[$threadyear][$threadmonth]++; |
353,7 → 353,7 |
$res .= '<td class="mois">'; |
if (isset($threadcount[$annee][$i]) && $threadcount[$annee][$i] > 0) { |
$res .= $this->makelink('action=show_month&actionargs[]='.$annee.($i < 10 ? '0'.$i:$i),$threadcount[$annee][$i]); |
} |
} |
$res .= '</td>'; |
} |
$res .= '</tr>'."\n"; |
363,34 → 363,34 |
*/ |
} |
/* |
* Cree un fichier liste.calendrierPermanent qui contient |
* le nombre de message par mois pour toutes les annees |
* Cree un fichier liste.calendrierPermanent qui contient |
* le nombre de message par mois pour toutes les annees |
* depuis le debut de la liste sauf la derniere |
* |
* |
*/ |
function calculeCalendrierPermanent($Annnee = '') { |
$numArchive = $this->getNumArchive(); |
$dernierRepertoire = floor($numArchive / 100); |
|
|
$threadcount = array(); |
$tableau_annee = array(); |
|
|
for ($rep_courant = $dernierRepertoire; $rep_courant >= 0; $rep_courant--) { |
$fichier_index = file ($this->listdir.'/archive/'.$rep_courant.'/index', FILE_IGNORE_NEW_LINES); |
|
// On parcours le fichier a l envers |
for ($j = count($fichier_index)-1; $j >= 0; $j-=2) { |
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) ; |
preg_match('/\t([0-9]+) ([a-zA-Z]{3}) ([0-9]{4})/', $fichier_index[$j], $match) ; |
if ($match[0] != '') { |
$threadmonth = date('n', strtotime($match[0])) ; |
$threadyear = date('Y', strtotime($match[0])) ; |
$threadmonth = date('n', strtotime($match[0])); |
$threadyear = date('Y', strtotime($match[0])); |
if ($Annnee != '') { |
if ($threadyear < date('Y')) { |
$sortir = true; |
break; |
break; |
} |
} else { |
if ($threadyear == date('Y')) continue; |
if ($threadyear == date('Y')) continue; |
} |
$threadcount[$threadyear][$threadmonth]++; |
if (!in_array($threadyear, $tableau_annee)) array_push ($tableau_annee, $threadyear); |
398,7 → 398,7 |
} |
if ($sortir) break; |
} |
$res = ''; |
$res = ''; |
arsort($tableau_annee); |
foreach ($tableau_annee as $annee) { |
$res .= " <tr>\n"; |
407,7 → 407,7 |
$res .= '<td class="mois">'; |
if (isset($threadcount[$annee][$i]) && $threadcount[$annee][$i] > 0) { |
$res .= $this->makelink('action=show_month&actionargs[]='.$annee.($i < 10 ? '0'.$i:$i),$threadcount[$annee][$i]); |
} |
} |
$res .= '</td>'; |
} |
$res .= '</tr>'."\n"; |
421,7 → 421,7 |
fclose($f); |
return $html; |
} |
|
|
function calendrierMessage() { |
$html = ''; |
// On ajoute la derniere annee |
437,7 → 437,7 |
|
return $html . file_get_contents('tmp/'.$this->listname.'.calendrier'); |
} |
|
|
function isFichierCalendrierExiste() { |
if (file_exists('tmp/'.$this->listname.'.calendrier')) { |
return true; |
447,13 → 447,13 |
function isDoitRecalculerCalendrier() { |
return (date ('Y', filemtime('tmp/'.$this->listname.'.calendrier')) <= date('Y') - 1); |
} |
|
|
function getAnneesARecalculer() { |
// On suppose que l index de ezmlm est correct |
$anneeFichierCalendrier = date ('Y', filemtime('tmp/'.$this->listname.'.calendrier')); |
return $anneeFichierCalendrier + 1; |
} |
|
|
} |
|
// CLASS: ezmlm-thread is a quick little class to allow us to define |