} echo rtrim($data_str, " "); } //id='+n_id+'&title='+title+'&description='+description+'&location='+location+'&owner='+owner+'&assigned='+assigned+'&status='+status+'&tags='+tags if (isset($_POST['id'])) { $id = $_POST['id']; $title = $_POST['title']; $desc = $_POST['description']; $location = $_POST['location']; $owner = $_POST['owner']; $assigned = $_POST['assigned']; $status = $_POST['status']; $tags = $_POST['tags']; $ip_2 = new IP_Database($id); $ip_2->set_title($title); $ip_2->set_description($desc); $ip_2->set_location_id($location); $ip_2->set_owner_id($owner); $ip_2->set_assigned_to_id($assigned); if (isset($_POST['status'])) { if ($status != 'undefined') { $ip_2->set_status($status); } } if (isset($_POST['stub'])) { $stub = $_POST['stub']; $ip_2->set_stub($stub); } $ip_2->set_tags($tags); if (!$ip_2->update()) { return false;
} else { if (isset($_POST['ip_host'])) { //get the ip and do some calculatins $ip = $_POST['ip_hostip'] . "/" . $_POST['ip_hostsubnet']; $ip_manager->set_IP($ip, $ip_info->get_family()); //check if the host is a valid host if ($ip_manager->get_is_negative() == false) { //if not then create a new manager to calculate for more checks $test_manager = new Netblock($ip_info->get_address_ip()); //if the address is part of the network, then create a new host if (substr($ip_manager->get_binary(), 0, $ip_info->get_subnet_size()) == substr($test_manager->get_binary(), 0, $ip_info->get_subnet_size())) { //set the information $host = new IP_Database(); $host->set_address_int($ip_manager->get_long()); $host->set_subnet_size($ip_manager->get_length()); $host->set_description($ip_info->get_description()); $host->set_family($ip_info->get_family()); //set the parent $host->set_parent_id($ip_info->get_netblock_id()); //if there are any inheritance of information, inherit them if ($_POST['inh_loc'] == "on") { $host->set_location_id($ip_info->get_location_id()); } if ($_POST['inh_owner'] == "on") { $host->set_owner_id($ip_info->get_owner_id()); } if ($_POST['inh_assigned'] == "on") { $host->set_assigned_to_id($ip_info->get_assigned_to_id()); } if ($_POST['inh_status'] == "on") { if ($ip_info->get_status() == 'PARENT') {