diff --git a/.gitattributes b/.gitattributes
index d8d558fe..ffd9ec72 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -99,6 +99,7 @@ bureau/admin/dom_subdel.php -text
bureau/admin/dom_subdodel.php -text
bureau/admin/dom_subdoedit.php -text
bureau/admin/dom_subedit.php -text
+bureau/admin/dom_substatus.php -text
bureau/admin/domlist.php -text
bureau/admin/foot.php -text
bureau/admin/ftp_add.php -text
diff --git a/bureau/admin/dom_edit.php b/bureau/admin/dom_edit.php
index ab388053..ad94e2ed 100644
--- a/bureau/admin/dom_edit.php
+++ b/bureau/admin/dom_edit.php
@@ -94,7 +94,7 @@ if ($r['dns_action']=='UPDATE') {?>
gestion des sous-domaines
-->
- | | | | | |
+ | | | | | |
";__("Disable");echo "";
break;
case 'ENABLE':
__("Activation pending");
break;
case 'DISABLED':
__("Disabled");
+ echo "
";__("Enable");echo "";
break;
case 'DISABLE':
__("Desactivation pending");
diff --git a/bureau/admin/dom_substatus.php b/bureau/admin/dom_substatus.php
new file mode 100644
index 00000000..71998be4
--- /dev/null
+++ b/bureau/admin/dom_substatus.php
@@ -0,0 +1,33 @@
+ array ("request", "string", ""),
+ "sub" => array ("request", "string", ""),
+ "type" => array ("request", "string", ""),
+ "value" => array ("request", "string", ""),
+ "status" => array ("request", "string", ""),
+);
+getFields($fields);
+
+$dom->lock();
+
+$r=$dom->sub_domain_change_status($domain,$sub,$type,$value,$status);
+
+$dom->unlock();
+
+if (!$r) {
+ $error=$err->errstr();
+ $noread=true;
+ include("dom_edit.php");
+ exit();
+} else {
+ $t = time();
+ // XXX: we assume the cron job is at every 5 minutes
+ $error=strtr(_("The modifications will take effect at %time. Server time is %now."), array('%now' => date('H:i:s', $t), '%time' => date('H:i:s', ($t-($t%300)+300))));
+ foreach($fields as $k=>$v) unset($k);
+}
+include("dom_edit.php");
+exit;
+
+?>
diff --git a/bureau/class/m_dom.php b/bureau/class/m_dom.php
index 9371e57a..ffec6d86 100644
--- a/bureau/class/m_dom.php
+++ b/bureau/class/m_dom.php
@@ -174,6 +174,16 @@ class m_dom {
return true;
}
+ function sub_domain_change_status($domain,$sub,$type,$value,$status) {
+ global $db,$err,$cuid;
+ $err->log("dom","sub_domain_change_status");
+ $status=strtoupper($status);
+ if (! in_array($status,array('ENABLE', 'DISABLE'))) return false;
+
+ $db->query("update sub_domaines set enable='$status' where domaine='$domain' and sub='$sub' and lower(type)=lower('$type') and valeur='$value'");
+
+ return true;
+ }
/* ----------------------------------------------------------------- */
/**
@@ -203,7 +213,7 @@ class m_dom {
$db->query("UPDATE sub_domaines SET web_action='UPDATE' WHERE domaine='$dom';");
$db->query("UPDATE domaines SET dns_action='UPDATE' WHERE domaine='$dom';");
- # TODO : some work with domain sensitive classes
+ # TODO : some work with domain sensitive classes
return true;
}
@@ -836,7 +846,7 @@ class m_dom {
}
if (! $this->can_create_subdomain($dom,$sub,$type,$value_old)) {
- # TODO have a real error code
+ # TODO have a real error code
$err->raise("dom", 654);
return false;
}