/trunk/classes/ezmlm-php-2.0/ezmlm-threads.php |
---|
1,5 → 1,5 |
<?php |
// $Id: ezmlm-threads.php,v 1.7 2008-11-19 09:28:46 aperonnet Exp $ |
// $Id: ezmlm-threads.php,v 1.6 2008-08-25 15:19:15 alexandre_tb Exp $ |
// |
// ezmlm-threads.php - ezmlm-php v2.0 |
// -------------------------------------------------------------- |
56,7 → 56,7 |
$html .= '[ '.$this->makelink('action=show_month&actionargs[]='.$month, 'par date').' ]' ; |
$months = array(1 => 'January', 2 => 'February', 3 => 'March', 4 => 'April', 5 => 'May', 6 => 'June', 7 => 'July', 8 => 'August', |
9 => 'September', 10 => 'October', 11 => 'November', 12 => 'December'); |
// remplacé par le tableau globals $mois dans ezmlm.php |
// 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"; |
65,7 → 65,7 |
$ctc .= 0; |
if (is_file($cache)) { |
$html .= file_get_contents($cache); |
include($cache); |
} |
$html .= '<tr><td colspan="3"></td></tr>'."\n"; |
$html .= '</table>'."\n"; |
99,7 → 99,7 |
$this->makehash($this->decode_iso($mailDecode->headers['from'])),$this->decode_iso($this->protect_email($mailDecode->headers['from'],TRUE))); |
$html .= '</td>'."\n"; |
$html .= '<td><b>'; |
//$html .= " <a name=\"" . urlencode($thread_curr->file) . "\">"; A quoi ça sert ? |
//$html .= " <a name=\"" . urlencode($thread_curr->file) . "\">"; A quoi �a sert ? |
for ($i = 0; $i < $thread_curr->depth; $i++) { |
$html .= " "; |
} |
128,38 → 128,6 |
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); |
// On parcourt le fichier a l envers |
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; |
174,7 → 142,7 |
fclose($fd2); |
$i=0; |
// ouverture du fichier thread de ezmlm |
// Ils sont classés mois par mois |
// Ils sont class�s mois par mois |
$fd1 = fopen($this->listdir . "/archive/threads/" . $month, "r"); |
while (!feof($fd1)) { |
$line = fgets($fd1,4096); |
192,9 → 160,9 |
if (!is_file($this->listdir . "/archive/subjects/" . $subjectfile)) { continue; } |
// on ouvre le fichier sujet |
// Celui-ci contient sur la première ligne le hash du sujet puis le 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 |
// num_message:ann�emois:hash_auteur nom_auteur |
$fd2 = fopen($this->listdir . "/archive/subjects/" . $subjectfile, "r"); |
while (!feof($fd2)) { |
$line2 = fgets($fd2,4096); |
212,7 → 180,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'] : ''); |
289,7 → 257,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 repertoire archive/threads/ qui contient un fichier par mois avec tous les thread, par sujet |
// On lit le repetoire archive/threads/ qui contient un fichier par moi 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 |
305,7 → 273,6 |
$res .=" </tr>\n"; |
$res .= $this->calendrierMessage(); |
$res .= "</table>\n"; |
return $res; |
/* |
$threadcount = array(); |
375,12 → 342,13 |
$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]{3}) ([0-9]{4})/', $fichier_index[$j], $match) ; |
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) ; |
if ($match[0] != '') { |
$threadmonth = date('n', strtotime($match[0])); |
$threadyear = date('Y', strtotime($match[0])); |
427,16 → 395,18 |
// On ajoute la derniere annee |
$html .= $this->calculeCalendrierPermanent(date ('Y')); |
if (! $this->isFichierCalendrierExiste()) return $html . $this->ecrireFichierCalendrier(); |
// S'il existe mais qu il est trop vieux, il faut le recalculer et le réécrire |
if ($this->isDoitRecalculerCalendrier()) return $html . $this->ecrireFichierCalendrier(); |
// précédemment, dans ce cas ci-dessus |
// était effectuée un recalcul partiel, mais sans réécriture du fichier: |
/* $annees = $this->getAnneesARecalculer(); |
$html .= $this->calculeCalendrierPermanent($annees); */ |
return $html . file_get_contents('tmp/'.$this->listname.'.calendrier'); |
if ($this->isFichierCalendrierExiste()) { |
// S il existe mais qu il est trop vieux, il faut le recalculer |
if ($this->isDoitRecalculerCalendrier()) { |
$annees = $this->getAnneesARecalculer(); |
$html .= $this->calculeCalendrierPermanent($annees); |
} |
$html .= file_get_contents('tmp/'.$this->listname.'.calendrier'); |
} else { |
$html .= $this->ecrireFichierCalendrier(); |
} |
return $html; |
} |
function isFichierCalendrierExiste() { |
if (file_exists('tmp/'.$this->listname.'.calendrier')) { |
445,12 → 415,14 |
return false; |
} |
function isDoitRecalculerCalendrier() { |
return (date ('Y', filemtime('tmp/'.$this->listname.'.calendrier')) <= date('Y') - 1); |
if (date ('Y', fileatime('tmp/'.$this->listname.'.calendrier')) != date('Y')) return true; |
return false; |
} |
function getAnneesARecalculer() { |
// On suppose que l index de ezmlm est correct |
$anneeFichierCalendrier = date ('Y', filemtime('tmp/'.$this->listname.'.calendrier')); |
$anneeFichierCalendrier = date ('Y', fileatime('tmp/'.$this->listname.'.calendrier')); |
return $anneeFichierCalendrier + 1; |
} |
/trunk/classes/ezmlm-php-2.0/ezmlm-msgdisplay.php |
---|
1,5 → 1,5 |
<?php |
// $Id: ezmlm-msgdisplay.php,v 1.11 2008-11-19 09:28:46 aperonnet Exp $ |
// $Id: ezmlm-msgdisplay.php,v 1.9 2008-05-23 10:18:37 alexandre_tb Exp $ |
// |
// ezmlm-msgdisplay.php - ezmlm-php v2.0 |
// -------------------------------------------------------------- |
125,9 → 125,7 |
while (!feof($fichier_index)) { |
$temp = fgets($fichier_index,4096); |
$x = preg_match('/(\d+): (\w+) (.*)/', $temp, $matches); |
array_shift($matches); |
list($num, $hash, $sujet) = $matches; |
list($num, $hash, $sujet) = split (':', $temp) ; |
if ($num == $numero_message) { |
225,9 → 223,9 |
} |
/** |
* analyse l'entete d'un mail pour en extraire les entête |
* analyse l'entete d'un mail pour en extraire les ent�tes |
* to, from, subject, date |
* met à jour la variable $this->msgtmpl |
* met � jour la variable $this->msgtmpl |
* |
*/ |
313,10 → 311,16 |
$lien .= '&actionargs[]='.$i ; |
$corps .= '<a href="'.$lien.'">'; |
$tableau_type_image = array ('jpg', 'jpeg', 'pjpeg'); |
if (in_array ($mailDecode->parts[$i]->ctype_secondary, $tableau_type_image)) { |
$corps .= '<img src="'.$lien.'&min=1" alt="'.$nom_piece_jointe.'" /> ' ; |
$texte_lien = ''; |
} else { |
$corps .= '<img src="'.$mimeType->getCheminIcone().'" alt="'.$nom_piece_jointe.'" /> ' ; |
if ($mailDecode->parts[$i]->ctype_secondary == 'jpg' || $mailDecode->parts[$i]->ctype_secondary == 'jpeg') |
$corps .= '<img src="'.$lien.'" alt="'.$nom_piece_jointe.'" /> ' ; |
$corps .= $nom_piece_jointe; |
$texte_lien = $nom_piece_jointe; |
} |
$corps .= $texte_lien; |
$corps .= '</a><br />' ; |
break ; |
} |
/trunk/classes/ezmlm-php-2.0/ezmlm-parser.php |
---|
19,7 → 19,7 |
// | 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.5 2008-11-19 09:28:46 aperonnet Exp $ |
// CVS : $Id: ezmlm-parser.php,v 1.3 2007/04/19 15:34:35 neiluj Exp $ |
/** |
* Application projet |
* |
29,7 → 29,7 |
//Auteur original : ?? recupere dans ezmlm-php |
*@author Alexandre Granier <alexandre@tela-botanica.org> |
*@copyright Tela-Botanica 2000-2004 |
*@version $Revision: 1.5 $ |
*@version $Revision: 1.3 $ |
// +------------------------------------------------------------------------------------------------------+ |
*/ |
38,7 → 38,7 |
// | ENTETE du PROGRAMME | |
// +------------------------------------------------------------------------------------------------------+ |
// $Id: ezmlm-parser.php,v 1.5 2008-11-19 09:28:46 aperonnet Exp $ |
// $Id: ezmlm-parser.php,v 1.3 2007/04/19 15:34:35 neiluj Exp $ |
// |
require_once("ezmlm.php"); |
87,10 → 87,17 |
$repertoire_archive = opendir($this->listdir . "/archive/"); |
$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 |
$numArchive = $this->getNumArchive(); |
$dernier_repertoire = floor($numArchive / 100); |
if (preg_match('/[0-9]+/', $item)) { |
// on ouvre le fichier d index de chaque repertoire |
if ((int) $item > $dernier_repertoire) $dernier_repertoire = (int) $item; |
} |
} |
$tableau_message = array() ; |
$compteur_message = 0 ; |
$fichier_index = fopen ($this->listdir.'/archive/'.$dernier_repertoire.'/index', 'r') ; |
169,7 → 176,7 |
return $this->parse($data,$simple); |
} |
// parse_file_headers - ouvre un fichier et analyse les entête |
// parse_file_headers - ouvre un fichier et analyse les ent�tes |
function parse_file_headers($file,$simple = FALSE) { |
if (!is_file($file)) { |
if (is_file($this->listdir . "/" . $file)) { $file = $this->listdir . "/" . $file; } |
243,8 → 250,8 |
} |
} |
// ajout alex |
// pour supprimer le problème des ISO... |
// a déplacer ailleur, et appelé avant affichage |
// pour supprimer le probl�me des ISO... |
// a d�placer ailleur, et appel� avant affichage |
if (preg_match ('/windows-[0-9][0-9][0-9][0-9]/', $this->headers['subject'], $nombre)) { |
$reg_exp = $nombre[0] ; |
353,8 → 360,8 |
function _get_parts($data,$boundary) { |
$inpart = -1; |
$lines = preg_split('/\n/', $data); |
// La première partie contient l'avertissement pour les client mail ne supportant pas |
// multipart, elle est stocké dans parts[-1] |
// La premi�re partie contient l'avertissement pour les client mail ne supportant pas |
// multipart, elle est stock� dans parts[-1] |
while(list($key,$val) = each($lines)) { |
if ($val == "--" . $boundary) { $inpart++; continue; } // start of a part |
else if ($val == "--" . $boundary . "--") { break; } // the end of the last part |
361,7 → 368,7 |
else { $parts[$inpart] .= $val . "\n"; } |
} |
for ($i = 0; $i < count($parts) - 1; $i++) { // On saute la première partie |
for ($i = 0; $i < count($parts) - 1; $i++) { // On saute la premi�re partie |
$part[$i] = new ezmlm_parser(); |
$part[$i]->parse($parts[$i]); |
$this->parts[$i] = $part[$i]; |
/trunk/classes/ezmlm-php-2.0/ezmlm-repondre.php |
---|
1,5 → 1,5 |
<?php |
// $Id: ezmlm-repondre.php,v 1.2 2005/09/27 16:43:08 alexandre_tb Exp $ |
// $Id: ezmlm-repondre.php,v 1.2 2005-09-27 16:43:08 alexandre_tb Exp $ |
// |
// ezmlm-msgdisplay.php - ezmlm-php v2.0 |
// -------------------------------------------------------------- |
115,12 → 115,12 |
$nom_piece_jointe = $mailDecode->parts[$i]->ctype_parameters['name'] ; |
$tab = explode ('.', $nom_piece_jointe) ; |
$extension = $tab[count ($tab) - 1] ; |
$mimeType = type_fichier_mime::factory($extension, $GLOBALS['projet_db']); |
$mimeType = type_fichier_mime::factory($extension); |
$mimeType->setCheminIcone(PROJET_CHEMIN_ICONES) ; |
} else { |
$nom_piece_jointe = isset ($mailDecode->parts[$i]->d_parameters['filename']) ? |
$mailDecode->parts[$i]->d_parameters['filename'] : $mailDecode->parts[$i]->ctype_parameters['name'] ; |
$mimeType = new type_fichier_mime($GLOBALS['projet_db'], $mailDecode->parts[$i]->ctype_primary.'/'. |
$mimeType = new type_fichier_mime( $mailDecode->parts[$i]->ctype_primary.'/'. |
$mailDecode->parts[$i]->ctype_secondary, PROJET_CHEMIN_ICONES) ; |
} |
147,7 → 147,7 |
} else if ($mailDecode->ctype_primary == 'application' || $mailDecode->ctype_primary == 'image'){ |
if ($mailDecode->ctype_secondary == 'applefile') return ; |
$mimeType = new type_fichier_mime($GLOBALS['projet_db'], $mailDecode->ctype_primary.'/'.$mailDecode->ctype_secondary,PROJET_CHEMIN_ICONES) ; |
$mimeType = new type_fichier_mime( $mailDecode->ctype_primary.'/'.$mailDecode->ctype_secondary,PROJET_CHEMIN_ICONES) ; |
if ($mimeType->getIdType() != 12) { |
$corps .= '' ; |
/trunk/classes/ezmlm-php-2.0/ezmlm-author.php |
---|
1,5 → 1,5 |
<?php |
// $Id: ezmlm-author.php,v 1.4 2008-11-19 09:28:46 aperonnet Exp $ |
// $Id: ezmlm-author.php,v 1.3 2007/04/19 15:34:35 neiluj Exp $ |
// |
// ezmlm-author.php - ezmlm-php v2.0 |
// -------------------------------------------------------------- |
14,8 → 14,8 |
//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 |
// num_mess:annéemois:hash_sujet sujet |
// Premi�re ligne hash_auteur nom_auteur |
// num_mess:ann�emois:hash_sujet sujet |
$fd = @fopen($this->listdir . $file, "r"); |
$i = 0 ; |
$class = array ('ligne_impaire', 'ligne_paire') ; |
30,7 → 30,7 |
$tableopened = TRUE; |
} else if (preg_match('/^[0-9]*:[0-9]/',$buf)) { |
// si la ligne est valide |
// on récupère le numéro du message pour en extraire le nom du fichier |
// 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); |
$msgfile = (int)$msgfile % 100; |
/trunk/classes/ezmlm-php-2.0/ezmlm.php |
---|
1,5 → 1,5 |
<?php |
// $Id: ezmlm.php,v 1.3.2.2 2007/03/13 11:04:46 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 ('Janvier', 'Février', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Août', 'Septembre', 'Octobre', 'Novembre', 'Décembre') ; |
$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 |
118,16 → 118,6 |
/*$this->error(EZMLM_INVALID_DIR,TRUE);*/ |
} |
} |
/* |
* Renvoi le nombre de message dans une archive |
* Le nombre contenu dans liste/num |
*/ |
function getNumArchive() { |
if ($this->listdir != '') { |
$num = split(':', file_get_contents($this->listdir.'/num')); |
return $num[0]; |
} |
} |
function set_action($action) { |
if (is_array($action)) { $this->error(EZMLM_INVALID_SYNTAX,TRUE); } |
243,15 → 233,6 |
$outstr = preg_replace("/<.*>/", '', $outstr); |
$outstr = preg_replace("/[\"']/", '', $outstr); |
} |
$at_split = explode('@',$outstr); |
$outstr = $at_split[0]; |
$points_sep = explode('.',$outstr); |
if(count($points_sep) > 2) { |
$outstr = implode('.', array_slice($points_sep,0,count($points_sep) - 2)); |
$outstr = rtrim($outstr, '.').'...'; |
} |
return trim($outstr); |
} |
273,7 → 254,7 |
if ($critical) { die; } |
} |
/** |
* Parse une chaine et supprime les probleme d'encodage de type ISO-4 ... |
* Parse une chaime et supprime les probl�me d'encodage de type ISO-4 ... |
* |
* @return string |
*/ |
311,10 → 292,10 |
*/ |
function date_francaise ($date_mail) { |
$date_mail = preg_replace ('/CEST/', '', $date_mail) ; |
$date_mail = preg_replace ('/\(?CEST\)?/', '', $date_mail) ; |
$numero_mois = date('m ', strtotime($date_mail)) - 1 ; |
$date = date ('d ', strtotime($date_mail)).$GLOBALS['mois'][$numero_mois] ; // Le jour et le mois |
$date .= date(' Y ', strtotime($date_mail)) ; // l'annee |
$date .= date(' Y ', strtotime($date_mail)) ; // l'ann�e |
if (date('a', strtotime($date_mail)) == 'pm') { |
$date .= (int) date('g', strtotime($date_mail)) + 12 ; // Les heures |
} else { |
/trunk/classes/ezmlm-php-2.0/services_vpopmail/messages_mois.php |
---|
37,9 → 37,6 |
include_once 'ezmlm-php-2.0/ezmlm.php' ; |
error_reporting(E_ALL ^ E_NOTICE ^ E_DEPRECATED ^ E_STRICT); |
date_default_timezone_set("Europe/Paris"); |
// extract($_GET); // PHP-5.4, sans register_globals |
// Parametrage de la liste |
$info = new ezmlm_listinfo(); |
92,7 → 89,10 |
/* +--Fin du code ----------------------------------------------------------------------------------------+ |
* |
* $Log: not supported by cvs2svn $ |
* $Log: messages_mois.php,v $ |
* Revision 1.4 2008-11-04 17:11:10 aperonnet |
* correction de bugs dans la liste des derniers messages |
* |
* Revision 1.3 2008-08-25 15:24:09 alexandre_tb |
* ajout de la gestion du cache |
* |
/trunk/classes/ezmlm-php-2.0/services_vpopmail/messages_thread.php |
---|
19,7 → 19,7 |
// | 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: messages_thread.php,v 1.5 2008-11-19 09:28:45 aperonnet Exp $ |
// CVS : $Id: messages_thread.php,v 1.4 2008-11-04 17:11:10 aperonnet Exp $ |
/** |
* Application projet |
* |
29,13 → 29,11 |
//Auteur original : |
*@author Alexandre Granier <alexandre@tela-botanica.org> |
*@copyright Tela-Botanica 2000-2008 |
*@version $Revision: 1.5 $ |
*@version $Revision: 1.4 $ |
// +------------------------------------------------------------------------------------------------------+ |
*/ |
include_once 'ezmlm-php-2.0/ezmlm.php' ; |
error_reporting(E_ALL ^ E_NOTICE ^ E_DEPRECATED ^ E_STRICT); |
// extract($_GET); // PHP-5.4, sans register_globals |
// Parametrage de la liste |
$info = new ezmlm_threads(); |
63,7 → 61,7 |
echo $xml ; |
/* +--Fin du code ----------------------------------------------------------------------------------------+ |
* |
* $Log: not supported by cvs2svn $ |
* $Log: messages_thread.php,v $ |
* Revision 1.4 2008-11-04 17:11:10 aperonnet |
* correction de bugs dans la liste des derniers messages |
* |
/trunk/classes/ezmlm-php-2.0/services_vpopmail/calendrier_messages.php |
---|
1,44 → 1,7 |
<?php |
/*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: calendrier_messages.php,v 1.4 2008-08-25 15:25:47 alexandre_tb Exp $ |
/** |
* Application projet |
* |
* Action forums |
* |
*@package projet |
//Auteur original : |
*@author Alexandre Granier <alexandre@tela-botanica.org> |
//Autres auteurs : |
*@author Aucun |
*@copyright Tela-Botanica 2000-2008 |
*@version $Revision: 1.4 $ |
// +------------------------------------------------------------------------------------------------------+ |
*/ |
include_once 'ezmlm-php-2.0/ezmlm.php' ; |
error_reporting(E_ALL ^ E_NOTICE ^ E_DEPRECATED ^ E_STRICT); |
date_default_timezone_set("Europe/Paris"); |
// extract($_GET); // PHP-5.4, sans register_globals |
// Parametrage de la liste |
$info = new ezmlm_threads(); |
48,85 → 11,22 |
$info->listname = $liste; |
$info->listdomain = $domaine ; |
/** Calcul du cache */ |
/* |
require_once('Cache/Lite.php'); |
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() ; |
// Set a id for this cache |
$id = 'cache_'.$domaine.'_'.$liste; |
include_once 'XML/Util.php' ; |
// Set a few options |
$options = array( |
'cacheDir' => 'tmp/', |
'lifeTime' => null |
); |
*/ |
include_once 'XML/Util.php' ; |
$xml = XML_Util::getXMLDeclaration('1.0', 'ISO-8859-15', 'no') ; |
if (!file_exists($info->listdir.'/num')) { |
$xml .= XML_Util::createStartElement ('ezmlm_calendrier_messages', array('domaine' => $domaine, 'liste' => $liste, 'langue' => $langue)) ; |
$xml .= '<![CDATA[il n\'y a pas de messages dans cette liste pour le moment.]]>'; |
$xml .= XML_Util::createEndElement('ezmlm_calendrier_messages') ; |
header ('Content-type: text/xml'); |
echo $xml; |
exit(); |
} |
/* |
// Create a Cache_Lite object |
$Cache_Lite = new Cache_Lite($options); |
$recalcule = false ; |
$Cache_Lite->get($id); |
if (@fileatime($info->listdir.'/num') > (int)$Cache_Lite->lastModified()) { |
$recalcule = true; |
} |
// Test if thereis a valide cache for this id |
if (!$recalcule) { |
$xml = $Cache_Lite->get($id); |
} else { // pas de cache, on construit le calendrier |
*/ |
$html = $info->listmessages(); |
if (!$html) { |
$xml .= XML_Util::createStartElement ('ezmlm_erreur', array('domaine' => $domaine, 'liste' => $liste, 'langue' => $langue)) ; |
$xml .= '<![CDATA[Les fichiers de la liste ne sont pas visibles sur le serveur]]>'; |
$xml .= XML_Util::createEndElement('ezmlm_erreur') ; |
} else { |
$xml .= XML_Util::createStartElement ('ezmlm_calendrier_messages', array('domaine' => $domaine, 'liste' => $liste, 'langue' => $langue)) ; |
$xml .= '<![CDATA[ '.$html.']]>'; |
$xml .= XML_Util::createEndElement('ezmlm_calendrier_messages') ; |
/* |
$xml .= XML_Util::createStartElement('cache_time') ; |
$xml .= (int)$Cache_Lite->lastmodified().'#'.fileatime($info->listdir.'/num'); |
$xml .= XML_Util::createEndElement('cache_time') ;*/ |
//$Cache_Lite->save($xml, $id); |
} |
//} |
header ('Content-type: text/xml'); |
echo $xml ; |
/* +--Fin du code ----------------------------------------------------------------------------------------+ |
* |
* $Log: calendrier_messages.php,v $ |
* Revision 1.4 2008-08-25 15:25:47 alexandre_tb |
* optimisation et gestion du cache |
* |
* Revision 1.3 2008-06-09 10:05:28 alexandre_tb |
* Ajout de la gestion du cache |
* dependance avec Cache_Lite |
* |
* +-- Fin du code ----------------------------------------------------------------------------------------+ |
*/ |
?> |
?> |
/trunk/classes/ezmlm-php-2.0/services_vpopmail/derniers_messages.php |
---|
31,14 → 31,11 |
//Autres auteurs : |
*@author Aucun |
*@copyright Tela-Botanica 2000-2008 |
*@version $Revision: 1.6 $ |
*@version $Revision: 1.5 $ |
// +------------------------------------------------------------------------------------------------------+ |
*/ |
include_once 'ezmlm-php-2.0/ezmlm.php' ; |
error_reporting(E_ALL ^ E_NOTICE ^ E_DEPRECATED ^ E_STRICT); |
date_default_timezone_set("Europe/Paris"); |
// extract($_GET); // PHP-5.4, sans register_globals |
// Parametrage de la liste |
$info = new ezmlm_listinfo(); |
80,7 → 77,7 |
/* +--Fin du code ----------------------------------------------------------------------------------------+ |
* |
* $Log: not supported by cvs2svn $ |
* $Log: derniers_messages.php,v $ |
* Revision 1.5 2008-11-04 17:11:10 aperonnet |
* correction de bugs dans la liste des derniers messages |
* |
/trunk/classes/ezmlm-php-2.0/services_vpopmail/ajout_abonne.php |
---|
2,5 → 2,5 |
$repertoire = '/home/vpopmail/domains/'.$domaine.'/'.$liste ; |
echo exec ('/usr/local/bin/ezmlm-sub '.$repertoire.' '.$mail, $output, $ret) ; |
echo exec ('ezmlm-sub '.$repertoire.' '.$mail, $output, $ret) ; |
?> |
/trunk/classes/ezmlm-php-2.0/ezmlm-listinfo.php |
---|
1,5 → 1,5 |
<?php |
// $Id: ezmlm-listinfo.php,v 1.3 2007/04/19 15:34:35 neiluj Exp $ |
// $Id: ezmlm-listinfo.php,v 1.5 2008-11-04 17:11:10 aperonnet Exp $ |
// |
// ezmlm-listinfo.php - ezmlm-php v2.0 |
// -------------------------------------------------------------- |
11,11 → 11,11 |
class ezmlm_listinfo extends ezmlm_php { |
function ezmlm_listinfo () { |
//return is_dir($this->listdir.'/archive/0') ; |
return is_dir($this->listdir.'/archive/0') ; |
} |
function display() { |
if (!is_dir($this->listdir.'/archive/0')) { // On teste si il y a au moins un message, cad le répertoire 0 |
if (!is_dir($this->listdir.'/archive/0')) { // On teste si il y a au moins un message, cad le r�pertoire 0 |
echo $this->listdir.'/archive/0' ; |
return false ; |
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; |
112,8 → 112,10 |
return $html; |
} |
// month = yyyymm |
function show_month ($month) { |
// Le nom du fichier est ann�emoi ex 200501 pour janvier 2005 |
// le html est vide au début |
$html = '' ; |
// on ouvre chaque fichier en lecture |
120,9 → 122,29 |
if(!file_exists($this->listdir . '/archive/threads/' . $month)) { |
return false ; |
} |
$fd = file_get_contents($this->listdir . '/archive/threads/' . $month, 'r'); |
$fichier = explode ("\n", $fd) ; |
// on r�cup�re la premi�re ligne |
$premiere_ligne = $fichier[0] ; |
$derniere_ligne = $fichier[count($fichier)-2]; |
$numeros_mails_mois = $this->calculerNumMessagesDansMois($month); |
preg_match ('/[0-9]+/', $premiere_ligne, $match) ; |
$numero_premier_mail = $match[0] ; |
preg_match ('/[0-9]+/', $derniere_ligne, $match1) ; |
$numero_dernier_mail = $match1[0] ; |
// On cherche le r�pertoire du premier mail |
$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; |
} |
$html .= '<table class="table_cadre">'."\n"; |
$html .= '<tr><th class="col1">Num</th><th>De</th><th>Sujet</th><th>Date</th></tr>'."\n"; |
$ctc = 0; |
129,25 → 151,16 |
$class = array ('ligne_paire', 'ligne_impaire') ; |
if(count($numeros_mails_mois) > 0) { |
$repertoire_premier_mail = (int) (reset($numeros_mails_mois) / 100) ; |
} |
foreach ($numeros_mails_mois as $num_message) { |
$i = $num_message; |
for ($i = $numero_premier_mail, $compteur = $numero_premier_mail ; $compteur <= $numero_dernier_mail; $i++, $compteur++) { |
if ($i > 99) { |
$multiplicateur = (int) ($i / 100) ; |
// pour les mails > 99, on retranche n fois 100, ex 256 => 56 cad 256 - 2 * 100 |
// pour les nails > 99, on retranche n fois 100, ex 256 => 56 cad 256 - 2 * 100 |
$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; |
177,59 → 190,8 |
if ($ctc == 2) { $ctc = 0; } |
} |
} |
$html .= '</table>'."\n"; |
return $html; |
} |
private function calculerNumMessagesDansMois($mois) { |
$fd = file_get_contents($this->listdir . '/archive/threads/'.$mois, 'r'); |
$fichier = explode ("\n", $fd) ; |
$premiere_ligne = $fichier[0] ; |
$nb_lignes_fichier = count($fichier); |
$lignes_messages = array(); |
preg_match ('/[0-9]+/', $premiere_ligne, $match) ; |
$numero_premier_mail = $match[0] ; |
$lignes_messages[$numero_premier_mail] = $numero_premier_mail; |
foreach($fichier as $ligne) { |
if(trim($ligne == '')) { continue ;} |
$ligne_tableau = explode(' ', $ligne); |
$num_mail_sujet = explode(':',$ligne_tableau[0]); |
$num_sujet = $num_mail_sujet[1]; |
$fd_sujet = file_get_contents($this->listdir.'/archive/subjects/'.substr($num_sujet,0,2).'/'.substr($num_sujet,2,strlen($num_sujet) - 1), 'r'); |
$premiere_ligne = true; |
$fichier_sujet = explode ("\n", $fd_sujet) ; |
foreach($fichier_sujet as $ligne_sujet) { |
if($premiere_ligne || trim($ligne_sujet) == '') {$premiere_ligne = false; continue; } |
$ligne_tableau_sujet = explode(':', $ligne_sujet); |
$num_mail = $ligne_tableau_sujet[0]; |
$mois_ligne = $ligne_tableau_sujet[1]; |
if($mois_ligne == $mois) { |
if(is_numeric($num_mail)) { |
$lignes_messages[$num_mail] = $num_mail; |
} else { |
$num_mail = preg_replace('/[^0-9]+/','', $num_mail) ; |
$lignes_messages[$num_mail] = $num_mail; |
} |
} |
} |
} |
asort($lignes_messages); |
return $lignes_messages; |
} |
} |
?> |
/trunk/classes/ezmlm-php-2.0/makehash |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |