function do_embed_lazy($html = '') { if (is_exit() || empty($html)) { return $html; } $patern_ifr = '/<\\s*iframe\\s+(?<attr>[^>]*)/i'; if (preg_match($patern_ifr, $html, $ifr)) { $attr_arr = parse_attr($ifr['attr']); if (!$attr_arr || empty($attr_arr['src']) || LAZY_PLACEHOLDER === $attr_arr['src'] || !empty($attr_arr['data-src'])) { return $html; } if (array_key_exists('class', $attr_arr)) { $attr_arr['class'] = do_class($attr_arr['class']); } else { $attr_arr['class'] = LAZY_CLASS; } $attr_arr['data-src'] = $attr_arr['src']; $attr_arr['src'] = LAZY_PLACEHOLDER; $html = str_replace($ifr['attr'], trim(attributes_to_string($attr_arr)), $html); get_assets(); } return $html; }
$icon = $iconbg != '' && $iconbg != 'transparent' ? $icon . "#" . $iconbg : $icon; $params = array($name, $url, $type, $type_name, $iconsize, $icon, $ri_id); $icon_query = ", icon= ?"; } else { $params = array($name, $url, $type, $type_name, $iconsize, $ri_id); $icon_query = ''; } $update_status = FALSE; if ($ri_id != '' && $name != '') { $query = "UPDATE risk_indicators set name= ?, url = ?, type= ?, type_name= ?, size= ? " . $icon_query . " WHERE id= ?"; $conn->Execute($query, $params); $update_status = TRUE; } } foreach ($delete_list as $idb) { $host_types = array("host", "server", "sensor"); list($name, $sensor, $type, $ips, $in_assets) = get_assets($conn, $idb[2], $idb[1], $host_types); $type = fix_type($type); $query = "DELETE FROM bp_asset_member WHERE member = UNHEX(?) AND type = ?"; $params = array($name, $type); $conn->Execute($query, $params); $query = "DELETE FROM risk_indicators WHERE id= ?"; $conn->Execute($query, array($idb[0])); $update_status == TRUE; } if ($update_status == TRUE) { $data['data'] = 'refresh_indicators();'; } echo json_encode($data); shell_exec('/usr/bin/sudo /usr/share/ossim/scripts/framework-restart > /dev/null 2>/dev/null &'); $db->close();
/** * Get Stylesheets * * @since 1.6.0 * * @param $instance (Assets object) (optional) Instance of Assets */ function get_stylesheets($instance = false) { return get_assets('stylesheet', $instance); }
function get_map_values($conn, $map, $name, $type, $host_types) { $r_value_max = -1; $v_value_max = -1; $a_value_max = -1; $r_value_aux = -1; $v_value_aux = -1; $a_value_aux = -1; $sensor = ''; $ips = $name; $in_assets = 0; list($map_array, $obj_map) = get_map_objects($conn, $map); foreach ($obj_map as $object) { list($name, $sensor, $type, $ips, $in_assets) = get_assets($conn, $object['type_name'], $object['type'], $host_types); list($r_value_aux, $v_value_aux, $a_value_aux) = get_values($conn, $host_types, $object['type'], $name, TRUE); if ($r_value_aux > $r_value_max) { $r_value_max = $r_value_aux; } if ($v_value_aux > $v_value_max) { $v_value_max = $v_value_aux; } if ($a_value_aux > $a_value_max) { $a_value_max = $a_value_aux; } } $r_value = get_value_by_digit($r_value_max); $v_value = get_value_by_digit($v_value_max); $a_value = get_value_by_digit($a_value_max); return array($r_value, $v_value, $a_value, $name, $sensor, $type, $ips, $in_assets); }
<?php get_assets('base', 'css');
function print_indicator_content($conn, $rs, $linked = 1) { $host_types = array("host", "server", "sensor"); // Linked to another map: loop by this map indicators if (preg_match("/view\\.php\\?map\\=(\\d+)/", $rs->fields['url'], $found)) { list($RiskValue, $VulnValue, $AvailValue, $v_ip, $a_ip, $name, $sensor, $type, $ips, $what, $in_assets) = get_map_values($conn, $found[1], $rs->fields["type_name"], $rs->fields["type"], $host_types); } else { // Asset Values list($name, $sensor, $type, $ips, $what, $in_assets) = get_assets($conn, $rs->fields["type_name"], $rs->fields["type"], $host_types); list($RiskValue, $VulnValue, $AvailValue, $v_ip, $a_ip, $r_ip) = get_values($conn, $host_types, $type, $name, $ips, false); } $gtype = $type == "net" ? "net" : "host"; $ips = $type == "net" ? $ips : $name; $r_url = "../control_panel/show_image.php?ip=" . urlencode($type == "host_group" ? $r_ip : $name) . "&range=week&what=compromise&start=N-1Y&end=N&type={$gtype}&zoom=1&hmenu=Risk&smenu=Metrics"; $v_url = "../vulnmeter/index.php?value=" . urlencode($type == "host_group" ? $v_ip : $ips) . "&type=hn&hmenu=Vulnerabilities&smenu=Vulnerabilities"; $a_url = "../nagios/index.php?sensor=" . urlencode($sensor) . "&hmenu=Availability&smenu=Availability&nagios_link=" . urlencode("/cgi-bin/status.cgi?host=all"); $size = $rs->fields["size"] > 0 ? $rs->fields["size"] : ''; $icon = $rs->fields["icon"]; if (preg_match("/\\#/", $icon)) { $aux = explode("#", $icon); $icon = $aux[0]; $bgcolor = $aux[1]; } else { $bgcolor = "transparent"; } if ($linked == 0) { $url = "javascript:;"; } else { if ($rs->fields["url"] == "REPORT") { $url = "../report/index.php?host=" . $ips; } else { $url = $rs->fields["url"] != '' ? $rs->fields["url"] : "javascript:;"; } } if (!$in_assets) { $icon = "../pixmaps/marker--exclamation.png"; $size = "16"; } $name = mb_detect_encoding($rs->fields["name"] . " ", 'UTF-8,ISO-8859-1') == 'UTF-8' ? $rs->fields["name"] : mb_convert_encoding($rs->fields["name"], 'UTF-8', 'ISO-8859-1'); ?> <table width="100%" border='0' cellspacing='0' cellpadding='1' style="background-color:<?php echo $bgcolor; ?> "> <tr> <td colspan='2' align='center'> <a href="<?php echo $url; ?> " class="ne"><i><?php echo $name; ?> </i></a> </td> </tr> <tr> <td> <a href="<?php echo $url; ?> "><img src="<?php echo $icon; ?> " width="<?php echo $size; ?> " border='0'/></a> </td> <td> <table border='0' cellspacing='0' cellpadding='1'> <tr> <td><a class="ne11" target="main" href="<?php echo $r_url; ?> ">R</a></td> <td><a class="ne11" target="main" href="<?php echo $v_url; ?> ">V</a></td> <td><a class="ne11" target="main" href="<?php echo $a_url; ?> ">A</a></td> </tr> <tr> <td><img src="images/<?php echo $RiskValue; ?> .gif" border='0'/></td> <td><img src="images/<?php echo $VulnValue; ?> .gif" border='0'/></td> <td><img src="images/<?php echo $AvailValue; ?> .gif" border='0'/></td> </tr> </table> </td> </tr> </table> <?php }
<?php get_assets('base', 'js');