} elseif ($ref == "Custom") { $fields = Incident_custom::get_custom_types($conn, $type); $form_builder = new Form_builder(); $params = array(); $cont = 1; if (empty($fields)) { echo "<tr><td class='nobborder' colspan='2'>"; $error = new OssimNotice(); $info = array(_("You don't have added any custom types or your custom types have been deleted")); $error->display(_("DEFAULT"), $info, false); echo "</td></tr>"; } else { foreach ($fields as $field) { echo "<tr id='item_" . $cont . "'><th id='name_" . $cont . "' class='thr'><span>" . utf8_decode($field['name']) . "</span></th>"; echo "<td style='border-width: 0px;text-align:left'>"; $params = get_params_field($field, $map_key); $form_builder->set_attributes($params); if (is_object($custom_values[$field['name']])) { $default_value = $custom_values[$field['name']]->get_content(); $type = $custom_values[$field['name']]->get_type(); $id = $custom_values[$field['name']]->get_id(); } else { $default_value = null; } $wf1_types = array('Select box', 'Date', 'Date Range', 'Checkbox', 'Radio button'); if (in_array($field['type'], $wf1_types)) { $class_wf = array('wfl1', 'wfr1'); } else { $class_wf = array('wfl2', 'wfr2'); } echo "<div class='" . $class_wf[0] . "'>";
//Validation array $validate_1 = array('title' => array('validation' => "OSS_ALPHA, OSS_SPACE, OSS_PUNC_EXT, '\\>'", 'e_message' => 'illegal:' . _('Title')), 'priority' => array('validation' => 'OSS_DIGIT', 'e_message' => 'illegal:' . _('Priority')), 'type' => array('validation' => 'OSS_ALPHA, OSS_PUNC_EXT, OSS_SPACE, OSS_SCORE', 'e_message' => 'illegal:' . _('Type')), 'transferred_user' => array('validation' => 'OSS_USER_2, OSS_NULLABLE', 'e_message' => 'illegal:' . _('User')), 'transferred_entity' => array('validation' => 'OSS_HEX, OSS_NULLABLE', 'e_message' => 'illegal:' . _('Entity')), 'submitter' => array('validation' => 'OSS_USER, OSS_PUNC, OSS_NULLABLE', 'e_message' => 'illegal:' . _('Submitter'))); if ($ref == 'Alarm' || $ref == 'Event') { $validate_2 = array('src_ips' => array('validation' => 'OSS_SEVERAL_IP_ADDRCIDR_0, OSS_NULLABLE', 'e_message' => 'illegal:' . _('Source Ips')), 'dst_ips' => array('validation' => 'OSS_SEVERAL_IP_ADDRCIDR_0, OSS_NULLABLE', 'e_message' => 'illegal:' . _('Dest Ips')), 'src_ports' => array('validation' => 'OSS_LETTER, OSS_DIGIT, OSS_PUNC, OSS_SPACE, OSS_NULLABLE', 'e_message' => 'illegal:' . _('Source Ports')), 'dst_ports' => array('validation' => 'OSS_LETTER, OSS_DIGIT, OSS_PUNC, OSS_SPACE, OSS_NULLABLE', 'e_message' => 'illegal:' . _('Dest Ports')), 'backlog_id' => array('validation' => 'OSS_HEX, OSS_NULLABLE', 'e_message' => 'illegal:' . _('Backlog ID')), 'event_id' => array('validation' => 'OSS_HEX, OSS_NULLABLE', 'e_message' => 'illegal:' . _('Event ID')), 'alarm_group_id' => array('validation' => 'OSS_DIGIT, OSS_NULLABLE', 'e_message' => 'illegal:' . _('Alarm group ID')), 'event_start' => array('validation' => 'OSS_DATETIME, OSS_NULLABLE', 'e_message' => 'illegal:' . _('Event start')), 'event_end' => array('validation' => 'OSS_DATETIME, OSS_NULLABLE', 'e_message' => 'illegal:' . _('Event end'))); } elseif ($ref == 'Metric') { $validate_2 = array('target' => array('validation' => 'OSS_TEXT, OSS_NULLABLE', 'e_message' => 'illegal:' . _('Target')), 'metric_type' => array('validation' => 'OSS_ALPHA, OSS_SPACE, OSS_NULLABLE', 'e_message' => 'illegal:' . _('Metric Type')), 'metric_value' => array('validation' => 'OSS_ALPHA, OSS_SPACE, OSS_PUNC, OSS_NULLABLE', 'e_message' => 'illegal:' . _('Metric Value')), 'event_start' => array('validation' => 'OSS_DATETIME, OSS_NULLABLE', 'e_message' => 'illegal:' . _('Event start')), 'event_end' => array('validation' => 'OSS_DATETIME, OSS_NULLABLE', 'e_message' => 'illegal:' . _('Event end'))); } elseif ($ref == 'Anomaly') { $validate_2 = array('anom_ip' => array('validation' => 'OSS_FQDN_IP, OSS_NULLABLE', 'e_message' => 'illegal:' . _('Host')), 'a_sen' => array('validation' => 'OSS_FQDN_IP, OSS_NULLABLE', 'e_message' => 'illegal:' . _('Sensor')), 'port' => array('validation' => 'OSS_PORT, OSS_NULLABLE', 'e_message' => 'illegal:' . _('Port')), 'a_mac' => array('validation' => 'OSS_MAC, OSS_NULLABLE', 'e_message' => 'illegal:' . _('New MAC')), 'a_mac_o' => array('validation' => 'OSS_MAC, OSS_NULLABLE', 'e_message' => 'illegal:' . _('Old MAC')), 'a_os' => array('validation' => 'OSS_ALPHA, OSS_PUNC_EXT, OSS_NULLABLE', 'e_message' => 'illegal:' . _('New OS')), 'a_os_o' => array('validation' => 'OSS_ALPHA, OSS_PUNC_EXT, OSS_NULLABLE', 'e_message' => 'illegal:' . _('Old OS')), 'a_vend' => array('validation' => 'OSS_ALPHA, OSS_PUNC_EXT, OSS_NULLABLE', 'e_message' => 'illegal:' . _('New Vendor')), 'a_vend_o' => array('validation' => 'OSS_ALPHA, OSS_PUNC_EXT, OSS_NULLABLE', 'e_message' => 'illegal:' . _('Old Vendor')), 'a_ver' => array('validation' => 'OSS_ALPHA, OSS_PUNC_EXT, OSS_NULLABLE', 'e_message' => 'illegal:' . _('New Version')), 'a_ver_o' => array('validation' => 'OSS_ALPHA, OSS_PUNC_EXT, OSS_NULLABLE', 'e_message' => 'illegal:' . _('Old Version')), 'a_prot_o' => array('validation' => 'OSS_ALPHA, OSS_PUNC_EXT, OSS_NULLABLE', 'e_message' => 'illegal:' . _('New Protocol')), 'a_prot' => array('validation' => 'OSS_ALPHA, OSS_PUNC_EXT, OSS_NULLABLE', 'e_message' => 'illegal:' . _('Old Protocol')), 'a_date' => array('validation' => 'OSS_DATETIME, OSS_NULLABLE', 'e_message' => 'illegal:' . _('When'))); } elseif ($ref == 'Vulnerability') { $validate_2 = array('ip' => array('validation' => 'OSS_IP_ADDRCIDR_0, OSS_NULLABLE', 'e_message' => 'illegal:' . _('Host')), 'port' => array('validation' => 'OSS_PORT, OSS_NULLABLE', 'e_message' => 'illegal:' . _('Port')), 'risk' => array('validation' => 'OSS_LETTER, OSS_DIGIT, OSS_PUNC, OSS_SPACE, OSS_NULLABLE', 'e_message' => 'illegal:' . _('Risk')), 'nessus_id' => array('validation' => 'OSS_LETTER, OSS_DIGIT, OSS_PUNC, OSS_SPACE, OSS_NULLABLE', 'e_message' => 'illegal:' . _('Nessus/OpenVas ID')), 'description' => array('validation' => "OSS_NULLABLE, OSS_AT, OSS_TEXT, OSS_PUNC_EXT, '~'", 'e_message' => 'illegal:' . _('Description'))); } elseif ($ref == 'Custom') { $fields = Incident_custom::get_custom_types($conn, $type); $validate_2 = array(); if (is_array($fields) && !empty($fields)) { foreach ($fields as $field) { $params = get_params_field($field); if (preg_match('/vfield/', $params['class'])) { $validate_2[$params['name']] = array('validation' => $params['validation'], 'e_message' => 'illegal:' . _($field['name'])); } } } } if ($action == 'editincident') { $validate_1['incident_id'] = array('validation' => 'OSS_DIGIT', 'e_message' => 'illegal:' . _('Incident ID')); } $validate = array_merge($validate_1, $validate_2); /* echo '<pre>"; print_r($validate); echo "</pre>"; */