[fix] misc bugs in update_domaines.php,
This commit is contained in:
parent
7445439654
commit
dbfc59097b
|
@ -197,7 +197,6 @@ if (!$r["sub"][$i]["only_dns"]) {
|
|||
__("HTTP and HTTPS");
|
||||
break;
|
||||
default:
|
||||
__("Unknown");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -242,6 +242,26 @@ class DB_Sql {
|
|||
return $data;
|
||||
}
|
||||
|
||||
/* pdo equivalent of fetch() */
|
||||
function fetch($mode=PDO::FETCH_ASSOC) {
|
||||
if (!$this->pdo_query) {
|
||||
$this->halt("next_record called with no query pending.");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
$data = $this->pdo_query->fetch($mode);
|
||||
$this->Errno = $this->pdo_query->errorCode();
|
||||
$this->Error = $this->pdo_query->errorInfo();
|
||||
|
||||
if ($data == FALSE) {
|
||||
if ($this->Auto_Free)
|
||||
$this->free();
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* table locking
|
||||
*/
|
||||
|
|
|
@ -105,7 +105,10 @@ class m_apache {
|
|||
/**
|
||||
* launched for each FQDN for which we want to delete a vhost template
|
||||
*/
|
||||
function hook_updatedomains_web_del($subdom) {
|
||||
function hook_updatedomains_web_del($subdomid) {
|
||||
$db->query("SELECT sd.*, dt.only_dns, dt.has_https_option, m.login FROM domaines_type dt, sub_domaines sd LEFT JOIN membres m ON m.uid=sd.compte WHERE dt.name=sd.type AND sd.web_action!='OK' AND id=?;",array($subdomid));
|
||||
$db->next_record();
|
||||
$subdom=$db->Record;
|
||||
$confdir = $this->vhostroot."/".substr($subdom["compte"],-1)."/".$subdom["compte"];
|
||||
@unlink($confdir."/".$subdom["fqdn"].".conf");
|
||||
$this->shouldreload=true;
|
||||
|
|
|
@ -128,7 +128,7 @@ class m_bind {
|
|||
*/
|
||||
function hook_updatedomains_dns_del($dominfo) {
|
||||
$domain = $dominfo["domaine"];
|
||||
if (remove_line_from_file(
|
||||
if (del_line_from_file(
|
||||
$this->NAMED_CONF,
|
||||
trim(strtr(
|
||||
file_get_contents($this->NAMED_TEMPLATE),
|
||||
|
@ -157,7 +157,7 @@ class m_bind {
|
|||
global $msg;
|
||||
if ($this->shouldreload) {
|
||||
$ret=0;
|
||||
exec($this->rndc." reload 2>&1",$out,$ret);
|
||||
exec($this->RNDC." reload 2>&1",$out,$ret);
|
||||
if ($ret!=0) {
|
||||
$msg->raise("ERROR","bind","Error while reloading bind, error code is $ret\n".implode("\n",$out));
|
||||
} else {
|
||||
|
@ -166,7 +166,7 @@ class m_bind {
|
|||
}
|
||||
if ($this->shouldreconfig) {
|
||||
$ret=0;
|
||||
exec($this->rndc." reload 2>&1",$out,$ret);
|
||||
exec($this->RNDC." reload 2>&1",$out,$ret);
|
||||
if ($ret!=0) {
|
||||
$msg->raise("ERROR","bind","Error while reconfiguring bind, error code is $ret\n".implode("\n",$out));
|
||||
} else {
|
||||
|
|
|
@ -1065,13 +1065,14 @@ class m_dom {
|
|||
$db->query("SELECT sd.*, dt.description AS type_desc, dt.only_dns, dt.advanced, dt.has_https_option FROM sub_domaines sd LEFT JOIN domaines_type dt on UPPER(dt.name)=UPPER(sd.type) WHERE compte= ? AND domaine= ? ORDER BY dt.advanced,sd.sub,sd.type ;", array($cuid, $dom));
|
||||
// Pas de webmail, on le cochera si on le trouve.
|
||||
$r["sub"] = array();
|
||||
$data = $db->fetchAll();
|
||||
foreach($data as $i=>$record) {
|
||||
$i=0;
|
||||
while ($record=$db->fetch()) {
|
||||
$r["sub"][$i] = $record;
|
||||
// FIXME : replace sub by name and dest by valeur in the code that exploits this function :
|
||||
$r["sub"][$i]["name"] = $record["sub"];
|
||||
$r["sub"][$i]["dest"] = $record["valeur"];
|
||||
$r["sub"][$i]["fqdn"] = ((!empty($r["sub"][$i]["name"])) ? $r["sub"][$i]["name"] . "." : "") . $r["name"];
|
||||
$i++;
|
||||
}
|
||||
$db->free();
|
||||
return $r;
|
||||
|
@ -1920,9 +1921,9 @@ class m_dom {
|
|||
$hooks->invoke("hook_updatedomains_dns_pre");
|
||||
foreach($alldoms as $id=>$onedom) {
|
||||
if ($onedom["gesdns"]==0 || $onedom["dns_action"]=="DELETE") {
|
||||
$ret = $hooks->invoke("hook_updatedomains_dns_del",array(array($onedom)));
|
||||
$ret = $hooks->invoke("hook_updatedomains_dns_del",array($onedom));
|
||||
} else {
|
||||
$ret = $hooks->invoke("hook_updatedomains_dns_add",array(array($onedom)));
|
||||
$ret = $hooks->invoke("hook_updatedomains_dns_add",array($onedom));
|
||||
}
|
||||
|
||||
if ($onedom["dns_action"]=="DELETE") {
|
||||
|
|
Loading…
Reference in New Issue