Subversion Repositories Applications.projet

Rev

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

Rev 392 Rev 393
Line 13... Line 13...
13
    function ezmlm_listinfo () {
13
    function ezmlm_listinfo () {
14
        //return is_dir($this->listdir.'/archive/0') ;
14
        //return is_dir($this->listdir.'/archive/0') ;
15
    }
15
    }
16
	function display() {
16
	function display() {
Line 17... Line 17...
17
	        
17
	        
18
        if (!is_dir($this->listdir.'/archive/0')) {  // On teste si il y a au moins un message, cad le r�pertoire 0
18
        if (!is_dir($this->listdir.'/archive/0')) {  // On teste si il y a au moins un message, cad le répertoire 0
Line 19... Line 19...
19
            echo $this->listdir.'/archive/0' ;
19
            echo $this->listdir.'/archive/0' ;
20
            
20
            
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") {
Line 128... Line 128...
128
        $ctc = 0;
128
        $ctc = 0;
Line 129... Line 129...
129
        
129
        
Line 130... Line 130...
130
        $class = array ('ligne_paire', 'ligne_impaire') ;
130
        $class = array ('ligne_paire', 'ligne_impaire') ;
131
 
131
 
132
	if(count($numeros_mails_mois) > 0) {
132
	if(count($numeros_mails_mois) > 0) {
Line 133... Line 133...
133
	    $repertoire_premier_mail = (int) ($numeros_mails_mois[0] / 100) ;
133
	    $repertoire_premier_mail = (int) (reset($numeros_mails_mois) / 100) ;
Line 134... Line 134...
134
	}
134
	}
Line 173... Line 173...
173
            	$html .= "</b></td>\n";
173
            	$html .= "</b></td>\n";
174
           	 	$html .= '<td>'.$this->date_francaise($mailDecode->headers['date']).'</td>'."\n";
174
           	 	$html .= '<td>'.$this->date_francaise($mailDecode->headers['date']).'</td>'."\n";
175
            	$html .= "</tr>\n";
175
            	$html .= "</tr>\n";
176
            	$ctc++;
176
            	$ctc++;
177
            	if ($ctc == 2) { $ctc = 0; }
177
            	if ($ctc == 2) { $ctc = 0; }
178
			}
178
	    }
179
        }
179
        }
-
 
180
 
180
        $html .= '</table>'."\n";
181
        $html .= '</table>'."\n";
Line 181... Line 182...
181
 
182
 
182
        return $html;
183
        return $html;
Line 183... Line 184...
183
    }
184
    }
Line 184... Line -...
184
 
-
 
