1 |
pjm2 |
1.1 |
<?php |
2 |
|
|
|
3 |
|
|
# Navigation for the i-scream alerts. |
4 |
|
|
# pjm2@ukc.ac.uk |
5 |
|
|
# |
6 |
|
|
# CONFIGURABLE CONSTANTS: - |
7 |
|
|
|
8 |
|
|
include("alerts_config.inc.php"); |
9 |
|
|
|
10 |
|
|
# |
11 |
|
|
# END CONFIGURATION |
12 |
|
|
|
13 |
|
|
include("iutils.inc.php"); |
14 |
|
|
|
15 |
|
|
function printLine($title) { |
16 |
|
|
echo "<hr style=\"color:#9999ff;\">"; |
17 |
|
|
echo "<b>$title</b>"; |
18 |
|
|
} |
19 |
|
|
|
20 |
|
|
function printAlert($machine, $alert) { |
21 |
|
|
echo "$alert<br>"; |
22 |
|
|
} |
23 |
|
|
|
24 |
|
|
?> |
25 |
|
|
|
26 |
|
|
<? include($titleHTML); ?> |
27 |
|
|
|
28 |
|
|
<? printLine("Display alerts about all hosts, or a host"); ?> |
29 |
|
|
|
30 |
|
|
<form method="<? echo $formMethod ?>" action="<? echo $thisPage ?>"> |
31 |
|
|
<? |
32 |
|
|
|
33 |
|
|
$file_array = getdirArray($alertDirectory,'asort'); |
34 |
|
|
print "<select size=\"1\" name=\"machine\">"; |
35 |
|
|
if ($machine) { ?> |
36 |
|
|
<option selected value="<? echo $machine ?>"><? echo $machine ?></option> |
37 |
|
|
<option value="">----------------</option> |
38 |
|
|
<? } |
39 |
|
|
foreach($file_array as $file_name) { |
40 |
|
|
#if (is_dir($file_name)) { |
41 |
|
|
print "<option value=\"$file_name\">$file_name</option>"; |
42 |
|
|
#} |
43 |
|
|
} |
44 |
|
|
print "</select>"; |
45 |
|
|
|
46 |
|
|
?> |
47 |
|
|
<input type="submit" name="submit" value="Display"> |
48 |
|
|
</form> |
49 |
|
|
|
50 |
|
|
<? if ($machine) { |
51 |
|
|
|
52 |
|
|
# Get a list of all files in the machine's directory. |
53 |
|
|
$alertArray = getdirArray("$alertDirectory/$machine", 'rsort'); |
54 |
|
|
|
55 |
|
|
foreach($file_array as $file_name) { |
56 |
|
|
$input = file("$alertDirectory/$machine/$file_name"); |
57 |
|
|
$input = $input[0]; |
58 |
|
|
$alerts[] = $input; |
59 |
|
|
} |
60 |
|
|
|
61 |
|
|
foreach ($alerts as $alert) { |
62 |
|
|
printAlert($machine, $alert); |
63 |
|
|
} |
64 |
|
|
|
65 |
|
|
} |
66 |
|
|
|
67 |
|
|
?> |
68 |
|
|
|
69 |
|
|
<? printLine(""); ?> |
70 |
|
|
|
71 |
|
|
<? include($bottomHTML); ?> |