} } // transform description to valid value $description = trim(htmlspecialchars($_POST['description'])); // generate a unique zone name if the generator is set to decimal or hex if (!$_POST['zone'] && $_POST['action'] == 'add') { if (!($zone = $Zones->generate_zone_name())) { $Result->show("danger", _("Cannot generate zone name"), true); } } else { $zone = $_POST['zone']; } // validate the zone name if text mode is enabled if ($_POST['generator'] == 2) { $textSettings = array($_POST['zone'], $_POST['id']); if (!($zone = $Zones->generate_zone_name($textSettings))) { $Result->show("danger", _("Cannot validate zone name"), true); } } // build the query parameter arrary if ($_POST['generator'] != 2 && $_POST['action'] == 'edit') { $values = array('id' => $_POST['id'], 'indicator' => $_POST['indicator'], 'padding' => $padding, 'description' => $description, 'subnetId' => $_POST['masterSubnetId'], 'vlanId' => $_POST['vlanId']); } else { $values = array('id' => $_POST['id'], 'generator' => $_POST['generator'], 'zone' => $zone, 'indicator' => $_POST['indicator'], 'padding' => $padding, 'description' => $description, 'subnetId' => $_POST['masterSubnetId'], 'vlanId' => $_POST['vlanId']); } # update if (!$Zones->modify_zone($_POST['action'], $values)) { $Result->show("danger", _("Cannot add zone"), true); } else { $Result->show("success", _("Zone modified successfully"), true); }