Beispiel #1
0
</td></tr>
        				
        				<tr>
        				<td style="height:106px" align="center">
        					<div id="graph4" style="text-align:center;margin:0px;height:104px;width:98%"></div>
        				</td>
        				</tr>
        
        					<script language="javascript" type="text/javascript">
        						$( function () {
        					        $.plot($("#graph4"), [
        								<?php 
    $i = 0;
    foreach ($list4 as $l) {
        $event = Util::signaturefilter($l[0]);
        $short_event = Security_report::Truncate($event, 20);
        $occurrences = number_format($l[1], 0, ",", ".");
        $label = str_replace("'", "\\'", "[<b>{$occurrences}</b>] {$short_event}");
        //if (strlen($label)>31) $label = substr($label, 0, 30)."..";
        ?>
        									<?php 
        echo $i++ == 0 ? "" : ",";
        ?>
{ label: '<?php 
        echo $label;
        ?>
',  data: <?php 
        echo $l[1];
        ?>
}
        								<?php 
if ($type == "event" && is_array($SS_TopEvents) && count($SS_TopEvents) > 0) {
    $list = $SS_TopEvents;
} elseif ($type == "alarm" && is_array($SA_TopAlarms) && count($SA_TopAlarms) > 0) {
    $list = $SA_TopAlarms;
} else {
    $list = $security_report->Events($limit, $type, $date_from, $date_to);
}
$data_pie = array();
$legend = $data = array();
foreach ($list as $key => $l) {
    if ($key >= 10) {
        // ponemos un límite de resultados para la gráfica
        break;
    }
    $data_pie[$l[1]] = Security_report::Truncate($l[0], 60);
    $legend[] = Util::signaturefilter(Security_report::Truncate($l[0], 60));
    $data[] = $l[1];
}
$total = array_sum($data);
$labels = array();
$tlabels = array();
$zero = $one = $two = 0;
foreach ($data as $value) {
    if (round($value / $total, 2) * 100 == 0) {
        // 0%
        $zero++;
    } else {
        if (round($value / $total, 2) * 100 == 1) {
            // 1%
            $one++;
        } else {
Beispiel #3
0
?>
:&nbsp;
                <select name="interface" onChange="submit()">

                    <?php 
if ($_total) {
    foreach ($ntop_list as $s_id => $s) {
        if ($sensor == $s['ip']) {
            foreach ($s['i_faces'] as $i_face => $i_data) {
                if ($interface == '' && $i_data['role'] == 'admin' || $interface == $i_face) {
                    $selected = " selected='selected'";
                } else {
                    $selected = '';
                }
                $interface_name = $i_data['name'] != '' ? $i_data['name'] : $i_face;
                $interface_name = Security_report::Truncate($interface_name, 30, '...');
                ?>
                                    <option <?php 
                echo $selected;
                ?>
 value="<?php 
                echo $i_face;
                ?>
"><?php 
                echo $interface_name;
                ?>
</option>
                                    <?php 
            }
        }
    }