} print '</div>'; die; } elseif ($_POST['action'] == "delete" && !isset($_POST['deleteconfirm'])) { # for ajax to prevent reload print "<div style='display:none'>alert alert-danger</div>"; # result print "<div class='alert alert-warning'>"; # print what will be deleted //fetch all slave subnets $Subnets->fetch_subnet_slaves_recursive($_POST['subnetId']); $subcnt = sizeof($Subnets->slaves); foreach ($Subnets->slaves as $s) { $slave_array[$s] = $s; } $ipcnt = $Addresses->count_addresses_in_multiple_subnets($slave_array); print "<strong>" . _("Warning") . "</strong>: " . _("I will delete") . ":<ul>"; print "\t<li>{$subcnt} " . _("subnets") . "</li>"; if ($ipcnt > 0) { print "\t<li>{$ipcnt} " . _("IP addresses") . "</li>"; } print "</ul>"; print "<hr><div style='text-align:right'>"; print _("Are you sure you want to delete above items?") . " "; print "<div class='btn-group'>"; print "\t<a class='btn btn-sm btn-danger editSubnetSubmitDelete' id='editSubnetSubmitDelete'>" . _("Confirm") . "</a>"; print "</div>"; print "</div>"; print "</div>"; } else { # remove scanagent if not needed
foreach ($subnets as $s) { $out[] = $s; } } //fetch subsection subnets foreach ($subsections as $ss) { $subsection_subnets = $Subnets->fetch_section_subnets($ss->id); //fetch all subnets in subsection if (sizeof($subsection_subnets) > 0) { foreach ($subsection_subnets as $sss) { $out[] = $sss; } } $num_subnets = $num_subnets + sizeof($subsection_subnets); //count all addresses that will be deleted! $ipcnt = $Addresses->count_addresses_in_multiple_subnets($out); } } else { $subnets = $Subnets->fetch_section_subnets($_POST['id']); //fetch all subnets in section $num_subnets = sizeof($subnets); $ipcnt = $Addresses->count_addresses_in_multiple_subnets($subnets); } # printout print "<strong>" . _("Warning") . "</strong>: " . _("I will delete") . ":<ul>"; print "\t<li>{$num_subnets} " . _("subnets") . "</li>"; if ($ipcnt > 0) { print "\t<li>{$ipcnt} " . _("IP addresses") . "</li>"; } print "</ul>"; print "<hr><div style='text-align:right'>";