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;
|
global $db,$err;
|
||||||
$err->log("bro","export_conf");
|
$err->log("bro","export_conf");
|
||||||
$str="<table border=\"1\"><caption> Browser </caption>\n";
|
$str="<table border=\"1\"><caption> Browser </caption>\n";
|
||||||
|
$str=" <browser>\n";
|
||||||
$pref=$this->GetPrefs();
|
$pref=$this->GetPrefs();
|
||||||
|
|
||||||
$i=1;
|
$i=1;
|
||||||
foreach ($pref as $k=>$v) {
|
foreach ($pref as $k=>$v) {
|
||||||
if (($i % 2)==0){
|
if (($i % 2)==0){
|
||||||
$str.=" <tr>\n";
|
$str.=" <$k>$v</$k>\n";
|
||||||
$str.=" <td>".$k."</td><td>".$v."</td>\n";
|
|
||||||
$str.=" </tr>\n";
|
|
||||||
}
|
}
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
$str.="</table>\n";
|
$str.=" </browser>\n";
|
||||||
|
|
||||||
return $str;
|
return $str;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1289,41 +1289,43 @@ class m_dom {
|
||||||
global $db,$err;
|
global $db,$err;
|
||||||
$err->log("dom","export");
|
$err->log("dom","export");
|
||||||
$this->enum_domains();
|
$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) {
|
foreach ($this->domains as $d) {
|
||||||
$str.="<tr>";
|
$str=" <domaines>\n";
|
||||||
$str.="<td>".$d."</td>";
|
$str.=" <nom>".$d."</nom>\n";
|
||||||
$this->lock();
|
$this->lock();
|
||||||
$s=$this->get_domain_all($d);
|
$s=$this->get_domain_all($d);
|
||||||
$this->unlock();
|
$this->unlock();
|
||||||
if(empty($s[dns])){
|
if(empty($s["dns"])){
|
||||||
$s[dns]="non";
|
$s[dns]="non";
|
||||||
|
}else{
|
||||||
|
$s[dns]="oui";
|
||||||
}
|
}
|
||||||
$str.=" <td>".$s[dns]."</td>\n";
|
$str.=" <dns>".$s[dns]."</dns>\n";
|
||||||
|
|
||||||
if(empty($s[mx])){
|
if(empty($s[mx])){
|
||||||
$s[mx]="non";
|
$s[mx]="non";
|
||||||
|
}else{
|
||||||
|
$s[mx]="oui";
|
||||||
}
|
}
|
||||||
$str.="<td>".$s[mx]."</td>\n";
|
|
||||||
|
$str.=" <mx>".$s[mx]."</mx>\n";
|
||||||
|
|
||||||
if(empty($s[mail])){
|
if(empty($s[mail])){
|
||||||
$s[mail]="non";
|
$s[mail]="non";
|
||||||
}
|
}
|
||||||
$str.="<td>".$s[mail]."</td>\n";
|
$str.=" <mail>".$s[mail]."</mail>\n";
|
||||||
if (is_array($s[sub])) {
|
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) {
|
foreach ($s[sub] as $sub) {
|
||||||
$str.="<tr><td>".$sub["enable"]." </td>";
|
$str.=" <subdomain>\n";
|
||||||
$str.="<td>".$sub["dest"]." </td>";
|
$str.=" <enabled>".$sub["enable"]." </enabled>\n";
|
||||||
$str.="<td>".$sub["type"]." </td></tr>";
|
$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;
|
return $str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -384,16 +384,13 @@ class m_ftp {
|
||||||
global $db,$err;
|
global $db,$err;
|
||||||
$err->log("ftp","export");
|
$err->log("ftp","export");
|
||||||
$f=$this->get_list();
|
$f=$this->get_list();
|
||||||
$str="<table border=\"1\"><caption> FTP </caption>\n";
|
$str=" <ftp>";
|
||||||
foreach ($f as $d=>$v) {
|
foreach ($f as $d=>$v) {
|
||||||
$str.=" <tr>\n";
|
$str.=" <login>".($v["login"])."</login>\n";
|
||||||
$str.=" <td>".$v["id"]."</td>\n";
|
$str.=" <password>".($v["encrypted_password"])."</password>\n";
|
||||||
$str.=" <td>".($v["encrypted_password"])."</td>\n";
|
$str.=" <directory>".($v["dir"])."<directory>\n";
|
||||||
$str.=" <td>".($v["login"])."</td>\n";
|
|
||||||
$str.=" <td>".($v["dir"])."<td>\n";
|
|
||||||
$str.=" </tr>\n";
|
|
||||||
}
|
}
|
||||||
$str.="</table>\n";
|
$str.=" </ftp>\n";
|
||||||
return $str;
|
return $str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -105,7 +105,6 @@ class m_mail {
|
||||||
while($db->next_record()){
|
while($db->next_record()){
|
||||||
$this->enum_domain_mails[]=$db->Record;
|
$this->enum_domain_mails[]=$db->Record;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->enum_domain_mails;
|
return $this->enum_domain_mails;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -195,7 +194,7 @@ class m_mail {
|
||||||
|
|
||||||
foreach($return2 as $tab => $v){
|
foreach($return2 as $tab => $v){
|
||||||
if($v["state"] != true){
|
if($v["state"] != true){
|
||||||
print_r($tab);
|
//print_r($tab);
|
||||||
$return["state"]=false;
|
$return["state"]=false;
|
||||||
$return["error"]="erreur lors du check de la classe $tab";
|
$return["error"]="erreur lors du check de la classe $tab";
|
||||||
return $return;
|
return $return;
|
||||||
|
@ -383,6 +382,51 @@ 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 */
|
} /* Class m_mail */
|
||||||
|
|
|
@ -558,19 +558,19 @@ Cordialement.
|
||||||
function alternc_export_conf() {
|
function alternc_export_conf() {
|
||||||
global $db,$err;
|
global $db,$err;
|
||||||
$err->log("mem","export");
|
$err->log("mem","export");
|
||||||
$str="<table border=\"1\"><caption > Member </caption>\n";
|
$str=" <member>\n";
|
||||||
$users=$this->user;
|
$users=$this->user;
|
||||||
$str.=" <tr> <td>".$users["uid"]."</td></tr>\n";
|
$str.=" <uid>".$users["uid"]."</uid>\n";
|
||||||
$str.=" <tr> <td>".$users["login"]."</td></tr>\n";
|
$str.=" <login>".$users["login"]."</login>\n";
|
||||||
$str.=" <tr> <td>".$users["enabled"]."</td></tr>\n";
|
$str.=" <enabled>".$users["enabled"]."</enabled>\n";
|
||||||
$str.=" <tr> <td>".$users["su"]."</td></tr>\n";
|
$str.=" <su>".$users["su"]."</su>\n";
|
||||||
$str.=" <tr> <td>".$users["pass"]."</td></tr>\n";
|
$str.=" <password>".$users["pass"]."</password>\n";
|
||||||
$str.=" <tr> <td>".$users["mail"]."</td></tr>\n";
|
$str.=" <mail>".$users["mail"]."</mail>\n";
|
||||||
$str.=" <tr> <td>".$users["created"]."</td></tr>\n";
|
$str.=" <created>".$users["created"]."</created>\n";
|
||||||
$str.=" <tr> <td>".$users["lastip"]."</td></tr>\n";
|
$str.=" <lastip>".$users["lastip"]."</lastip>\n";
|
||||||
$str.=" <tr> <td>".$users["lastlogin"]."</td></tr>\n";
|
$str.=" <lastlogin>".$users["lastlogin"]."</lastlogin>\n";
|
||||||
$str.=" <tr> <td>".$users["lastfail"]."</td></tr>\n";
|
$str.=" <lastfail>".$users["lastfail"]."</lastfail>\n";
|
||||||
$str.="</table>\n";
|
$str.=" </member>\n";
|
||||||
return $str;
|
return $str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -768,28 +768,22 @@ class m_mysql {
|
||||||
global $db,$err,$cuid;
|
global $db,$err,$cuid;
|
||||||
$err->log("mysql","export");
|
$err->log("mysql","export");
|
||||||
$db->query("SELECT login, pass, db, bck_mode, bck_dir, bck_history, bck_gzip FROM db WHERE uid='$cuid';");
|
$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()) {
|
if ($db->next_record()) {
|
||||||
$str.="<tr>\n";
|
$str.=" <sql>\n";
|
||||||
$str.=" <td>".$db->Record["login"]."</td>";
|
$str.=" <login>".$db->Record["login"]."</login>\n";
|
||||||
$str.=" <td>".$db->Record["pass"]."</td>";
|
$str.=" <pass>".$db->Record["pass"]."</pass>\n";
|
||||||
$str.="</tr>\n";
|
|
||||||
do {
|
do {
|
||||||
$filename=$tmpdir."/mysql.".$db->Record["db"].".sql.gz";
|
$filename=$tmpdir."/mysql.".$db->Record["db"].".sql.gz";
|
||||||
$str.=" <tr>\n";
|
$str.=" <database>".($db->Record["db"])."</database>\n";
|
||||||
$str.=" <td>".($db->Record["db"])."</td>\n";
|
$str.=" <password>".($db->Record["pass"])."</password>\n";
|
||||||
$str.=" <td>".($db->Record["pass"])."</td>\n";
|
|
||||||
if ($s["bck_mode"]!=0) {
|
if ($s["bck_mode"]!=0) {
|
||||||
$str.=" <table>\n";
|
$str.=" <backup-mode>".($db->Record["bck_mode"])."</backup-mode>\n";
|
||||||
$str.=" <td>".($db->Record["bck_mode"])."</td>\n";
|
$str.=" <backup-dir>".($db->Record["bck_dir"])."</backup-dir>\n";
|
||||||
$str.=" <td>".($db->Record["bck_dir"])."</td>\n";
|
$str.=" <backup-history>".($db->Record["bck_history"])."</backup-history>\n";
|
||||||
$str.=" <td>".($db->Record["bck_history"])."</td>\n";
|
$str.=" <backup-gzip>".($db->Record["bck_gzip"])."</backup-gzip>\n";
|
||||||
$str.=" <td>".($db->Record["bck_gzip"])."</td>\n";
|
|
||||||
$str.=" </table>\n";
|
|
||||||
}
|
}
|
||||||
$str.=" </tr>\n";
|
|
||||||
} while ($db->next_record());
|
} while ($db->next_record());
|
||||||
$str.="</table>\n";
|
$str.=" </sql>\n";
|
||||||
}
|
}
|
||||||
return $str;
|
return $str;
|
||||||
}
|
}
|
||||||
|
@ -815,8 +809,6 @@ function alternc_export_data ($dir){
|
||||||
$filename=$dir."mysql.".$db->Record["db"].".".date("H:i:s").".sql.gz";
|
$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));
|
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
|
* @access private
|
||||||
* EXPERIMENTAL 'sid' function ;)
|
* EXPERIMENTAL 'sid' function ;)
|
||||||
*/
|
*/
|
||||||
function alternc_export_conf($tmpdir) {
|
function alternc_export_conf() {
|
||||||
global $db,$err;
|
global $db,$err;
|
||||||
$err->log("quota","export");
|
$err->log("quota","export");
|
||||||
$str="<table border=\"1\" ><caption>QUOTA</caption>\n";
|
$str=" <quota>";
|
||||||
|
|
||||||
$q=$this->getquota();
|
$q=$this->getquota();
|
||||||
foreach ($q as $k=>$v) {
|
foreach ($q as $k=>$v) {
|
||||||
$str.=" <tr>\n <td>".($k)."</td>\n";
|
$str.=" <$k>\n";
|
||||||
$str.=" <td>".($v[u])."</td>\n \n";
|
$str.=" <used>".($v["u"])."</used>\n";
|
||||||
$str.=" <td>".($v[t])."</td>\n </tr>\n";
|
$str.=" <total>".($v["t"])."</total>\n";
|
||||||
|
$str.=" </$k>\n";
|
||||||
}
|
}
|
||||||
$str.="</table>\n";
|
$str.="</quota>\n";
|
||||||
return $str;
|
return $str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -72,14 +72,14 @@ $conf_user=$export->export_conf();
|
||||||
$file_conf=$dir."dump_conf_".date("H:i:s");
|
$file_conf=$dir."dump_conf_".date("H:i:s");
|
||||||
echo $file_conf;
|
echo $file_conf;
|
||||||
$file=fopen($file_conf."dump","ab");
|
$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,"<version>:".$L_VERSION."</version>\n");
|
||||||
fputs($file,"<html><body>");
|
fputs($file,"<user>".$mem->user["login"]."</user>\n");
|
||||||
foreach($conf_user as $string){
|
foreach($conf_user as $string){
|
||||||
fputs($file,$string);
|
fputs($file,$string);
|
||||||
}
|
}
|
||||||
fputs($file,"</html></body>");
|
//fputs($file,"</html></body>");
|
||||||
fclose($file);
|
fclose($file);
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue