Changeset 3150


Ignore:
Timestamp:
05/21/12 17:58:20 (12 months ago)
Author:
squidly
Message:

Modification des fonctions d'export de compte pour exporter en XML + ajout de l'export de la classe mail

Location:
alternc/trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • alternc/trunk/bureau/class/m_bro.php

    r3143 r3150  
    931931    $err->log("bro","export_conf"); 
    932932    $str="<table border=\"1\"><caption> Browser </caption>\n"; 
     933    $str="  <browser>\n"; 
    933934    $pref=$this->GetPrefs(); 
    934935     
     
    936937    foreach ($pref as $k=>$v) { 
    937938         if (($i % 2)==0){ 
    938             $str.="  <tr>\n"; 
    939             $str.="  <td>".$k."</td><td>".$v."</td>\n";  
    940             $str.="  </tr>\n"; 
    941        }  
     939            $str.="   <$k>$v</$k>\n";  
     940       } 
    942941        $i++; 
    943942    } 
    944     $str.="</table>\n"; 
     943    $str.=" </browser>\n"; 
    945944     
    946945    return $str; 
  • alternc/trunk/bureau/class/m_dom.php

    r3135 r3150  
    12901290    $err->log("dom","export"); 
    12911291    $this->enum_domains(); 
    1292     $str="<table border=\"1\"><caption>Domaines</caption><tr><th>Domaine</th><th>DNS</th><th>MX</th><th>mail</th></tr> \n"; 
    12931292    foreach ($this->domains as $d) { 
    1294         $str.="<tr>"; 
    1295         $str.="<td>".$d."</td>"; 
     1293        $str="  <domaines>\n"; 
     1294        $str.="   <nom>".$d."</nom>\n"; 
    12961295        $this->lock(); 
    12971296        $s=$this->get_domain_all($d); 
    12981297        $this->unlock(); 
    1299         if(empty($s[dns])){ 
     1298        if(empty($s["dns"])){ 
    13001299            $s[dns]="non";  
     1300        }else{ 
     1301            $s[dns]="oui"; 
    13011302        } 
    1302         $str.=" <td>".$s[dns]."</td>\n"; 
     1303        $str.="   <dns>".$s[dns]."</dns>\n"; 
    13031304         
    13041305        if(empty($s[mx])){ 
    13051306            $s[mx]="non";  
     1307        }else{ 
     1308            $s[mx]="oui"; 
    13061309        } 
    1307         $str.="<td>".$s[mx]."</td>\n"; 
     1310 
     1311        $str.="   <mx>".$s[mx]."</mx>\n"; 
    13081312 
    13091313        if(empty($s[mail])){ 
    13101314            $s[mail]="non";  
    13111315        } 
    1312         $str.="<td>".$s[mail]."</td>\n"; 
     1316        $str.="   <mail>".$s[mail]."</mail>\n"; 
    13131317        if (is_array($s[sub])) { 
    1314             $str.="<table border=\"1\"><th>nom sous domaine</th><th>destination</th><th>type</th><tr>"; 
    1315  
    13161318            foreach ($s[sub] as $sub) { 
    1317                   $str.="<tr><td>".$sub["enable"]." </td>"; 
    1318                   $str.="<td>".$sub["dest"]." </td>"; 
    1319                   $str.="<td>".$sub["type"]." </td></tr>"; 
     1319                  $str.="     <subdomain>\n"; 
     1320                  $str.="       <enabled>".$sub["enable"]." </enabled>\n"; 
     1321                  $str.="       <destination>".$sub["dest"]." </destination>\n"; 
     1322                  $str.="       <type>".$sub["type"]." </type>\n"; 
     1323                  $str.="     </subdomain>\n"; 
    13201324            } 
    13211325 
    1322             $str.="</tr>\n"; 
    13231326        } 
    1324         $str.="</table>\n"; 
    1325     } 
    1326     $str.="</table>\n"; 
     1327        $str.=" </domaines>\n"; 
     1328    } 
    13271329    return $str; 
    13281330  } 
  • alternc/trunk/bureau/class/m_ftp.php

    r3149 r3150  
    385385    $err->log("ftp","export"); 
    386386    $f=$this->get_list(); 
    387     $str="<table border=\"1\"><caption> FTP </caption>\n"; 
     387    $str="  <ftp>"; 
    388388    foreach ($f as $d=>$v) { 
    389       $str.="  <tr>\n"; 
    390       $str.="    <td>".$v["id"]."</td>\n"; 
    391       $str.="    <td>".($v["encrypted_password"])."</td>\n"; 
    392       $str.="    <td>".($v["login"])."</td>\n"; 
    393       $str.="    <td>".($v["dir"])."<td>\n"; 
    394       $str.="  </tr>\n"; 
    395     } 
    396     $str.="</table>\n"; 
     389      $str.="   <login>".($v["login"])."</login>\n"; 
     390      $str.="   <password>".($v["encrypted_password"])."</password>\n"; 
     391      $str.="   <directory>".($v["dir"])."<directory>\n"; 
     392    } 
     393    $str.=" </ftp>\n"; 
    397394    return $str; 
    398395  } 
  • alternc/trunk/bureau/class/m_mail.php

    r3149 r3150  
    106106      $this->enum_domain_mails[]=$db->Record; 
    107107    } 
    108      
    109108    return $this->enum_domain_mails; 
    110109  } 
     
    196195    foreach($return2 as $tab => $v){ 
    197196      if($v["state"] != true){ 
    198         print_r($tab); 
     197        //print_r($tab); 
    199198        $return["state"]=false; 
    200199        $return["error"]="erreur lors du check de la classe $tab"; 
     
    384383  } 
    385384 
    386  
     385/** 
     386* Export the mail information of an account  
     387* @return: str, chaine de caractere containing every usefull mail informations. 
     388* 
     389*/ 
     390function alternc_export_conf() { 
     391     global $db,$err,$mail_localbox; 
     392     $err->log("mail","export"); 
     393     $domain=$this->enum_domains(); 
     394     $str="<mail>\n"; 
     395     $onepop=false; 
     396     foreach ($domain as $d) { 
     397       $str.="  <domain>\n    <name>".xml_entities($d["domaine"])."</name>\n"; 
     398       $s=$this->enum_domain_mails($d["id"]); 
     399       if (count($s)) { 
     400         while (list($key,$val)=each($s)){ 
     401            $test=$this->mail_get_details($val['id']); 
     402           $str.="    <address>\n"; 
     403           $str.="      <name>".xml_entities($val["address"])."</name>\n"; 
     404           $str.="      <enabled>".xml_entities($val["enabled"])."</enabled>\n"; 
     405           if(is_array($test["is_local"])){ 
     406             $str.="      <islocal>oui</islocal>\n"; 
     407             $str.="      <path>".$test["is_local"]["path"]."</path>\n"; 
     408             $str.="      <quota>".$test["is_local"]["quota"]."</quota>\n"; 
     409           }else{ 
     410             $str.="      <islocal>non</islocal>\n"; 
     411          } 
     412          if(!empty($test["recipients"])){ 
     413              foreach($test["recipients"] as $recip){ 
     414                $str.="      <recipients>".$recip."<recipients>\n"; 
     415              } 
     416          } 
     417          if(!empty($test["alias"])){ 
     418              foreach($test["alias"] as $alias){ 
     419                $str.="      <alias>".$alias."<alias>\n"; 
     420              } 
     421          } 
     422       $str.="    </address>\n"; 
     423     } 
     424       }      
     425       $str.="  </domain>\n"; 
     426     } 
     427     $str.="</mail>\n"; 
     428     return $str; 
     429   } 
     430  
    387431 
    388432} /* Class m_mail */ 
  • alternc/trunk/bureau/class/m_mem.php

    r3135 r3150  
    559559    global $db,$err; 
    560560    $err->log("mem","export"); 
    561     $str="<table border=\"1\"><caption > Member </caption>\n"; 
     561    $str="  <member>\n"; 
    562562    $users=$this->user; 
    563       $str.="  <tr> <td>".$users["uid"]."</td></tr>\n"; 
    564       $str.="  <tr> <td>".$users["login"]."</td></tr>\n"; 
    565       $str.="  <tr> <td>".$users["enabled"]."</td></tr>\n"; 
    566       $str.="  <tr> <td>".$users["su"]."</td></tr>\n"; 
    567       $str.="  <tr> <td>".$users["pass"]."</td></tr>\n"; 
    568       $str.="  <tr> <td>".$users["mail"]."</td></tr>\n"; 
    569       $str.="  <tr> <td>".$users["created"]."</td></tr>\n"; 
    570       $str.="  <tr> <td>".$users["lastip"]."</td></tr>\n"; 
    571       $str.="  <tr> <td>".$users["lastlogin"]."</td></tr>\n"; 
    572       $str.="  <tr> <td>".$users["lastfail"]."</td></tr>\n"; 
    573     $str.="</table>\n"; 
     563      $str.="   <uid>".$users["uid"]."</uid>\n"; 
     564      $str.="   <login>".$users["login"]."</login>\n"; 
     565      $str.="   <enabled>".$users["enabled"]."</enabled>\n"; 
     566      $str.="   <su>".$users["su"]."</su>\n"; 
     567      $str.="   <password>".$users["pass"]."</password>\n"; 
     568      $str.="   <mail>".$users["mail"]."</mail>\n"; 
     569      $str.="   <created>".$users["created"]."</created>\n"; 
     570      $str.="   <lastip>".$users["lastip"]."</lastip>\n"; 
     571      $str.="   <lastlogin>".$users["lastlogin"]."</lastlogin>\n"; 
     572      $str.="   <lastfail>".$users["lastfail"]."</lastfail>\n"; 
     573    $str.=" </member>\n"; 
    574574    return $str; 
    575575  } 
  • alternc/trunk/bureau/class/m_mysql.php

    r3138 r3150  
    769769    $err->log("mysql","export"); 
    770770    $db->query("SELECT login, pass, db, bck_mode, bck_dir, bck_history, bck_gzip FROM db WHERE uid='$cuid';"); 
    771     $str.="<table border=\"1\"><caption>MyQSL</caption><th>login</th><th>pass</th>"; 
    772771    if ($db->next_record()) { 
    773       $str.="<tr>\n"; 
    774       $str.="  <td>".$db->Record["login"]."</td>"; 
    775       $str.="  <td>".$db->Record["pass"]."</td>"; 
    776       $str.="</tr>\n"; 
     772      $str.=" <sql>\n"; 
     773      $str.="   <login>".$db->Record["login"]."</login>\n"; 
     774      $str.="   <pass>".$db->Record["pass"]."</pass>\n"; 
    777775      do { 
    778776        $filename=$tmpdir."/mysql.".$db->Record["db"].".sql.gz"; 
    779         $str.="  <tr>\n"; 
    780         $str.="    <td>".($db->Record["db"])."</td>\n"; 
    781         $str.="    <td>".($db->Record["pass"])."</td>\n"; 
     777        $str.="   <database>".($db->Record["db"])."</database>\n"; 
     778        $str.="   <password>".($db->Record["pass"])."</password>\n"; 
    782779        if ($s["bck_mode"]!=0) { 
    783           $str.="    <table>\n"; 
    784           $str.="      <td>".($db->Record["bck_mode"])."</td>\n"; 
    785           $str.="      <td>".($db->Record["bck_dir"])."</td>\n"; 
    786           $str.="      <td>".($db->Record["bck_history"])."</td>\n"; 
    787           $str.="      <td>".($db->Record["bck_gzip"])."</td>\n"; 
    788           $str.="    </table>\n"; 
     780          $str.="   <backup-mode>".($db->Record["bck_mode"])."</backup-mode>\n"; 
     781          $str.="   <backup-dir>".($db->Record["bck_dir"])."</backup-dir>\n"; 
     782          $str.="   <backup-history>".($db->Record["bck_history"])."</backup-history>\n"; 
     783          $str.="   <backup-gzip>".($db->Record["bck_gzip"])."</backup-gzip>\n"; 
    789784        } 
    790         $str.="  </tr>\n"; 
    791785      } while ($db->next_record()); 
    792       $str.="</table>\n"; 
     786      $str.=" </sql>\n"; 
    793787    } 
    794788    return $str; 
     
    816810            exec ("/usr/bin/mysqldump --defaults-file=/etc/alternc/my.cnf --add-drop-table --allow-keywords -Q -f -q -a -e ".escapeshellarg($db->Record["db"])." |/bin/gzip >".escapeshellarg($filename)); 
    817811    } 
    818  
    819  
    820812} 
    821813 
  • alternc/trunk/bureau/class/m_quota.php

    r3147 r3150  
    370370   * EXPERIMENTAL 'sid' function ;)  
    371371   */ 
    372   function alternc_export_conf($tmpdir) { 
     372  function alternc_export_conf() { 
    373373    global $db,$err; 
    374374    $err->log("quota","export"); 
    375     $str="<table border=\"1\" ><caption>QUOTA</caption>\n"; 
     375    $str="  <quota>"; 
    376376 
    377377    $q=$this->getquota(); 
    378378    foreach ($q as $k=>$v) { 
    379       $str.="  <tr>\n    <td>".($k)."</td>\n"; 
    380       $str.="    <td>".($v[u])."</td>\n  \n"; 
    381       $str.="    <td>".($v[t])."</td>\n  </tr>\n"; 
    382     } 
    383     $str.="</table>\n"; 
     379      $str.=" <$k>\n"; 
     380      $str.="   <used>".($v["u"])."</used>\n"; 
     381      $str.="   <total>".($v["t"])."</total>\n"; 
     382      $str.=" </$k>\n"; 
     383    } 
     384    $str.="</quota>\n"; 
    384385    return $str; 
    385386  } 
  • alternc/trunk/src/export_account.php

    r3132 r3150  
    7373echo $file_conf; 
    7474$file=fopen($file_conf."dump","ab"); 
    75 fputs($file,"dump of ::".$mem->user["login"]."\n"); 
     75fputs($file,"<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?\> \n"); 
    7676 
    77 fputs($file,"alternc version:".$L_VERSION."\n\n"); 
    78 fputs($file,"<html><body>"); 
     77fputs($file,"<version>:".$L_VERSION."</version>\n"); 
     78fputs($file,"<user>".$mem->user["login"]."</user>\n"); 
    7979foreach($conf_user as $string){ 
    8080    fputs($file,$string); 
    8181} 
    82 fputs($file,"</html></body>"); 
     82//fputs($file,"</html></body>"); 
    8383fclose($file); 
    8484 
Note: See TracChangeset for help on using the changeset viewer.