function save_list_selection($conn, $data) { $asset_type = $data['asset_type']; $all = $data['all']; $assets = $data['assets']; $members = $data['save_members']; ossim_valid($asset_type, 'asset', 'network', 'group', 'illegal:' . _('Type')); ossim_valid($assets, OSS_HEX, OSS_NULLABLE, 'illegal:' . _('Assets')); ossim_valid($all, OSS_BINARY, 'illegal:' . _('Asset Selection')); ossim_valid($members, OSS_BINARY, OSS_NULLABLE, 'illegal:' . _('Member Selection Option')); check_ossim_error(); //Common error message when the selection is empty $empty_msg = sprintf(_('You need to select at least one %s.'), $asset_type); //If we filter by manual selection and the asset array is empty if (!$all && !is_array($assets)) { Av_exception::throw_error(Av_exception::USER_ERROR, $empty_msg); } $total = Filter_list::save_list_selection($conn, $asset_type, $all, $assets); //If the selection is 0 if ($total < 1) { Av_exception::throw_error(Av_exception::USER_ERROR, $empty_msg); } if ($members) { $total = Filter_list::save_members_from_selection($conn, $asset_type); } return $total; }
* */ require_once 'av_init.php'; $asset_type = GET('type'); Session::logcheck('environment-menu', 'EventsHidsConfig'); Session::logcheck_by_asset_type($asset_type); session_write_close(); ossim_valid($asset_type, 'asset', 'network', 'group', 'illegal:' . _('Asset Type')); if (ossim_error()) { echo ossim_error(); } //Database connection $db = new ossim_db(); $conn = $db->connect(); if ($asset_type == 'network' || $asset_type == 'group') { Filter_list::save_members_from_selection($conn, $asset_type); } $total_selected = Filter_list::get_total_selection($conn, 'asset'); $total_unknown_os = 0; $total_not_windows = 0; if ($total_selected > 0) { //Getting assets with unknown Operating System $tables = 'LEFT JOIN host_properties hp ON hp.host_id=host.id AND hp.property_ref=3 INNER JOIN user_component_filter f ON f.asset_id = host.id'; $filters = array('where' => '(hp.host_id IS NULL OR hp.value IS NULL OR hp.value LIKE "%unknown%") AND f.asset_type="asset" AND f.session_id = "' . session_id() . '"'); list($assets_unknown_os, $total_unknown_os) = Asset_host::get_list($conn, $tables, $filters, FALSE); //Getting assets with Operating System distinct to Windows $tables = ', host_properties hp, user_component_filter f'; $filters = array('where' => 'hp.host_id=host.id AND hp.property_ref=3 AND (hp.value NOT LIKE "windows%" AND hp.value NOT LIKE "microsoft%") AND f.asset_id = host.id AND f.asset_type="asset" AND f.session_id = "' . session_id() . '"'); list($assets_not_w_os, $total_not_windows) = Asset_host::get_list($conn, $tables, $filters, FALSE);