break; } if ($var_tmp != "") { Util::print_succesful(_($var_tmp)); } } $inctype_id = GET('id'); ossim_valid($inctype_id, OSS_ALPHA, OSS_SPACE, OSS_PUNC, 'illegal:' . _("Incident type")); if (ossim_error()) { die(ossim_error()); } $db = new ossim_db(); $conn = $db->connect(); // $custom_fields = array(); if ($inctype_list = Incident_type::get_list($conn, "WHERE id = '{$inctype_id}'")) { $inctype = $inctype_list[0]; $custom = preg_match("/custom/", $inctype->get_keywords()) ? 1 : 0; $custom_fields = Incident_custom::get_custom_types($conn, $inctype_id); } ?> <form method="post" id="crt" action="modifyincidenttype.php"> <div id='info_error' class='ct_error'></div> <input type="hidden" id="modify" name="modify" value="modify"/> <input type="hidden" name="id" id='id_crt' value="<?php echo $inctype->get_id(); ?>
if (ossim_error()) { die(ossim_error()); } if (!Session::am_i_admin()) { require_once "ossim_error.inc"; $error = new OssimError(); $error->display("ONLY_ADMIN"); } require_once 'ossim_db.inc'; require_once 'classes/Incident_type.inc'; $db = new ossim_db(); $conn = $db->connect(); $custom_name = Util::htmlentities($custom_name, ENT_QUOTES); $custom_old_name = Util::htmlentities($custom_old_name, ENT_QUOTES); if ($action == "modify") { Incident_type::update($conn, $inctype_id, $inctype_descr, $custom == 1 ? "custom" : ""); $location = "incidenttype.php"; } elseif ($action == "modify_ct") { Incident_custom::update_custom($conn, $custom_name, $custom_type, $custom_options, $custom_required, $inctype_id, $custom_old_name); $location = "modifyincidenttypeform.php?id=" . urlencode($inctype_id); } elseif ($action == "modify_pos") { Incident_custom::update_ord($conn, $custom_oldpos, $custom_newpos, $inctype_id, $custom_old_name); $location = "modifyincidenttypeform.php?id=" . urlencode($inctype_id); } elseif ($action == "add" && trim($custom_name) != "" && trim($custom_type) != "") { if (in_array($custom_type, $options) && $custom_options != '' || !in_array($custom_type, $options)) { $next_ord = Incident_custom::get_next_ord($conn, $inctype_id); $params = array($inctype_id, $custom_name, $custom_type, $custom_options, $custom_required, $next_ord); Incident_custom::insert_custom($conn, $params); $location = "modifyincidenttypeform.php?id=" . urlencode($inctype_id); } } elseif ($action == "delete" && trim($custom_name) != "") {
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, * MA 02110-1301 USA * * * On Debian GNU/Linux systems, the complete text of the GNU General * Public License can be found in `/usr/share/common-licenses/GPL-2'. * * Otherwise you can read it here: http://www.gnu.org/licenses/gpl-2.0.txt * */ require_once 'av_init.php'; Session::logcheck("analysis-menu", "IncidentsTypes"); if (!Session::am_i_admin() && !Session::menu_perms("analysis-menu", "IncidentsTypes")) { die(ossim_error(_("Sorry, you are not allowed to perform this action"))); } $inctype_id = POST('inctype_id'); ossim_valid($inctype_id, OSS_ALPHA, OSS_SPACE, OSS_PUNC, 'illegal:' . _("Incident ID")); if (ossim_error()) { $data['status'] = 'error'; $data['data'] = ossim_get_error(); echo json_encode($data); exit; } $db = new ossim_db(); $conn = $db->connect(); Incident_type::delete($conn, $inctype_id); $db->close($conn); $data['status'] = 'OK'; $data['data'] = _("Ticket Type successfully deleted"); echo json_encode($data); exit;
}); }); </script> </head> <body> <div class='c_back_button' style='display:block;'> <input type='button' class="av_b_back" onclick="document.location.href='../incidents/index.php';return false;"/> </div> <?php $db = new ossim_db(); $conn = $db->connect(); $inctype_list = Incident_type::get_list($conn, ""); ?> <div id='av_info'> <?php if (!empty($_GET['msg'])) { $var_tmp = ""; switch ($_GET['msg']) { case 1: $var_tmp = _("New Custom Ticket successfully created"); break; case 2: $var_tmp = _("New Ticket Type successfully created"); break; case 3: $var_tmp = _("Ticket Type successfully updated");
</td> <td style="border-width: 0px;"> <select name="type" onChange="document.forms['filter'].submit()"> <option value="" <?php if (!$type) { echo "selected"; } ?> ><?php echo gettext("ALL"); ?> </option> <?php $customs = array(); foreach (Incident_type::get_list($conn) as $itype) { $id = $itype->get_id(); if (preg_match("/custom/", $itype->get_keywords())) { $customs[] = $itype->get_id(); } ?> <option <?php if ($type == $id) { echo "selected"; } ?> value="<?php echo $id; ?> "><?php echo $id;
} else { $data['status'] = 'OK'; echo json_encode($data); } exit; } else { if (is_array($validation_errors) && !empty($validation_errors)) { $info_error = $validation_errors; } else { $id = POST('id'); $descr = POST('descr'); $custom = POST('custom'); $db = new ossim_db(); $conn = $db->connect(); $custom_type = $custom == 1 ? 'custom' : ''; $res = Incident_type::insert($conn, $id, $descr, $custom_type); $db->close($conn); if ($res !== true) { $info_error[] = $res; } else { if ($custom == 1) { header('Location: modifyincidenttypeform.php?msg=1&id=' . urlencode($id)); } else { header('Location: incidenttype.php?msg=2'); } exit; } } } } ?>
function incident_report() { // First time we visit this page, show by default only Open incidents // when GET() returns NULL, means that the param is not set if (!GET('status')) { $status = 'Open'; } $db = new ossim_db(); $conn = $db->connect(); ?> <!-- filter --> <form name="filter" method="GET" action="<?php echo $_SERVER["SCRIPT_NAME"]; ?> "> <table align="center" width="100%"> <tr> <th colspan="7"><?php echo gettext("Incidents Report Options"); ?> </th> </tr> <table align="center" width="100%"> <tr> <table align="center" valign="center" width="100%"> <tr> <td> <?php echo gettext("Class"); /* ref */ ?> </td> <td> <?php echo gettext("Type"); /* type */ ?> </td> <td> <?php echo gettext("In charge"); ?> </td> <td> <?php echo gettext("Title"); ?> </td> <td> <?php echo gettext("Date"); ?> </td> <td> <?php echo gettext("Status"); ?> </td> <td> <?php echo gettext("Priority"); ?> </td> <td> <?php echo gettext("Action"); ?> </td> </tr> <tr> <td class="left"> <table> <tr> <td class="left"> <input type="checkbox" name="Alarm" checked> <?php echo gettext("Alarm"); ?> </input> </td> </tr> <tr> <td class="left"> <input type="checkbox" name="Event" checked> <?php echo gettext("Event"); ?> </input> </td> </tr> <tr> <td class="left"> <input type="checkbox" name="Metric" checked> <?php echo gettext("Metric"); ?> </input> </td> </tr> <tr> <td class="left"> <input type="checkbox" name="Anomaly" checked> <?php echo gettext("Anomaly"); ?> </input> </td> </tr> <tr> <td class="left"> <input type="checkbox" name="Vulnerability" checked> <?php echo gettext("Vulnerability"); ?> </input> </td> </tr> </table> </td> <td valign="top"> <select name="Type"> <option value="ALL"> <?php echo gettext("ALL"); ?> </option> <?php foreach (Incident_type::get_list($conn) as $itype) { $id = $itype->get_id(); ?> <option <?php if ($type == $id) { echo "selected"; } ?> value="<?php echo $id; ?> "> <?php echo $id; ?> </option> <?php } ?> </select> </td> <td valign="top" > <input type="text" name="In_Charge" value="<?php echo $in_charge; ?> " /></td> <td valign="top" > <input type="text" name="Title" value="<?php echo $title; ?> " /></td> <td valign="top" > <input type="text" size="22" name="Date" value="<?php echo date("F j, Y, g:i a"); ?> " /></td> <td valign="top" > <select name="Status"> <option value="ALL"> <?php echo gettext("ALL"); ?> </option> <option <?php if ($status == "Open") { echo "selected"; } ?> value="Open"> <?php echo gettext("Open"); ?> </option> <option <?php if ($status == "Closed") { echo "selected"; } ?> value="Closed"> <?php echo gettext("Closed"); ?> </option> </select> </td> <td valign="top" > <table> <tr> <td class="left"> <input type="checkbox" name="High" checked> <?php echo gettext("High"); ?> </input> </td> </tr> <tr> <td class="left"> <input type="checkbox" name="Medium" checked> <?php echo gettext("Medium"); ?> </input> </td> </tr> <tr> <td class="left"> <input type="checkbox" name="Low" checked> <?php echo gettext("Low"); ?> </input> </td> </tr> </table> </td> <td valign="top" nowrap > <input type="submit" name="submit_incident" value="Generate" class="btn" style="font-size:12px"> </td> </tr> </tr> </table> </td></tr> </table> </form> <br/> <!-- end filter --> <?php }