$maxrows = $maxrows > 50 ? 50 : $maxrows; $torder = $torder == 1 ? 'ASC' : 'DESC'; $to = $maxrows; $session = session_id(); //Get list params $filters = array(); $tables = ''; $filters['order_by'] = $order . ' ' . $torder; $filters['limit'] = $from . ', ' . $to; $filters['where'] = ''; if (!$all_list) { $tables = ', user_host_filter hf'; $filters['where'] = "hf.asset_id=host.id AND hf.session_id='{$session}'"; } try { list($assets, $total) = Asset_host::get_full_list($conn, $tables, $filters); } catch (Exception $e) { $response = array(); $response['sEcho'] = $sec; $response['iTotalRecords'] = 0; $response['iTotalDisplayRecords'] = 0; $response['aaData'] = array(); $response['iDisplayStart'] = 0; echo json_encode($response); exit; } $detail = ''; $results = array(); foreach ($assets as $_id => $asset_data) { $d_types = Asset_host_devices::get_devices_to_string($conn, $_id); if (preg_match('/<br\\/>/', $d_types)) {
$db = new ossim_db(); $conn = $db->connect(); if (array_key_exists($order, $orders_by_columns)) { $order = $orders_by_columns[$order]; } else { $order = 'host.hostname'; } $tables = ''; // Group filter $filters = array('limit' => "{$from}, {$maxrows}", 'order_by' => "{$order} {$torder}", 'where' => " id NOT IN (SELECT host_id FROM host_group_reference WHERE host_group_id = UNHEX('" . $group_id . "')) "); if ($search_str != '') { $search_str = escape_sql($search_str, $conn); $tables = ', host_ip hi'; $filters['where'] .= 'AND host.id = hi.host_id AND (host.hostname LIKE "%' . $search_str . '%" OR INET6_NTOA(hi.ip) LIKE "%' . $search_str . '%")'; } list($asset_list, $total) = Asset_host::get_full_list($conn, $tables, $filters, FALSE); } catch (Exception $e) { $db->close(); Util::response_bad_request($e->getMessage()); } $data = array(); foreach ($asset_list as $_id => $asset_data) { $d_types = Asset_host_devices::get_devices_to_string($conn, $_id); if (preg_match('/<br\\/>/', $d_types)) { $d_types = preg_replace('/<br\\/>.*/', '', $d_types) . '...'; } // COLUMNS $_res = array(); $_res['DT_RowId'] = $_id; $_res[] = ''; //Checkbox