本文整理汇总了PHP中Asset_host::get_ctx方法的典型用法代码示例。如果您正苦于以下问题:PHP Asset_host::get_ctx方法的具体用法?PHP Asset_host::get_ctx怎么用?PHP Asset_host::get_ctx使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Asset_host
的用法示例。
在下文中一共展示了Asset_host::get_ctx方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sprintf
$validation_errors = validate_form_fields('POST', $validate);
//Database connection
$db = new ossim_db();
$conn = $db->connect();
if (empty($validation_errors)) {
//Extra validations
try {
if (Asset_host::is_in_db($conn, $asset_id) == FALSE) {
$e_msg = _('Unable to deploy HIDS agent. This asset no longer exists in the asset inventory. Please check with your system admin for more information');
Av_exception::throw_error(Av_exception::USER_ERROR, $e_msg);
}
$asset = new Asset_host($conn, $asset_id);
$asset->load_from_db($conn);
//Check asset context
$ext_ctxs = Session::get_external_ctxs($conn);
$ctx = $asset->get_ctx();
if (!empty($ext_ctxs[$ctx])) {
$e_msg = _('Asset can only be deployed at this USM');
//Server related to CTX
$server_obj = Server::get_server_by_ctx($conn, $ctx);
if ($server_obj) {
$s_name = $server_obj->get_name();
$s_ip = $server_obj->get_ip();
$server = $s_name . ' (' . $s_ip . ')';
$e_msg = sprintf(_("Unable to deploy agent to assets on a child server. Please login to %s to deploy the HIDS agents"), $server);
}
Av_exception::throw_error(Av_exception::USER_ERROR, $e_msg);
}
} catch (Exception $e) {
$validation_errors['asset_id'] = $e->getMessage();
}
示例2: _
$id = GET('id');
ossim_valid($id, OSS_HEX, 'illegal:' . _('Host ID'));
if (ossim_error()) {
echo ossim_error(_('Error! Host not found'));
exit;
}
/****************************************************
******************** Host data *********************
****************************************************/
//Database connection
$db = new ossim_db();
$conn = $db->connect();
$host = new Asset_host($conn, $id);
$host->load_from_db($conn);
//CTX
$ctx = $host->get_ctx();
$is_nagios_enabled = $host->is_nagios_enabled($conn);
$is_ext_ctx = FALSE;
$ext_ctxs = Session::get_external_ctxs($conn);
if (!empty($ext_ctxs[$ctx])) {
$is_ext_ctx = TRUE;
}
//Closing database connection
$db->close();
?>
<!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 _('OSSIM Framework');
?>