This commit is contained in:
Alan Garcia 2014-03-06 08:25:30 +00:00
parent d9c7107e59
commit 9c9e80e0f8
3 changed files with 27 additions and 7 deletions

View File

@ -108,6 +108,10 @@ if ($r['dns_action']=='UPDATE') {?>
die();
}
if (! empty($r['dns_result']) && $r['dns_result'] != '0') {
echo '<p class="alert alert-warning">'; __($r['dns_result']); echo '</p>';
}
?>

View File

@ -279,7 +279,7 @@ class system_bind {
// return true if zone is locked
function is_locked($domain) {
preg_match_all("/(\;\s*LOCKED:YES)/i", $this->get_zone($domain), $output_array);
preg_match_all("/(\;\s*LOCKED:YES)/i", $this->get_zone_file($domain), $output_array);
if (isset($output_array[1][0]) && !empty($output_array[1][0])) {
return true;
}
@ -287,10 +287,14 @@ class system_bind {
}
function save_zone($domain) {
global $db;
global $db, $dom;
// Do not save if the zone is LOCKED
if ( $this->is_locked($domain)) return false;
if ( $this->is_locked($domain)) {
$dom->set_dns_result($domain,"The zone file of this domain is locked");
$dom->set_dns_action($domain, 'OK');
return false;
}
// Save file, and apply chmod/chown
$file=$this->get_zone_file_uri($domain);
@ -298,7 +302,7 @@ class system_bind {
chown($file, 'bind');
chmod($file, 0640);
$db->query("UPDATE domaines SET dns_action = 'OK' WHERE domaine = '".mysql_escape_string($domain)."';");
$dom->set_dns_action($domain, 'OK');
return true; // fixme add tests
}

View File

@ -544,7 +544,7 @@ class m_dom {
}
$db->query("update sub_domaines set enable='$status' where id = '".intval($sub_id)."';");
$db->query("UPDATE domaines SET dns_action='UPDATE' WHERE domaine='".mysql_escape_string($jh['domain'])."';");
$this->set_dns_action($jh['domain'], 'UPDATE');
return true;
}
@ -577,7 +577,7 @@ class m_dom {
$err->log("dom","del_domaini_canl",$dom);
$dom=strtolower($dom);
$db->query("UPDATE sub_domaines SET web_action='UPDATE' WHERE domaine='$dom';");
$db->query("UPDATE domaines SET dns_action='UPDATE' WHERE domaine='$dom';");
$this->set_dns_action($dom, 'UPDATE');
# TODO : some work with domain sensitive classes
@ -617,7 +617,7 @@ class m_dom {
// Now mark the domain for deletion:
$db->query("UPDATE sub_domaines SET web_action='DELETE' WHERE domaine='$dom';");
$db->query("UPDATE domaines SET dns_action='DELETE' WHERE domaine='$dom';");
$this->set_dns_action($dom, 'DELETE');
return true;
}
@ -2027,6 +2027,18 @@ function generate_apacheconf($p = null) {
return true;
}
function set_dns_action($domain, $dns_action) {
global $db;
$db->query("UPDATE domaines SET dns_action='".mysql_escape_string($dns_action)."' WHERE domaine='".mysql_escape_string($domain)."'; ");
return true;
}
function set_dns_result($domain, $dns_result) {
global $db;
$db->query("UPDATE domaines SET dns_result='".mysql_escape_string($dns_result)."' WHERE domaine='".mysql_escape_string($domain)."'; ");
return true;
}
/* ----------------------------------------------------------------- */
/** hook function called by AlternC-upnp to know which open
* tcp or udp ports this class requires or suggests