本文整理汇总了PHP中Asset_host::get_autodetected_name方法的典型用法代码示例。如果您正苦于以下问题:PHP Asset_host::get_autodetected_name方法的具体用法?PHP Asset_host::get_autodetected_name怎么用?PHP Asset_host::get_autodetected_name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Asset_host
的用法示例。
在下文中一共展示了Asset_host::get_autodetected_name方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _
$host->set_sensors($sensors);
$host->save_in_db($conn_aux, FALSE);
$hosts_in_db[$ip][$ctx] = $ip;
?>
<script type="text/javascript">
parent.$("#ptext").html("<?php
echo _('Inserting new host') . ' <strong>' . $hostname . '</strong>';
?>
");
</script>
<?php
} catch (Exception $e) {
$errors[] = $e->getMessage();
}
} else {
$hostname = Asset_host::get_autodetected_name($ip);
$h_key = $ip . ';' . $ctx;
if (array_key_exists($h_key, $new_hosts) == FALSE) {
$new_hosts[$h_key] = array('hostname' => $hostname, 'ip' => $ip);
fputs($f, $ip . ' detected from Network ' . $net['name'] . "\n");
}
}
}
$rs->MoveNext();
}
}
$i++;
}
if ($mode == 'insert') {
Util::disable_perm_triggers($conn_aux, FALSE);
if (count($new_hosts) > 0) {
示例2: import_assets_from_csv
//.........这里部分代码省略.........
$summary['by_hosts'][$num_line]['errors']['Format'] = _('Number of fields is incorrect');
$summary['general']['statistics']['errors']++;
continue;
}
//Clean values
$param = array();
$index = 0;
$max_index = count($v) - 1;
foreach ($v as $field) {
$parameter = trim($field);
if ($index == 0) {
$pattern = '/^\\"|^\'/';
$param[] = preg_replace($pattern, '', $parameter);
} else {
if ($index == $max_index) {
$pattern = '/\\"$|\'$/';
$param[] = preg_replace($pattern, '', $parameter);
} else {
$param[] = $parameter;
}
}
$index++;
}
//Values
$is_in_db = FALSE;
$host_id = '';
$sensors = $sensor_ids;
$csv_ips = preg_replace("/\\s+/", '', $param[0]);
if (!empty($param[1])) {
$name = $param[1];
} else {
$aux_name = str_replace(' ', '', $csv_ips);
$aux_name = str_replace(',', '-', $aux_name);
$name = Asset_host::get_autodetected_name($aux_name);
}
if ($import_type == 'hosts') {
$fqdns = $param[2];
$descr = $param[3];
$asset_value = !empty($param[4]) ? $param[4] : 2;
if (preg_match('/Host ID/', $csv_headers[8])) {
$os = $param[5];
$latitude = floatval($param[6]);
$longitude = floatval($param[7]);
$external = empty($param[9]) ? 0 : intval($param[9]);
$csv_devices = $param[10];
} else {
$os = $param[6];
$latitude = floatval($param[7]);
$longitude = floatval($param[8]);
$external = 0;
$csv_devices = '';
}
} else {
$descr = $param[2];
$os = $param[3];
$latitude = 0;
$longitude = 0;
$asset_value = 2;
$external = 0;
$csv_devices = $param[4];
}
//Permissions
$can_i_create_assets = Session::can_i_create_assets();
$can_i_modify_ips = TRUE;
//IPs
if (!ossim_valid($csv_ips, OSS_IP_ADDR, 'illegal:' . _('IP'))) {