Subversion Repositories Applications.projet

Rev

Rev 423 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 423 Rev 431
Line 1... Line 1...
1
<?php
1
<?php
2
// $Id: ezmlm.php,v 1.3.2.2 2007/03/13 11:04:46 alexandre_tb Exp $
2
// $Id: ezmlm.php,v 1.5 2007/04/19 15:34:35 neiluj Exp $
3
//
3
//
4
// ezmlm.php - ezmlm-php v2.0
4
// ezmlm.php - ezmlm-php v2.0
5
// --------------------------------------------------------------
5
// --------------------------------------------------------------
6
// As the site that ezmlm-php was developed for grew, and grew
6
// As the site that ezmlm-php was developed for grew, and grew
7
// the old system used had to be bandaid fixed more, and more
7
// the old system used had to be bandaid fixed more, and more
Line 28... Line 28...
28
require_once("ezmlm-listinfo.php");
28
require_once("ezmlm-listinfo.php");
29
require_once("ezmlm-msgdisplay.php");
29
require_once("ezmlm-msgdisplay.php");
30
require_once("ezmlm-repondre.php");
30
require_once("ezmlm-repondre.php");
31
require_once("ezmlm-author.php");
31
require_once("ezmlm-author.php");
Line 32... Line 32...
32
 
32
 
Line 33... Line 33...
33
$GLOBALS['mois'] = array ('Janvier', 'Février', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Août', 'Septembre', 'Octobre', 'Novembre', 'Décembre') ;
33
$GLOBALS['mois'] = array ('Jan', 'F�v', 'Mars', 'Avril', 'Mai', 'Juin', 'Juil', 'Ao�t', 'Sept', 'Oct', 'Nov', 'D�c') ;
34
 
34
 
35
// CLASS: ezmlm_php
35
// CLASS: ezmlm_php
36
// the base class, contains common functions and the config
36
// the base class, contains common functions and the config
Line 65... Line 65...
65
	// Internal variables
65
	// Internal variables
66
	var $action = '';
66
	var $action = '';
67
	var $actionargs;
67
	var $actionargs;
Line 68... Line 68...
68
 
68
 
69
	function ezmlm_php() {
69
	function ezmlm_php() {
70
 
70
		
71
		// USER-CONFIG section
71
		// USER-CONFIG section
72
		// these variables act the same way ezmlm-php-config.php did in the first release
72
		// these variables act the same way ezmlm-php-config.php did in the first release
73
		// simply edit these variables to match your setup
73
		// simply edit these variables to match your setup
74
 
74
                                
75
		$this->listdir		= "";
75
		$this->listdir		= "";
76
		$this->listname		= "";
76
		$this->listname		= "";
77
		$this->listdomain	= "";
77
		$this->listdomain	= "";
78
 
78
	
Line 79... Line 79...
79
		$this->tempdir		= "";
79
		$this->tempdir		= "";
80
 
80
 
81
		$this->sendheaders	= TRUE;
81
		$this->sendheaders	= TRUE;
Line 91... Line 91...
91
						"to",
91
						"to",
92
						"from",
92
						"from",
93
						"subject",
93
						"subject",
94
						"date"
94
						"date"
95
					);
95
					);
96
        $this->header_en_francais = array ('to' => 'A',
96
        $this->header_en_francais = array ('to' => 'A', 
97
                                            'from' => 'De',
97
                                            'from' => 'De',
98
                                            'subject' => 'Sujet',
98
                                            'subject' => 'Sujet',
99
                                            'date' => 'Date') ;
99
                                            'date' => 'Date') ;
Line 100... Line 100...
100
 
100
 
Line 116... Line 116...
116
		    (!is_dir($this->listdir . "/archive/subjects"))) {
116
		    (!is_dir($this->listdir . "/archive/subjects"))) {
117
            return false ;
117
            return false ;
118
			/*$this->error(EZMLM_INVALID_DIR,TRUE);*/
118
			/*$this->error(EZMLM_INVALID_DIR,TRUE);*/
119
		}
