Files
itflow/agent/post/asset_model.php
johnnyq 2fc9c7bfe3 Networks and asset interfaces modernization: networks list with type tiles and type filter pills, usage bars, subnet/gateway/DNS/DHCP at a glance, IP-contains search, bulk type/site/star/archive and type quick pick; network page with address plan (documented IPs and device interfaces merged, free runs with Use, DHCP band, gateway, next free IP, conflict/in-pool/MAC-mismatch/held-back/broadcast/outside-subnet flags), overlap notice, devices tab, inline notes, document device addresses, WAN provider details; network quick look; shared network form with icon input groups, type guessed from name, live CIDR info with gateway/DHCP suggestions and overlap check, validated on save (canonical CIDR, gateway and range inside subnet, DNS, VLAN 1-4094, client-owned site, client or own vendor as provider); documented IP types (fixed, DHCP reservation, held back, floating) with MAC, ranges up to 256, bulk type, import/export with type and MAC; asset interfaces moved to their own handler and form with network/IP validation and live check, next free, VLANs, one-to-one connections scoped to the client, disconnect, make primary, switch/firewall/AP port map, run-of-ports modal with preview and padding, ajax import/export with VLANs and connected to, bulk network/VLANs/type/DHCP/disconnect/delete; networks and IP addresses in global search with subnet containment and MAC normalization; location and service pages link networks; demo data with WAN networks tied to ISP vendors, reservations, held-back addresses and switch VLANs; alertMessageHtml no longer double-encodes; db update 2.8.9 adds network_type, network_vendor_id, ip_type, ip_mac, interface_vlans and indexes, backfills types and CIDR prefixes
2026-10-15 20:33:28 -04:00

53 lines
1.9 KiB
PHP

<?php
defined('FROM_POST_HANDLER') || die("Direct file access is not allowed");
$name = escapeSql($_POST['name'] ?? '');
$description = escapeSql($_POST['description'] ?? '');
$type = escapeSql($_POST['type'] ?? '');
$make = escapeSql($_POST['make'] ?? '');
$model = escapeSql($_POST['model'] ?? '');
$serial = escapeSql($_POST['serial'] ?? '');
$os = escapeSql($_POST['os'] ?? '');
// The address and MAC in one form when they are one (functions/network.php) -
// kept as typed when not, so the asset still saves
$ip = trim((string) ($_POST['ip'] ?? ''));
$ip = escapeSql(normalizeIpAddress($ip) ?: $ip);
$dhcp = intval($_POST['dhcp'] ?? 0);
if ($dhcp == 1) {
$ip = 'DHCP';
}
$ipv6 = escapeSql($_POST['ipv6'] ?? '');
$nat_ip = escapeSql($_POST['nat_ip'] ?? '');
$mac = trim((string) ($_POST['mac'] ?? ''));
$mac = escapeSql(normalizeMacAddress($mac) ?: $mac);
$uri = escapeSql($_POST['uri'] ?? '');
$uri_2 = escapeSql($_POST['uri_2'] ?? '');
$uri_client = escapeSql($_POST['uri_client'] ?? '');
$status = escapeSql($_POST['status'] ?? '');
$location = intval($_POST['location'] ?? 0);
$physical_location = escapeSql($_POST['physical_location'] ?? '');
$vendor = intval($_POST['vendor'] ?? 0);
$contact = intval($_POST['contact'] ?? 0);
$network = intval($_POST['network'] ?? 0);
$purchase_reference = escapeSql($_POST['purchase_reference'] ?? '');
$purchase_date = escapeSql($_POST['purchase_date'] ?? '');
if (empty($purchase_date)) {
$purchase_date = "NULL";
} else {
$purchase_date = "'" . $purchase_date . "'";
}
$warranty_expire = escapeSql($_POST['warranty_expire'] ?? '');
if (empty($warranty_expire)) {
$warranty_expire = "NULL";
} else {
$warranty_expire = "'" . $warranty_expire . "'";
}
$install_date = escapeSql($_POST['install_date'] ?? '');
if (empty($install_date)) {
$install_date = "NULL";
} else {
$install_date = "'" . $install_date . "'";
}
$notes = escapeSql($_POST['notes'] ?? '');
$favorite = intval($_POST['favorite'] ?? 0);