$seen_text = _("Device is offline") . "<br>" . _("Last seen") . ": " . $address['lastSeen']; } elseif ($address['lastSeen'] == "0000-00-00 00:00:00") { $seen_status = "neutral"; $seen_text = _("Device is offline") . "<br>" . _("Last seen") . ": " . _("Never"); } else { $seen_status = "neutral"; $seen_text = _("Device status unknown"); } print "\t<th>" . _('Availability') . "<br><span class='status status-ip status-{$seen_status}' style='pull-right'></span></th>"; print "\t<td>"; print "{$seen_text}"; print "\t</td>"; print "</tr>"; # search for DNS records if ($User->settings->enablePowerDNS == 1 && $subnet['DNSrecords'] == 1) { $records = $PowerDNS->search_records("name", $address['dns_name'], 'name', true); $ptr = $PowerDNS->fetch_record($address['PTR']); if ($records !== false || $ptr !== false) { print "<tr><td colspan='2'><hr></tr>"; print "<tr>"; print "<th>" . _('DNS records') . "</th>"; print "<td>"; if ($records !== false) { foreach ($records as $r) { print "<span class='badge badge1 badge3'>{$r->type}</span> {$r->content} <br>"; } } if ($ptr !== false) { print "<span class='badge badge1 badge3'>{$ptr->type}</span> {$ptr->name} <br>"; } print "</td>";
if (@$address['PTRignore'] == "1") { $checked = "checked='checked'"; } else { $checked = ""; } print '<tr>'; print '<td>' . _("PTR exclude") . '</td>'; print '<td>'; print ' <input type="checkbox" class="ip_addr input-switch" name="PTRignore" value="1" ' . $checked . ' ' . $delete . '> <span class="text-muted">' . _('Dont create PTR records') . '</span>'; print '</td>'; print '</tr>'; //remove all associated queries if delete if ($_POST['action'] == "delete") { // check $PowerDNS = new PowerDNS($Database); $records = $PowerDNS->search_records("name", $address['dns_name'], 'name', true); $records2 = $PowerDNS->search_records("content", $address['ip'], 'content', true); if ($records !== false || $records2 !== false) { // form print '<tr>'; print '<td>' . _("Remove DNS records") . '</td>'; print '<td>'; print ' <input type="checkbox" class="ip_addr input-switch-danger alert-danger" data-on-color="danger" name="remove_all_dns_records" value="1" checked> <span class="text-muted">' . _('Remove all associated DNS records:') . '</span>'; print '</td>'; print '</tr>'; // records print '<tr>'; print '<td></td>'; print '<td>'; print "<hr>"; // hostname records
} // gateway $gw = $addresses[$n]->is_gateway == 1 ? "gateway" : ""; print "\t<td class='ipaddress {$gw}'><span class='status status-{$hStatus}' {$hTooltip}></span><a href='" . create_link("subnets", $subnet['sectionId'], $_REQUEST['subnetId'], "address-details", $addresses[$n]->id) . "'>" . $Subnets->transform_to_dotted($addresses[$n]->ip_addr); if ($addresses[$n]->is_gateway == 1) { print " <i class='fa fa-info-circle fa-gateway' rel='tooltip' title='" . _('Address is marked as gateway') . "'></i>"; } print $Addresses->address_type_format_tag($addresses[$n]->state); print "</td>"; # search for DNS records if ($User->settings->enablePowerDNS == 1 && $subnet['DNSrecords'] == 1) { # for ajax-loaded subnets if (!isset($PowerDNS)) { $PowerDNS = new PowerDNS($Database); } $records = $PowerDNS->search_records("name", $addresses[$n]->dns_name, 'name', true); $ptr = $PowerDNS->fetch_record($addresses[$n]->PTR); unset($dns_records); if ($records !== false || $ptr !== false) { $dns_records[] = "<hr>"; $dns_records[] = "<ul class='submenu-dns'>"; if ($records !== false) { foreach ($records as $r) { if ($r->type != "SOA" && $r->type != "NS") { $dns_records[] = "<li><i class='icon-gray fa fa-gray fa-angle-right'></i> <span class='badge badge1 badge2 editRecord' data-action='edit' data-id='{$r->id}' data-domain_id='{$r->domain_id}'>{$r->type}</span> {$r->content} </li>"; } } } if ($ptr !== false) { $dns_records[] = "<li><i class='icon-gray fa fa-gray fa-angle-right'></i> <span class='badge badge1 badge2 editRecord' data-action='edit' data-id='{$ptr->id}' data-domain_id='{$ptr->domain_id}'>{$ptr->type}</span> {$ptr->name} </li>"; }
} else { $hStatus = "neutral"; $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'>";