function insert_link($conn, $data) { $new_linkname = $data['link']; $id_document = $data['id']; $link_type = $data['type']; ossim_valid($link_type, OSS_INPUT, 'Illegal:' . _('Link Type')); ossim_valid($id_document, OSS_DIGIT, 'Illegal:' . _('Document ID')); switch ($link_type) { case 'directive': ossim_valid($new_linkname, OSS_DIGIT, 'illegal:' . _('Directive')); break; case 'incident': ossim_valid($new_linkname, OSS_DIGIT, 'illegal:' . _('Incident ID')); break; case 'plugin_sid': $plugin = explode('##', $new_linkname); ossim_valid($plugin[0], OSS_DIGIT, 'illegal:' . _('Plugin SID')); ossim_valid($plugin[1], OSS_DIGIT, 'illegal:' . _('Plugin ID')); break; case 'host': case 'host_group': case 'net': case 'net_group': ossim_valid($new_linkname, OSS_HEX, 'illegal:' . _('Asset ID')); break; case 'taxonomy': $tax = explode('##', $new_linkname); ossim_valid($tax[0], OSS_DIGIT, 'illegal:' . _('Product Type')); ossim_valid($tax[1], OSS_DIGIT, 'illegal:' . _('Category')); ossim_valid($tax[2], OSS_DIGIT, 'illegal:' . _('Subcategory')); break; default: $return['error'] = TRUE; $return['msg'] = _('Invalid Link Type'); return $return; } if (ossim_error()) { $info_error = _('Error') . ': ' . ossim_get_error(); ossim_clean_error(); $return['error'] = TRUE; $return['msg'] = $info_error; return $return; } $result = Repository::insert_relationships($conn, $id_document, $link_type, $new_linkname); if (!empty($result)) { $return['error'] = TRUE; $return['msg'] = $result; return $return; } if ($link_type == 'plugin_sid') { $result = Repository::insert_snort_references($conn, $id_document, $plugin[1], $plugin[0]); if (!empty($result)) { $return['error'] = TRUE; $return['msg'] = $result; return $return; } } $info_item['key'] = $new_linkname; $info_item['id'] = $id_document; $info_item['type'] = $link_type; $item_html = build_item_list($conn, $info_item); $return['error'] = FALSE; $return['data'] = $item_html; $return['msg'] = _('Link inserted successfully'); return $return; }
</th> <th> <?php echo _("Value"); ?> </th> <th> <?php echo _("Action"); ?> </th> </tr> <?php $rel_list = is_array($rel_list) ? $rel_list : array(); foreach ($rel_list as $rel) { $rel['id'] = $id_document; $item = build_item_list($conn, $rel); echo $item; } ?> </table> </div> </body> </html> <?php $db->close();