/trunk/client/projet/classes/ezmlm-php-2.0/ezmlm-langue-fr.php |
---|
New file |
0,0 → 1,5 |
<?php |
define ('FIL_DE_DISCUSSION', 'Fil de discussion') ; |
?> |
/trunk/client/projet/classes/ezmlm-php-2.0/services_vpopmail/derniers_messages.php |
---|
New file |
0,0 → 1,32 |
<?php |
include_once 'ezmlm-php-2.0/ezmlm.php' ; |
// Parametrage de la liste |
$info = new ezmlm_listinfo(); |
if (!$info) return 'Les fichiers de la liste ne sont pas visible sur le serveur' ; |
$info->forcehref = $url; |
$info->listdir = '/home/vpopmail/domains/'.$domaine.'/'.$liste ; |
$info->listname = $liste; |
$info->listdomain = $domaine ; |
ob_start() ; |
if (!$info->show_recentmsgs()) { |
if (!$info) return 'Les fichiers de la liste ne sont pas visible sur le serveur' ; |
} |
$html = ob_get_contents() ; |
ob_end_clean() ; |
include_once 'XML/Util.php' ; |
$xml = XML_Util::getXMLDeclaration('1.0', 'ISO-8859-15', 'no') ; |
$xml .= XML_Util::createStartElement ('ezmlm_derniers_messages', array('domaine' => $domaine, 'liste' => $liste, 'langue' => $langue)) ; |
$xml .= '<![CDATA[ '.$html.']]>'; |
$xml .= XML_Util::createEndElement('ezmlm_derniers_messages') ; |
header ('Content-type: text/xml'); |
echo $xml ; |
?> |
/trunk/client/projet/classes/ezmlm-php-2.0/services_vpopmail/ajout_abonne.php |
---|
New file |
0,0 → 1,6 |
<?php |
$repertoire = '/home/vpopmail/domains/'.$domaine.'/'.$liste ; |
echo exec ('ezmlm-sub '.$repertoire.' '.$mail, $output, $ret) ; |
?> |
/trunk/client/projet/classes/ezmlm-php-2.0/services_vpopmail/creation_liste.php |
---|
New file |
0,0 → 1,20 |
<?php |
$repertoire = '/home/vpopmail/domains/'.$domaine.'/'.$liste ; |
$fichier_qmail = '/home/vpopmail/domains/'.$domaine.'/.qmail-'.$liste ; |
// Transformation de ma chaine $parametres ((de aBud en -a -B -u -D) |
$para = '' ; |
for ($i = 0; $i < count ($parametres); $i++) { |
$para .= '-'.$parametres.' ' ; |
} |
echo exec ('ezmlm-make '.$para.' '.$repertoire.' '.$fichier_qmail.' '.$liste.' '.$domaine, $output, $ret) ; |
echo "\n" ; |
echo exec ('ezmlm-reply-to '.$domaine.' '.$liste) ; |
echo "\n" ; |
?> |
/trunk/client/projet/classes/ezmlm-php-2.0/services_vpopmail/message.php |
---|
New file |
0,0 → 1,38 |
<?php |
include_once 'ezmlm-php-2.0/ezmlm.php' ; |
// Parametrage de la liste |
$message = new ezmlm_msgdisplay(); |
if (!$message) return 'Les fichiers de la liste ne sont pas visible sur le serveur' ; |
$message->forcehref = $url; |
$message->listdir = '/home/vpopmail/domains/'.$domaine.'/'.$liste ; |
$message->listname = $liste; |
$message->listdomain = $domaine ; |
$id_rep = $actionargs[0] ; |
$num_message = $actionargs[1] ; |
if ($id_rep =='' || $num_message == '') exit(); |
$html = $message->display ($id_rep.'/'.$num_message) ; |
include_once 'XML/Util.php' ; |
$xml = XML_Util::getXMLDeclaration('1.0', 'ISO-8859-15', 'no') ; |
$xml .= XML_Util::createStartElement ('ezmlm_message', array('domaine' => $domaine, 'liste' => $liste, 'langue' => $langue)) ; |
$xml .= "\n".'<![CDATA[ '.$html.']]>'; |
$info_suivant = $message->getInfoSuivant() ; |
$xml .= XML_Util::createStartElement ('message_suivant', array ('numero' => $info_suivant['fichier_suivant'], |
'numero_repertoire' => $info_suivant['repertoire_suivant'])) ; |
$xml .= XML_Util::createEndElement('message_suivant') ; |
$xml .= XML_Util::createStartElement ('message_precedent', array ('numero' => $info_suivant['fichier_precedent'], |
'numero_repertoire' => $info_suivant['repertoire_precedent'])) ; |
$xml .= XML_Util::createEndElement('message_precedent') ; |
$xml .= XML_Util::createEndElement('ezmlm_message') ; |
header ('Content-type: text/xml'); |
echo $xml ; |
?> |
/trunk/client/projet/classes/ezmlm-php-2.0/services_vpopmail/.htaccess |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/client/projet/classes/ezmlm-php-2.0/services_vpopmail/.htaccess |
---|
New file |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/trunk/client/projet/classes/ezmlm-php-2.0/services_vpopmail/liste_abonnes.php |
---|
New file |
0,0 → 1,17 |
<?php |
$repertoire = '/home/vpopmail/domains/'.$domaine.'/'.$liste ; |
exec ('ezmlm-list '.$repertoire, $output, $ret) ; |
include_once 'XML/Util.php' ; |
$xml = XML_Util::getXMLDeclaration('1.0', 'ISO-8859-15', 'no') ; |
$xml .= XML_Util::createStartElement ('ezmlm_liste_abonnes', array('domaine' => $domaine, 'liste' => $liste)) ; |
foreach ($output as $mail) $xml .= XML_Util::createTag('email', '', $mail) ; |
$xml .= XML_Util::createEndElement('ezmlm_liste_abonnes') ; |
header ('Content-type: text/xml'); |
echo $xml ; |
?> |
/trunk/client/projet/classes/ezmlm-php-2.0/services_vpopmail/supprimer.php |
---|
New file |
0,0 → 1,15 |
<?php |
/** |
* Supprime un message d'une liste |
* Entrée domaine, liste, numero_repertoire, numero_message |
*/ |
$repertoire_liste = '/home/vpopmail/domains/'.$domaine.'/'.$liste; |
$message_a_supprimer = $repertoire_liste.'/archive/'.$actionargs[0].'/'.$actionargs[1] ; |
if (file_exists ($message_a_supprimer)) { |
echo $message_a_supprimer; |
exec ('rm '.$message_a_supprimer) ; |
exec ('ezmlm-archive -c '.$repertoire_liste); |
exec ('ezmlm-idx '.$repertoire_liste); |
} |
/trunk/client/projet/classes/ezmlm-php-2.0/services_vpopmail/ajout_moderateur.php |
---|
New file |
0,0 → 1,7 |
<?php |
$repertoire = '/home/vpopmail/domains/'.$domaine.'/'.$liste.'/mod' ; |
echo exec ('ezmlm-sub '.$repertoire.' '.$mail, $output, $ret) ; |
echo 'ezmlm-sub '.$repertoire.' '.$mail ; |
?> |
/trunk/client/projet/classes/ezmlm-php-2.0/services_vpopmail/suppression_liste.php |
---|
New file |
0,0 → 1,20 |
<?php |
if (!isset ($domaine) || $domaine == '' || !isset($liste) || $liste == '') { |
die ('manque paramètre domaine ou liste') ; |
} |
$repertoire = '/home/vpopmail/domains/'.$domaine.'/'.$liste ; |
$fichier_qmail = '/home/vpopmail/domains/'.$domaine.'/.qmail-'.$liste ; |
echo exec ('rm '.$fichier_qmail, $output2, $ret2) ; |
echo exec ('rm '.$fichier_qmail.'-default', $output2, $ret2) ; |
echo exec ('rm '.$fichier_qmail.'-digest-owner', $output2, $ret2) ; |
echo exec ('rm '.$fichier_qmail.'-digest-return-default', $output2, $ret2) ; |
echo exec ('rm '.$fichier_qmail.'-owner', $output2, $ret2) ; |
echo exec ('rm '.$fichier_qmail.'-return-default', $output2, $ret2) ; |
echo 'rm '.$fichier_qmail ; |
echo exec ('rm -rf '.$repertoire, $output, $ret) ; |
echo 'rm -rf '.$repertoire ; |
?> |
/trunk/client/projet/classes/ezmlm-php-2.0/services_vpopmail/messages_auteur.php |
---|
New file |
0,0 → 1,32 |
<?php |
include_once 'ezmlm-php-2.0/ezmlm.php' ; |
// Parametrage de la liste |
$info = new ezmlm_author(); |
if (!$info) return 'Les fichiers de la liste ne sont pas visible sur le serveur' ; |
$info->forcehref = $url; |
$info->listdir = '/home/vpopmail/domains/'.$domaine.'/'.$liste ; |
$info->listname = $liste; |
$info->listdomain = $domaine ; |
ob_start() ; |
if (!$info->display($actionargs[0])) { |
if (!$info) return 'Les fichiers de la liste ne sont pas visible sur le serveur' ; |
} |
$html = ob_get_contents() ; |
ob_end_clean() ; |
include_once 'XML/Util.php' ; |
$xml = XML_Util::getXMLDeclaration('1.0', 'ISO-8859-15', 'no') ; |
$xml .= XML_Util::createStartElement ('ezmlm_messages_auteur', array('domaine' => $domaine, 'liste' => $liste, 'langue' => $langue )) ; |
$xml .= '<![CDATA[ '.$html.']]>'; |
$xml .= XML_Util::createEndElement('ezmlm_messages_auteur') ; |
header ('Content-type: text/xml'); |
echo $xml ; |
?> |
/trunk/client/projet/classes/ezmlm-php-2.0/services_vpopmail/suppression_abonne.php |
---|
New file |
0,0 → 1,7 |
<?php |
$repertoire = '/home/vpopmail/domains/'.$domaine.'/'.$liste ; |
echo exec ('ezmlm-unsub '.$repertoire.' '.$mail, $output, $ret) ; |
echo 'ezmlm-unsub '.$repertoire.' '.$mail; |
?> |
/trunk/client/projet/classes/ezmlm-php-2.0/services_vpopmail/messages_mois.php |
---|
New file |
0,0 → 1,32 |
<?php |
include_once 'ezmlm-php-2.0/ezmlm.php' ; |
// Parametrage de la liste |
$info = new ezmlm_listinfo(); |
if (!$info) return 'Les fichiers de la liste ne sont pas visible sur le serveur' ; |
$info->forcehref = $url; |
$info->listdir = '/home/vpopmail/domains/'.$domaine.'/'.$liste ; |
$info->listname = $liste; |
$info->listdomain = $domaine ; |
ob_start() ; |
if (!$info->show_month($actionargs[0])) { |
if (!$info) return 'Les fichiers de la liste ne sont pas visible sur le serveur' ; |
} |
$html = ob_get_contents() ; |
ob_end_clean() ; |
include_once 'XML/Util.php' ; |
$xml = XML_Util::getXMLDeclaration('1.0', 'ISO-8859-15', 'no') ; |
$xml .= XML_Util::createStartElement ('ezmlm_messages_mois', array('domaine' => $domaine, 'liste' => $liste, 'langue' => $langue)) ; |
$xml .= '<![CDATA[ '.$html.']]>'; |
$xml .= XML_Util::createEndElement('ezmlm_messages_mois') ; |
header ('Content-type: text/xml'); |
echo $xml ; |
?> |
/trunk/client/projet/classes/ezmlm-php-2.0/services_vpopmail/messages_thread.php |
---|
New file |
0,0 → 1,32 |
<?php |
include_once 'ezmlm-php-2.0/ezmlm.php' ; |
// Parametrage de la liste |
$info = new ezmlm_threads(); |
if (!$info) return 'Les fichiers de la liste ne sont pas visible sur le serveur' ; |
$info->forcehref = $url; |
$info->listdir = '/home/vpopmail/domains/'.$domaine.'/'.$liste ; |
$info->listname = $liste; |
$info->listdomain = $domaine ; |
$info->tempdir = '/home/vpopmail/www/tmp' ; |
ob_start() ; |
if (!$info->load($actionargs[0])) { |
if (!$info) return 'Les fichiers de la liste ne sont pas visible sur le serveur' ; |
} |
$html = ob_get_contents() ; |
ob_end_clean() ; |
include_once 'XML/Util.php' ; |
$xml = XML_Util::getXMLDeclaration('1.0', 'ISO-8859-15', 'no') ; |
$xml .= XML_Util::createStartElement ('ezmlm_messages_thread', array('domaine' => $domaine, 'liste' => $liste, 'langue' => $langue)) ; |
$xml .= '<![CDATA[ '.$html.']]>'; |
$xml .= XML_Util::createEndElement('ezmlm_messages_thread') ; |
header ('Content-type: text/xml'); |
echo $xml ; |
?> |
/trunk/client/projet/classes/ezmlm-php-2.0/services_vpopmail/calendrier_messages.php |
---|
New file |
0,0 → 1,32 |
<?php |
include_once 'ezmlm-php-2.0/ezmlm.php' ; |
// Parametrage de la liste |
$info = new ezmlm_threads(); |
if (!$info) return 'Les fichiers de la liste ne sont pas visible sur le serveur' ; |
$info->forcehref = $url; |
$info->listdir = '/home/vpopmail/domains/'.$domaine.'/'.$liste ; |
$info->listname = $liste; |
$info->listdomain = $domaine ; |
ob_start() ; |
if (!$info->listmessages()) { |
if (!$info) return 'Les fichiers de la liste ne sont pas visible sur le serveur' ; |
} |
$html = ob_get_contents() ; |
ob_end_clean() ; |
include_once 'XML/Util.php' ; |
$xml = XML_Util::getXMLDeclaration('1.0', 'ISO-8859-15', 'no') ; |
$xml .= XML_Util::createStartElement ('ezmlm_calendrier_messages', array('domaine' => $domaine, 'liste' => $liste, 'langue' => $langue)) ; |
$xml .= '<![CDATA[ '.$html.']]>'; |
$xml .= XML_Util::createEndElement('ezmlm_calendrier_messages') ; |
header ('Content-type: text/xml'); |
echo $xml ; |
?> |
/trunk/client/projet/classes/ezmlm-php-2.0/ezmlm-listinfo.php |
---|
1,5 → 1,5 |
<?php |
// $Id: ezmlm-listinfo.php,v 1.2 2005-09-27 16:43:08 alexandre_tb Exp $ |
// $Id: ezmlm-listinfo.php,v 1.3 2007-04-19 15:34:35 neiluj Exp $ |
// |
// ezmlm-listinfo.php - ezmlm-php v2.0 |
// -------------------------------------------------------------- |
46,7 → 46,7 |
} |
function show_recentmsgs($title = "Messages récents") { |
function show_recentmsgs($title = "Messages ràcents") { |
if (!is_dir($this->listdir.'/archive/0')) return false; |
56,25 → 56,51 |
print '<tr><th class="col1">Num</th><th>De</th><th>Sujet</th><th>Date</th></tr>'."\n"; |
$ctc = 0; |
$recent = $parser->recent_msgs(); |
// le tableau recent est de la forme |
// $recent[numero_message][1] sujet |
// $recent[numero_message][2] date en anglais => (22 May 2006) |
// $recent[numero_message][3] le hash de l auteur |
// $recent[numero_message][4] auteur |
$class = array ('ligne_paire', 'ligne_impaire') ; |
while (list($key,$val) = each($recent)) { |
print '<tr class="'.$class[$ctc].'">'."\n"; |
print '<td>'.$val->nummessage.'</td>' ; |
//print '<td>'.$val->nummessage.'</td>' ; |
// $key contient le numero du message tel que dans les fichiers d index par ex 216 |
// on retrouve le nom du repertoire et le nom du fichier |
$decimal = (string) $key; |
if ($key >= 100) { |
$fichier_message = substr($decimal, -2) ; |
$repertoire_message = substr ($decimal, 0,count ($decimal) -2) ; |
} else { |
if ($key < 10) { |
$fichier_message = '0'.$key; |
} else { |
$fichier_message = $decimal; |
} |
$repertoire_message = '0'; |
} |
print '<td>'.$key.'</td>' ; |
print '<td>'; |
$hash = $this->makehash($val->headers['from']); |
print $this->makelink("action=show_author_msgs&actionargs[]=" . $hash,$this->decode_iso($this->protect_email($val->headers['from'],TRUE))); |
$from = $val[4]; |
print $this->makelink("action=show_author_msgs&actionargs[]=".$val[3],$this->decode_iso($this->protect_email($from,false))); |
print "</td>\n"; |
print '<td><b>'; |
$actionargs = preg_split("/\//", $val->msgfile); |
if (count ($actionargs) > 2) { |
print $this->makelink("action=show_msg&actionargs[]=" . $actionargs[(count($actionargs) - 2)] . |
"&actionargs[]=" . $actionargs[(count($actionargs) - 1)] ,$this->decode_iso($val->headers['subject'])); |
} |
print $this->makelink("action=show_msg&actionargs[]=" . $repertoire_message . |
"&actionargs[]=" . $fichier_message ,$this->decode_iso($val[1])); |
print "</b></td>\n"; |
print '<td>'.$this->date_francaise($val->headers['date']).'</td>'."\n"; |
//print '<td>'.$this->date_francaise($val[2]).'</td>'."\n"; |
print '<td>'.$val[2].'</td>'."\n"; |
print "</tr>\n"; |
$ctc++; |
85,7 → 111,7 |
} |
function show_month ($month) { |
// Le nom du fichier est annéemoi ex 200501 pour janvier 2005 |
// Le nom du fichier est annéemois ex 200501 pour janvier 2005 |
// on ouvre chaque fichier en lecture |
$fd = file_get_contents($this->listdir . '/archive/threads/' . $month, 'r'); |
105,6 → 131,12 |
$repertoire_premier_mail = (int) ($numero_premier_mail / 100) ; |
// petite verification de coherence |
if ($numero_premier_mail > $numero_dernier_mail) { |
$temp = $numero_premier_mail; |
$numero_premier_mail = $numero_dernier_mail ; |
$numero_dernier_mail = $temp; |
} |
print '<table class="table_cadre">'."\n"; |
print '<tr><th class="col1">Num</th><th>De</th><th>Sujet</th><th>Date</th></tr>'."\n"; |
$ctc = 0; |
118,33 → 150,37 |
$i = $i - $multiplicateur * 100 ; |
} |
if ($i < 10) $num_message = '0'.$i ; else $num_message = $i ; |
if (file_exists($this->listdir.'/archive/'.$repertoire_premier_mail.'/'.$num_message)) { |
$mimeDecode = new Mail_mimeDecode(file_get_contents ($this->listdir.'/archive/'.$repertoire_premier_mail.'/'.$num_message)) ; |
$mailDecode = $mimeDecode->decode() ; |
if ($i == 99) { |
$repertoire_premier_mail++; |
$i = -1; |
} |
$mimeDecode = new Mail_mimeDecode(file_get_contents ($this->listdir.'/archive/'.$repertoire_premier_mail.'/'.$num_message)) ; |
$mailDecode = $mimeDecode->decode() ; |
if ($i == 99) { |
$repertoire_premier_mail++; |
$i = -1; |
} |
print '<tr class="'.$class[$ctc].'">'."\n"; |
print '<td>'.($repertoire_premier_mail != 0 ? $repertoire_premier_mail : '').$num_message.'</td><td>'; |
$hash = $this->makehash($mailDecode->headers['from']); |
print '<tr class="'.$class[$ctc].'">'."\n"; |
print '<td>'.$repertoire_premier_mail.$num_message.'</td><td>'; |
$hash = $this->makehash($mailDecode->headers['from']); |
print $this->makelink("action=show_author_msgs&actionargs[]=". |
$hash,$this->decode_iso($this->protect_email($mailDecode->headers['from'],TRUE))); |
print "</td>\n"; |
print '<td><b>'; |
$actionargs[0] = $repertoire_premier_mail ; |
$actionargs[1] = $num_message ; |
print $this->makelink("action=show_author_msgs&actionargs[]=" . $hash,$this->decode_iso($this->protect_email($mailDecode->headers['from'],TRUE))); |
print "</td>\n"; |
print '<td><b>'; |
$actionargs[0] = $repertoire_premier_mail ; |
$actionargs[1] = $num_message ; |
if (count ($actionargs) > 1) { |
print $this->makelink("action=show_msg&actionargs[]=" . $actionargs[(count($actionargs) - 2)] . |
"&actionargs[]=" . $actionargs[(count($actionargs) - 1)] ,$this->decode_iso($mailDecode->headers['subject'])); |
} |
print "</b></td>\n"; |
print '<td>'.$this->date_francaise($mailDecode->headers['date']).'</td>'."\n"; |
print "</tr>\n"; |
$ctc++; |
if ($ctc == 2) { $ctc = 0; } |
if (count ($actionargs) > 1) { |
print $this->makelink("action=show_msg&actionargs[]=". |
$actionargs[(count($actionargs) - 2)] . |
"&actionargs[]=". |
$actionargs[(count($actionargs) - 1)] ,$this->decode_iso($mailDecode->headers['subject'])); |
} |
print "</b></td>\n"; |
print '<td>'.$this->date_francaise($mailDecode->headers['date']).'</td>'."\n"; |
print "</tr>\n"; |
$ctc++; |
if ($ctc == 2) { $ctc = 0; } |
} |
} |
print '</table>'."\n"; |
return true; |
/trunk/client/projet/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&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&actionargs[]=$key$key2",$threadcount[$key][$key2]); |
$res .= $this->makelink('action=show_month&actionargs[]='.$key.($i < 10 ? '0'.$i:$i),$threadcount[$key][$i]); |
$res .= "</td>"; |
} else { |
$res .= "<td bgcolor=\"" . $this->tablecolours[0] . "\"></td>"; |
/trunk/client/projet/classes/ezmlm-php-2.0/ezmlm-parser.php |
---|
1,31 → 1,62 |
<?php |
// $Id: ezmlm-parser.php,v 1.2 2005-09-27 16:43:08 alexandre_tb Exp $ |
/*vim: set expandtab tabstop=4 shiftwidth=4: */ |
// +------------------------------------------------------------------------------------------------------+ |
// | PHP version 4.1 | |
// +------------------------------------------------------------------------------------------------------+ |
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) | |
// +------------------------------------------------------------------------------------------------------+ |
// | This library is free software; you can redistribute it and/or | |
// | modify it under the terms of the GNU General Public | |
// | License as published by the Free Software Foundation; either | |
// | version 2.1 of the License, or (at your option) any later version. | |
// | | |
// | This library is distributed in the hope that it will be useful, | |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
// | General Public License for more details. | |
// | | |
// | You should have received a copy of the GNU General Public | |
// | License along with this library; if not, write to the Free Software | |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
// +------------------------------------------------------------------------------------------------------+ |
// CVS : $Id: ezmlm-parser.php,v 1.3 2007-04-19 15:34:35 neiluj Exp $ |
/** |
* Application projet |
* |
* classe ezmlm_parser pour lire les fichiers d index de ezmlm-idx |
* |
*@package projet |
//Auteur original : ?? recupere dans ezmlm-php |
*@author Alexandre Granier <alexandre@tela-botanica.org> |
*@copyright Tela-Botanica 2000-2004 |
*@version $Revision: 1.3 $ |
// +------------------------------------------------------------------------------------------------------+ |
*/ |
// +------------------------------------------------------------------------------------------------------+ |
// | ENTETE du PROGRAMME | |
// +------------------------------------------------------------------------------------------------------+ |
// $Id: ezmlm-parser.php,v 1.3 2007-04-19 15:34:35 neiluj Exp $ |
// |
// ezmlm-parser.php - ezmlm-php v2.0 |
// -------------------------------------------------------------- |
// Contains all the code for parsing messages. |
// It handles all the nessesary decoding, attachments, etc... |
// Note this does all the parsing itself now removing the dependancy |
// on the mailparse library (as it looks like it will never make |
// it into the official inclusion with PHP)... |
// -------------------------------------------------------------- |
require_once("ezmlm.php"); |
require_once("Mail/mimeDecode.php") ; |
// CLASS: ezmlm-parser |
class ezmlm_parser extends ezmlm_php { |
var $headers; // the full untouched headers of the message |
var $body; // the full untouched (but decoded) body (this is not $this->parts[0]->body) |
var $headers; // the full untouched headers of the message |
var $body; // the full untouched (but decoded) body (this is not $this->parts[0]->body) |
var $parts; // all the parts, if it is a multipart message. each part is an ezmlm_parser object... |
// Here's the most accessed headers, everything else can be |
// accessed from the $this->headers array. |
var $to; // To: |
var $from; // From: |
var $date; // Date: |
var $subject; // Subject: |
var $replyto; // Reply-To: |
var $contenttype; // Content-Type: |
// Here's the most accessed headers, everything else can be |
// accessed from the $this->headers array. |
var $to; // To: |
var $from; // From: |
var $date; // Date: |
var $subject; // Subject: |
var $replyto; // Reply-To: |
var $contenttype; // Content-Type: |
var $multipart; // TRUE if the message is a multipart message |
33,105 → 64,99 |
// functions |
// recent_msgs - parses and returns an arbitrary number of the most recent messages |
/** |
* recent_msgs renvoie les derniers messages de la liste de discussion |
* ezmlm |
* |
* ( |
* [0] => Array |
* ( |
* [1] => sujet |
* [2] => date en anglais |
* [3] => le hash de l auteur |
* [4] => l auteur |
* ) |
* [1] => ... |
* ) |
* @param int le nombre de message a renvoye |
* @return array un tableau contenant les messages |
* @access public |
*/ |
function recent_msgs($show = 20, $month = "") { |
if ($month == "") { $month = date("Ym"); } |
$threadyear = substr($month,0,4); |
$threadmonth = substr($month,4,2); |
$repertoire_archive = opendir($this->listdir . "/archive/"); |
if (!is_file($this->listdir . "/archive/threads/" . $month)) { |
if ($threadmonth == '01') { $prevthread = ($threadyear - 1) . "12"; } |
else if ($threadmonth >= 11) { $prevthread = $threadyear . ($threadmonth - 1); } |
else { $prevthread = $threadyear . "0" . ($threadmonth - 1); } |
return $this->recent_msgs($show,$prevthread); |
$repertoire_message = array() ; |
$dernier_repertoire = 0 ; |
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 |
if ((int) $item > $dernier_repertoire) $dernier_repertoire = (int) $item; |
} |
} |
// on ouvre les fichiers de threads du dernier mois |
$fd = fopen($this->listdir . "/archive/threads/" . $month, "r"); |
fseek($fd,-256,SEEK_END); |
// on récupère la dernière ligne |
while (!feof($fd)) { |
$temp = fgets($fd,4096); |
if ($temp != "") { $curthread = $temp; } |
} |
$nombre_message = 0 ; |
fseek ($fd, 0) ; |
while (!feof($fd)) { |
$nombre_message++; |
fgets($fd); |
} |
fclose($fd); |
///echo "<br />".$curthread."<br />" ; |
$subjectfile = preg_replace("/^[0-9]*\:([a-z]*) \[.*/", "\\1", $curthread); |
$subjectfile = substr($subjectfile,0,2) . "/" . substr($subjectfile,2,18); // on ne garde que les 2 1ère lettre du hash, slash et le reste du hash |
// on ouvre le fichier des sujets |
// présenté comme suit : |
// hash sujet originel (sur la première ligne) |
// num_message:annéemois:hash_auteur Nom Auteur |
$fd = fopen($this->listdir . "/archive/subjects/" . $subjectfile, "r"); |
fseek($fd,-512,SEEK_END); |
// on prend la dernière ligne |
while (!feof($fd)) { |
$temp = fgets($fd,4096); |
if ($temp != "") { $cursubject = $temp; } |
} |
fclose($fd); |
list($msgnum,$fromthread,$authorid) = split(":",$cursubject); |
$msgdir = (int)($msgnum / 100); // on reconstruit le répertoire du message en divisant son numéro par 100 |
$tableau_message = array() ; |
$compteur_message = 0 ; |
$fichier_index = fopen ($this->listdir.'/archive/'.$dernier_repertoire.'/index', 'r') ; |
while (!feof($fichier_index)) { |
// Recuperation du numero de message, du hash du sujet et du sujet |
$temp = fgets($fichier_index, 4096); |
preg_match('/([0-9]+): ([a-z]+) (.*)/', $temp, $match) ; |
// dans la seconde on recupere la date, hash auteur et auteur |
$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_deuxieme_ligne) ; |
if ($match[1] != '') { |
$tableau_message[$match[1]] = array ($match[2], $match[3], |
$match_deuxieme_ligne[1].' '.$match_deuxieme_ligne[2].' '.$match_deuxieme_ligne[3], |
$match_deuxieme_ligne[5], |
$match_deuxieme_ligne[6]); |
} |
} |
fclose ($fichier_index); |
// on renverse le tableau pour afficher les derniers messages en premier |
$tableau_message = array_reverse($tableau_message, true); |
$numshown = 0; |
$msgfiles = array(); |
// on boucle 100 fois |
for ($i = 0; $i <= 99; $i++) { |
if (($msgdir == 0) and ($i == 0)) { $i++; }; |
if ($i < 10) { $msgfile = "0" . $i; } |
else { $msgfile = $i; } |
if (!is_file($this->listdir . "/archive/" . $msgdir . "/" . $msgfile)) { break; } |
} |
if ($show == '') $show = $nombre_message ; // Si aucun paramètre n'est passé on renvoie tous les fichiers du mois |
while ($numshown < $show) { |
$i--; |
if ($i < 0) { |
$i = 99; |
$msgdir--; |
if ($msgdir < 0) { break; } |
// On compte le nombre de message, s il est inferieur $show et que l on est |
// pas dans le premier index, on ouvre le fichier precedent et recupere |
// le n dernier message |
if (count ($tableau_message) < $show && $dernier_repertoire != '0') { |
$avant_dernier_repertoire = $dernier_repertoire - 1 ; |
// On utilise file_get_contents pour renverser le fichier |
$fichier_index = array_reverse( |
explode ("\n", |
preg_replace ('/\n$/', '', |
file_get_contents ($this->listdir.'/archive/'.$avant_dernier_repertoire.'/index')) ), true) ; |
reset ($fichier_index); |
//var_dump ($fichier_index); |
for ($i = count ($tableau_message); $i <= $show; $i++) { |
// Recuperation du numero de message, du hash du sujet et du sujet |
// dans la seconde on recupere la date, hash auteur et auteur |
preg_match('/\t([0-9]+) ([a-zA-Z][a-zA-Z][a-zA-Z]) ([0-9][0-9][0-9][0-9]) ([^;]+);([^ ]*) (.*)/', |
current ($fichier_index), $match_deuxieme_ligne) ; |
preg_match('/([0-9]+): ([a-z]+) (.*)/', next($fichier_index), $match) ; |
next ($fichier_index); |
if ($match[1] != '') { |
$tableau_message[$match[1]] = array ($match[2], $match[3], |
$match_deuxieme_ligne[1].' '.$match_deuxieme_ligne[2].' '.$match_deuxieme_ligne[3], |
$match_deuxieme_ligne[5], |
$match_deuxieme_ligne[6]); |
} |
} |
if ($i < 10) { |
$msgfile = $this->listdir . "/archive/" . $msgdir . "/0" . $i; |
} else { |
$msgfile = $this->listdir . "/archive/" . $msgdir . "/" . $i; |
} |
/* |
$msg = new ezmlm_parser(); |
$msg->parse_file($msgfile); |
*/ |
if (!is_file($msgfile)) { |
if (is_file($this->listdir . "/" . $msgfile)) { |
$msgfile = $this->listdir . "/" . $msgfile; |
} else if (is_file($this->listdir . "/archive/" . $msgfile)) { |
$msgfile = $this->listdir . "/archive/" . $msgfile; |
} else { |
return $msgfiles; |
} |
} |
$message = file_get_contents($msgfile) ; |
$mimeDecode = new Mail_mimeDecode($message) ; |
$mailDecode = $mimeDecode->decode() ; |
$mailDecode->msgfile = $msgfile ; |
$mailDecode->nummessage = $msgdir.$i ; |
$msgfiles[] = $mailDecode ; |
unset($mailDecode); |
$numshown++; |
} else { |
// Si le nombre de message est > $show on limite le tableau de retour |
$tableau_message = array_slice($tableau_message, 0, $show, true); |
} |
return $msgfiles; |
return $tableau_message ; |
} |
151,7 → 176,7 |
return $this->parse($data,$simple); |
} |
// parse_file_headers - ouvre un fichier et analyse les entêtes |
// parse_file_headers - ouvre un fichier et analyse les entête |
function parse_file_headers($file,$simple = FALSE) { |
if (!is_file($file)) { |
if (is_file($this->listdir . "/" . $file)) { $file = $this->listdir . "/" . $file; } |
165,11 → 190,6 |
$mimeDecode = new Mail_mimeDecode($message) ; |
$mailDecode = $mimeDecode->decode() ; |
return $mailDecode ; |
/*$fd = fopen($file, "r"); |
while (!feof($fd)) { $data .= fgets($fd,4096); } |
fclose($fd);*/ |
if ($this->_get_headers($data, $simple)) return true ; |
return false ; |
} |
// this does all of the work (well it calls two functions that do all the work :) |
/trunk/client/projet/classes/ezmlm-php-2.0/ezmlm-author.php |
---|
1,5 → 1,5 |
<?php |
// $Id: ezmlm-author.php,v 1.2 2005-09-27 16:43:08 alexandre_tb Exp $ |
// $Id: ezmlm-author.php,v 1.3 2007-04-19 15:34:35 neiluj Exp $ |
// |
// ezmlm-author.php - ezmlm-php v2.0 |
// -------------------------------------------------------------- |
14,7 → 14,7 |
//echo $file ; |
if (!is_file($this->listdir . $file)) { $this->error(EZMLM_INVALID_AUTHOR); return; } |
// Le fichier author comprend |
// Première ligne hash_auteur nom_auteur |
// première ligne hash_auteur nom_auteur |
// num_mess:annéemois:hash_sujet sujet |
$fd = @fopen($this->listdir . $file, "r"); |
$i = 0 ; |
24,13 → 24,12 |
if (preg_match('/^' . $authorhash . '/', $buf)) { |
// this should ALWAYS be the first line in the file |
$author = preg_replace('/^' . $authorhash . ' /', '', $buf); |
print '<h3>'.PROJET_MESSAGES_DE.$author.'</h3>' ; |
print '<h3>'.$author.'</h3>' ; |
print '<table class="table_cadre">'."\n"; |
print '<tr><th class="col1">De</th><th>Sujet</th><th>Date</th></tr>'."\n"; |
$tableopened = TRUE; |
} else if (preg_match('/^[0-9]*:[0-9]/',$buf)) { |
// this is a valid message line |
// all we need is the first item |
// si la ligne est valide |
// on récupère le numéro du message pour en extraire le nom du fichier |
$msgfile = preg_replace('/^([0-9]*):.*/', '\1', $buf); |
$msgdir = (int)((int)$msgfile / 100); |
56,16 → 55,11 |
$subject = preg_replace("/\[" . $this->listname . "\]/", "", $subject); |
$date = preg_replace ('/CEST/', '', $mailDecode->headers['date']); |
print '<tr class="'.$class[$i].'">'."\n"; |
$hash = $this->makehash($mailDecode->headers['from']); |
print '<td>'.$this->makelink("action=show_author_msgs&actionargs[]=" . $hash,$this->decode_iso($this->protect_email($mailDecode->headers['from'],TRUE))); |
if ($mailDecode->headers['from'] == '') $from = $mailDecode->headers['return-path'] ; else $from = $mailDecode->headers['from']; |
$hash = $this->makehash($from); |
print '<td>'.$this->makelink("action=show_author_msgs&actionargs[]=" . $hash,$this->decode_iso($this->protect_email($from,false))); |
print '</td>'; |
print "<td><b>" . $this->makelink("action=show_msg&actionargs[]=" . $msgdir . "&actionargs[]=" . $msgfile, $this->decode_iso($subject)) . "</b></td>"; |
/* |
print "<td>[" . $this->makelink("action=show_threads&actionargs[]=" . |
date("Ym", strtotime($date)) . "#" . urlencode("/archive/" . $msgdir . "/" . $msgfile), PROJET_FILE_DE_DISCUSSION) . "]</td>\n"; |
*/ |
print "<td>" . $this->date_francaise($mailDecode->headers['date']) . "</td>\n"; |
print "</tr>\n"; |
$i++; |
/trunk/client/projet/classes/ezmlm-php-2.0/ezmlm.php |
---|
1,5 → 1,5 |
<?php |
// $Id: ezmlm.php,v 1.4 2007-02-16 10:44:47 alexandre_tb Exp $ |
// $Id: ezmlm.php,v 1.5 2007-04-19 15:34:35 neiluj Exp $ |
// |
// ezmlm.php - ezmlm-php v2.0 |
// -------------------------------------------------------------- |
30,7 → 30,7 |
require_once("ezmlm-repondre.php"); |
require_once("ezmlm-author.php"); |
$GLOBALS['mois'] = array ('Janv', 'Fév', 'Mars', 'Avri', 'Mai', 'Juin', 'Juil', 'Août', 'Sept', 'Oct', 'Nov', 'Déc') ; |
$GLOBALS['mois'] = array ('Jan', 'Fév', 'Mars', 'Avril', 'Mai', 'Juin', 'Juil', 'Août', 'Sept', 'Oct', 'Nov', 'Dèc') ; |
// CLASS: ezmlm_php |
// the base class, contains common functions and the config |
72,11 → 72,11 |
// these variables act the same way ezmlm-php-config.php did in the first release |
// simply edit these variables to match your setup |
$this->listdir = "/home/telabotap/sd/testv4/client/synchroliste/liste/tela-botanica.org/equipe"; |
$this->listname = "equipe"; |
$this->listdomain = "tela-botanica.org"; |
$this->listdir = ""; |
$this->listname = ""; |
$this->listdomain = ""; |
$this->tempdir = "/home/telabotap/www/tmp"; |
$this->tempdir = ""; |
$this->sendheaders = TRUE; |
$this->sendbody = TRUE; |
254,7 → 254,7 |
if ($critical) { die; } |
} |
/** |
* Parse une chaime et supprime les problême d'encodage de type ISO-4 ... |
* Parse une chaime et supprime les problème d'encodage de type ISO-4 ... |
* |
* @return string |
*/ |
263,6 → 263,7 |
if (preg_match ('/windows-[0-9][0-9][0-9][0-9]/i', $chaine, $nombre)) { |
$reg_exp = $nombre[0] ; |
$chaine = str_replace(' ', '', $chaine); |
} else { |
$reg_exp = 'ISO-8859-15?' ; |
} |
303,6 → 304,20 |
$date .= date(':i', strtotime($date_mail)) ; // Les minutes |
return $date ; |
} |
/** |
* Cette fonction renvoie le prefixe, cad 0 ou rien |
* d un nom de message, ex : pour 09, on renvoie 0 |
* pour 12 on renvoie rien |
*/ |
function prefixe_nom_message($nom) { |
if (preg_match ('/0([1-9][0-9]*)/', $nom, $match)) { |
$nom_fichier = $match[1]; |
return '0' ; |
} else { |
return '' ; |
} |
} |
} |
// |
/trunk/client/projet/classes/ezmlm-php-2.0/ezmlm-msgdisplay.php |
---|
1,5 → 1,5 |
<?php |
// $Id: ezmlm-msgdisplay.php,v 1.3 2006-04-19 13:50:04 alexandre_tb Exp $ |
// $Id: ezmlm-msgdisplay.php,v 1.4 2007-04-19 15:34:35 neiluj Exp $ |
// |
// ezmlm-msgdisplay.php - ezmlm-php v2.0 |
// -------------------------------------------------------------- |
17,14 → 17,21 |
var $_auth ; |
// display: parses a message (using ezmlm_parser) and displays it |
// using a template |
var $msgfile; |
function display($msgfile) { |
function display($msgfile) { |
if (!is_file($msgfile)) { |
if (is_file($this->listdir . "/" . $msgfile)) { $msgfile = $this->listdir . "/" . $msgfile; } |
else if (is_file($this->listdir . "/archive/" . $msgfile)) { $msgfile = $this->listdir . "/archive/" . $msgfile; } |
else { return FALSE; } |
} |
if (is_file($this->listdir . "/" . $msgfile)) { $msgfile = $this->listdir . "/" . $msgfile; } |
else if (is_file($this->listdir . "/archive/" . $msgfile)) { $msgfile = $this->listdir . "/archive/" . $msgfile; } |
else { return FALSE; } |
} |
$this->msgfile = $msgfile ; |
$message = file_get_contents($msgfile) ; |
// En cours de codage |
// La fonction display retourne tout simplement le source du mail |
// Il n'y a plus d'analyse à ce niveau |
return $message; |
$mimeDecode = new Mail_mimeDecode($message) ; |
$mailDecode = $mimeDecode->decode(array('decode_bodies' => 'true', 'include_bodies' => 'true')) ; |
67,37 → 74,151 |
$fichier_precedent = '0'.($nom_fichier - 1) ; |
} |
} |
if (is_file($this->listdir.'/archive/'.$repertoire_precedent.'/'.$fichier_precedent)) { |
print "[" . $this->makelink("action=show_msg&actionargs[]=$a1&actionargs[]=" . $numero_precedent, ' '.PROJET_PRECEDENT.' ') . "] "; |
} else { |
print '['.PROJET_PRECEDENT.']' ; |
} |
if (is_file($this->listdir.'/archive/'.$repertoire_suivant.'/'.$fichier_suivant)) { |
print "[" . $this->makelink("action=show_msg&actionargs[]=$a1&actionargs[]=" . $numero_suivant, ' '.PROJET_SUIVANT.' ') . "] "; |
} else { |
print '['.PROJET_SUIVANT.']' ; |
} |
// on crée un lien vers la thread avec une ancre vers le message |
$parser = new ezmlm_parser(); |
$parser->listdir = $this->listdir ; |
$recent = $parser->recent_msgs(1); |
$actionargs = preg_split("/\//", $recent[0]->msgfile); |
print "[" . $this->makelink('action=show_msg&actionargs[]=' . $actionargs[(count($actionargs) - 2)] . |
'&actionargs[]=' . $actionargs[(count($actionargs) - 1)] , ' '.PROJET_DERNIER_MESSAGE.' ') . '] '; |
if ($this->_auth->getAuth()) { |
print '['.$this->makelink('action=repondre&actionargs[]='.$a1.'&actionargs[]='.$a2, PROJET_REPONDRE).'] '; |
} |
print '<br />'."\n"; |
print '<div class="message">' ; |
print $this->parse_entete_mail($mailDecode) ; |
$this->parse_template($mailDecode, $a2, $a1); |
print $this->message_rendu; |
print '</div>' ; |
//print '</div>' ; |
} |
/** |
* analyse l'entete d'un mail pour en extraire les entêtes |
* Renvoie les infos des messages suivants |
* |
* |
*/ |
function getInfoSuivant() { |
$relfile = preg_replace('!' . $this->listdir . '!', '', $this->msgfile); |
$nom_repertoire = preg_replace('!/archive/(.*)/.*$!', '\1', $relfile); |
$nom_fichier = preg_replace('!/archive/.*/(.*)$!', '\1', $relfile); |
$repertoire_suivant = $nom_repertoire; |
// a partir du nom du fichier |
// et du nom du repertoire, on reconstitue |
// le numero du message stocke dans le fichier d index |
// le message 12 du repertoire 2 a le numero 112 |
if ($nom_repertoire == '0') { |
$numero_message = $nom_fichier; |
} else { |
$numero_message = $nom_repertoire.$nom_fichier ; |
} |
// On ouvre le fichier d index |
$fichier_index = fopen ($this->listdir.'/archive/'.$nom_repertoire.'/index', 'r'); |
$compteur_ligne = 1; |
if (preg_match ('/0([1-9][0-9]*)/', $nom_fichier, $match)) { |
$nom_fichier = $match[1]; |
$prefixe = '0' ; |
} else { |
$prefixe = '' ; |
} |
$prefixe = $this->prefixe_nom_message($nom_fichier); |
//echo $numero_message; |
// on cherche la ligne avec le numero du message |
while (!feof($fichier_index)) { |
$temp = fgets($fichier_index,4096); |
list($num, $hash, $sujet) = split (':', $temp) ; |
if ($num == $numero_message) { |
$ligne_message_precedent = $compteur_ligne -2; |
$temp = fgets($fichier_index, 4096); |
$temp = fgets($fichier_index, 4096); |
list ($fichier_suivant,$hash, $sujet) = split(':', $temp); |
// Au cas ou est au dernier message du fichier d index |
// il faut ouvrir le suivant |
if (feof($fichier_index)) { |
$repertoire_suivant++; |
if (file_exists($this->listdir.'/archive/'.$repertoire_suivant.'/index')) { |
$fichier_index_suivant = fopen($this->listdir.'/archive/'.$repertoire_suivant.'/index', 'r'); |
// on recupere le numero du premier message |
list($fichier_suivant, $hash, $sujet) = split (':', fgets($fichier_index_suivant), 4096); |
fclose ($fichier_index_suivant); |
} |
} |
// Si le numero est > 100, il faut decouper et ne retenir |
// que les dizaines et unites |
if ($fichier_suivant >= 100) { |
$decimal = (string) $fichier_suivant; |
$numero = substr($decimal, -2) ; |
$fichier_suivant = $numero ; |
} else { |
if ($fichier_suivant < 9)$fichier_suivant = '0'.$fichier_suivant; |
} |
break; |
} |
// On avance d une ligne, la 2e ligne contient date hash auteur |
$temp2 = fgets($fichier_index, 4096); |
$compteur_ligne += 2; |
} |
// On utilise $ligne_message_precedent pour recupere le num du message precedent |
// Si $ligne_precedent est negatif soit c le premier message de la liste |
// soit il faut ouvrir le repertoire precedent |
if ($ligne_message_precedent > 0) { |
$compteur = 1; |
rewind($fichier_index); |
while (!feof($fichier_index)) { |
$temp = fgets($fichier_index, 4096); |
if ($ligne_message_precedent == $compteur) { |
list ($fichier_precedent, $hash, $sujet) = split (':', $temp) ; |
} |
$compteur++; |
} |
// Le nom du repertoire precedent est le meme que le repertoire courant |
$repertoire_precedent = $nom_repertoire ; |
// Si $ligne_message_precedent est negatif, alors il faut ouvrir |
// le fichier index du repertoire precedent |
// si le nom du repertoire est 0, alors il n y a pas de repertoire precedent |
// et donc pas de message precedent |
} else { |
if ($nom_repertoire != '0') { |
$repertoire_precedent = $nom_repertoire -1 ; |
// on ouvre le fichier d index et on extraie le numero |
// du dernier message |
$fichier_index_precedent = fopen ($this->listdir.'/archive/'.$repertoire_precedent.'/index', 'r') ; |
while (!feof($fichier_index_precedent)) { |
$temp = fgets($fichier_index_precedent,4096); |
$ligne = split (':', $temp) ; |
if ($ligne[0] != '') $fichier_precedent = $ligne[0]; |
$temp = fgets($fichier_index_precedent,4096); |
} |
fclose ($fichier_index_precedent); |
// on se situe dans le repertoire 0 donc pas de message precedent |
} else { |
$fichier_precedent = null; |
$repertoire_precedent = null; |
} |
} |
if ($fichier_precedent > 100) { |
$decimal = (string) $fichier_precedent; |
$numero = substr($decimal, -2) ; |
$fichier_precedent = $numero ; |
} else { |
if ($fichier_precedent < 10 )$fichier_precedent = '0'.$fichier_precedent; |
} |
fclose ($fichier_index); |
//if ($fichier_precedent != null && $fichier_precedent < 10) $fichier_precedent = '0'.$fichier_precedent; |
return array ('fichier_suivant' => $fichier_suivant, |
'repertoire_suivant' => $repertoire_suivant, |
'fichier_precedent' => $fichier_precedent, |
'repertoire_precedent' => $repertoire_precedent); |
} |
/** |
* analyse l'entete d'un mail pour en extraire les entête |
* to, from, subject, date |
* met à jour la variable $this->msgtmpl |
* |
105,24 → 226,31 |
function parse_entete_mail (&$mailDecode) { |
$startpos = strpos(strtolower($this->msgtmpl_entete), '<ezmlm-headers>'); |
$endpos = strpos(strtolower($this->msgtmpl_entete), '</ezmlm-headers>'); |
$endpos = strpos(strtolower($this->msgtmpl_entete), '</ezmlm-headers>'); |
$headers = substr($this->msgtmpl_entete,$startpos + 15,($endpos - $startpos - 15)); |
$headers_replace = '' ; |
for ($i = 0; $i < count($this->showheaders); $i++) { |
$val = $this->showheaders[$i]; |
$headers_replace .= $headers; |
$hnpos = strpos(strtolower($headers_replace), '<ezmlm-header-name>'); |
$headers_replace = substr_replace($headers_replace, $this->header_en_francais[$val], $hnpos, 19); |
$hvpos = strpos(strtolower($headers_replace), '<ezmlm-header-value'); |
if ($val == 'date') { |
$headers_replace = substr_replace($headers_replace, $this->date_francaise($mailDecode->headers[strtolower($val)]), $hvpos, 20); |
} else { |
$headers_replace = substr_replace($headers_replace, $this->protect_email($mailDecode->headers[strtolower($val)]), $hvpos, 20); |
$val = $this->showheaders[$i]; |
$headers_replace .= $headers; |
$hnpos = strpos(strtolower($headers_replace), '<ezmlm-header-name>'); |
$headers_replace = substr_replace($headers_replace, $this->header_en_francais[$val], $hnpos, 19); |
$hvpos = strpos(strtolower($headers_replace), '<ezmlm-header-value'); |
$headers_replace = $this->decode_iso ($headers_replace) ; |
switch ($val) { |
case 'date': |
$headers_replace = substr_replace($headers_replace, $this->date_francaise($mailDecode->headers[strtolower($val)]), $hvpos, 20); |
break; |
case 'from': |
if ($mailDecode->headers[strtolower($val)] == '') $from = $mailDecode->headers['return-path'] ; |
else $from = $mailDecode->headers['from']; |
$headers_replace = substr_replace($headers_replace, $this->protect_email($this->decode_iso($from)), $hvpos, 20); |
//$headers_replace = htmlspecialchars($headers_replace); |
break; |
default: |
$headers_replace = substr_replace($headers_replace, $this->protect_email($this->decode_iso($mailDecode->headers[strtolower($val)])), $hvpos, 20); |
} |
$headers_replace = $this->decode_iso ($headers_replace) ; |
} |
return substr_replace($this->msgtmpl_entete, $headers_replace, $startpos, (($endpos + 16) - $startpos)); |
return substr_replace($this->msgtmpl_entete, $headers_replace, $startpos, (($endpos + 16) - $startpos)); |
} |
136,6 → 264,10 |
for ($i = 0; $i < count($mailDecode->parts); $i++) { |
switch ($mailDecode->parts[$i]->ctype_secondary) { |
case 'plain' : |
if ($mailDecode->parts[$i]->headers['content-transfer-encoding'] == '8bit') { |
$corps .= $this->_cte_8bit($mailDecode->parts[$i]->body); |
} |
break; |
case 'html' : $corps .= $mailDecode->parts[$i]->body ; |
break ; |
case 'mixed' : |
161,7 → 293,7 |
$mailDecode->parts[$i]->ctype_secondary, PROJET_CHEMIN_ICONES) ; |
} |
$corps .= '<a href="'.PROJET_CHEMIN_APPLI.'fichier_attache.php?nom_liste='.$this->listname. |
$corps .= '<a href="'.PROJET_CHEMIN_APPLI.'synchroliste/fichier_attache.php?nom_liste='.$this->listname. |
'&actionargs[]='.$numero_mois. |
'&actionargs[]='.$numero_mail; |
189,7 → 321,7 |
$mimeType = new type_fichier_mime($GLOBALS['projet_db'], $mailDecode->ctype_primary.'/'.$mailDecode->ctype_secondary,PROJET_CHEMIN_ICONES) ; |
if ($mimeType->getIdType() != 12) { |
$corps .= '<a href="'.PROJET_CHEMIN_APPLI.'fichier_attache.php?nom_liste='.$this->listname.'&actionargs[]='. |
$corps .= '<a href="'.PROJET_CHEMIN_APPLI.'synchroliste/fichier_attache.php?nom_liste='.$this->listname.'&actionargs[]='. |
$numero_mois.'&actionargs[]='. |
$numero_mail.'&actionargs[]='.$i.'">'. |
'<img src="'.$mimeType->getCheminIcone().'" alt="'.$mailDecode->ctype_parameters['name'].'" /> ' ; |