/*
* vim: ts=4 sw=3:
*
* Copyright (c) 2007, SURFnet B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this
* list of conditions and the following disclaimer in the documentation and/or
* other materials provided with the distribution.
* * Neither the name of the SURFnet B.V. nor the names of its contributors may be
* used to endorse or promote products derived from this software without specific
* prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*
*
* $Author: wernerschram $
*
* $Id: Events.php 3 2008-09-04 15:25:51Z wernerschram $
*
* $LastChangedRevision: 3 $
*
*
*/
#$ip_lookup=1;
// Required functions
/*
* This function is called prior to any output to the web browser and is intended
* for the plugin to parse possible form data. This function is called only, if this
* plugin is selected in the plugins tab
*/
function Events_ParseInput( $plugin_id ) {
} // End of alarm_ParseInput
function is_ip_attribute( $attr ) {
return $attr === "Source" or $attr === "Destination";
}
function markup_attribute( $attr, $val) {
global $ip_lookup;
if (is_ip_attribute($attr) and ($ip_lookup))
return "$val";
else
return $val;
}
function show_attributes( $line ) {
$ret="";
foreach ($line as $name=>$value) {
if ($name!='event_id' and $name!='starttime' and $name!='stoptime' and $name!='updatetime' and $name!='level' and $name!='type' and $name!='profile') {
if (is_array($value)) {
$curline="".$name."=";
foreach($value as $val) {
$curline.=markup_attribute($name,$val).", ";
}
$ret .= $curline."
";
# $ret .= markup_attribute($name, $value)."
";
} else
$ret .= "".$name."=".markup_attribute($name, $value)."
";
}
}
return $ret;
}
function show_actions( $line ) {
$ret="";
if (array_key_exists('Graph',$line) and array_key_exists('Channel',$line)) {
if (isset($line['stoptime'])) {
$endTime=$line['stoptime'];
} else {
$endTime=time()-300;
$endTime-=$endTime % 300;
}
$vars=array(
'tab'=>2,
'sub_tab'=>'-',
'profileswitch'=>$line['profile'],
'channellist'=>$line['Channel'],
'detail_opts/proto'=>$line['Proto'],
'detail_opts/type'=>$line['Graph'],
'detail_opts/wsize'=>1,
'detail_opts/cursor_mode'=>1,
'tend'=>$endTime,
'tleft'=>$line['starttime'],
#-300,
'tright'=>$endTime,
#-300,
'detail_opts/logscale'=>'-',
'detail_opts/ratescale'=>'-',
'detail_opts/linegraph'=>'-',
);
$bookmark = urlencode(base64_encode(implode('|', $vars)));
#print(implode('|',$vars));
$ret .= "show details";
}
return $ret;
}
function DisplayTable( $count, $Offset, $Limit, $filter ) {
?>
ID | Starttime | Stoptime | Updatetime | Level | Profile | Type | Attributes | Actions |
Thu Jan 1 01:00:00 1970 | active | Thu Jan 1 01:00:00 1970 |