gere la valeur du champ zonettl dans le formulaire du domaine (et update dans la base)

fixes #1514
This commit is contained in:
domi 2013-07-04 08:54:58 +00:00
parent df28b20d83
commit dc801c9a59
3 changed files with 17 additions and 4 deletions

View File

@ -216,6 +216,17 @@ if (!$r['noerase']) {
</tr>
</table>
<?php if ($r["dns"]) { ?>
<table class="tlist2">
<tr>
<td><?php __("Define TTL for the zone records"); ?>&nbsp;: </td>
<td>
<input type="text" id="ttldns" class="inc" name="ttl" size="6" value="<?php echo ($r["zonettl"]); ?>" /> <?php __("seconds"); ?>
</td>
</tr>
</table>
<?php } ?>
<table class="tlist2">
<tr>
<td>

View File

@ -34,12 +34,13 @@ $fields = array (
"domain" => array ("request", "string", ""),
"dns" => array ("request", "integer", 1),
"email" => array ("request", "integer", 1),
"ttl" => array ("request", "integer", 86400),
);
getFields($fields);
$dom->lock();
if (!$dom->edit_domain($domain,$dns,$email)) {
if (!$dom->edit_domain($domain,$dns,$email,0,$ttl)) {
$error=$err->errstr();
include("dom_edit.php");
$dom->unlock();

View File

@ -771,6 +771,7 @@ class m_dom {
$r["dns_action"]=$db->Record["dns_action"];
$r["dns_result"]=$db->Record["dns_result"];
$r["mail"]=$db->Record["gesmx"];
$r["zonettl"]=$db->Record["zonettl"];
$r['noerase']=$db->Record['noerase'];
$db->free();
$db->query("SELECT COUNT(*) AS cnt FROM sub_domaines WHERE compte='$cuid' AND domaine='$dom'");
@ -1073,7 +1074,7 @@ class m_dom {
* TRUE sinon.
*
*/
function edit_domain($dom,$dns,$gesmx,$force=0) {
function edit_domain($dom,$dns,$gesmx,$force=0,$ttl=86400) {
global $db,$err,$L_MX,$classes,$cuid,$hooks;
$err->log("dom","edit_domain",$dom."/".$dns."/".$gesmx);
// Locked ?
@ -1109,7 +1110,7 @@ class m_dom {
}
if ($dns!="1") $dns="0";
// On vérifie que des modifications ont bien eu lieu :)
if ($r["dns"]==$dns && $r["mail"]==$gesmx) {
if ($r["dns"]==$dns && $r["mail"]==$gesmx && $r["zonettl"]==$ttl) {
$err->raise("dom",_("No change has been requested..."));
return false;
}
@ -1137,7 +1138,7 @@ class m_dom {
$hooks->invoke("hook_dom_del_mx_domain",array($r["id"]));
}
$db->query("UPDATE domaines SET gesdns='$dns', gesmx='$gesmx' WHERE domaine='$dom'");
$db->query("UPDATE domaines SET gesdns='$dns', gesmx='$gesmx', zonettl='$ttl' WHERE domaine='$dom'");
$db->query("UPDATE domaines set dns_action='UPDATE' where domaine='$dom';");
return true;