Commit 85444438 authored by moglia's avatar moglia

Added dns_zone_get_id function get id from domain name. To discover a domain...

Added dns_zone_get_id function get id from domain name. To discover a domain id passing domain name as argument.
parent 5c67f75b
......@@ -1558,6 +1558,30 @@ class remoting {
$app->remoting_lib->loadFormDef('../dns/form/dns_soa.tform.php');
return $app->remoting_lib->getDataRecord($primary_id);
}
//* Get record id by origin
public function dns_zone_get_id($session_id, $origin)
{
global $app;
if(!$this->checkPerm($session_id, 'dns_zone_get_id')) {
$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
return false;
}
if (preg_match('/^[a-z0-9][a-z0-9\-]+[a-z0-9](\.[a-z]{2,4})+$/i', $origin)) {
$this->server->fault('no_domain_found', 'Invalid domain name.');
return false;
}
$rec = $app->db->queryOneRecord("SELECT id FROM dns_soa WHERE origin like '".$origin.'%');
if(isset($rec['id'])) {
return intval($rec['id']);
} else {
$this->server->fault('no_domain_found', 'There is no domain ID with informed domain name.');
return false;
}
}
//* Add a record
public function dns_zone_add($session_id, $client_id, $params)
......
<?php
$function_list['dns_zone_get,dns_zone_add,dns_zone_update,dns_zone_delete,dns_zone_set_status'] = 'DNS zone functions';
$function_list['dns_zone_get,dns_zone_get_id,dns_zone_add,dns_zone_update,dns_zone_delete,dns_zone_set_status'] = 'DNS zone functions';
$function_list['dns_a_get,dns_a_add,dns_a_update,dns_a_delete'] = 'DNS a functions';
$function_list['dns_aaaa_get,dns_aaaa_add,dns_aaaa_update,dns_aaaa_delete'] = 'DNS aaaa functions';
$function_list['dns_alias_get,dns_alias_add,dns_alias_update,dns_alias_delete'] = 'DNS alias functions';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment