This repository has been archived by the owner on Mar 2, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbase_graph_form.php
333 lines (285 loc) · 15.5 KB
/
base_graph_form.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
<?php
/*******************************************************************************
** Basic Analysis and Security Engine (BASE)
** Copyright (C) 2004 BASE Project Team
** Copyright (C) 2000 Carnegie Mellon University
**
** (see the file 'base_main.php' for license details)
**
** Project Leads: Kevin Johnson <[email protected]>
** Sean Muller <[email protected]>
** Built upon work by Roman Danyliw <[email protected]>, <[email protected]>
**
** Purpose: Displays form for graphing
********************************************************************************
** Authors:
********************************************************************************
** Kevin Johnson <[email protected]
**
********************************************************************************
*/
include_once ("$BASE_path/base_graph_common.php");
echo '<FORM ACTION="base_graph_main.php" METHOD="post">';
echo '<TABLE WIDTH="100%" BORDER="2" class="query" cellpadding="20" summary="Outer table">
<TR>
<TD COLSPAN=2>';
echo '<TABLE WIDTH="100%" BORDER="1" SUMMARY="1st inner table"><TR>';
// echo '<B>'._CHARTTYPE.'</B>
echo '<TD><B>What do you want to know:</B></TD><TD>
<SELECT NAME="chart_type">
<OPTION VALUE=" " '. chk_select($chart_type, " ").'>'._CHARTTYPES.'
<OPTION VALUE="' . CHARTTYPE_HOUR . '" ' . chk_select($chart_type, CHARTTYPE_HOUR).'>'._CHRTTYPEHOUR.'
<OPTION VALUE="' . CHARTTYPE_DAY . '" ' . chk_select($chart_type, CHARTTYPE_DAY).'>'._CHRTTYPEDAY.'
<!--<OPTION VALUE="' . CHARTTYPE_WEEK . '" ' . chk_select($chart_type, CHARTTYPE_WEEK).'>'._CHRTTYPEWEEK.'-->
<OPTION VALUE="' . CHARTTYPE_MONTH . '" ' . chk_select($chart_type, CHARTTYPE_MONTH).'>'._CHRTTYPEMONTH.'
<!--<OPTION VALUE="' . CHARTTYPE_YEAR . '" ' . chk_select($chart_type, CHARTTYPE_YEAR).'>'._CHRTTYPEYEAR.'-->
<OPTION VALUE="' . CHARTTYPE_SRC_IP . '" ' . chk_select($chart_type, CHARTTYPE_SRC_IP).'>'._CHRTTYPESRCIP.'
<OPTION VALUE="' . CHARTTYPE_DST_IP . '" ' . chk_select($chart_type, CHARTTYPE_DST_IP).'>'._CHRTTYPEDSTIP.'
<OPTION VALUE="' . CHARTTYPE_SRC_TCP_PORT . '" ' . chk_select($chart_type, CHARTTYPE_SRC_TCP_PORT).'>'._CHRTTYPESRCPORT.'
<OPTION VALUE="' . CHARTTYPE_DST_TCP_PORT . '" ' . chk_select($chart_type, CHARTTYPE_DST_TCP_PORT).'>'._CHRTTYPEDSTPORT.'
<OPTION VALUE="' . CHARTTYPE_SRC_UDP_PORT . '" ' . chk_select($chart_type, CHARTTYPE_SRC_UDP_PORT).'>'._CHRTTYPESRCUDP.'
<OPTION VALUE="' . CHARTTYPE_DST_UDP_PORT . '" ' . chk_select($chart_type, CHARTTYPE_DST_UDP_PORT).'>'._CHRTTYPEDSTUDP.'
<OPTION VALUE="' . CHARTTYPE_SRC_COUNTRY . '" ' . chk_select($chart_type, CHARTTYPE_SRC_COUNTRY).'>'. 'Src. countries vs. number of alerts
<OPTION VALUE="' . CHARTTYPE_SRC_COUNTRY_ON_MAP . '" ' . chk_select($chart_type, CHARTTYPE_SRC_COUNTRY_ON_MAP).'>'. 'Src. countries vs. number of alerts on a worldmap
<OPTION VALUE="' . CHARTTYPE_DST_COUNTRY . '" ' . chk_select($chart_type, CHARTTYPE_DST_COUNTRY).'>'. 'Dst. countries vs. number of alerts
<OPTION VALUE="' . CHARTTYPE_DST_COUNTRY_ON_MAP . '" ' . chk_select($chart_type, CHARTTYPE_DST_COUNTRY_ON_MAP).'>'. 'Dst. countries vs. number of alerts on a worldmap
<OPTION VALUE="' . CHARTTYPE_SENSOR . '" ' . chk_select($chart_type, CHARTTYPE_SENSOR).'>'._CHRTTYPESENSOR.'
<OPTION VALUE="' . CHARTTYPE_UNIQUE_SIGNATURE .'" ' . chk_select($chart_type, CHARTTYPE_UNIQUE_SIGNATURE).'>'. 'Unique alerts vs. number of alerts' . '
<OPTION VALUE="' . CHARTTYPE_CLASSIFICATION . '" ' . chk_select($chart_type, CHARTTYPE_CLASSIFICATION).'>'._CHRTTYPESIG;
echo '</SELECT>
</TD></TR>';
//echo ' <B>'._PLOTTYPE.'</B>
echo '<TR><TD><B>How should it be displayed?</B></TD><TD>As
<INPUT TYPE="radio" NAME="chart_style"
VALUE="bar" '.chk_check($chart_style, "bar").'> '._TYPEBAR.'
<INPUT TYPE="radio" NAME="chart_style"
VALUE="line" '.chk_check($chart_style, "line").'> '._TYPELINE.'
<INPUT TYPE="radio" NAME="chart_style"
VALUE="pie" '.chk_check($chart_style, "pie").'> '._TYPEPIE.' ';
echo '</TD></TR>';
// echo ' <B>'._CHARTSIZE.'</B>
echo '<TD><B>... with a size of:</B></TD><TD>(width x height)
<INPUT TYPE="text" NAME="width" SIZE=4 VALUE="'.$width.'">
<B>x</B>
<INPUT TYPE="text" NAME="height" SIZE=4 VALUE="'.$height.'">
<BR></TD></TR>';
// not implemented:
/*
//echo ' <B>'._PLOTMARGINS.'</B>
echo '<TR><TD><B>... and with margins of:</B></TD><TD>(left x right x top x bottom)<BR>
<INPUT TYPE="text" NAME="pmargin0" SIZE=4 VALUE="'.$pmargin0.'">
<B>x</B>
<INPUT TYPE="text" NAME="pmargin1" SIZE=4 VALUE="'.$pmargin1.'">
<B>x</B>
<INPUT TYPE="text" NAME="pmargin2" SIZE=4 VALUE="'.$pmargin2.'">
<B>x</B>
<INPUT TYPE="text" NAME="pmargin3" SIZE=4 VALUE="'.$pmargin3.'">
<BR></TD></TR>';
*/
echo '<TR><TD><B>Do you want to know<BR>the data just of a<BR>particular time frame?</B> (optional)</TD><TD>';
echo '<b>'._CHRTBEGIN.'</B>
<SELECT NAME="chart_begin_hour">
<OPTION VALUE=" " '.chk_select($chart_begin_hour, " ").'>'._CHARTHOUR."\n";
for ( $i = 0; $i <= 23; $i++ )
echo "<OPTION VALUE=\"$i\" ".chk_select($chart_begin_hour, $i)." >$i\n";
echo '</SELECT>
<SELECT NAME="chart_begin_day">
<OPTION VALUE=" " '.chk_select($chart_begin_day, " ").'>'._CHARTDAY."\n";
for ( $i = 1; $i <= 31; $i++ )
echo "<OPTION VALUE=\"$i\" ".chk_select($chart_begin_day, $i).">$i\n";
echo '</SELECT>
<SELECT NAME="chart_begin_month">
<OPTION VALUE=" " '.chk_select($chart_begin_month, " ").'>'._CHARTMONTH.'
<OPTION VALUE="01" '.chk_select($chart_begin_month, "01").'>'._JANUARY.'
<OPTION VALUE="02" '.chk_select($chart_begin_month, "02").'>'._FEBRUARY.'
<OPTION VALUE="03" '.chk_select($chart_begin_month, "03").'>'._MARCH.'
<OPTION VALUE="04" '.chk_select($chart_begin_month, "04").'>'._APRIL.'
<OPTION VALUE="05" '.chk_select($chart_begin_month, "05").'>'._MAY.'
<OPTION VALUE="06" '.chk_select($chart_begin_month, "06").'>'._JUNE.'
<OPTION VALUE="07" '.chk_select($chart_begin_month, "07").'>'._JULY.'
<OPTION VALUE="08" '.chk_select($chart_begin_month, "08").'>'._AUGUST.'
<OPTION VALUE="09" '.chk_select($chart_begin_month, "09").'>'._SEPTEMBER.'
<OPTION VALUE="10" '.chk_select($chart_begin_month, "10").'>'._OCTOBER.'
<OPTION VALUE="11" '.chk_select($chart_begin_month, "11").'>'._NOVEMBER.'
<OPTION VALUE="12" '.chk_select($chart_begin_month, "12").'>'._DECEMBER.'
</SELECT>
<SELECT NAME="chart_begin_year">'.
dispYearOptions($chart_begin_year)
.'</SELECT>';
echo '<br><b>'._CHRTEND.'</B>
<SELECT NAME="chart_end_hour">
<OPTION VALUE=" " '.chk_select($chart_end_hour, " ").'>'._CHARTHOUR."\n";
for ( $i = 0; $i <= 23; $i++ )
echo "<OPTION VALUE=$i ".chk_select($chart_end_hour, $i).">$i\n";
echo '</SELECT>
<SELECT NAME="chart_end_day">
<OPTION VALUE=" " '.chk_select($chart_end_day, " ").'>'._CHARTDAY."\n";
for ( $i = 1; $i <= 31; $i++ )
echo "<OPTION VALUE=$i ".chk_select($chart_end_day, $i).">$i\n";
echo '</SELECT>
<SELECT NAME="chart_end_month">
<OPTION VALUE=" " '.chk_select($chart_end_month, " ").'>'._CHARTMONTH.'
<OPTION VALUE="01" '.chk_select($chart_end_month, "01").'>'._JANUARY.'
<OPTION VALUE="02" '.chk_select($chart_end_month, "02").'>'._FEBRUARY.'
<OPTION VALUE="03" '.chk_select($chart_end_month, "03").'>'._MARCH.'
<OPTION VALUE="04" '.chk_select($chart_end_month, "04").'>'._APRIL.'
<OPTION VALUE="05" '.chk_select($chart_end_month, "05").'>'._MAY.'
<OPTION VALUE="06" '.chk_select($chart_end_month, "06").'>'._JUNE.'
<OPTION VALUE="07" '.chk_select($chart_end_month, "07").'>'._JULY.'
<OPTION VALUE="08" '.chk_select($chart_end_month, "08").'>'._AUGUST.'
<OPTION VALUE="09" '.chk_select($chart_end_month, "09").'>'._SEPTEMBER.'
<OPTION VALUE="10" '.chk_select($chart_end_month, "10").'>'._OCTOBER.'
<OPTION VALUE="11" '.chk_select($chart_end_month, "11").'>'._NOVEMBER.'
<OPTION VALUE="12" '.chk_select($chart_end_month, "12").'>'._DECEMBER.'
</SELECT>
<SELECT NAME="chart_end_year">'.
dispYearOptions($chart_end_year)
.'</SELECT></TD></TR>';
echo '<TR><TD><B>'._CHARTTITLE.'</B></TD><TD>
<INPUT TYPE="text" NAME="user_chart_title" SIZE="35" VALUE="'.$user_chart_title.'"></TD></TR>';
// echo ' <b>'._CHARTPERIOD.'</B>
echo '<TR><TD><B>How many columns or elements do you want to see?</B> </TD><TD>';
echo '<SELECT NAME="chart_interval">'.
'<OPTION VALUE="0" '.chk_select($chart_interval, "0").'>{all of them}' . /* _PERIODNO. */
'<OPTION VALUE="5" '.chk_select($chart_interval, "5").'> 5 elements' .
'<OPTION VALUE="10" '.chk_select($chart_interval, "10").'>10 elements' . /* _PERIODWEEK. */
'<OPTION VALUE="15" '.chk_select($chart_interval, "15").'>15 elements' . /* _PERIODDAY. */
'<OPTION VALUE="20" '.chk_select($chart_interval, "20").'>20 elements' . /* _PERIOD168. */
'<OPTION VALUE="25" '.chk_select($chart_interval, "25").'>25 elements' .
'<OPTION VALUE="30" '.chk_select($chart_interval, "30").'>30 elements' .
'</SELECT><BR></TD></TR>';
echo '<TR><TD><B>... and starting from which element on?</B> </TD>' .
'<TD>From element no. <INPUT TYPE="text" NAME="element_start" SIZE="10" VALUE="'.$element_start.'"></TD></TR>';
// submit button
echo '<TR align=middle><TD colspan="2">';
echo '<BR><BR><div class="center"><INPUT TYPE="submit" NAME="submit" VALUE="'._GRAPHALERTS.'" align=center></div><BR><BR>';
echo '</TR></TABLE>';
echo '<TR><TD COLSPAN=2>
<ul id="zMenu">
<li>'._AXISCONTROLS.':<BR>';
echo '<TABLE WIDTH="100%" BORDER="1" SUMMARY="2nd inner table">
<TR>
<TD ALIGN="CENTER" WIDTH="50%"><B>'._CHRTX.'</B></TD>
<TD ALIGN="CENTER" WIDTH="50%"><B>'._CHRTY.'</B></TD>
</TR>
<TR>
<TD>
<B>'._CHRTDS.'</B>
<SELECT NAME="data_source">
<OPTION VALUE=" " '.chk_select($data_source, " ").'>{ data source (AG) }';
$temp_sql = "SELECT ag_id, ag_name FROM acid_ag";
$tmp_result = $db->baseExecute($temp_sql);
if ( ( $tmp_result ) )
{
while ( $myrow = $tmp_result->baseFetchRow() )
echo '<OPTION VALUE="'.$myrow[0].'" '.chk_select($data_source, $myrow[0]).'>'.
'['.$myrow[0].'] '.$myrow[1];
$tmp_result->baseFreeRows();
}
echo '</SELECT><BR>'.
'<B>'._CHRTMINTRESH.':</B>
<INPUT TYPE="text" NAME="min_size" SIZE="5" VALUE='.$min_size.'>
<BR>
<INPUT TYPE="checkbox" NAME="rotate_xaxis_lbl" VALUE="1" '.
chk_check($rotate_xaxis_lbl, "1").'>
<B>'._CHRTROTAXISLABEL.'</B><BR>
<INPUT TYPE="checkbox" NAME="xaxis_grid" VALUE="1" '.
chk_check($xaxis_grid, "1").'>
<B>'._CHRTSHOWX.'</B><BR>
<!--
Disabled because it unexpectedly prevents displaying
the whole bar instead of just suppressing the label...
-->
<!--
<B>'._CHRTDISPLABELX.'
<INPUT TYPE="text" NAME="xaxis_label_inc" SIZE=4 VALUE='.$xaxis_label_inc.'>
'._CHRTDATAPOINTS.'
-->
<INPUT TYPE="hidden" NAME="xaxis_label_inc" VALUE="1"><BR>
</TD>
<TD VALIGN="top">
<!--
Logarithmic y-axis temporarily disabled, as the bars seem
to be displayed in a wrong way, although the y-axis grid lines
look correct
-->
<!--
<INPUT TYPE="checkbox" NAME="yaxis_scale" VALUE="1" '.
chk_check($yaxis_scale, "1").'>
<B>'._CHRTYLOG.'</B>
<BR>
-->
<INPUT TYPE="hidden" NAME="yaxis_scale" VALUE="0">
<INPUT TYPE="checkbox" NAME="yaxis_grid" VALUE="1" '.
chk_check($yaxis_grid, "1").'>
<B>'._CHRTYGRID.'</B>
</TD>
</TR>
</TABLE>
</ul></li>
</TD></TR>
</TABLE>';
echo '</FORM><P><HR>';
echo '
<!-- ************ JavaScript for Hiding Details ******************** -->
<script type="text/javascript">
// <![CDATA[
function loopElements(el,level){
for(var i=0;i<el.childNodes.length;i++){
//just want LI nodes:
if(el.childNodes[i] && el.childNodes[i]["tagName"] && el.childNodes[i].tagName.toLowerCase() == "li"){
//give LI node a className
el.childNodes[i].className = "zMenu"+level
//Look for the A and if it has child elements (another UL tag)
childs = el.childNodes[i].childNodes
for(var j=0;j<childs.length;j++){
temp = childs[j]
if(temp && temp["tagName"]){
if(temp.tagName.toLowerCase() == "a"){
//found the A tag - set class
temp.className = "zMenu"+level
//adding click event
temp.onclick=showHide;
}else if(temp.tagName.toLowerCase() == "ul"){
//Hide sublevels
temp.style.display = "none"
//Set class
temp.className= "zMenu"+level
//Recursive - calling self with new found element - go all the way through
loopElements(temp,level +1)
}
}
}
}
}
}
var menu = document.getElementById("zMenu") //get menu div
menu.className="zMenu"+0 //Set class to top level
loopElements(menu,0) //function call
function showHide(){
//from the LI tag check for UL tags:
el = this.parentNode
//Loop for UL tags:
for(var i=0;i<el.childNodes.length;i++){
temp = el.childNodes[i]
if(temp && temp["tagName"] && temp.tagName.toLowerCase() == "ul"){
//Check status:
if(temp.style.display=="none"){
temp.style.display = ""
}else{
temp.style.display = "none"
}
}
}
return false
}
// ]]>
</script>
';
/*
vim:shiftwidth=2:tabstop=2:expandtab
*/
?>