} 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>"; print "</tr>";
/** * Script to edit domain ***************************/ /* functions */ require dirname(__FILE__) . '/../../../functions/functions.php'; # initialize user object $Database = new Database_PDO(); $User = new User($Database); $Admin = new Admin($Database); $Result = new Result(); $PowerDNS = new PowerDNS($Database); # verify that user is logged in $User->check_user_session(); # fetch old record if ($_POST['action'] != "add") { $record = $PowerDNS->fetch_record($_POST['id']); $record !== false ?: $Result->show("danger", _("Invalid ID"), true, true); } # edit and add - check that smth is in name and content! if ($_POST['action'] != "delete") { if (strlen($_POST['name']) < 2) { $Result->show("danger", _("Invalid name"), true); } if (strlen($_POST['content']) < 2) { $Result->show("danger", _("Invalid content"), true); } } # validate and set values if ($_POST['action'] == "edit") { $values = $PowerDNS->formulate_update_record($_POST['name'], $_POST['type'], $_POST['content'], $_POST['ttl'], $_POST['prio'], $_POST['disabled'], $record->change_date); $values['domain_id'] = $_POST['domain_id'];
// 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>"; } $dns_records[] = "</ul>";