fqdn; if (! $entry['hostname']) $entry['fqdn'] = $dom->fqdn; array_push($data, $entry); } DEBUG($data); return $data; } $valid_record_types = array('a', 'aaaa', 'mx', 'ns', 'spf', 'txt', 'cname', 'ptr', 'srv', 'raw'); function blank_dns_record($type) { global $valid_record_types; if (!in_array(strtolower($type), $valid_record_types)) system_failure('invalid type: '.$type); $rec = array('hostname' => NULL, 'domain' => 0, 'type' => strtolower($type), 'ttl' => 3600, 'ip' => NULL, 'dyndns' => NULL, 'data' => NULL, 'spec' => NULL); if (strtolower($type) == 'mx') { $rec['data'] = 'zucker.schokokeks.org'; $rec['spec'] = '5'; } return $rec; } function get_dns_record($id) { $id = (int) $id; $result = db_query("SELECT hostname, domain, type, ip, dyndns, spec, data, ttl FROM dns.custom_records WHERE id={$id}"); if (mysql_num_rows($result) != 1) system_failure('illegal ID'); $data = mysql_fetch_assoc($result); DEBUG($data); return $data; } function get_domain_records($dom) { $dom = (int) $dom; $result = db_query("SELECT hostname, domain, type, ip, dyndns, spec, data, ttl, id FROM dns.custom_records WHERE domain={$dom}"); $data = array(); while ($entry = mysql_fetch_assoc($result)) { $dom = new Domain((int) $entry['domain']); $entry['fqdn'] = $entry['hostname'].'.'.$dom->fqdn; if (! $entry['hostname']) $entry['fqdn'] = $dom->fqdn; array_push($data, $entry); } DEBUG($data); return $data; } function get_domain_auto_records($domainname) { $domainname = mysql_real_escape_string($domainname); $result = db_query("SELECT hostname, domain, CONCAT_WS('.', hostname, domain) AS fqdn, type, ip, spec, data, ttl FROM dns.v_autogenerated_records WHERE domain='{$domainname}'"); $data = array(); while ($entry = mysql_fetch_assoc($result)) { array_push($data, $entry); } DEBUG($data); return $data; } ?>