Subversion Repositories Applications.papyrus

Compare Revisions

Ignore whitespace Rev 1254 → Rev 1255

/branches/livraison_menes/client/projet/classes/ezmlm-php-2.0/ezmlm-threads.php
1,5 → 1,5
<?php
// $Id: ezmlm-threads.php,v 1.4.2.1 2007-02-16 13:40:21 alexandre_tb Exp $
// $Id: ezmlm-threads.php,v 1.4.2.2 2007-03-12 11:23:46 alexandre_tb Exp $
//
// ezmlm-threads.php - ezmlm-php v2.0
// --------------------------------------------------------------
10,7 → 10,7
 
require_once("ezmlm.php");
require_once("ezmlm-parser.php");
require_once ('ezmlm-langue-fr.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 {
260,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";
295,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>";