websiteWebsite
bechamail Bechamail
Bechamail est un outil de gestion des adresses email par domaine, avant tout orienté utilisateur final.

 

Browse the code

Differences between 132 and 133 on /.
Number of edited files: 5 (0 added, 0 deleted and 5 modified)
Author: zenjo
Log message: Traitement des erreurs transport et MX
Date: 2010-01-01 15:02:49

Added file(s) Deleted file(s) Modified file(s)

 

Old New Code
3 3
<entry
4 4
   kind="dir"
5 5
   path="."
6  
   revision="131">
7  
<url>http://svn.codingteam.net/code/bechamail</url>
  6
   revision="132">
  7
<url>http://svn.codingteam.net/code/bechamail/versions/0.9.2.alpha</url>
8 8
<repository>
9 9
<root>http://svn.codingteam.net/code/bechamail</root>
10 10
<uuid>f9b7b763-9970-474c-87d9-ba888ff6c2cf</uuid>
13 13
<schedule>normal</schedule>
14 14
</wc-info>
15 15
<commit
16  
   revision="131">
  16
   revision="132">
17 17
<author>zenjo</author>
18  
<date>2009-12-30T11:40:56.218484Z</date>
  18
<date>2009-12-30T12:49:34.032951Z</date>
19 19
</commit>
20 20
</entry>
21 21
</info>
22 22

                                        

 

Old New Code
144 144
} // function insere_menu ($type)
145 145

                                        
146 146
//Transport et mx du domaine courant
147  
$transport_mx = "";
  147
$transport_mx = "";$format_avert_start = "";$format_avert_end = "";$transport_trouve = "";
148 148
if ($_SESSION["S_niveau"] == 1) {
149  
   $transport_mx .= " [Transport: ".retourne_transport($_SESSION['S_domaines_courant']);
150  
   $transport_mx .= " - MX: ".retourne_mx($_SESSION['S_domaines_courant'])."]";
  149
   $transport_trouve = retourne_transport($_SESSION['S_domaines_courant']);
  150
   $transport_mx .= " [Transport: ".$transport_trouve;
  151
   $result_mx = array(); $result_mx = retourne_mx($_SESSION['S_domaines_courant']);
  152
   $transport_mx .= " - MX: ".$result_mx["valeur"];
  153
   if ($result_mx["poid"] != "") {$transport_mx .= " (".$result_mx["poid"].")";}
  154
   $transport_mx .= "]";
  155
   $transport_mx = verif_correspondance_transport_mx($transport_mx, $transport_trouve, $result_mx["local"]);
151 156
   }
152 157

                                        
153 158
	/* Autres template var de tete.html */
154 159

                                        

 

Old New Code
212 212
$conf_alias_gen_transport = true;
213 213
//$conf_alias_gen_transport = false;
214 214

                                        
  215
// MX et transport
  216
// Un(et un seul de vos records MX 
  217
$conf_record_mx = "mail.cassiopea.org";
  218

                                    
  219
// Intiyule exacte de vos transports local (en general maildrop ou virtual) et remote (en general smtp)
  220
// dans la table des transports.
  221
$conf_transport_local = "maildrop:";
  222
$conf_transport_remote = "smtp:";
  223

                                    
215 224
// Gerer les log pour les alias et les login. le dossier $conf_path_log doit etre accessible en ecriture par apache
216 225
// le nom du fichier de log est: bechamail.log. $conf_name_log = identifiant du site bechamail dans les logs et dans l'en-tete
217 226
// $conf_path_log ne doit pas contenir de trail slash (de / final)
218 227

                                        

 

Old New Code
203 203
$conf_alias_gen_transport = true;
204 204
// $conf_alias_gen_transport = false;
205 205

                                        
  206
// MX et transport
  207
// Un(et un seul de vos records MX 
  208
$conf_record_mx = "mail.domain.tld";
  209

                                    
  210
// Intiyule exacte de vos transports local (en general maildrop ou virtual) et remote (en general smtp)
  211
// dans la table des transports.
  212
$conf_transport_local = "transport_local";
  213
$conf_transport_remote = "transport_remote";
  214

                                    
