本文整理汇总了PHP中ossim_get_error函数的典型用法代码示例。如果您正苦于以下问题:PHP ossim_get_error函数的具体用法?PHP ossim_get_error怎么用?PHP ossim_get_error使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ossim_get_error函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: delete_nfsen_source
function delete_nfsen_source($data)
{
if (!Session::am_i_admin()) {
$return['error'] = TRUE;
$return['msg'] = _('Action not authorized');
return $return;
}
require_once '../sensor/nfsen_functions.php';
$sensor = $data['sensor'];
ossim_valid($sensor, OSS_ALPHA, 'illegal:' . _('Nfsen Source'));
if (ossim_error()) {
$info_error = _('Error') . ': ' . ossim_get_error();
ossim_clean_error();
$return['error'] = TRUE;
$return['msg'] = $info_error;
return $return;
}
$res = delete_nfsen($sensor);
if ($res['status'] == 'success') {
$return['error'] = FALSE;
$return['msg'] = _('Source deleted successfully');
//To forcer load variables in session again
unset($_SESSION['tab']);
} else {
$return['error'] = TRUE;
$return['msg'] = $res['data'];
}
return $return;
}
示例2: check_ossim_error
function check_ossim_error()
{
if (ossim_error()) {
$error = ossim_get_error();
ossim_clean_error();
Av_exception::throw_error(Av_exception::USER_ERROR, $error);
}
}
示例3: check_ossim_error
function check_ossim_error($throw_excep = TRUE)
{
if (ossim_error()) {
$error = ossim_get_error();
ossim_clean_error();
if ($throw_excep) {
Av_exception::throw_error(Av_exception::USER_ERROR, $error);
} else {
Util::response_bad_request($error);
}
}
}
示例4: modify_plugingroup_plugin
function modify_plugingroup_plugin($conn, $data)
{
$plugin_group = $data['plugin_group'];
$plugin_id = $data['plugin_id'];
$sids_str = $data['plugin_sids'];
ossim_valid($plugin_id, OSS_DIGIT, 'illegal:' . _("Plugin ID"));
ossim_valid($plugin_group, OSS_HEX, 'illegal:' . _("Plugin GroupID"));
if (ossim_error()) {
$info_error = "Error: " . ossim_get_error();
ossim_clean_error();
$return['error'] = true;
$return['msg'] = $info_error;
return $return;
}
$total_sel = 1;
if (is_array($sids_str)) {
$total_sel = count($sids_str);
$sids_str = implode(',', $sids_str);
}
if ($sids_str !== '') {
list($valid, $data) = Plugin_sid::validate_sids_str($sids_str);
if (!$valid) {
$return['error'] = true;
$return['msg'] = _("Error for data source ") . $plugin_id . ': ' . $data;
return $return;
}
if ($sids_str == "ANY") {
$sids_str = "0";
} else {
$total = Plugin_sid::get_sidscount_by_id($conn, $plugin_id);
$sids_str = $total_sel == $total ? "0" : $sids_str;
}
Plugin_group::edit_plugin($conn, $plugin_group, $plugin_id, $sids_str);
}
$return['error'] = false;
$return['output'] = '';
return $return;
}
示例5: modify_deploy_hosts
function modify_deploy_hosts($wizard, $data)
{
$os = $data['os'];
$hosts = $data['hosts'];
$username = $data['username'];
$password = $data['password'];
$domain = $data['domain'];
ossim_valid($os, "windows|linux", 'illegal:' . _('Deploy Option'));
ossim_valid($hosts, OSS_HEX, 'illegal:' . _('Host'));
ossim_valid($username, OSS_USER_2, 'illegal:' . _('Username'));
ossim_valid($password, OSS_PASSWORD, 'illegal:' . _('Password'));
ossim_valid($domain, OSS_NOECHARS, OSS_ALPHA, OSS_PUNC_EXT, OSS_NULLABLE, 'illegal:' . _('Domain'));
if (ossim_error()) {
$response['error'] = TRUE;
$response['msg'] = ossim_get_error();
ossim_clean_error();
return $response;
}
$domain = $os == 'windows' ? $domain : '';
//Encrypting password to save it in the object
$pass_c = Util::encrypt($password, Util::get_system_uuid());
//First we clean the deploy info stored in the object
$wizard->clean_step_data();
//Saving the info to achieve the deploy
$wizard->set_step_data('deploy_os', $os);
$wizard->set_step_data('deploy_username', $username);
$wizard->set_step_data('deploy_password', $pass_c);
$wizard->set_step_data('deploy_domain', $domain);
$wizard->set_step_data('deploy_hosts', $hosts);
//Setting the deploy step to 1 (Inicialized)
$wizard->set_step_data('deploy_step', 1);
//Saving wizard status
$wizard->save_status();
$response['error'] = FALSE;
return $response;
}
示例6: _
$info_error = '<div>' . _('We Found the following errors') . ':</div><div style="padding:10px;">' . implode('<br/>', $validation_errors) . '</div>';
}
}
}
//Form actions
if (empty($step)) {
unset($_SESSION['_al_new']);
$sensor_id = GET('sensor');
ossim_valid($sensor_id, OSS_HEX, 'illegal:' . _('Sensor'));
if (!ossim_error()) {
if (!Ossec_utilities::is_sensor_allowed($conn, $sensor_id)) {
ossim_set_error(_('Error! Sensor not allowed'));
}
}
if (ossim_error()) {
$info_error = ossim_get_error();
} else {
$sensor_name = Av_sensor::get_name_by_id($conn, $sensor_id);
$_SESSION['_al_new']['sensor'] = $sensor_id;
$_SESSION['_al_new']['sensor_name'] = $sensor_name;
}
} elseif ($step == 1 || $step == 2 && !empty($back)) {
$hostname = $_SESSION['_al_new']['hostname'] = POST('hostname');
$ip = $_SESSION['_al_new']['ip'] = POST('ip');
$user = $_SESSION['_al_new']['user'] = POST('user');
$pass = $_SESSION['_al_new']['pass'] = POST('pass');
$passc = $_SESSION['_al_new']['passc'] = POST('passc');
$ppass = $_SESSION['_al_new']['ppass'] = POST('ppass');
$ppassc = $_SESSION['_al_new']['ppassc'] = POST('ppassc');
$use_su = $_SESSION['_al_new']['use_su'] = intval(POST('use_su'));
$descr = $_SESSION['_al_new']['descr'] = POST('descr');
示例7: check_deploy_perms
* Otherwise you can read it here: http://www.gnu.org/licenses/gpl-2.0.txt
*
*/
require_once 'av_init.php';
require_once '../deploy_common.php';
//Checking perms
check_deploy_perms();
/* connect to db */
$db = new ossim_db(TRUE);
$conn = $db->connect();
$type = GET('type');
$id = GET('id');
ossim_valid($id, OSS_HEX, 'illegal:' . _("Network ID"));
ossim_valid($type, "network", "server", 'illegal:' . _("Asset Type"));
if (ossim_error()) {
$error_msg = "Error: " . ossim_get_error();
$error = true;
ossim_clean_error();
}
$type = $type == 'server' ? 1 : 4;
$sql = "SELECT distinct HEX(h.id) as id, h.hostname, MAX(DATE(ac.timestamp)) as log\n\t\t\t\tFROM alienvault.host_types t, alienvault.host_net_reference hn, alienvault.host h \n\t\t\t\tLEFT JOIN alienvault_siem.ac_acid_event ac ON ac.src_host = h.id\n\t\t\t\tWHERE h.id=hn.host_id AND h.id=t.host_id AND t.type=? AND hn.net_id=UNHEX(?)\n\t\t\t\tGROUP BY h.id\n\t\t\t\t";
$params = array($type, $id);
$asset_list = array();
if ($rs = $conn->Execute($sql, $params)) {
while (!$rs->EOF) {
try {
$ips = Asset_host_ips::get_ips_to_string($conn, $rs->fields['id']);
} catch (Exception $e) {
$ips = '';
}
$asset_list[] = array('id' => $rs->fields['id'], 'name' => $rs->fields["hostname"], 'ip' => $ips, 'log' => $rs->fields["log"]);
示例8: 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;
}
示例9: md5
$res['data'] = md5($cidr);
}
echo json_encode($res);
exit;
} elseif ($action == 'check_server') {
$new_server = POST('new_server');
$old_server = POST('old_server');
$priority = POST('priority');
ossim_valid($new_server, OSS_IP_ADDR, 'illegal:' . _('IP Address'));
ossim_valid($priority, '0,1,2,3,4,5', 'illegal:' . _('Priority'));
if (!empty($old_server)) {
ossim_valid($old_server, OSS_IP_ADDR, 'illegal:' . _('IP Address'));
}
if (ossim_error()) {
$res['status'] = 'error';
$res['data'] = ossim_get_error();
echo json_encode($res);
exit;
}
session_start();
$cnf_data = $_SESSION['sensor_cnf'];
$server_ip = $cnf_data['server_ip']['value'];
session_write_close();
//Update master server
if (!empty($old_server) && $old_server == $server_ip) {
$res['status'] = 'success';
$res['data']['id'] = md5($new_server);
$res['data']['server_type'] = _('Server, Inventory');
$res['data']['is_master'] = TRUE;
} else {
$res['status'] = 'success';
示例10: check_security
function check_security($value, $match, $value2 = NULL, $userfriendly = false)
{
require_once "classes/Security.inc";
switch ($match) {
case "text":
ossim_valid($value, OSS_SPACE, OSS_ALPHA, OSS_SCORE, OSS_SLASH, OSS_DOT, 'illegal:' . _("{$match} value"));
break;
case "ip":
// "LIKE" patch
if (preg_match("/^\\d+\\.\\d+\\.\\d+\$/", $value)) {
$value .= ".0";
} elseif (preg_match("/^\\d+\\.\\d+\$/", $value)) {
$value .= ".0.0";
} elseif (preg_match("/^\\d+\$/", $value)) {
$value .= ".0.0.0";
}
ossim_valid($value, OSS_IP_ADDR, 'illegal:' . _("{$match} value"));
break;
case "network":
ossim_valid($value, OSS_IP_CIDR, 'illegal:' . _("{$match} value"));
break;
case "number":
ossim_valid($value, OSS_DIGIT, 'illegal:' . _("{$match} value"));
break;
case "fixed":
ossim_valid($value, OSS_SPACE, OSS_ALPHA, OSS_SCORE, OSS_SLASH, OSS_DOT, 'illegal:' . _("{$match} value"));
//ossim_valid($value, OSS_ALPHA, OSS_SCORE, OSS_SLASH, 'illegal:' . _("$match value"));
break;
case "concat":
ossim_valid($value, OSS_ALPHA, '-', 'illegal:' . _("{$match} value"));
break;
case "fixedText":
ossim_valid($value2, OSS_SPACE, OSS_ALPHA, OSS_SCORE, OSS_SLASH, 'illegal:' . _("{$match} value"));
ossim_valid($value, OSS_ALPHA, OSS_SCORE, OSS_SLASH, 'illegal:' . _("{$match} value"));
break;
}
if (ossim_error()) {
?>
<table class="noborder transparent" align="center" width="94%">
<tr><td class='nobborder'><div class='ossim_error'><?php
echo ossim_get_error();
?>
</div></td></tr>
<tr>
<td class="nobborder" style="padding:10px 0;text-align:center">
<?php
$location = $userfriendly ? "/ossim/inventorysearch/userfriendly.php" : "/ossim/inventorysearch/inventory_search.php";
?>
<input type="button" value="Back" onclick="document.location.href='<?php
echo $location;
?>
'" class="button"/>
</td>
</tr>
</table>
<?php
exit;
}
}
示例11: POST
//DataTables Pagination and search Params
$maxrows = POST('iDisplayLength') != '' ? POST('iDisplayLength') : 10;
$from = POST('iDisplayStart') != '' ? POST('iDisplayStart') : 0;
$order = POST('iSortCol_0') != '' ? POST('iSortCol_0') : '';
$torder = POST('sSortDir_0');
$sec = POST('sEcho');
$search = utf8_decode(POST('search'));
$torder = !strcasecmp($torder, 'asc') ? 0 : 1;
ossim_valid($maxrows, OSS_DIGIT, 'illegal: iDisplayLength');
ossim_valid($from, OSS_DIGIT, 'illegal: iDisplayStart');
ossim_valid($order, OSS_ALPHA, 'illegal: iSortCol_0');
ossim_valid($torder, OSS_DIGIT, 'illegal: sSortDir_0');
ossim_valid($sec, OSS_DIGIT, 'illegal: sEcho');
ossim_valid($search, OSS_NOECHARS, OSS_ALPHA, OSS_NET_NAME, OSS_NULLABLE, 'illegal: search');
if (ossim_error()) {
echo ossim_get_error();
$response['sEcho'] = intval($sec);
$response['iTotalRecords'] = 0;
$response['iTotalDisplayRecords'] = 0;
$response['aaData'] = array();
echo json_encode($response);
exit;
}
$filters = array();
$tables = '';
// Order by column
switch ($order) {
case 0:
$order = 'name';
break;
default:
示例12: set_default_map
function set_default_map($conn, $id)
{
ossim_valid($id, OSS_HEX, 'illegal:' . _('Map'));
if (ossim_error()) {
$info_error = "Error: " . ossim_get_error();
ossim_clean_error();
$return['error'] = TRUE;
$return['msg'] = $info_error;
return $return;
}
if (!is_map_editable($conn, $id)) {
$return['error'] = TRUE;
$return['msg'] = _("You do not have permission to edit this map");
return $return;
}
$login = Session::get_session_user();
$config = new User_config($conn);
$config->set($login, "riskmap", $id, 'simple', "main");
$return['error'] = FALSE;
$return['msg'] = _("Default map changed successfully");
return $return;
}
示例13: array
$err_msn = array('dir' => _('Directory/File monitored'), 'ign' => _('Directory/File ignored'), 'went' => _('Windows registry entry'), 'regi' => _('Registry ignore'));
$keys = array();
$indexes = array('dir' => 0, 'ign' => 0, 'went' => 0, 'regi' => 0);
foreach ($_POST as $k => $v) {
if ($v == '') {
continue;
}
foreach ($regex as $i => $r) {
if (preg_match("/{$r}/", $k, $match)) {
$indexes[$i] = $indexes[$i]++;
//Auto-remove '\' to avoid a syntax error
$v = preg_replace('/\\\\+$/', '', $v);
$keys[$i][$match[1]] = $v;
ossim_valid($v, OSS_ALPHA, OSS_PUNC_EXT, OSS_SLASH, OSS_NULLABLE, 'illegal:' . $err_msn[$i]);
if (ossim_error()) {
$info_error[] = ossim_get_error() . '. Input num. ' . $indexes[$i];
ossim_clean_error();
}
break;
}
}
}
if (!empty($info_error)) {
$data['status'] = 'error';
$data['data'] = implode('<br/>', $info_error);
echo json_encode($data);
exit;
}
if (is_array($keys['dir']) && !empty($keys['dir'])) {
foreach ($keys['dir'] as $k => $v) {
$node_sys .= '<directories';
示例14: build_crumb
function build_crumb($data)
{
Session::logcheck("dashboard-menu", "ControlPanelExecutiveEdit");
$type = $data['type'];
$step = $data['step'];
$titles = array();
$pro = Session::is_pro();
ossim_valid($type, OSS_DIGIT, 'illegal:' . _("Breadcrumb"));
ossim_valid($step, OSS_DIGIT, 'illegal:' . _("Step"));
if (ossim_error()) {
$info_error = "Error: " . ossim_get_error();
ossim_clean_error();
$return['error'] = TRUE;
$return['msg'] = $info_error;
return $return;
}
switch ($type) {
case 1:
$titles = array(1 => utf8_encode(_("Select Type")), 2 => utf8_encode(_("Select Category")), 4 => utf8_encode(_("Customize Widget")), 5 => utf8_encode(_("Save Widget")));
if ($pro) {
$titles[3] = utf8_encode(_("Select Assets"));
}
break;
case 2:
$titles = array(1 => utf8_encode(_("Select Type")), 2 => utf8_encode(_("Insert Rss URL")), 4 => utf8_encode(_("Customize Widget")), 5 => utf8_encode(_("Save Widget")));
break;
case 3:
$titles = array(1 => utf8_encode(_("Select Type")), 2 => utf8_encode(_("Insert Image URL")), 4 => utf8_encode(_("Customize Widget")), 5 => utf8_encode(_("Save Widget")));
break;
case 4:
$titles = array(1 => utf8_encode(_("Select Type")), 2 => utf8_encode(_("Select Report")), 4 => utf8_encode(_("Customize Widget")), 5 => utf8_encode(_("Save Widget")));
break;
case 5:
$titles = array(1 => utf8_encode(_("Select Type")), 2 => utf8_encode(_("Select OSSIM URL")), 4 => utf8_encode(_("Customize Widget")), 5 => utf8_encode(_("Save Widget")));
break;
case 6:
$titles = array(1 => utf8_encode(_("Select Type")), 4 => utf8_encode(_("Customize Widget")), 5 => utf8_encode(_("Save Widget")));
if ($pro) {
$titles[3] = utf8_encode(_("Select Assets"));
}
break;
case 7:
$titles = array(1 => utf8_encode(_("Select Type")), 4 => utf8_encode(_("Customize Widget")), 5 => utf8_encode(_("Save Widget")));
break;
}
$breadcrumb = "";
ksort($titles);
foreach ($titles as $i => $title) {
if ($i > $step) {
break;
}
if ($i == $step) {
$class = "class='current'";
$link = "#";
} else {
$class = "";
$link = "wizard.php?backbc=1&step={$i}";
}
$breadcrumb .= "<li id='step{$i}' {$class}>\n\t\t\t\t\t\t\t<a href='{$link}'>" . $title . "</a>\n\t\t\t\t\t\t</li>";
}
$return['error'] = FALSE;
$return['msg'] = $breadcrumb;
return $return;
}
示例15: _
$info_error = '<div>' . _('We Found the following errors') . ':</div><div style="padding:10px;">' . implode('<br/>', $validation_errors) . '</div>';
}
}
}
//Form actions
ossim_valid($ip, OSS_IP_ADDR, 'illegal:' . _('Ip Address'));
ossim_valid($sensor_id, OSS_HEX, 'illegal:' . _('Sensor'));
$db = new ossim_db();
$conn = $db->connect();
if (!ossim_error()) {
if (!Ossec_utilities::is_sensor_allowed($conn, $sensor_id)) {
ossim_set_error(_('Error! Sensor not allowed'));
}
}
if (ossim_error()) {
$critical_error = ossim_get_error();
ossim_clean_error();
} else {
$agentless = Ossec_agentless::get_object($conn, $sensor_id, $ip);
if (is_object($agentless) && !empty($agentless)) {
$ip = $agentless->get_ip();
$hostname = $agentless->get_hostname();
$user = $agentless->get_user();
$pass = Util::fake_pass($agentless->get_pass());
$passc = $pass;
$ppass = Util::fake_pass($agentless->get_ppass());
$use_su = $agentless->get_use_su();
$ppassc = $ppass;
$descr = $agentless->get_descr();
$sensor_name = Av_sensor::get_name_by_id($conn, $sensor_id);
$_SESSION['_al_new']['sensor'] = $sensor_id;