Subversion Repositories Applications.projet

Compare Revisions

Ignore whitespace Rev 430 → Rev 431

/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
67,15 → 67,15
var $actionargs;
 
function ezmlm_php() {
 
// USER-CONFIG section
// 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 = "";
$this->listname = "";
$this->listdomain = "";
 
$this->tempdir = "";
 
$this->sendheaders = TRUE;
93,7 → 93,7
"subject",
"date"
);
$this->header_en_francais = array ('to' => 'A',
$this->header_en_francais = array ('to' => 'A',
'from' => 'De',
'subject' => 'Sujet',
'date' => 'Date') ;
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); }
189,8 → 179,8
print "</body>\n";
print "</html>\n";
}
 
 
// begin common functions
 
// makehash - generates an author hash using the included makehash program
243,15 → 233,6
$outstr = preg_replace("/&lt;.*&gt;/", '', $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,13 → 254,13
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
*/
 
function decode_iso ($chaine) {
 
if (preg_match ('/windows-[0-9][0-9][0-9][0-9]/i', $chaine, $nombre)) {
$reg_exp = $nombre[0] ;
$chaine = str_replace(' ', '', $chaine);
289,7 → 270,7
if (preg_match ('/UTF/i', $chaine)) $reg_exp = 'UTF-8' ;
preg_match_all ("/=\?$reg_exp\?(Q|B)\?(.*?)\?=/i", $chaine, $match, PREG_PATTERN_ORDER) ;
for ($i = 0; $i < count ($match[0]); $i++ ) {
 
if (strtoupper($match[1][$i]) == 'Q') {
$decode = quoted_printable_decode ($match[2][$i]) ;
} elseif ($match[1][$i] == 'B') {
298,23 → 279,23
$decode = preg_replace ("/_/", " ", $decode) ;
if ($reg_exp == 'UTF-8') {
$decode = utf8_decode ($decode) ;
}
}
$chaine = str_replace ($match[0][$i], $decode, $chaine) ;
}
return $chaine ;
}
 
/**
*
*
* @return
*/
 
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 {
323,8 → 304,8
$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