// fetch subnet $subnet = $Subnets->fetch_subnet("id", $s->id); $nsid = $subnet === false ? false : $subnet->nameserverId; // try to resolve hostname $hostname = $DNS->resolve_address($ip, false, true, $nsid); //set update query $values = array("subnetId" => $s->id, "ip_addr" => $Subnets->transform_address($ip, "decimal"), "dns_name" => $hostname['name'], "description" => "-- autodiscovered --", "note" => "This host was autodiscovered on " . $nowdate, "lastSeen" => $nowdate, "state" => "2", "action" => "add"); //insert $Addresses->modify_address($values); //set discovered $discovered++; } } } # update scan time $Scan->ping_update_scanagent_checktime(1, $nowdate); # send mail if ($discovered > 0 && $send_mail) { # check for recipients foreach ($Admin->fetch_multiple_objects("users", "role", "Administrator") as $admin) { if ($admin->mailNotify == "Yes") { $recepients[] = array("name" => $admin->real_name, "email" => $admin->email); } } # none? if (!isset($recepients)) { die; } # fetch mailer settings $mail_settings = $Admin->fetch_object("settingsMail", "id", 1); # fake user object, needed for create_link