$temp = $temp['data']['brands']; $temp['oui_list']['oui'] = $endpoint->fix_single_array_keys($temp['oui_list']['oui']); foreach ($temp['oui_list']['oui'] as $oui) { $sql = "INSERT INTO endpointman_oui_list (`oui`, `brand`, `custom`) VALUES ('" . $oui . "', '" . $temp['brand_id'] . "', '0')"; $endpoint->db->query($sql); } $brand_name = $temp['directory']; $version[$brand_name] = $temp['last_modified']; $last_mod = ""; $temp['family_list']['family'] = $endpoint->fix_single_array_keys($temp['family_list']['family']); foreach ($temp['family_list']['family'] as $list) { $last_mod = max($last_mod, $list['last_modified']); } $last_mod = max($last_mod, $version[$brand_name]); $version[$brand_name] = $last_mod; if (!$endpoint->arraysearchrecursive($brand_name, $row, 'directory')) { //insert row $sql = "INSERT INTO endpointman_brand_list (id, name, directory, cfg_ver, installed) VALUES ('" . $temp['brand_id'] . "', '" . $temp['name'] . "', '" . $temp['directory'] . "', '" . $version[$brand_name] . "', 1)"; $endpoint->db->query($sql); } else { $brand_version = max($last_mod, $brand_version); echo "Updating data.........."; $sql = "UPDATE endpointman_brand_list SET name = '" . $temp['name'] . "', cfg_ver = '" . $version[$brand_name] . "', installed = 1, hidden = 0 WHERE id = " . $temp['brand_id']; $endpoint->db->query($sql); echo "Done!<br/>"; } } } break; } }