Modification des fonctions d'export de compte pour exporter en XML + ajout de l'export de la classe mail
This commit is contained in:
parent
8910c3e604
commit
68888932dd
|
@ -930,18 +930,17 @@ function alternc_export_conf() {
|
|||
global $db,$err;
|
||||
$err->log("bro","export_conf");
|
||||
$str="<table border=\"1\"><caption> Browser </caption>\n";
|
||||
$str=" <browser>\n";
|
||||
$pref=$this->GetPrefs();
|
||||
|
||||
$i=1;
|
||||
foreach ($pref as $k=>$v) {
|
||||
if (($i % 2)==0){
|
||||
$str.=" <tr>\n";
|
||||
$str.=" <td>".$k."</td><td>".$v."</td>\n";
|
||||
$str.=" </tr>\n";
|
||||
}
|
||||
$str.=" <$k>$v</$k>\n";
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
$str.="</table>\n";
|
||||
$str.=" </browser>\n";
|
||||
|
||||
return $str;
|
||||
}
|
||||
|
|
|
@ -1289,41 +1289,43 @@ class m_dom {
|
|||
global $db,$err;
|
||||
$err->log("dom","export");
|
||||
$this->enum_domains();
|
||||
$str="<table border=\"1\"><caption>Domaines</caption><tr><th>Domaine</th><th>DNS</th><th>MX</th><th>mail</th></tr> \n";
|
||||
foreach ($this->domains as $d) {
|
||||
$str.="<tr>";
|
||||
$str.="<td>".$d."</td>";
|
||||
$str=" <domaines>\n";
|
||||
$str.=" <nom>".$d."</nom>\n";
|
||||
$this->lock();
|
||||
$s=$this->get_domain_all($d);
|
||||
$this->unlock();
|
||||
if(empty($s[dns])){
|
||||
if(empty($s["dns"])){
|
||||
$s[dns]="non";
|
||||
}else{
|
||||
$s[dns]="oui";
|
||||
}
|
||||
$str.=" <td>".$s[dns]."</td>\n";
|
||||
$str.=" <dns>".$s[dns]."</dns>\n";
|
||||
|
||||
if(empty($s[mx])){
|
||||
$s[mx]="non";
|
||||
}else{
|
||||
$s[mx]="oui";
|
||||
}
|
||||
$str.="<td>".$s[mx]."</td>\n";
|
||||
|
||||
$str.=" <mx>".$s[mx]."</mx>\n";
|
||||
|
||||
if(empty($s[mail])){
|
||||
$s[mail]="non";
|
||||
}
|
||||
$str.="<td>".$s[mail]."</td>\n";
|
||||
$str.=" <mail>".$s[mail]."</mail>\n";
|
||||
if (is_array($s[sub])) {
|
||||
$str.="<table border=\"1\"><th>nom sous domaine</th><th>destination</th><th>type</th><tr>";
|
||||
|
||||
foreach ($s[sub] as $sub) {
|
||||
$str.="<tr><td>".$sub["enable"]." </td>";
|
||||
$str.="<td>".$sub["dest"]." </td>";
|
||||
$str.="<td>".$sub["type"]." </td></tr>";
|
||||
$str.=" <subdomain>\n";
|
||||
$str.=" <enabled>".$sub["enable"]." </enabled>\n";
|
||||
$str.=" <destination>".$sub["dest"]." </destination>\n";
|
||||
$str.=" <type>".$sub["type"]." </type>\n";
|
||||
$str.=" </subdomain>\n";
|
||||
}
|
||||
|
||||
$str.="</tr>\n";
|
||||
}
|
||||
$str.="</table>\n";
|
||||
$str.=" </domaines>\n";
|
||||
}
|
||||
$str.="</table>\n";
|
||||
return $str;
|
||||
}
|
||||
|
||||
|
|
|
@ -384,16 +384,13 @@ class m_ftp {
|
|||
global $db,$err;
|
||||
$err->log("ftp","export");
|
||||
$f=$this->get_list();
|
||||
$str="<table border=\"1\"><caption> FTP </caption>\n";
|
||||
$str=" <ftp>";
|
||||
foreach ($f as $d=>$v) {
|
||||
$str.=" <tr>\n";
|
||||
$str.=" <td>".$v["id"]."</td>\n";
|
||||
$str.=" <td>".($v["encrypted_password"])."</td>\n";
|
||||
$str.=" <td>".($v["login"])."</td>\n";
|
||||
$str.=" <td>".($v["dir"])."<td>\n";
|
||||
$str.=" </tr>\n";
|
||||
$str.=" <login>".($v["login"])."</login>\n";
|
||||
$str.=" <password>".($v["encrypted_password"])."</password>\n";
|
||||
$str.=" <directory>".($v["dir"])."<directory>\n";
|
||||
}
|
||||
$str.="</table>\n";
|
||||
$str.=" </ftp>\n";
|
||||
return $str;
|
||||
}
|
||||
|
||||
|
|
|
@ -105,7 +105,6 @@ class m_mail {
|
|||
while($db->next_record()){
|
||||
$this->enum_domain_mails[]=$db->Record;
|
||||
}
|
||||
|
||||
return $this->enum_domain_mails;
|
||||
}
|
||||
|
||||
|
@ -195,7 +194,7 @@ class m_mail {
|
|||
|
||||
foreach($return2 as $tab => $v){
|
||||
if($v["state"] != true){
|
||||
print_r($tab);
|
||||
//print_r($tab);
|
||||
$return["state"]=false;
|
||||
$return["error"]="erreur lors du check de la classe $tab";
|
||||
return $return;
|
||||
|
@ -383,7 +382,52 @@ class m_mail {
|
|||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Export the mail information of an account
|
||||
* @return: str, chaine de caractere containing every usefull mail informations.
|
||||
*
|
||||
*/
|
||||
function alternc_export_conf() {
|
||||
global $db,$err,$mail_localbox;
|
||||
$err->log("mail","export");
|
||||
$domain=$this->enum_domains();
|
||||
$str="<mail>\n";
|
||||
$onepop=false;
|
||||
foreach ($domain as $d) {
|
||||
$str.=" <domain>\n <name>".xml_entities($d["domaine"])."</name>\n";
|
||||
$s=$this->enum_domain_mails($d["id"]);
|
||||
if (count($s)) {
|
||||
while (list($key,$val)=each($s)){
|
||||
$test=$this->mail_get_details($val['id']);
|
||||
$str.=" <address>\n";
|
||||
$str.=" <name>".xml_entities($val["address"])."</name>\n";
|
||||
$str.=" <enabled>".xml_entities($val["enabled"])."</enabled>\n";
|
||||
if(is_array($test["is_local"])){
|
||||
$str.=" <islocal>oui</islocal>\n";
|
||||
$str.=" <path>".$test["is_local"]["path"]."</path>\n";
|
||||
$str.=" <quota>".$test["is_local"]["quota"]."</quota>\n";
|
||||
}else{
|
||||
$str.=" <islocal>non</islocal>\n";
|
||||
}
|
||||
if(!empty($test["recipients"])){
|
||||
foreach($test["recipients"] as $recip){
|
||||
$str.=" <recipients>".$recip."<recipients>\n";
|
||||
}
|
||||
}
|
||||
if(!empty($test["alias"])){
|
||||
foreach($test["alias"] as $alias){
|
||||
$str.=" <alias>".$alias."<alias>\n";
|
||||
}
|
||||
}
|
||||
$str.=" </address>\n";
|
||||
}
|
||||
}
|
||||
$str.=" </domain>\n";
|
||||
}
|
||||
$str.="</mail>\n";
|
||||
return $str;
|
||||
}
|
||||
|
||||
|
||||
} /* Class m_mail */
|
||||
|
||||
|
|
|
@ -558,19 +558,19 @@ Cordialement.
|
|||
function alternc_export_conf() {
|
||||
global $db,$err;
|
||||
$err->log("mem","export");
|
||||
$str="<table border=\"1\"><caption > Member </caption>\n";
|
||||
$str=" <member>\n";
|
||||
$users=$this->user;
|
||||
$str.=" <tr> <td>".$users["uid"]."</td></tr>\n";
|
||||
$str.=" <tr> <td>".$users["login"]."</td></tr>\n";
|
||||
$str.=" <tr> <td>".$users["enabled"]."</td></tr>\n";
|
||||
$str.=" <tr> <td>".$users["su"]."</td></tr>\n";
|
||||
$str.=" <tr> <td>".$users["pass"]."</td></tr>\n";
|
||||
$str.=" <tr> <td>".$users["mail"]."</td></tr>\n";
|
||||
$str.=" <tr> <td>".$users["created"]."</td></tr>\n";
|
||||
$str.=" <tr> <td>".$users["lastip"]."</td></tr>\n";
|
||||
$str.=" <tr> <td>".$users["lastlogin"]."</td></tr>\n";
|
||||
$str.=" <tr> <td>".$users["lastfail"]."</td></tr>\n";
|
||||
$str.="</table>\n";
|
||||
$str.=" <uid>".$users["uid"]."</uid>\n";
|
||||
$str.=" <login>".$users["login"]."</login>\n";
|
||||
$str.=" <enabled>".$users["enabled"]."</enabled>\n";
|
||||
$str.=" <su>".$users["su"]."</su>\n";
|
||||
$str.=" <password>".$users["pass"]."</password>\n";
|
||||
$str.=" <mail>".$users["mail"]."</mail>\n";
|
||||
$str.=" <created>".$users["created"]."</created>\n";
|
||||
$str.=" <lastip>".$users["lastip"]."</lastip>\n";
|
||||
$str.=" <lastlogin>".$users["lastlogin"]."</lastlogin>\n";
|
||||
$str.=" <lastfail>".$users["lastfail"]."</lastfail>\n";
|
||||
$str.=" </member>\n";
|
||||
return $str;
|
||||
}
|
||||
|
||||
|
|
|
@ -768,28 +768,22 @@ class m_mysql {
|
|||
global $db,$err,$cuid;
|
||||
$err->log("mysql","export");
|
||||
$db->query("SELECT login, pass, db, bck_mode, bck_dir, bck_history, bck_gzip FROM db WHERE uid='$cuid';");
|
||||
$str.="<table border=\"1\"><caption>MyQSL</caption><th>login</th><th>pass</th>";
|
||||
if ($db->next_record()) {
|
||||
$str.="<tr>\n";
|
||||
$str.=" <td>".$db->Record["login"]."</td>";
|
||||
$str.=" <td>".$db->Record["pass"]."</td>";
|
||||
$str.="</tr>\n";
|
||||
$str.=" <sql>\n";
|
||||
$str.=" <login>".$db->Record["login"]."</login>\n";
|
||||
$str.=" <pass>".$db->Record["pass"]."</pass>\n";
|
||||
do {
|
||||
$filename=$tmpdir."/mysql.".$db->Record["db"].".sql.gz";
|
||||
$str.=" <tr>\n";
|
||||
$str.=" <td>".($db->Record["db"])."</td>\n";
|
||||
$str.=" <td>".($db->Record["pass"])."</td>\n";
|
||||
$str.=" <database>".($db->Record["db"])."</database>\n";
|
||||
$str.=" <password>".($db->Record["pass"])."</password>\n";
|
||||
if ($s["bck_mode"]!=0) {
|
||||
$str.=" <table>\n";
|
||||
$str.=" <td>".($db->Record["bck_mode"])."</td>\n";
|
||||
$str.=" <td>".($db->Record["bck_dir"])."</td>\n";
|
||||
$str.=" <td>".($db->Record["bck_history"])."</td>\n";
|
||||
$str.=" <td>".($db->Record["bck_gzip"])."</td>\n";
|
||||
$str.=" </table>\n";
|
||||
$str.=" <backup-mode>".($db->Record["bck_mode"])."</backup-mode>\n";
|
||||
$str.=" <backup-dir>".($db->Record["bck_dir"])."</backup-dir>\n";
|
||||
$str.=" <backup-history>".($db->Record["bck_history"])."</backup-history>\n";
|
||||
$str.=" <backup-gzip>".($db->Record["bck_gzip"])."</backup-gzip>\n";
|
||||
}
|
||||
$str.=" </tr>\n";
|
||||
} while ($db->next_record());
|
||||
$str.="</table>\n";
|
||||
$str.=" </sql>\n";
|
||||
}
|
||||
return $str;
|
||||
}
|
||||
|
@ -815,8 +809,6 @@ function alternc_export_data ($dir){
|
|||
$filename=$dir."mysql.".$db->Record["db"].".".date("H:i:s").".sql.gz";
|
||||
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));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -369,18 +369,19 @@ class m_quota {
|
|||
* @access private
|
||||
* EXPERIMENTAL 'sid' function ;)
|
||||
*/
|
||||
function alternc_export_conf($tmpdir) {
|
||||
function alternc_export_conf() {
|
||||
global $db,$err;
|
||||
$err->log("quota","export");
|
||||
$str="<table border=\"1\" ><caption>QUOTA</caption>\n";
|
||||
$str=" <quota>";
|
||||
|
||||
$q=$this->getquota();
|
||||
foreach ($q as $k=>$v) {
|
||||
$str.=" <tr>\n <td>".($k)."</td>\n";
|
||||
$str.=" <td>".($v[u])."</td>\n \n";
|
||||
$str.=" <td>".($v[t])."</td>\n </tr>\n";
|
||||
$str.=" <$k>\n";
|
||||
$str.=" <used>".($v["u"])."</used>\n";
|
||||
$str.=" <total>".($v["t"])."</total>\n";
|
||||
$str.=" </$k>\n";
|
||||
}
|
||||
$str.="</table>\n";
|
||||
$str.="</quota>\n";
|
||||
return $str;
|
||||
}
|
||||
|
||||
|
|
|
@ -72,14 +72,14 @@ $conf_user=$export->export_conf();
|
|||
$file_conf=$dir."dump_conf_".date("H:i:s");
|
||||
echo $file_conf;
|
||||
$file=fopen($file_conf."dump","ab");
|
||||
fputs($file,"dump of ::".$mem->user["login"]."\n");
|
||||
fputs($file,"<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?\> \n");
|
||||
|
||||
fputs($file,"alternc version:".$L_VERSION."\n\n");
|
||||
fputs($file,"<html><body>");
|
||||
fputs($file,"<version>:".$L_VERSION."</version>\n");
|
||||
fputs($file,"<user>".$mem->user["login"]."</user>\n");
|
||||
foreach($conf_user as $string){
|
||||
fputs($file,$string);
|
||||
}
|
||||
fputs($file,"</html></body>");
|
||||
//fputs($file,"</html></body>");
|
||||
fclose($file);
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue