Esempio n. 1
0
$c1 = $otx->get_token();
$c2 = $c1 && $otx->get_key_version() < 2;
if (!$c1 || $c2) {
    $_GET['error_type'] = !$c1 ? 'token' : 'old_key';
    require '../draw/otx_unregistered.php';
    die;
}
//Now the widget's data will be calculated depending of the widget's type.
switch ($type) {
    case "top":
        $limit = $chart_info['top'] > 0 ? $chart_info['top'] : 5;
        $range = $chart_info['range'] > 0 ? $chart_info['range'] : 14;
        $params = array('top' => $limit, 'range' => $range);
        $range = $range * 86400;
        try {
            $top_otx = $otx->get_top_pulses($params);
            foreach ($top_otx as $p_id => $pulse) {
                $name = $pulse['name'];
                $data[] = $pulse['total'];
                $label[] = strlen($name) > 28 ? substr($name, 0, 25) . '...' : $name;
                $tooltip[] = $name;
                $link = "/ossim/forensics/base_qry_main.php?clear_allcriteria=1&time_range=range&time_cnt=2&time[0][0]=+&time[0][1]=%3E%3D&time[0][8]=+&time[0][9]=AND&time[1][1]=%3C%3D&time[0][2]=" . gmdate("m", $timeutc - $range) . "&time[0][3]=" . gmdate("d", $timeutc - $range) . "&time[0][4]=" . gmdate("Y", $timeutc - $range) . "&time[0][5]=00&time[0][6]=00&time[0][7]=00&time[1][2]=" . gmdate("m", $timeutc) . "&time[1][3]=" . gmdate("d", $timeutc) . "&time[1][4]=" . gmdate("Y", $timeutc) . "&time[1][5]=23&time[1][6]=59&time[1][7]=59&otx[0]=" . $p_id . "&submit=Query+DB&num_result_rows=-1&sort_order=time_d";
                $f_link = Menu::get_menu_url($link, 'analysis', 'security_events', 'security_events');
                $links[] = $f_link;
            }
        } catch (Exception $e) {
        }
        $colors = get_widget_colors(count($data));
        $nodata_text = _('No recent OTX activity.');
        $hide_x_axis = TRUE;
        break;