// modify - normally zero. If user belongs to multiple groups, takes lowest value $limit = $ds->ds->GetOne("SELECT min(resaddr) AS cnt FROM grp WHERE grp " . $ds->grpSQL($grps)); foreach ((array) $ip as $iptemp) { // cast ip to array if ($iptemp - $baseaddr < $limit) { myError($w, $p, sprintf("You may not modify the first %s subnet addresses", $limit)); } if ($iptemp - $baseaddr < 0 or $iptemp - $baseaddr >= $maxcnt) { myError($w, $p, "An address you are attempting to modify is outside of the subnet"); } } // ---------------- end check --------------- // --------- test if ip addresses to update are within bounds ---------- foreach ($grps as $value) { foreach ((array) $ip as $ipvalue) { if ($extst = $ds->TestBounds($ipvalue, 1, $value)) { // got an overlap, allowed to create break 2; } } } // could not find address within any of the defined bounds // so do not update if (!$extst) { if (is_array($ip)) { myError($w, $p, my_("IP addresses not updated - out of defined authority boundary") . "\n"); } else { myError($w, $p, sprintf(my_("IP address %s not updated - out of defined authority boundary"), inet_ntoa($ip)) . "\n"); } } // ---------------- end check ---------------
// found as array search will return false $row = $result->FetchRow(); if (!in_array($row["admingrp"], $grps)) { myError($w, $p, my_("You may not move this subnet for this customer as you are not a member of the original customers admin group")); } // did somebody else whack the subnet in the meantime? $result = $ds->GetBaseFromIndex($baseindex); if (!($row = $result->FetchRow())) { myError($w, $p, my_("Subnet cannot be found!")); } $size = $row["subnetsize"]; $base = $row["baseaddr"]; $baseip = inet_ntoa($row["baseaddr"]); // test if subnet to delete is within bounds foreach ($grps as $value) { if ($extst = $ds->TestBounds($base, $size, $value)) { // got an overlap, allowed to create break; } } // could not find new subnet within any of the defined bounds // so do not create if (!$extst) { myError($w, $p, sprintf(my_("Subnet %s not modified - out of defined authority boundary"), $baseip) . "\n"); } $restemp = $ds->GetDuplicateSubnet($base, $size, $cust); if ($restemp->FetchRow()) { $formerror .= my_("Subnet could not be created - possibly overlaps with an existing subnet on new customers network") . "\n"; } else { $ds->DbfTransactionStart(); // move the subnet to another customer, template will move with as relation