本文整理汇总了PHP中Repository::insert_relationships方法的典型用法代码示例。如果您正苦于以下问题:PHP Repository::insert_relationships方法的具体用法?PHP Repository::insert_relationships怎么用?PHP Repository::insert_relationships使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Repository
的用法示例。
在下文中一共展示了Repository::insert_relationships方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ossim_valid
ossim_valid($type_link, OSS_ALPHA, 'illegal:' . _("type_link"));
ossim_valid($linkdoc, OSS_DIGIT, OSS_NULLABLE, 'illegal:' . _("Linkdoc"));
ossim_valid(GET('insert'), OSS_DIGIT, OSS_NULLABLE, 'illegal:' . _("Insert"));
ossim_valid(GET('newlinkname'), OSS_ALPHA, OSS_PUNC, '#', OSS_NULLABLE, 'illegal:' . _("Newlinkname"));
ossim_valid(GET('key_delete'), OSS_ALPHA, OSS_PUNC, OSS_NULLABLE, 'illegal:' . _("Key_delete"));
ossim_valid(GET('id_delete'), OSS_DIGIT, OSS_NULLABLE, 'illegal:' . _("Id_delete"));
if (ossim_error()) {
die(ossim_error());
}
// DB connect
$db = new ossim_db();
$conn = $db->connect();
// New link on relationships
if ($linkdoc != "" && GET('insert') == "1") {
$name_link = $id != "" ? $conn->GetOne("SELECT title from incident as total WHERE id={$id}") : "";
Repository::insert_relationships($conn, $linkdoc, $type_link, $id_link);
}
// Delete link on relationships
if (GET('key_delete') != "" && GET('id_delete') != "") {
Repository::delete_relationships($conn, GET('id_delete'), GET('key_delete'));
}
$rel_list = Repository::get_relationships_by_link($conn, $id_link);
$pholder = _('Type to Start Searching the Document to Link');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title> <?php
echo _('AlienVault ' . (Session::is_pro() ? 'USM' : 'OSSIM'));
?>
</title>
示例2: insert_link
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;
}
示例3: ossim_valid
ossim_valid($id, OSS_HEX, 'illegal:' . _("id"));
ossim_valid($link_type, OSS_ALPHA, '_', 'illegal:' . _("link_type"));
if (ossim_error()) {
die(ossim_error());
}
// To link back
$referer = array('net_group' => '/ossim/netgroup/netgroup.php');
// DB connect
$db = new ossim_db();
$conn = $db->connect();
$user = Session::get_session_user();
list($document_list, $documents_num_rows) = Repository::get_list($conn);
// New link on relationships
if (GET('linkdoc') != "" && GET('insert') == "1") {
$aux = explode("####", GET('newlinkname'));
Repository::insert_relationships($conn, GET('linkdoc'), $link_type, $id);
}
// Delete link on relationships
if (GET('key_delete') != "" && GET('id_delete') != "") {
Repository::delete_relationships($conn, GET('id_delete'), GET('key_delete'));
}
$rel_list = Repository::get_relationships_by_link($conn, $id);
?>
<html>
<head>
<title> <?php
echo _("OSSIM Framework");
?>
</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
示例4: ossim_valid
ossim_valid($name_host, OSS_TEXT, 'illegal:' . _("name_host"));
//ossim_valid($id_document , OSS_DIGIT, 'illegal:' . _("id_document"));
ossim_valid($id_host, OSS_TEXT, 'illegal:' . _("id_host"));
ossim_valid($link_type, OSS_ALPHA, 'illegal:' . _("link_type"));
if (ossim_error()) {
die(ossim_error());
}
// DB connect
require_once "ossim_db.inc";
$db = new ossim_db();
$conn = $db->connect();
list($document_list, $documents_num_rows) = Repository::get_list($conn);
// New link on relationships
if (GET('linkdoc') != "" && GET('insert') == "1") {
$aux = explode("####", GET('newlinkname'));
Repository::insert_relationships($conn, GET('linkdoc'), $name_host, "host", $id_host);
}
// Delete link on relationships
if (GET('key_delete') != "" && GET('id_delete') != "") {
Repository::delete_relationships($conn, GET('id_delete'), GET('key_delete'));
}
//$document = Repository::get_document($conn,$id_document);
$rel_list = Repository::get_relationships_by_link($conn, $id_host);
//list($hostnet_list,$num_rows) = Repository::get_hostnet($conn,$link_type);
?>
<html>
<head>
<title> <?php
echo gettext("OSSIM Framework");
?>
</title>
示例5: GET
$id_document = GET('id_document') != "" ? GET('id_document') : (POST('id_document') != "" ? POST('id_document') : "");
if (!ossim_valid($id_document, OSS_DIGIT, 'illegal:' . _("id_document"))) {
exit;
}
// DB connect
$db = new ossim_db();
$conn = $db->connect();
$pid = intval(GET('pid'));
// New link on relationships
if (GET('newlinkname') != "" && GET('insert') == "1") {
if ($link_type == "directive") {
$idd = intval(GET('newlinkname'));
Repository::insert_relationships($conn, $id_document, $idd, $link_type, $idd);
} else {
$aux = explode("####", GET('newlinkname'));
Repository::insert_relationships($conn, $id_document, $aux[0], $link_type, $aux[1]);
if ($link_type == "plugin_sid") {
Repository::insert_snort_references($conn, $id_document, $aux[1], $aux[0]);
}
}
}
// Delete link on relationships
if (GET('key_delete') != "") {
$key = mb_convert_encoding(urldecode(GET('key_delete')), 'HTML-ENTITIES', 'UTF-8');
Repository::delete_relationships($conn, $id_document, $key);
if ($link_type == "plugin_sid") {
Repository::delete_snort_references($conn, $id_document);
}
}
$document = Repository::get_document($conn, $id_document);
$rel_list = Repository::get_relationships($conn, $id_document);