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
|
<?php
/*
** Zabbix
** Copyright (C) 2000,2001,2002,2003,2004 Alexei Vladishev
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
**/
?>
<?php
include "include/config.inc.php";
$page["title"] = "Alert history";
$page["file"] = "alerts.php";
show_header($page["title"],30,0);
?>
<?php
show_table_header_begin();
echo "ALERT HISTORY";
show_table_v_delimiter();
?>
<?php
if(isset($HTTP_GET_VARS["start"])&&($HTTP_GET_VARS["start"]<=0))
{
unset($HTTP_GET_VARS["start"]);
}
if(isset($HTTP_GET_VARS["start"]))
{
echo "[<A HREF=\"alerts.php?start=".($HTTP_GET_VARS["start"]-100)."\">";
echo "Show previous 100</A>] ";
echo "[<A HREF=\"alerts.php?start=".($HTTP_GET_VARS["start"]+100)."\">";
echo "Show next 100</A>]";
}
else
{
echo "[<A HREF=\"alerts.php?start=100\">";
echo "Show next 100</A>]";
}
show_table_header_end();
echo "<br>";
show_table_header("ALERTS");
?>
<FONT COLOR="#000000">
<?php
$sql="select max(alertid) as max from alerts";
$result=DBselect($sql);
$row=DBfetch($result);
$maxalertid=@iif(DBnum_rows($result)>0,$row["max"],0);
if(!isset($HTTP_GET_VARS["start"]))
{
$sql="select a.alertid,a.clock,mt.description,a.sendto,a.subject,a.message,ac.triggerid,a.status,a.retries from alerts a,actions ac,media_type mt where a.actionid=ac.actionid and mt.mediatypeid=a.mediatypeid and a.alertid>$maxalertid-200 order by a.clock desc limit 200";
}
else
{
$sql="select a.alertid,a.clock,mt.description,a.sendto,a.subject,a.message,ac.triggerid,a.status,a.retries from alerts a,actions ac,media_type mt where a.actionid=ac.actionid and mt.mediatypeid=a.mediatypeid and a.alertid>$maxalertid-200-".$HTTP_GET_VARS["start"]." order by a.clock desc limit ".($HTTP_GET_VARS["start"]+500);
}
$result=DBselect($sql);
echo "<TABLE WIDTH=100% align=center BORDER=0 BGCOLOR=\"#CCCCCC\" cellspacing=1 cellpadding=3>";
echo "<TR>";
echo "<TD WIDTH=10%><b>Time</b></TD>";
echo "<TD WIDTH=5%><b>Type</b></TD>";
echo "<TD WIDTH=5%><b>Status</b></TD>";
echo "<TD WIDTH=15%><b>Recipient(s)</b></TD>";
echo "<TD><b>Subject</b></TD>";
echo "<TD><b>Message</b></TD>";
echo "</TR>";
$col=0;
$zzz=0;
while($row=DBfetch($result))
{
$zzz++;
if(isset($HTTP_GET_VARS["start"])&&($zzz<$HTTP_GET_VARS["start"]))
{
continue;
}
if(!check_right_on_trigger("R",$row["triggerid"]))
{
continue;
}
if($col++%2==0) { echo "<tr bgcolor=#DDDDDD>"; }
else { echo "<tr bgcolor=#EEEEEE>"; }
if($col>100) break;
echo "<TD><a href=\"alarms.php?triggerid=".$row["triggerid"]."\">".date("Y.M.d H:i:s",$row["clock"])."</a></TD>";
echo "<TD>".$row["description"]."</TD>";
if($row["status"] == 1)
{
echo "<TD><font color=\"00AA00\">sent</font></TD>";
}
else
{
echo "<TD><font color=\"AA0000\">not sent</font></TD>";
}
echo "<TD>".htmlspecialchars($row["sendto"])."</TD>";
echo "<TD><pre>".htmlspecialchars($row["subject"])."</pre></TD>";
echo "<TD>";
echo "<pre>".htmlspecialchars($row["message"])."</pre>";
// for($i=0;$i<strlen($row["message"]);$i++)
// {
// if($row["message"][$i]=="\n")
// {
// echo "<br>";
// }
// else
// {
// echo $row["message"][$i];
// }
// }
echo "</TD>";
echo "</TR>";
cr();
}
if(DBnum_rows($result)==0)
{
echo "<TR BGCOLOR=#EEEEEE>";
echo "<TD COLSPAN=6 ALIGN=CENTER>-No alerts-</TD>";
echo "<TR>";
}
echo "</TABLE>";
?>
</FONT>
</TR>
</TABLE>
<?php
show_footer();
?>
|