$PowerDNS->create_default_records($values);
}
// remove existing records and links
$PowerDNS->remove_all_ptr_records($domain->id);
$Addresses->ptr_unlink_subnet_addresses($subnet->id);
// fetch all hosts
$hosts = $Addresses->fetch_subnet_addresses($subnet->id, "ip_addr", "asc");
// create PTR records
if (sizeof($hosts) > 0) {
    foreach ($hosts as $h) {
        // ignore PTR
        if ($h->PTRignore == "1") {
            $ignored[] = $h;
        } elseif ($Result->validate_hostname($h->dns_name) !== false) {
            // formulate new record
            $record = $PowerDNS->formulate_new_record($domain->id, $PowerDNS->get_ip_ptr_name($h->ip), "PTR", $h->dns_name, $values['ttl']);
            // insert record
            $PowerDNS->add_domain_record($record, false);
            // link
            $Addresses->ptr_link($h->id, $PowerDNS->lastId);
            // ok
            $success[] = $h;
        } else {
            $failures[] = $h;
        }
    }
} else {
    $empty = true;
}
# generate print
if (sizeof(@$success) > 0) {
         $hTooltip = "rel='tooltip' data-container='body' data-html='true' data-placement='left' title='" . _("Address status unknown") . "'";
     }
 } else {
     $hStatus = "hidden";
     $hTooltip = "";
 }
 # search for DNS records
 if ($User->settings->enablePowerDNS == 1 && $subnet['DNSrecords'] == 1) {
     # for ajax-loaded subnets
     if (!isset($PowerDNS)) {
         $PowerDNS = new PowerDNS($Database);
     }
     // search for hostname records
     $records = $PowerDNS->search_records("name", $addresses[$n]->dns_name, 'name', true);
     $ptr = $PowerDNS->fetch_record($addresses[$n]->PTR);
     $ptr_name = $PowerDNS->get_ip_ptr_name(long2ip($addresses[$n]->ip_addr));
     if (!$ptr || $ptr_name != $ptr->name) {
         $ptr = $PowerDNS->search_records("name", $ptr_name);
         if ($ptr) {
             $ptr = array_pop($ptr);
             $Addresses->ptr_link($addresses[$n]->id, $ptr->id);
         } else {
             $Addresses->ptr_link($addresses[$n]->id, 0);
         }
     }
     unset($dns_records);
     if ($records !== false || $ptr !== false) {
         $dns_records[] = "<hr>";
         $dns_records[] = "<ul class='submenu-dns'>";
         if ($records !== false) {
             foreach ($records as $r) {