119
		}
120
	}
120
	}
121
	/*
-
 
122
	 * Renvoi le nombre de message dans une archive
-
 
123
	 * Le nombre contenu dans liste/num
-
 
124
	 */
-
 
125
	function getNumArchive() {
-
 
126
		if ($this->listdir != '') {
-
 
127
			$num = split(':', file_get_contents($this->listdir.'/num'));
-
 
128
			return $num[0];
-
 
129
		}
-
 
130
	}
-
 
Line 131... Line 121...
131
 
121
 
132
	function set_action($action) {
122
	function set_action($action) {
133
		if (is_array($action)) { $this->error(EZMLM_INVALID_SYNTAX,TRUE); }
123
		if (is_array($action)) { $this->error(EZMLM_INVALID_SYNTAX,TRUE); }
134
		$this->action = $action;
124
		$this->action = $action;
Line 187... Line 177...
187
 
177
 
188
	function sendfooters() {
178
	function sendfooters() {
189
		print "</body>\n";
179
		print "</body>\n";
190
		print "</html>\n";
180
		print "</html>\n";
191
	}
181
	}
Line 192... Line 182...
192
 
182
				
Line 193... Line 183...
193
 
183
 
194
	// begin common functions
184
	// begin common functions
Line 241... Line 231...
241
 
231
 
242
		if ($short) {
232
		if ($short) {
243
			$outstr = preg_replace("/&lt;.*&gt;/", '', $outstr);
233
			$outstr = preg_replace("/&lt;.*&gt;/", '', $outstr);
244
			$outstr = preg_replace("/[\"']/", '', $outstr);
234
			$outstr = preg_replace("/[\"']/", '', $outstr);
245
		}
-
 
246
 
-
 
247
		$at_split = explode('@',$outstr);
-
 
248
		$outstr = $at_split[0];
-
 
249
 
-
 
250
		$points_sep = explode('.',$outstr);
-
 
251
		if(count($points_sep) > 2) {
-
 
252
			$outstr = implode('.', array_slice($points_sep,0,count($points_sep) - 2));
-
 
253
			$outstr = rtrim($outstr, '.').'...';
-
 
254
		}
235
		}
255
		return trim($outstr);
236
		return trim($outstr);
Line 256... Line 237...
256
	}
237
	}
257
 
238
 
Line 271... Line 252...
271
		print "</table>\n\n";
252
		print "</table>\n\n";
Line 272... Line 253...
272
 
253
 
273
		if ($critical) { die; }
254
		if ($critical) { die; }
274
	}
255
	}
275
    /**
256
    /**
276
     *  Parse une chaine et supprime les probleme d'encodage de type ISO-4 ...
257
     *  Parse une chaime et supprime les probl�me d'encodage de type ISO-4 ...
277
     *
258
     *
278
     * @return string
259
     * @return string
279
     */
260
     */
280
 
261
    
