Subversion Repositories Applications.projet

Rev

Rev 11 | Rev 312 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 11 Rev 208
Line 1... Line 1...
1
<?php
1
<?php
2
// $Id: ezmlm-listinfo.php,v 1.2 2005-09-27 16:43:08 alexandre_tb Exp $
2
// $Id: ezmlm-listinfo.php,v 1.3 2007-04-19 15:34:35 neiluj Exp $
3
//
3
//
4
// ezmlm-listinfo.php - ezmlm-php v2.0
4
// ezmlm-listinfo.php - ezmlm-php v2.0
5
// --------------------------------------------------------------
5
// --------------------------------------------------------------
6
// Displays general list info in the format of a welcome page.
6
// Displays general list info in the format of a welcome page.
7
// --------------------------------------------------------------
7
// --------------------------------------------------------------
Line 44... Line 44...
44
			}
44
			}
45
		}
45
		}
46
	}
46
	}
Line 47... Line 47...
47
 
47
 
Line 48... Line 48...
48
 
48
 
Line 49... Line 49...
49
	function show_recentmsgs($title = "Messages récents") {
49
	function show_recentmsgs($title = "Messages ràcents") {
50
        
50
        
51
        if (!is_dir($this->listdir.'/archive/0')) return false;
51
        if (!is_dir($this->listdir.'/archive/0')) return false;
52
        
52
        
53
		$parser = new ezmlm_parser();
53
		$parser = new ezmlm_parser();
54
        $parser->listdir = $this->listdir ;
54
        $parser->listdir = $this->listdir ;
-
 
55
        print '<table class="table_cadre">'."\n";
-
 
56
        print '<tr><th class="col1">Num</th><th>De</th><th>Sujet</th><th>Date</th></tr>'."\n";
-
 
57
        $ctc = 0;
-
 
58
        $recent = $parser->recent_msgs();
-
 
59
        
-
 
60
        // le tableau recent est de la forme
-
 
61
        // $recent[numero_message][1] sujet
55
        print '<table class="table_cadre">'."\n";
62
        // $recent[numero_message][2] date en anglais => (22 May 2006)
Line 56... Line 63...
56
        print '<tr><th class="col1">Num</th><th>De</th><th>Sujet</th><th>Date</th></tr>'."\n";
63
        // $recent[numero_message][3] le hash de l auteur
57
        $ctc = 0;
64
        // $recent[numero_message][4] auteur
58
        $recent = $parser->recent_msgs();
65
        
59
        $class = array ('ligne_paire', 'ligne_impaire') ;
-
 
60
        
-
 
Line -... Line 66...
-
 
66
        $class = array ('ligne_paire', 'ligne_impaire') ;
-
 
67
        
-
 
68
        while (list($key,$val) = each($recent)) {
-
 
69
            print '<tr class="'.$class[$ctc].'">'."\n";
-
 
70
            //print '<td>'.$val->nummessage.'</td>' ;
-
 
71
            
-
 
72
            // $key contient le numero du message tel que dans les fichiers d index par ex 216
-
 
73
            // on retrouve le nom du repertoire et le nom du fichier
-
 
74
            $decimal = (string) $key;
-
 
75
            if ($key >= 100) {
-
 
76
					$fichier_message = substr($decimal, -2) ;
-
 
77
					$repertoire_message = substr ($decimal, 0,count ($decimal) -2) ;
-
 
78
				} else {
-
 
79
					if ($key < 10) {
-
 
80
						$fichier_message = '0'.$key;
-
 
81
					} else {
-
 
82
						$fichier_message = $decimal;
-
 
83
					}
-
 
84
					$repertoire_message = '0';
-
 
85
			}
61
        while (list($key,$val) = each($recent)) {
86
            
62
            print '<tr class="'.$class[$ctc].'">'."\n";
87
            print '<td>'.$key.'</td>' ;
63
            print '<td>'.$val->nummessage.'</td>' ;
88
            print '<td>';
64
            print '<td>';
89
 
65
            $hash = $this->makehash($val->headers['from']);
-
 
-
 
90
            $from = $val[4];
66
            
91
 
67
            print $this->makelink("action=show_author_msgs&actionargs[]=" . $hash,$this->decode_iso($this->protect_email($val->headers['from'],TRUE)));
92
            print $this->makelink("action=show_author_msgs&actionargs[]=".$val[3],$this->decode_iso($this->protect_email($from,false)));
68
            print "</td>\n";
93
            print "</td>\n";
69
            print '<td><b>';
94
            print '<td><b>';
Line 70... Line 95...
70
            $actionargs = preg_split("/\//", $val->msgfile);
95
            $actionargs = preg_split("/\//", $val->msgfile);
-
 
96
            
71
            if (count ($actionargs) > 2) {
97
            print $this->makelink("action=show_msg&actionargs[]=" .  $repertoire_message . 
Line 72... Line 98...
72
                print $this->makelink("action=show_msg&actionargs[]=" .  $actionargs[(count($actionargs) - 2)] . 
98
                                "&actionargs[]=" .  $fichier_message ,$this->decode_iso($val[1]));
73
                                "&actionargs[]=" .  $actionargs[(count($actionargs) - 1)] ,$this->decode_iso($val->headers['subject']));
99
 
74
            }
100
            print "</b></td>\n";
75
            print "</b></td>\n";
101
            
76
            
102
            //print '<td>'.$this->date_francaise($val[2]).'</td>'."\n";
77
            print '<td>'.$this->date_francaise($val->headers['date']).'</td>'."\n";
103
            print '<td>'.$val[2].'</td>'."\n";
Line 78... Line 104...
78
            print "</tr>\n";
104
            print "</tr>\n";
79
 
105
 
Line 80... Line 106...
80
            $ctc++;
106
            $ctc++;
81
            if ($ctc == 2) { $ctc = 0; }
107
            if ($ctc == 2) { $ctc = 0; }
82
        }
108
        }
83
        print '</table>'."\n";
109
        print '</table>'."\n";
Line 103... Line 129...
103
		
129
		
Line 104... Line 130...
104
		// On cherche le répertoire du premier mail
130
		// On cherche le répertoire du premier mail
Line -... Line 131...
-
 
131
        
-
 
132
        $repertoire_premier_mail = (int) ($numero_premier_mail / 100) ;
-
 
133
        
-
 
134
        // petite verification de coherence
-
 
135
        if ($numero_premier_mail > $numero_dernier_mail) {
-
 
136
        	$temp = $numero_premier_mail;
105
        
137
        	$numero_premier_mail = $numero_dernier_mail ;
106
        $repertoire_premier_mail = (int) ($numero_premier_mail / 100) ;
138
        	$numero_dernier_mail = $temp;
107
        
139
        }
Line 108... Line 140...
108
        print '<table class="table_cadre">'."\n";
140
        print '<table class="table_cadre">'."\n";
Line 116... Line 148...
116
                $multiplicateur = (int) ($i / 100) ;
148
                $multiplicateur = (int) ($i / 100) ;
117
                // pour les nails > 99, on retranche n fois 100, ex 256 => 56 cad 256 - 2 * 100 
149
                // pour les nails > 99, on retranche n fois 100, ex 256 => 56 cad 256 - 2 * 100 
118
                $i = $i - $multiplicateur * 100 ;
150
                $i = $i - $multiplicateur * 100 ;
119
            }
151
            }