185
    private function calculerNumMessagesDansMois($mois) {
-
 
186
 
-
 
187
		/* Pour le calcul du nombre de message par mois 
-
 
188
		* 1 => ouvrir fichier /archive/threads/yyyymm qui contient les sujets abordés dans le mois
-
 
189
		* 2 => pour chaque ligne: 
-
 
190
		* 	a =>  extraire l'id du du premier message (1er nombre de la ligne)
-
 
191
		* 	b =>  extraire l'id du sujet et ouvrir le fichier concerné dans /archive/subjects/
-
 
192
		*     b1 => pour chaque ligne du fichier des sujets extraire les id des messages concernés 
-
 
193
		*     s'ils sont dans le mois demandé
-
 
194
		*/		
185
 
195
 
186
    private function calculerNumMessagesDansMois($mois) {
Line 196... Line 187...
196
		// étape 1
187
 
Line 197... Line 188...
197
		$fd = file_get_contents($this->listdir . '/archive/threads/'.$mois, 'r');
188
	$fd = file_get_contents($this->listdir . '/archive/threads/'.$mois, 'r');
Line 198... Line 189...
198
        $fichier = explode ("\n", $fd) ;
189
        $fichier = explode ("\n", $fd) ;
Line 199... Line 190...
199
 
190
 
200
        $premiere_ligne = $fichier[0] ;
191
        $premiere_ligne = $fichier[0] ;
Line 201... Line 192...
201
 
192
 
Line 202... Line -...
202
		$nb_lignes_fichier = count($fichier);
-
 
203
 
193
	$nb_lignes_fichier = count($fichier);
204
		$lignes_messages = array();
194
 
205
	        
195
	$lignes_messages = array();
206
        preg_match ('/[0-9]+/', $premiere_ligne, $match) ;
-
 
207
        $numero_premier_mail  = $match[0] ;
-
 
208
 
196
	        
209
		$lignes_messages[$numero_premier_mail] = $numero_premier_mail;
-
 
210
 
197
        preg_match ('/[0-9]+/', $premiere_ligne, $match) ;
211
		// étape 2
198
        $numero_premier_mail  = $match[0] ;
212
		foreach($fichier as $ligne) {
199
 
213
	
200
	$lignes_messages[$numero_premier_mail] = $numero_premier_mail;
214
		      if(trim($ligne == '')) { continue ;}
-
 
215
		      // Une ligne du fichier mois se présente comme ceci
201
 
216
			  //numero_premier_message_sujet:md5_sujet [nb_messages_sujet] titre_sujet
202
	foreach($fichier as $ligne) {
217
	
203
 
218
			  // étape 2 a 
204
	      if(trim($ligne == '')) { continue ;}
219
		      $ligne_tableau = explode(' ', $ligne);
-
 
220
		      $num_mail_sujet = explode(':',$ligne_tableau[0]);
-
 
221
		      $num_sujet =  $num_mail_sujet[1];
-
 
222
	
-
 
223
			  // étape 2 b
205
 
224
		      $fd_sujet = file_get_contents($this->listdir.'/archive/subjects/'.substr($num_sujet,0,2).'/'.substr($num_sujet,2,strlen($num_sujet) - 1), 'r');
-
 
225
		      $premiere_ligne = true;
206
	      $ligne_tableau = explode(' ', $ligne);
226
	
207
	      $num_mail_sujet = explode(':',$ligne_tableau[0]);
227
		      $fichier_sujet = explode ("\n", $fd_sujet) ;
208
	      $num_sujet =  $num_mail_sujet[1];
228
		      // La première ligne d'un fichier de sujet se présente ainsi 
209
 
229
		      // md5_sujet titre_sujet
210
	      $fd_sujet = file_get_contents($this->listdir.'/archive/subjects/'.substr($num_sujet,0,2).'/'.substr($num_sujet,2,strlen($num_sujet) - 1), 'r');
230
		      // Les lignes suivante sont de la forme :
211
	      $premiere_ligne = true;
-
 
212
 
-
 
213
	      $fichier_sujet = explode ("\n", $fd_sujet) ;
-
 
214
	      foreach($fichier_sujet as $ligne_sujet) {
-
 
215
 
231
			  // id_message:yyyymm:id_message_fichier_index nom_expediteur
216
		if($premiere_ligne || trim($ligne_sujet) == '') {$premiere_ligne = false; continue; }
-
 
217
		  $ligne_tableau_sujet = explode(':', $ligne_sujet);
232
		      foreach($fichier_sujet as $ligne_sujet) {
218
		  $num_mail =  $ligne_tableau_sujet[0];
233
				if($premiere_ligne || trim($ligne_sujet) == '') {$premiere_ligne = false; continue; }
219
		  $mois_ligne =  $ligne_tableau_sujet[1];
234
	
220
		  if($mois_ligne == $mois) {
Line 235... Line -...
235
			      // étape 2 b b1
-
 
236
				  $ligne_tableau_sujet = explode(':', $ligne_sujet);
221
			if(is_numeric($num_mail)) {
237
				  $num_mail =  $ligne_tableau_sujet[0];
222
			    $lignes_messages[$num_mail] = $num_mail;
238
				  $mois_ligne =  $ligne_tableau_sujet[1];
223
			} else {
239
				  if($mois_ligne == $mois) {
224
			    $num_mail = preg_replace('/[^0-9]+/','', $num_mail) ;
240
				    	$lignes_messages[$num_mail] = $num_mail;
225
			    $lignes_messages[$num_mail] = $num_mail;
241
			  	  }
226
			}