Subversion Repositories Applications.papyrus

Rev

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

Rev 448 Rev 474
1
<?php
1
<?php
2
// $Id: ezmlm-author.php,v 1.1 2005-09-22 14:02:46 ddelon Exp $
2
// $Id: ezmlm-author.php,v 1.2 2005-09-27 16:43:08 alexandre_tb Exp $
3
//
3
//
4
// ezmlm-author.php - ezmlm-php v2.0
4
// ezmlm-author.php - ezmlm-php v2.0
5
// --------------------------------------------------------------
5
// --------------------------------------------------------------
6
// Displays all messages by a given author
6
// Displays all messages by a given author
7
// --------------------------------------------------------------
7
// --------------------------------------------------------------
8
 
8
 
9
require_once("ezmlm.php");
9
require_once("ezmlm.php");
10
 
10
 
11
class ezmlm_author extends ezmlm_php {
11
class ezmlm_author extends ezmlm_php {
12
	function display($authorhash) {
12
	function display($authorhash) {
13
		$file = "/archive/authors/" . substr($authorhash,0,2) . "/" . substr($authorhash,2,18);
13
		$file = "/archive/authors/" . substr($authorhash,0,2) . "/" . substr($authorhash,2,18);
14
        //echo $file ;
14
        //echo $file ;
15
		if (!is_file($this->listdir . $file)) { $this->error(EZMLM_INVALID_AUTHOR); return; }
15
		if (!is_file($this->listdir . $file)) { $this->error(EZMLM_INVALID_AUTHOR); return; }
16
        // Le fichier author comprend
16
        // Le fichier author comprend
17
        // Première ligne hash_auteur nom_auteur
17
        // Première ligne hash_auteur nom_auteur
18
        // num_mess:annéemois:hash_sujet sujet
18
        // num_mess:annéemois:hash_sujet sujet
19
		$fd = @fopen($this->listdir . $file, "r");
19
		$fd = @fopen($this->listdir . $file, "r");
20
        $i = 0 ;
20
        $i = 0 ;
21
        $class = array ('ligne_impaire', 'ligne_paire') ;
21
        $class = array ('ligne_impaire', 'ligne_paire') ;
22
		while (!feof($fd)) {
22
		while (!feof($fd)) {
23
			$buf = fgets($fd,4096);
23
			$buf = fgets($fd,4096);
24
			if (preg_match('/^' . $authorhash . '/', $buf)) {
24
			if (preg_match('/^' . $authorhash . '/', $buf)) {
25
				// this should ALWAYS be the first line in the file
25
				// this should ALWAYS be the first line in the file
26
				$author = preg_replace('/^' . $authorhash . ' /', '', $buf);
26
				$author = preg_replace('/^' . $authorhash . ' /', '', $buf);
27
                print '<h3>'.PROJET_MESSAGES_DE.$author.'</h3>' ;
27
                print '<h3>'.PROJET_MESSAGES_DE.$author.'</h3>' ;
28
				print '<table class="table_cadre">'."\n";
28
				print '<table class="table_cadre">'."\n";
29
                print '<tr><th class="col1">De</th><th>Sujet</th><th>Date</th></tr>'."\n";
29
                print '<tr><th class="col1">De</th><th>Sujet</th><th>Date</th></tr>'."\n";
30
				$tableopened = TRUE;
30
				$tableopened = TRUE;
31
			} else if (preg_match('/^[0-9]*:[0-9]/',$buf)) {
31
			} else if (preg_match('/^[0-9]*:[0-9]/',$buf)) {
32
				// this is a valid message line
32
				// this is a valid message line
33
				// all we need is the first item
33
				// all we need is the first item
34
                // on récupère le numéro du message pour en extraire le nom du fichier
34
                // on récupère le numéro du message pour en extraire le nom du fichier
35
				$msgfile = preg_replace('/^([0-9]*):.*/', '\1', $buf);
35
				$msgfile = preg_replace('/^([0-9]*):.*/', '\1', $buf);
36
				$msgdir  = (int)((int)$msgfile / 100);
36
				$msgdir  = (int)((int)$msgfile / 100);
37
				$msgfile = (int)$msgfile % 100;
37
				$msgfile = (int)$msgfile % 100;
38
 
38
 
39
				if ($msgfile < 10) { $msgfile = "0" . $msgfile; }
39
				if ($msgfile < 10) { $msgfile = "0" . $msgfile; }
40
 
40
 
41
				if (!is_file($this->listdir . "/archive/" . $msgdir . "/" . $msgfile)) {
41
				if (!is_file($this->listdir . "/archive/" . $msgdir . "/" . $msgfile)) {
42
					print "<!-- " . $this->listdir . "/archive/" . $msgdir . "/" . $msgfile . " -->\n";
42
					print "<!-- " . $this->listdir . "/archive/" . $msgdir . "/" . $msgfile . " -->\n";
43
					$this->error(EZMLM_INCONSISTANCY);	
43
					$this->error(EZMLM_INCONSISTANCY);	
44
					fclose($fd);
44
					fclose($fd);
45
					return;
45
					return;
46
				}
46
				}
47
 
47
 
48
				//$msg = new ezmlm_parser();
48
				//$msg = new ezmlm_parser();
49
				//$msg->parse_file_headers($this->listdir . "/archive/" . $msgdir . "/" . $msgfile);
49
				//$msg->parse_file_headers($this->listdir . "/archive/" . $msgdir . "/" . $msgfile);
50
                
50
                
51
                $message = file_get_contents($this->listdir . "/archive/" . $msgdir . "/" . $msgfile) ;
51
                $message = file_get_contents($this->listdir . "/archive/" . $msgdir . "/" . $msgfile) ;
52
                $mimeDecode = new Mail_mimeDecode($message) ;
52
                $mimeDecode = new Mail_mimeDecode($message) ;
53
                $mailDecode = $mimeDecode->decode() ;
53
                $mailDecode = $mimeDecode->decode() ;
54
                
54
                
55
				$subject = $mailDecode->headers['subject'];	
55
				$subject = $mailDecode->headers['subject'];	
56
				$subject = preg_replace("/\[" . $this->listname . "\]/", "", $subject);
56
				$subject = preg_replace("/\[" . $this->listname . "\]/", "", $subject);
57
                $date = preg_replace ('/CEST/', '', $mailDecode->headers['date']);	
57
                $date = preg_replace ('/CEST/', '', $mailDecode->headers['date']);	
58
				print '<tr class="'.$class[$i].'">'."\n";
58
				print '<tr class="'.$class[$i].'">'."\n";
59
                
59
                
60
                $hash = $this->makehash($val->headers['from']);
60
                $hash = $this->makehash($mailDecode->headers['from']);
61
                print '<td>'.$this->makelink("action=show_author_msgs&actionargs[]=" . $hash,$this->decode_iso($this->protect_email($mailDecode->headers['from'],TRUE)));
61
                print '<td>'.$this->makelink("action=show_author_msgs&actionargs[]=" . $hash,$this->decode_iso($this->protect_email($mailDecode->headers['from'],TRUE)));
62
                print '</td>';
62
                print '</td>';
63
                
63
                
64
                print "<td><b>" . $this->makelink("action=show_msg&actionargs[]=" . $msgdir . "&actionargs[]=" . $msgfile, $this->decode_iso($subject)) . "</b></td>";
64
                print "<td><b>" . $this->makelink("action=show_msg&actionargs[]=" . $msgdir . "&actionargs[]=" . $msgfile, $this->decode_iso($subject)) . "</b></td>";
65
                /*
65
                /*
66
                print "<td>[" . $this->makelink("action=show_threads&actionargs[]=" . 
66
                print "<td>[" . $this->makelink("action=show_threads&actionargs[]=" . 
67
                                date("Ym", strtotime($date)) . "#" . urlencode("/archive/" . $msgdir . "/" . $msgfile), PROJET_FILE_DE_DISCUSSION) . "]</td>\n";
67
                                date("Ym", strtotime($date)) . "#" . urlencode("/archive/" . $msgdir . "/" . $msgfile), PROJET_FILE_DE_DISCUSSION) . "]</td>\n";
68
                */
68
                */
69
				print "<td>" . $this->date_francaise($mailDecode->headers['date']) . "</td>\n";
69
				print "<td>" . $this->date_francaise($mailDecode->headers['date']) . "</td>\n";
70
				print "</tr>\n";
70
				print "</tr>\n";
71
                $i++;
71
                $i++;
72
                if ($i == 2) $i = 0 ;
72
                if ($i == 2) $i = 0 ;
73
                unset ($mailDecode) ;
73
                unset ($mailDecode) ;
74
			}
74
			}
75
		}
75
		}
76
		if ($tableopened) { print "</table>\n"; }
76
		if ($tableopened) { print "</table>\n"; }
77
	}
77
	}
78
}
78
}