206 215
// Gerer les log pour les alias et les login. le dossier $conf_path_log doit etre accessible en ecriture par apache
207 216
// le nom du fichier de log est: bechamail.log. $conf_name_log = identifiant du site bechamail dans les logs et dans l'en-tete
208 217
// $conf_path_log ne doit pas contenir de trail slash (de / final)
209 218

                                        

 

Old New Code
274 274
   return $varget;
275 275
}
276 276

                                        
277  
// Retourne les MX d'un domaine.
  277
// Retourne les MX d'un domaine dans un tableau: 
  278
// string "valeur", string "poid", bool "existe", bool "local".
278 279
function retourne_mx ($hostname) {
279  
GLOBAL $conf_demo;
  280
GLOBAL $conf_demo, $conf_record_mx;
280 281
   if ($conf_demo) {return "Fonction désactivée dans la démo";}
281  
   $mxhosts=array();$weight=array();$chainemx="";
  282
   $mxhosts=array();$weight=array();$chainemx="";$poidmx="";
  283
   $mxarray = array("valeur" => "", "poid" => "", "existe" => false, "local" => false);
282 284
   if (getmxrr($hostname, $mxhosts, $weight)) {
283 285
      foreach($mxhosts as $wkey => $mxval) {
284  
         $chainemx .= $mxval." (".$weight[$wkey]."), ";
  286
         $chainemx .= $mxval.", ";
  287
         $poidmx .= $weight[$wkey].",";
285 288
         }
286  
      $chainemx = substr($chainemx,0,-2);
287  
      if ($chainemx=="") {return "Domaine trouvé, mais pas de MX";} else {return $chainemx;}
  289
      if ($chainemx != "") {
  290
         $mxarray["valeur"] = substr($chainemx,0,-2);
  291
         $mxarray["existe"] = true;
  292
         if (preg_match("/^.*".$conf_record_mx.".*$/", $mxarray["valeur"])) {$mxarray["local"] = true;}
  293
         }
  294
         else {$mxarray["valeur"] = "<span style='background:red;color:yellow;'>Domaine trouvé, pas de MX</span>";}
  295
      if ($poidmx != "") {$mxarray["poid"] = substr($poidmx,0,-1);}
288 296
      }
289  
   else {return "Domaine non trouvé";}
290  

                                    
  297
   else {$mxarray["valeur"] = "<span style='background:red;color:yellow;'>Domaine non trouvé</span>";}
  298
   return $mxarray;
291 299
}
292 300

                                        
293 301
// Retourne le transport d'un domaine.
300 308
	$whe = $conf_champ_domaine." like '".$domaine."'";
301 309
//echo "SELECT ".$sel." FROM ".$from." WHERE ". $whe;
302 310
	$transport_dom_dourant->RS_select($sel, $from, $whe);
303  
	mysql_free_result($transport_dom_dourant->RS_res);
  311
	mysql_free_result($transport_dom_dourant->RS_res);
  312
	if (is_null($transport_dom_dourant->RS_ligne[0][0])) 
  313
	   {return "<span style='background:red;color:yellow;'>Valeur NULL</span>";}
  314
	if ($transport_dom_dourant->RS_ligne[0][0] == "") 
  315
	   {return "<span style='background:red;color:yellow;'>Non trouvé</span>";}
304 316
   return $transport_dom_dourant->RS_ligne[0][0];
305 317
}
306 318

                                        
  319
// verifie la correspondance transport et MX (string (to return), stirng (transport), bool (MX local))
  320
function verif_correspondance_transport_mx($trmx, $tr, $mxlocal) {
  321
GLOBAL $conf_transport_local, $conf_transport_remote;
307 322

                                        
  323
   $ok = false;
  324
   if ($mxlocal AND $tr == $conf_transport_local) {$ok = true;}
  325
   if (!$mxlocal AND $tr == $conf_transport_remote) {$ok = true;}
  326
   if ($ok) {$trmx = $trmx;}
  327
      else {$trmx = "<span style='background:red;color:yellow;'>".$trmx."</span>";}
  328
   return $trmx;
  329
}
  330

                                    
308 331
// for the fun ;-)
309 332
function exclamation() {
310 333
GLOBAL $conf_exclamation_erreur;
311 334