} else {
         $hStatus = "neutral";
         $hTooltip = "rel='tooltip' data-container='body' data-html='true' data-placement='left' title='" . _("Device status unknown") . "'";
     }
 } else {
     $hStatus = "hidden";
     $hTooltip = "";
 }
 print "\t<td class='ipaddress'><span class='status status-{$hStatus}' {$hTooltip}></span><a href='subnets/{$_REQUEST['section']}/{$_REQUEST['subnetId']}/ipdetails/" . $ipaddress[$n]['id'] . "/'>" . Transform2long($ipaddress[$n]['ip_addr']);
 if (in_array('state', $setFields)) {
     print reformatIPState($ipaddress[$n]['state']);
 }
 print "</td>";
 # resolve dns name if not provided, else print it - IPv4 only!
 if (empty($ipaddress[$n]['dns_name']) and $settings['enableDNSresolving'] == 1 and IdentifyAddress($ipaddress[$n]['ip_addr']) == "IPv4") {
     $dnsResolved = ResolveDnsName($ipaddress[$n]['ip_addr']);
 } else {
     $dnsResolved['class'] = "";
     $dnsResolved['name'] = $ipaddress[$n]['dns_name'];
 }
 print "<td class='{$dnsResolved['class']} hostname'>{$dnsResolved['name']}</td>";
 # print description - mandatory
 print "<td class='description'>" . $ipaddress[$n]['description'] . "</td>";
 # Print mac address icon!
 if (in_array('mac', $setFields)) {
     if (!empty($ipaddress[$n]['mac'])) {
         print "<td class='narrow'><i class='info fa fa-gray fa-sitemap' rel='tooltip' data-container='body' title='" . _('MAC') . ": " . $ipaddress[$n]['mac'] . "'></i></td>";
     } else {
         print "<td class='narrow'></td>";
     }
 }
Beispiel #2
0
                    if ($exitCode != 0) {
                        $dead[] = $addresses[$index];
                        unset($addresses[$index]);
                    }
                    //remove thread
                    unset($threads[$index]);
                }
            }
            usleep(500);
        }
    }
}
// first add to IP table
foreach ($addresses as $k => $ip) {
    // try to resolve
    $ip['dns_name'] = ResolveDnsName($ip['ip_addr']);
    if ($ip['dns_name']['class'] == "resolved") {
        $ip['dns_name'] = $ip['dns_name']['name'];
        $addresses[$k]['dns_name'] = $ip['dns_name'];
    } else {
        $ip['dns_name'] = "";
        $addresses[$k]['dns_name'] = _("unresolved");
    }
    // insert
    if (!insert_discovered_ip($ip)) {
        print "Cannot add discovered IP " . transform2long($ip['ip_addr']) . "\n";
    }
}
// all done, mail discovered?
if (sizeof($addresses) > 0 && $email) {
    //send text array, cron will do that by default if you don't redirect output > /dev/null 2>&1