auth->check_module_permissions('admin');
//* This is only allowed for administrators
if(!$app->auth->is_admin()) die('only allowed for administrators.');
$app->uses('tpl,validate_dns');
$app->tpl->newTemplate('form.tpl.htm');
$app->tpl->setInclude('content_tpl', 'templates/dns_resync.htm');
$msg = '';
$error = '';
// Resyncing dns zones
if(isset($_POST['resync']) && $_POST['resync'] == 1) {
$zones = $app->db->queryAllRecords("SELECT id,origin,serial FROM dns_soa WHERE active = 'Y'");
if(is_array($zones) && !empty($zones)) {
foreach($zones as $zone) {
$records = $app->db->queryAllRecords("SELECT id,serial FROM dns_rr WHERE zone = ".$zone['id']." AND active = 'Y'");
if(is_array($records)) {
foreach($records as $rec) {
$new_serial = $app->validate_dns->increase_serial($rec["serial"]);
$app->db->datalogUpdate('dns_rr', "serial = '".$new_serial."'", 'id', $rec['id']);
}
}
$new_serial = $app->validate_dns->increase_serial($zone["serial"]);
$app->db->datalogUpdate('dns_soa', "serial = '".$new_serial."'", 'id', $zone['id']);
$msg .= "Resynced: ".$zone['origin'].'
';
}
} else {
$error .= "No zones found to sync.
";
}
}
$app->tpl->setVar('msg',$msg);
$app->tpl->setVar('error',$error);
//* load language file
/*
$lng_file = 'lib/lang/'.$_SESSION['s']['language'].'_mailbox_import.lng';
include($lng_file);
$app->tpl->setVar($wb);
*/
$app->tpl_defaults();
$app->tpl->pparse();
?>