Subversion Repositories Applications.projet

Compare Revisions

Ignore whitespace Rev 207 → Rev 208

/trunk/classes/ezmlm-php-2.0/ezmlm-threads.php
1,5 → 1,5
<?php
// $Id: ezmlm-threads.php,v 1.4 2006-04-19 13:50:13 alexandre_tb Exp $
// $Id: ezmlm-threads.php,v 1.5 2007-04-19 15:34:35 neiluj Exp $
//
// ezmlm-threads.php - ezmlm-php v2.0
// --------------------------------------------------------------
10,6 → 10,7
 
require_once("ezmlm.php");
require_once("ezmlm-parser.php");
require_once ('ezmlm-langue-fr.php');
 
// CLASS: ezmlm_threads will build, maintain & display thread files (even if a thread is only 1 msg)
class ezmlm_threads extends ezmlm_php {
53,7 → 54,7
echo '[ '.$this->makelink('action=show_month&amp;actionargs[]='.$month, 'par date').' ]' ;
$months = array(1 => 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December');
// remplacé par le tableau globals $mois dans ezmlm.php
print '<h2>'.PROJET_FILE_DE_DISCUSSION.' pour '.$GLOBALS['mois'][((int)substr($month,4,2) / 1)] .', ' . substr($month,0,4) . '</h2>'."\n";
print '<h2>'.FIL_DE_DISCUSSION.' pour '.$GLOBALS['mois'][((int)substr($month,4,2) / 1)] .', ' . substr($month,0,4) . '</h2>'."\n";
print '<table class="table_cadre">'."\n";
print '<tr><th>Num</th><th>De</th><th>Sujet</th><th>Date</th></tr>'."\n";
174,7 → 175,7
// On stocke le fichier analysée pour réutilisation ultérieure
// 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'] : '');
$inreply = (isset($mailDecode->headers['in-reply-to']) ? $mailDecode->headers['in-reply-to'] : '');
251,7 → 252,7
 
// 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 répetoire archive/threads/ qui contient un fichier par moi avec tous les thread, par sujet
// On lit le répertoire archive/threads/ qui contient un fichier par moi avec tous les thread, par sujet
// Présentés comme suit
// num_thread:hash [taille_du_thread] Sujet du thread (le dernier)
// les messages sont rangés par leur numéro
259,30 → 260,35
if (!is_dir($this->listdir . "/archive/threads/")) {
return false ;
}
$dir = opendir($this->listdir . "/archive/threads/");
while ($item = readdir($dir)) {
if (($item == ".") or ($item == "..")) { continue; }
// Le nom du fichier est annéemoi ex 200501 pour janvier 2005
if (preg_match("/^[0-9][0-9][0-9][0-9][0-9][0-9]/",$item)) {
// on ouvre chaque fichier en lecture
$fd = fopen($this->listdir . "/archive/threads/" . $item, "r");
$count = 0; // on initialise un compteur
while(!feof($fd)) {
$curthread = fgets($fd,4096);
$num = preg_replace("/.*\[([0-9].*)\].*/", "\\1", $curthread); // $num contient le nbre de message du thread
$count = $count + $num;
$threadcount = array();
 
$repertoire_archive = opendir($this->listdir . "/archive/");
 
while (false !== ($item = readdir($repertoire_archive))) {
// $item contient les noms des repertoires
// on ne garde que ceux qui sont des chiffres
 
if (preg_match('/[0-9]+/', $item)) {
// 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);
// dans la seconde on recupere la date
$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]++;
}
}
$threadyear = substr($item,0,4);
$threadmonth = substr($item,4,2);
// on construit un tableau à 2 entrée [année][mois] = nbre_message
$threadcount[$threadyear][$threadmonth] = $count;
fclose ($fichier_index);
}
}
closedir($dir);
 
arsort($threadcount); // modifié par alex, car remplace l'année par 0
// La partie qui suit, simple, crée la table avec le nombre de message échangé chaque mois
$res = '<table id="petit_calendrier">'."\n";
$res .= " <tr>\n";
294,11 → 300,9
$res .= " <tr>\n";
$res .= " <td>$key</td>";
for ($i = 1; $i <= 12; $i++) {
if ($i < 10) { $key2 = "0" . $i; }
else { $key2 = $i; }
if (isset($threadcount[$key][$key2]) && $threadcount[$key][$key2] > 0) {
if (isset($threadcount[$key][$i]) && $threadcount[$key][$i] > 0) {
$res .= "<td bgcolor=\"" . $this->tablecolours[0] . "\" valign=\"middle\">";
$res .= $this->makelink("action=show_month&amp;actionargs[]=$key$key2",$threadcount[$key][$key2]);
$res .= $this->makelink('action=show_month&amp;actionargs[]='.$key.($i < 10 ? '0'.$i:$i),$threadcount[$key][$i]);
$res .= "</td>";
} else {
$res .= "<td bgcolor=\"" . $this->tablecolours[0] . "\"></td>";