120
            if ($i < 10) $num_message = '0'.$i ; else $num_message = $i ;
152
            if ($i < 10) $num_message = '0'.$i ; else $num_message = $i ;
121
            
-
 
-
 
153
            if (file_exists($this->listdir.'/archive/'.$repertoire_premier_mail.'/'.$num_message)) { 
122
            $mimeDecode = new Mail_mimeDecode(file_get_contents ($this->listdir.'/archive/'.$repertoire_premier_mail.'/'.$num_message)) ;
154
	            $mimeDecode = new Mail_mimeDecode(file_get_contents ($this->listdir.'/archive/'.$repertoire_premier_mail.'/'.$num_message)) ;
123
            $mailDecode = $mimeDecode->decode() ;
155
        	    $mailDecode = $mimeDecode->decode() ;
124
            if ($i == 99) {
156
            	if ($i == 99) {
125
                $repertoire_premier_mail++;
157
                	$repertoire_premier_mail++;
126
                $i = -1;
158
               	 $i = -1;
127
            }
159
            	}
128
            
160
            
129
            print '<tr class="'.$class[$ctc].'">'."\n";
161
           	 	print '<tr class="'.$class[$ctc].'">'."\n";
130
            print '<td>'.$repertoire_premier_mail.$num_message.'</td><td>';
162
            	print '<td>'.($repertoire_premier_mail != 0 ? $repertoire_premier_mail : '').$num_message.'</td><td>';
131
            $hash = $this->makehash($mailDecode->headers['from']);
163
            	$hash = $this->makehash($mailDecode->headers['from']);
132
            
164
            
-
 
165
            	print $this->makelink("action=show_author_msgs&actionargs[]=".
133
            print $this->makelink("action=show_author_msgs&actionargs[]=" . $hash,$this->decode_iso($this->protect_email($mailDecode->headers['from'],TRUE)));
166
            			$hash,$this->decode_iso($this->protect_email($mailDecode->headers['from'],TRUE)));
134
            print "</td>\n";
167
            	print "</td>\n";
135
            print '<td><b>';
168
            	print '<td><b>';
136
            $actionargs[0] = $repertoire_premier_mail ;
169
            	$actionargs[0] = $repertoire_premier_mail ;
137
            $actionargs[1] = $num_message ;
170
            	$actionargs[1] = $num_message ;
138
            
171
            
139
            if (count ($actionargs) > 1) {
172
           	 	if (count ($actionargs) > 1) {
140
                print $this->makelink("action=show_msg&actionargs[]=" .  $actionargs[(count($actionargs) - 2)] . 
173
                	print $this->makelink("action=show_msg&actionargs[]=".
-
 
174
                			$actionargs[(count($actionargs) - 2)] . 
-
 
175
                            "&actionargs[]=".
141
                                "&actionargs[]=" .  $actionargs[(count($actionargs) - 1)] ,$this->decode_iso($mailDecode->headers['subject']));
176
                            $actionargs[(count($actionargs) - 1)] ,$this->decode_iso($mailDecode->headers['subject']));
142
            }
177
            	}
143
            print "</b></td>\n";
178
            	print "</b></td>\n";
144
            print '<td>'.$this->date_francaise($mailDecode->headers['date']).'</td>'."\n";
179
           	 	print '<td>'.$this->date_francaise($mailDecode->headers['date']).'</td>'."\n";
145
            print "</tr>\n";
180
            	print "</tr>\n";
146
            $ctc++;
181
            	$ctc++;
147
            if ($ctc == 2) { $ctc = 0; }
182
            	if ($ctc == 2) { $ctc = 0; }
-
 
183
			}
148
        }
184
        }
149
        print '</table>'."\n";
185
        print '</table>'."\n";
150
        return true;
186
        return true;
151
    }
187
    }
152
}
188
}