281
    function decode_iso ($chaine) {
262
    function decode_iso ($chaine) {
282
 
263
        
283
        if (preg_match ('/windows-[0-9][0-9][0-9][0-9]/i', $chaine, $nombre)) {
264
        if (preg_match ('/windows-[0-9][0-9][0-9][0-9]/i', $chaine, $nombre)) {
284
            $reg_exp = $nombre[0] ;
265
            $reg_exp = $nombre[0] ;
285
            $chaine = str_replace(' ', '', $chaine);
266
            $chaine = str_replace(' ', '', $chaine);
286
        } else {
267
        } else {
287
            $reg_exp = 'ISO-8859-15?' ;
268
            $reg_exp = 'ISO-8859-15?' ;
288
        }
269
        }
289
        if (preg_match ('/UTF/i', $chaine)) $reg_exp = 'UTF-8' ;
270
        if (preg_match ('/UTF/i', $chaine)) $reg_exp = 'UTF-8' ;
290
        preg_match_all ("/=\?$reg_exp\?(Q|B)\?(.*?)\?=/i", $chaine, $match, PREG_PATTERN_ORDER)  ;
271
        preg_match_all ("/=\?$reg_exp\?(Q|B)\?(.*?)\?=/i", $chaine, $match, PREG_PATTERN_ORDER)  ;
291
        for ($i = 0; $i < count ($match[0]); $i++ ) {
272
        for ($i = 0; $i < count ($match[0]); $i++ ) {
292
 
273
            
293
                if (strtoupper($match[1][$i]) == 'Q') {
274
                if (strtoupper($match[1][$i]) == 'Q') {
294
                    $decode = quoted_printable_decode ($match[2][$i]) ;
275
                    $decode = quoted_printable_decode ($match[2][$i]) ;
295
                } elseif ($match[1][$i] == 'B') {
276
                } elseif ($match[1][$i] == 'B') {
296
                    $decode = base64_decode ($match[2][$i]) ;
277
                    $decode = base64_decode ($match[2][$i]) ;
297
                }
278
                }
298
                $decode = preg_replace ("/_/", " ", $decode) ;
279
                $decode = preg_replace ("/_/", " ", $decode) ;
299
            if ($reg_exp == 'UTF-8') {
280
            if ($reg_exp == 'UTF-8') {
300
                $decode = utf8_decode ($decode) ;
281
                $decode = utf8_decode ($decode) ;
301
            }
282
            } 
302
            $chaine = str_replace ($match[0][$i], $decode, $chaine) ;
283
            $chaine = str_replace ($match[0][$i], $decode, $chaine) ;
303
        }
284
        }
304
        return $chaine ;
285
        return $chaine ;
305
    }
286
    }
306
 
287
    
307
    /**
288
    /**
308
     *
289
     *
309
     *
290
     *
310
     * @return
291
     * @return
311
     */
292
     */
312
 
293
    
313
    function date_francaise ($date_mail) {
294
    function date_francaise ($date_mail) {
314
        $date_mail = preg_replace ('/CEST/', '', $date_mail) ;
295
        $date_mail = preg_replace ('/\(?CEST\)?/', '', $date_mail) ;
315
        $numero_mois = date('m ', strtotime($date_mail)) - 1 ;
296
        $numero_mois = date('m ', strtotime($date_mail)) - 1 ;
316
        $date = date ('d ', strtotime($date_mail)).$GLOBALS['mois'][$numero_mois] ; // Le jour et le mois
297
        $date = date ('d ', strtotime($date_mail)).$GLOBALS['mois'][$numero_mois] ; // Le jour et le mois
317
        $date .= date(' Y ', strtotime($date_mail)) ; // l'annee
298
        $date .= date(' Y ', strtotime($date_mail)) ; // l'ann�e
318
        if (date('a', strtotime($date_mail)) == 'pm') {
299
        if (date('a', strtotime($date_mail)) == 'pm') {
319
            $date .= (int) date('g', strtotime($date_mail)) + 12 ;  // Les heures
300
            $date .= (int) date('g', strtotime($date_mail)) + 12 ;  // Les heures
320
        } else {
301
        } else {
321
            $date .= date('g', strtotime($date_mail)) ;
302
            $date .= date('g', strtotime($date_mail)) ;
322
        }
303
        }
323
        $date .= date(':i', strtotime($date_mail)) ;    // Les minutes
304
        $date .= date(':i', strtotime($date_mail)) ;    // Les minutes
324
        return $date ;
305
        return $date ;
325
    }
306
    }
326
 
307
    
327
    /**
308
    /** 
328
     * Cette fonction renvoie le prefixe, cad 0 ou rien
309
     * Cette fonction renvoie le prefixe, cad 0 ou rien
329
     * d un nom de message, ex : pour 09, on renvoie 0
310
     * d un nom de message, ex : pour 09, on renvoie 0
330
     * pour 12 on renvoie rien
311
     * pour 12 on renvoie rien
331
     */
312
     */