Beispiel #1
0
                            array_push($parameters, $v_data['e_message']);
                            call_user_func_array('ossim_valid', $parameters);
                            if (ossim_error()) {
                                $exp_msg = ossim_get_error();
                                Av_exception::throw_error(Av_exception::USER_ERROR, $exp_msg);
                            }
                        }
                        //Update Nagios
                        $parameters = array();
                        $parameters = array_values($s_data);
                        //Adding BD connection
                        array_unshift($parameters, $conn);
                        call_user_func_array($p_function, $parameters);
                    } catch (Exception $e) {
                        $data['status'] = 'error';
                    }
                }
            }
            if ($data['status'] == 'error') {
                $db->close();
                Util::response_bad_request(_('Some of your changes could not be saved'));
            }
            //Add host to nagios
            Asset_host_scan::save_plugin_in_db($conn, $asset_id, 2007);
            //report changes
            Asset_host::report_changes($conn, 'hosts');
        }
        $db->close();
        break;
}
echo json_encode($data);
                 $e_message = _('Host services could not be toggled');
             } else {
                 $e_message = _('Some host services could not be toggled');
                 //At least, one service was toggled, we have to clear the cache
                 $data['reload_tree'] = TRUE;
             }
         }
         //Formatted message
         $data['data'] = '<div>' . _('We Found the following errors') . ":</div>\n\t\t\t\t\t         <div style='padding: 5px;'>" . $e_message . '</div>';
     }
     //Enable o disable Nagios in host
     $filters = array('where' => "h.id IN (UNHEX('" . $p_data['host_id'] . "')) AND nagios = 1");
     $_host_services = Asset_host_services::get_list($conn, $filters);
     $host_services = $_host_services[0];
     if (count($host_services) >= 1) {
         Asset_host_scan::save_plugin_in_db($conn, $p_data['host_id'], 2007);
     } else {
         Asset_host_scan::delete_plugin_from_db($conn, $p_data['host_id'], 2007);
     }
     $db->close();
     break;
 case 'delete_properties':
     //Error counter
     $e_counter = 0;
     //Properties
     $properties = base64_decode(POST('properties'));
     $properties = json_decode($properties, TRUE);
     $data['status'] = 'OK';
     $data['data'] = _('Host properties removed successfully');
     $data['reload_tree'] = TRUE;
     $db = new ossim_db();