if ($section['strictMode'] == 1 && !$isFolder) { /* verify that no overlapping occurs if we are adding root subnet */ if ($overlap = verifySubnetOverlapping($_POST['sectionIdNew'], $_POST['subnet'], $_POST['vrfId'])) { $errors[] = $overlap; } } } else { if ($_POST['action'] == "add" && $_POST['masterSubnetId'] == 0) { /* first verify user input */ $errors = verifyCidr($_POST['subnet']); /* check for overlapping */ if ($section['strictMode'] == 1 && !$isFolder) { /* verify that no overlapping occurs if we are adding root subnet only check for overlapping if vrf is empty or not exists! */ if ($overlap = verifySubnetOverlapping($_POST['sectionId'], $_POST['subnet'], $_POST['vrfId'])) { $errors[] = $overlap; } } } else { if ($_POST['action'] == "add") { /* first verify user input */ $errors = verifyCidr($_POST['subnet']); /* verify that nested subnet is inside root subnet */ if ($section['strictMode'] == 1 && !$isFolder) { if (!($overlap = verifySubnetNesting($_POST['masterSubnetId'], $_POST['subnet']))) { $errors[] = _('Nested subnet not in root subnet!'); } } /* verify that no overlapping occurs if we are adding nested subnet */ if ($section['strictMode'] == 1 && !$isFolder) {
foreach ($allSubnets as $subnet) { //get number $m = str_replace("subnet-", "", $subnet); //set subnet details $subnetDetails['action'] = "add"; $subnetDetails['subnet'] = $_POST['subnet-' . $m]; $subnetDetails['sectionId'] = $_POST['section-' . $m]; $subnetDetails['description'] = $_POST['description-' . $m]; $subnetDetails['VLAN'] = $_POST['vlan-' . $m]; $subnetDetails['masterSubnetId'] = 0; //cidr if (verifyCidr($subnetDetails['subnet'])) { $errors[] = verifyCidr($subnetDetails['subnet']); } else { if (verifySubnetOverlapping($subnetDetails['sectionId'], $subnetDetails['subnet'], "000")) { $errors[] = verifySubnetOverlapping($subnetDetails['sectionId'], $subnetDetails['subnet'], "000"); } else { if (verifyNestedSubnetOverlapping($subnetDetails['sectionId'], $subnetDetails['subnet'], "000")) { $errors[] = verifyNestedSubnetOverlapping($subnetDetails['sectionId'], $subnetDetails['subnet'], "000"); } else { $subnetInsert[] = $subnetDetails; } } } } /* print errors if they exist or success */ if (!isset($errors)) { $errors2 = 0; //insert if all other is ok! foreach ($subnetInsert as $subnetDetails) { if (!modifySubnetDetails($subnetDetails)) {