Subversion Repositories Applications.projet

Rev

Rev 313 | Rev 359 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 313 Rev 356
1
<?php
1
<?php
2
// $Id: ezmlm.php,v 1.7 2008-08-25 15:23:34 alexandre_tb Exp $
2
// $Id: ezmlm.php,v 1.8 2008-11-04 17:11:10 aperonnet 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
8
// because the site started moving to an object oriented design
8
// because the site started moving to an object oriented design
9
// for all the backend systems and ezmlm wasn't playing nice
9
// for all the backend systems and ezmlm wasn't playing nice
10
// with the new design. So, ezmlm was redesigned too, and here
10
// with the new design. So, ezmlm was redesigned too, and here
11
// it is.
11
// it is.
12
//
12
//
13
// It may look a little more confusing if you're not used to
13
// It may look a little more confusing if you're not used to
14
// working with objects but it actually is much more effiecient
14
// working with objects but it actually is much more effiecient
15
// and organized in it's new incarnation.
15
// and organized in it's new incarnation.
16
// Simply edit the variables in the ezmlm-php constructor below
16
// Simply edit the variables in the ezmlm-php constructor below
17
// just like you would with the old ezmlm-php-config.php file,
17
// just like you would with the old ezmlm-php-config.php file,
18
// if you're unsure howto do this check out the file CONFIG,
18
// if you're unsure howto do this check out the file CONFIG,
19
// then check the USAGE file for how you should include and use
19
// then check the USAGE file for how you should include and use
20
// the new classes if you are integrating ezmlm-php into your
20
// the new classes if you are integrating ezmlm-php into your
21
// site.
21
// site.
22
// (SEARCH FOR: USER-CONFIG to find where to edit.)
22
// (SEARCH FOR: USER-CONFIG to find where to edit.)
23
// --------------------------------------------------------------
23
// --------------------------------------------------------------
24
 
24
 
25
require_once("ezmlm-errors.def");
25
require_once("ezmlm-errors.def");
26
require_once("ezmlm-parser.php");
26
require_once("ezmlm-parser.php");
27
require_once("ezmlm-threads.php");
27
require_once("ezmlm-threads.php");
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");
32
 
32
 
