Example #1
0
if (empty($allowed_action[$action])) {
    Util::response_bad_request(_('Error! Action not allowed'));
}
$db = new Ossim_db();
$conn = $db->connect();
switch ($action) {
    case 'show_unsupported':
        $data['status'] = 'success';
        $data['data'] = _('Your request has been processed');
        try {
            //Number of assets in the system
            list($assets, $total_assets) = Asset_host::get_list($conn, '', array('limit' => 1));
            //Number of selected assets
            $total_selected = Filter_list::get_total_selection($conn, 'asset');
            //Remove asset selection
            Filter_list::clean_selection($conn);
            //Getting the object with the filters.
            $filters = Filter_list::retrieve_filter_list_session();
            $filters->empty_filter_search($conn);
            if ($filters === FALSE) {
                $exp_msg = _('Sorry, operation was not completed due to an error when processing the request');
                Av_exception::throw_error(Av_exception::USER_ERROR, $exp_msg);
            }
            if ($total_selected == $total_assets) {
                //All assets were selected, so we filter them by OS
                $os_filters = array('where' => '(host_properties.value NOT LIKE "windows%" AND host_properties.value NOT LIKE "microsoft%")');
                list($os_list, $total_os) = Asset_host_properties::get_property_values($conn, 3, $os_filters);
                $filters->modify_filter(20, 'unknown', 0);
                foreach ($os_list as $os_key => $os_value) {
                    $filters->modify_filter(20, $os_value, 0);
                }