33
$GLOBALS['mois'] = array ('Janvier', 'Février', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Août', 'Septembre', 'Octobre', 'Novembre', 'Décembre') ;
33
$GLOBALS['mois'] = array ('Janvier', 'Février', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Août', 'Septembre', 'Octobre', 'Novembre', 'Décembre') ;
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
37
class ezmlm_php {
37
class ezmlm_php {
38
	var $listdir;		// the root directory of the list
38
	var $listdir;		// the root directory of the list
39
	var $listname;		// the list address upto the @
39
	var $listname;		// the list address upto the @
40
	var $listdomain;	// the domain for the list
40
	var $listdomain;	// the domain for the list
41
 
41
 
42
	var $tempdir;		// a directory in which the webserver can write cache files
42
	var $tempdir;		// a directory in which the webserver can write cache files
43
 
43
 
44
	var $sendheaders;	// send generic page headers
44
	var $sendheaders;	// send generic page headers
45
	var $sendbody;		// send generic body definitions
45
	var $sendbody;		// send generic body definitions
46
	var $sendfooters;	// send generic page footers
46
	var $sendfooters;	// send generic page footers
47
	var $includebefore;	// a file to include before the content
47
	var $includebefore;	// a file to include before the content
48
	var $includeafter;	// a file to include after the content
48
	var $includeafter;	// a file to include after the content
49
 
49
 
50
	var $href;		// what to add before the '?param=value' in links
50
	var $href;		// what to add before the '?param=value' in links
51
 
51
 
52
	var $prefertype;	// what mime type do you prefer?
52
	var $prefertype;	// what mime type do you prefer?
53
	var $showheaders;	// what headers should we show?
53
	var $showheaders;	// what headers should we show?
54
 
54
 
55
	var $msgtemplate;	// the template for displaying messages (see the file TEMPLATE)
55
	var $msgtemplate;	// the template for displaying messages (see the file TEMPLATE)
56
 
56
 
57
	var $tablecolours;	// what are the colours for the table rows?
57
	var $tablecolours;	// what are the colours for the table rows?
58
 
58
 
59
	var $thread_subjlen;	// the maximum length of subjects in the thread view (0 = no limit)
59
	var $thread_subjlen;	// the maximum length of subjects in the thread view (0 = no limit)
60
 
60
 
61
	var $forcehref;		// force the base of makelink();
61
	var $forcehref;		// force the base of makelink();
62
 
62
 
63
	// --------- END USER CONFIGURATION ---------
63
	// --------- END USER CONFIGURATION ---------
64
 
64
 
65
	// Internal variables
65
	// Internal variables
66
	var $action = '';
66
	var $action = '';
67
	var $actionargs;
67
	var $actionargs;
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
	
79
		$this->tempdir		= "";
79
		$this->tempdir		= "";
80
 
80
 
81
		$this->sendheaders	= TRUE;
81
		$this->sendheaders	= TRUE;
82
		$this->sendbody		= TRUE;
82
		$this->sendbody		= TRUE;
83
		$this->sendfooters	= TRUE;
83
		$this->sendfooters	= TRUE;
84
		$this->includebefore	= "";
84
		$this->includebefore	= "";
85
		$this->includeafter	= "";
85
		$this->includeafter	= "";
86
 
86
 
87
		$this->href		= "";
87
		$this->href		= "";
88
 
88
 
89
		$this->prefertype	= "text/html";
89
		$this->prefertype	= "text/html";
90
		$this->showheaders	= array(
90
		$this->showheaders	= array(
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') ;
100
 
100
 
101
		$this->msgtemplate	= "<pre><ezmlm-body></pre>"; // if blank it will use the internal one
101
		$this->msgtemplate	= "<pre><ezmlm-body></pre>"; // if blank it will use the internal one
102
 
102
 
103
		$this->tablecolours	= array(
103
		$this->tablecolours	= array(
104
						// delete the next line if you don't want alternating colours
104
						// delete the next line if you don't want alternating colours
105
						"#eeeeee",
105
						"#eeeeee",
106
						"#ffffff"
106
						"#ffffff"
107
					);
107
					);
108
 
108
 
109
		$this->thread_subjlen	= 55;
109
		$this->thread_subjlen	= 55;
110
 
110
 
111
		// --- STOP EDITING HERE ---
111
		// --- STOP EDITING HERE ---
112
		// some sanity checking
112
		// some sanity checking
113
		if ((!is_dir($this->listdir . "/archive")) or
113
		if ((!is_dir($this->listdir . "/archive")) or
114
		    (!is_dir($this->listdir . "/archive/authors")) or
114
		    (!is_dir($this->listdir . "/archive/authors")) or
115
		    (!is_dir($this->listdir . "/archive/threads")) or
115
		    (!is_dir($this->listdir . "/archive/threads")) or
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
	/*
121
	/*
122
	 * Renvoi le nombre de message dans une archive
122
	 * Renvoi le nombre de message dans une archive
123
	 * Le nombre contenu dans liste/num 
123
	 * Le nombre contenu dans liste/num 
124
	 */
124
	 */
125
	function getNumArchive() {
125
	function getNumArchive() {
126
		if ($this->listdir != '') {
126
		if ($this->listdir != '') {
127
			$num = split(':', file_get_contents($this->listdir.'/num'));
127
			$num = split(':', file_get_contents($this->listdir.'/num'));
128
			return $num[0];
128
			return $num[0];
129
		}
129
		}
130
	}
130
	}
131
 
131
 
132
	function set_action($action) {
132
	function set_action($action) {
133
		if (is_array($action)) { $this->error(EZMLM_INVALID_SYNTAX,TRUE); }
133
		if (is_array($action)) { $this->error(EZMLM_INVALID_SYNTAX,TRUE); }
134
		$this->action = $action;
134
		$this->action = $action;
135
	}
135
	}
136
	function set_actionargs($actionargs) {
136
	function set_actionargs($actionargs) {
137
		if ($this->action == '') { $this->error(EZMLM_INVALID_SYNTAX,TRUE); }
137
		if ($this->action == '') { $this->error(EZMLM_INVALID_SYNTAX,TRUE); }
138
		$this->actionargs = $actionargs;
138
		$this->actionargs = $actionargs;
139
	}
139
	}
140
 
140
 
141
	function run() {
141
	function run() {
142
		if ($this->action == '') { $this->error(EZMLM_INVALID_SYNTAX,TRUE); }
142
		if ($this->action == '') { $this->error(EZMLM_INVALID_SYNTAX,TRUE); }
143
 
143
 
144
		if ($this->sendheaders) { $this->sendheaders(); }
144
		if ($this->sendheaders) { $this->sendheaders(); }
145
		if ($this->sendbody) { $this->sendbody(); }
145
		if ($this->sendbody) { $this->sendbody(); }
146
		if ($this->includebefore != '') { @include_once($this->includebefore); }
146
		if ($this->includebefore != '') { @include_once($this->includebefore); }
147
 
147
 
148
		switch ($this->action) {
148
		switch ($this->action) {
149
			case "list_info":
149
			case "list_info":
150
				$info = new ezmlm_listinfo();
150
				$info = new ezmlm_listinfo();
151
				$info->display();
151
				$info->display();
152
				break;
152
				break;
153
			case "show_msg":
153
			case "show_msg":
154
				if (count($this->actionargs) < 2) {
154
				if (count($this->actionargs) < 2) {
155
					$this->error(EZMLM_INVALID_SYNTAX,TRUE);
155
					$this->error(EZMLM_INVALID_SYNTAX,TRUE);
156
				}
156
				}
157
				$show_msg = new ezmlm_msgdisplay();
157
				$show_msg = new ezmlm_msgdisplay();
158
				$show_msg->display($this->actionargs[0] . "/" . $this->actionargs[1]);
158
				$show_msg->display($this->actionargs[0] . "/" . $this->actionargs[1]);
159
				break;
159
				break;
160
			case "show_threads":
160
			case "show_threads":
161
				$threads = new ezmlm_threads();
161
				$threads = new ezmlm_threads();
162
				$threads->load($this->actionargs[0]);
162
				$threads->load($this->actionargs[0]);
163
				break;
163
				break;
164
			case "show_author_msgs":
164
			case "show_author_msgs":
165
				$author = new ezmlm_author();
165
				$author = new ezmlm_author();
166
				$author->display($this->actionargs[0]);
166
				$author->display($this->actionargs[0]);
167
				break;
167
				break;
168
		}
168
		}
169
 
169
 
170
		if ($this->includeafter != '') { @include_once($this->includeafter); }
170
		if ($this->includeafter != '') { @include_once($this->includeafter); }
171
		if ($this->sendfooters) { $this->sendfooters(); }
171
		if ($this->sendfooters) { $this->sendfooters(); }
172
	}
172
	}
173
 
173
 
174
	function sendheaders() {
174
	function sendheaders() {
175
		print "<html><head>\n";
175
		print "<html><head>\n";
176
		print "<style type=\"text/css\">\n";
176
		print "<style type=\"text/css\">\n";
177
		print "<!--\n";
177
		print "<!--\n";
178
		print ".heading { font-family: helvetica; font-size: 16px; line-height: 18px; font-weight: bold; }\n";
178
		print ".heading { font-family: helvetica; font-size: 16px; line-height: 18px; font-weight: bold; }\n";
179
		print "//-->\n";
179
		print "//-->\n";
180
		print "</style>\n";
180
		print "</style>\n";
181
		print "</head>\n";
181
		print "</head>\n";
182
	}
182
	}
183
 
183
 
184
	function sendbody() {
184
	function sendbody() {
185
		print "<body>\n";
185
		print "<body>\n";
186
	}
186
	}
187
 
187
 
188
	function sendfooters() {
188
	function sendfooters() {
189
		print "</body>\n";
189
		print "</body>\n";
190
		print "</html>\n";
190
		print "</html>\n";
191
	}
191
	}
192
				
192
				
193
 
193
 
194
	// begin common functions
194
	// begin common functions
195
 
195
 
196
	// makehash - generates an author hash using the included makehash program
196
	// makehash - generates an author hash using the included makehash program
197
	function makehash($str) {
197
	function makehash($str) {
198
         $str = preg_replace ('/>/', '', $str) ;
198
         $str = preg_replace ('/>/', '', $str) ;
199
        $handle = popen ('/usr/local/lib/safe_mode/makehash \''.$str.'\'', 'r') ;
199
        $handle = popen ('/usr/local/lib/safe_mode/makehash \''.$str.'\'', 'r') ;
200
        $hash = fread ($handle, 256) ;
200
        $hash = fread ($handle, 256) ;
201
        pclose ($handle) ;
201
        pclose ($handle) ;
202
		return $hash;
202
		return $hash;
203
	}
203
	}
204
 
204
 
205
	// makelink - writes the <a href=".."> tag
205
	// makelink - writes the <a href=".."> tag
206
	function makelink($params,$text) {
206
	function makelink($params,$text) {
207
		if ($this->forcehref != "") {
207
		if ($this->forcehref != "") {
208
			$basehref = $this->forcehref;
208
			$basehref = $this->forcehref;
209
		} else {
209
		} else {
210
			$basehref = preg_replace('/^(.*)\?.*/', '\\1', $_SERVER['REQUEST_URI']);
210
			$basehref = preg_replace('/^(.*)\?.*/', '\\1', $_SERVER['REQUEST_URI']);
211
		}
211
		}
212
		$link = '<a href="'. $basehref . '&amp;' . $params . '">' . $text . '</a>';
212
		$link = '<a href="'. $basehref . '&amp;' . $params . '">' . $text . '</a>';
213
		return $link;
213
		return $link;
214
	}
214
	}
215
 
215
 
216
	// md5_of_file - provides wrapper function that emulates md5_file for PHP < 4.2.0
216
	// md5_of_file - provides wrapper function that emulates md5_file for PHP < 4.2.0
217
	function md5_of_file($file) {
217
	function md5_of_file($file) {
218
		if (function_exists("md5_file")) { // php >= 4.2.0
218
		if (function_exists("md5_file")) { // php >= 4.2.0
219
			return md5_file($file);
219
			return md5_file($file);
220
		} else {
220
		} else {
221
			if (is_file($file)) {
221
			if (is_file($file)) {
222
				$fd = fopen($file, "rb");
222
				$fd = fopen($file, "rb");
223
				$filecontents = fread($fd, filesize($file));
223
				$filecontents = fread($fd, filesize($file));
224
				fclose ($fd);
224
				fclose ($fd);
225
				return md5($filecontents);
225
				return md5($filecontents);
226
			} else {
226
			} else {
227
				return FALSE;
227
				return FALSE;
228
			}
228
			}
229
		}
229
		}
230
	}
230
	}
231
 
231
 
232
	// protect_email - protects email address turns user@domain.com into user@d...
232
	// protect_email - protects email address turns user@domain.com into user@d...
233
	function protect_email($str,$short = FALSE) {
233
	function protect_email($str,$short = FALSE) {
234
		if (preg_match("/[a-zA-Z0-9\-\.]\@[a-zA-Z0-9\-\.]*\./", $str)) {
234
		if (preg_match("/[a-zA-Z0-9\-\.]\@[a-zA-Z0-9\-\.]*\./", $str)) {
235
			$outstr = preg_replace("/([a-zA-Z0-9\-\.]*\@)([a-zA-Z0-9\-\.])[a-zA-Z0-9\-\.]*\.[a-zA-Z0-9\-\.]*/","\\1\\2...",$str);
235
			$outstr = preg_replace("/([a-zA-Z0-9\-\.]*\@)([a-zA-Z0-9\-\.])[a-zA-Z0-9\-\.]*\.[a-zA-Z0-9\-\.]*/","\\1\\2...",$str);
236
			$outstr = preg_replace("/\</", '&lt;', $outstr);
236
			$outstr = preg_replace("/\</", '&lt;', $outstr);
237
			$outstr = preg_replace("/\>/", '&gt;', $outstr);
237
			$outstr = preg_replace("/\>/", '&gt;', $outstr);
238
		} else {
238
		} else {
239
			$outstr = $str;
239
			$outstr = $str;
240
		}
240
		}
241
 
241
 
242
		if ($short) {
242
		if ($short) {
243
			$outstr = preg_replace("/&lt;.*&gt;/", '', $outstr);
243
			$outstr = preg_replace("/&lt;.*&gt;/", '', $outstr);
244
			$outstr = preg_replace("/[\"']/", '', $outstr);
244
			$outstr = preg_replace("/[\"']/", '', $outstr);
245
		}
245
		}
246
		return trim($outstr);
246
		return trim($outstr);
247
	}
247
	}
248
 
248
 
249
	// cleanup_body: sortta like protect_email, just for message bodies
249
	// cleanup_body: sortta like protect_email, just for message bodies
250
	function cleanup_body($str) {
250
	function cleanup_body($str) {
251
			$outstr = preg_replace("/([a-zA-Z0-9\-\.]*\@)([a-zA-Z0-9\-\.])[a-zA-Z0-9\-\.]*\.[a-zA-Z0-9\-\.]*/","\\1\\2...",$str);
251
			$outstr = preg_replace("/([a-zA-Z0-9\-\.]*\@)([a-zA-Z0-9\-\.])[a-zA-Z0-9\-\.]*\.[a-zA-Z0-9\-\.]*/","\\1\\2...",$str);
252
			return $outstr;
252
			return $outstr;
253
	}
253
	}
254
 
254
 
255
	function error($def, $critical = FALSE) {
255
	function error($def, $critical = FALSE) {
256
		global $ezmlm_error;
256
		global $ezmlm_error;
257
 
257
 
258
		print "\n\n";
258
		print "\n\n";
259
		print "<table width=600 border=1 cellpadding=3 cellspacing=0>\n";
259
		print "<table width=600 border=1 cellpadding=3 cellspacing=0>\n";
260
		print "<tr bgcolor=\"#cccccc\"><td><b>EZMLM-PHP Error: " . $ezmlm_error[$def]['title'] . "</td></tr>\n";
260
		print "<tr bgcolor=\"#cccccc\"><td><b>EZMLM-PHP Error: " . $ezmlm_error[$def]['title'] . "</td></tr>\n";
261
		print "<tr bgcolor=\"#aaaaaa\"><td>" . $ezmlm_error[$def]['body'] . "</td></tr>\n";
261
		print "<tr bgcolor=\"#aaaaaa\"><td>" . $ezmlm_error[$def]['body'] . "</td></tr>\n";
262
		print "</table>\n\n";
262
		print "</table>\n\n";
263
 
263
 
264
		if ($critical) { die; }
264
		if ($critical) { die; }
265
	}
265
	}
266
    /**
266
    /**
267
     *  Parse une chaine et supprime les probleme d'encodage de type ISO-4 ...
267
     *  Parse une chaine et supprime les probleme d'encodage de type ISO-4 ...
268
     *
268
     *
269
     * @return string
269
     * @return string
270
     */
270
     */
271
    
271
    
272
    function decode_iso ($chaine) {
272
    function decode_iso ($chaine) {
273
        
273
        
274
        if (preg_match ('/windows-[0-9][0-9][0-9][0-9]/i', $chaine, $nombre)) {
274
        if (preg_match ('/windows-[0-9][0-9][0-9][0-9]/i', $chaine, $nombre)) {
275
            $reg_exp = $nombre[0] ;
275
            $reg_exp = $nombre[0] ;
276
            $chaine = str_replace(' ', '', $chaine);
276
            $chaine = str_replace(' ', '', $chaine);
277
        } else {
277
        } else {
278
            $reg_exp = 'ISO-8859-15?' ;
278
            $reg_exp = 'ISO-8859-15?' ;
279
        }
279
        }
280
        if (preg_match ('/UTF/i', $chaine)) $reg_exp = 'UTF-8' ;
280
        if (preg_match ('/UTF/i', $chaine)) $reg_exp = 'UTF-8' ;
281
        preg_match_all ("/=\?$reg_exp\?(Q|B)\?(.*?)\?=/i", $chaine, $match, PREG_PATTERN_ORDER)  ;
281
        preg_match_all ("/=\?$reg_exp\?(Q|B)\?(.*?)\?=/i", $chaine, $match, PREG_PATTERN_ORDER)  ;
282
        for ($i = 0; $i < count ($match[0]); $i++ ) {
282
        for ($i = 0; $i < count ($match[0]); $i++ ) {
283
            
283
            
284
                if (strtoupper($match[1][$i]) == 'Q') {
284
                if (strtoupper($match[1][$i]) == 'Q') {
285
                    $decode = quoted_printable_decode ($match[2][$i]) ;
285
                    $decode = quoted_printable_decode ($match[2][$i]) ;
286
                } elseif ($match[1][$i] == 'B') {
286
                } elseif ($match[1][$i] == 'B') {
287
                    $decode = base64_decode ($match[2][$i]) ;
287
                    $decode = base64_decode ($match[2][$i]) ;
288
                }
288
                }
289
                $decode = preg_replace ("/_/", " ", $decode) ;
289
                $decode = preg_replace ("/_/", " ", $decode) ;
290
            if ($reg_exp == 'UTF-8') {
290
            if ($reg_exp == 'UTF-8') {
291
                $decode = utf8_decode ($decode) ;
291
                $decode = utf8_decode ($decode) ;
292
            } 
292
            } 
293
            $chaine = str_replace ($match[0][$i], $decode, $chaine) ;
293
            $chaine = str_replace ($match[0][$i], $decode, $chaine) ;
294
        }
294
        }
295
        return $chaine ;
295
        return $chaine ;
296
    }
296
    }
297
    
297
    
298
    /**
298
    /**
299
     *
299
     *
300
     *
300
     *
301
     * @return
301
     * @return
302
     */
302
     */
303
    
303
    
304
    function date_francaise ($date_mail) {
304
    function date_francaise ($date_mail) {
305
        $date_mail = preg_replace ('/CEST/', '', $date_mail) ;
305
        $date_mail = preg_replace ('/CEST/', '', $date_mail) ;
306
        $numero_mois = date('m ', strtotime($date_mail)) - 1 ;
306
        $numero_mois = date('m ', strtotime($date_mail)) - 1 ;
307
        $date = date ('d ', strtotime($date_mail)).$GLOBALS['mois'][$numero_mois] ; // Le jour et le mois
307
        $date = date ('d ', strtotime($date_mail)).$GLOBALS['mois'][$numero_mois] ; // Le jour et le mois
308
        $date .= date(' Y ', strtotime($date_mail)) ; // l'annee
308
        $date .= date(' Y ', strtotime($date_mail)) ; // l'annee
309
        if (date('a', strtotime($date_mail)) == 'pm') {
309
        if (date('a', strtotime($date_mail)) == 'pm') {
310
            $date .= (int) date('g', strtotime($date_mail)) + 12 ;  // Les heures
310
            $date .= (int) date('g', strtotime($date_mail)) + 12 ;  // Les heures
311
        } else {
311
        } else {
312
            $date .= date('g', strtotime($date_mail)) ;
312
            $date .= date('g', strtotime($date_mail)) ;
313
        }
313
        }
314
        $date .= date(':i', strtotime($date_mail)) ;    // Les minutes
314
        $date .= date(':i', strtotime($date_mail)) ;    // Les minutes
315
        return $date ;
315
        return $date ;
316
    }
316
    }
317
    
317
    
318
    /** 
318
    /** 
319
     * Cette fonction renvoie le prefixe, cad 0 ou rien
319
     * Cette fonction renvoie le prefixe, cad 0 ou rien
320
     * d un nom de message, ex : pour 09, on renvoie 0
320
     * d un nom de message, ex : pour 09, on renvoie 0
321
     * pour 12 on renvoie rien
321
     * pour 12 on renvoie rien
322
     */
322
     */
323
    function prefixe_nom_message($nom) {
323
    function prefixe_nom_message($nom) {
324
    	if (preg_match ('/0([1-9][0-9]*)/', $nom, $match)) {
324
    	if (preg_match ('/0([1-9][0-9]*)/', $nom, $match)) {
325
			$nom_fichier = $match[1];
325
			$nom_fichier = $match[1];
326
			return '0' ;
326
			return '0' ;
327
		} else {
327
		} else {
328
			return '' ;
328
			return '' ;
329
		}
329
		}
330
    }
330
    }
331
}
331
}
332
 
332
 
333
//
333
//
334
// --- END OF CLASS DEFINITION ---
334
// --- END OF CLASS DEFINITION ---
335
//
335
//
336
 
336
 
337
// FIN
337
// FIN