comparison cgi-bin/list-log.in @ 0:c7f6b056b673

First import of vendor version
author Peter Gervai <grin@grin.hu>
date Tue, 10 Mar 2009 13:49:58 +0100
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:c7f6b056b673
1 #! @PERL@ -wT
2
3 # List the messages in a user's log directory
4
5 # Copyright (c) 2008 by Rhyolite Software, LLC
6 #
7 # This agreement is not applicable to any entity which sells anti-spam
8 # solutions to others or provides an anti-spam solution as part of a
9 # security solution sold to other entities, or to a private network
10 # which employs the DCC or uses data provided by operation of the DCC
11 # but does not provide corresponding data to other users.
12 #
13 # Permission to use, copy, modify, and distribute this software without
14 # changes for any purpose with or without fee is hereby granted, provided
15 # that the above copyright notice and this permission notice appear in all
16 # copies and any distributed versions or copies are either unchanged
17 # or not called anything similar to "DCC" or "Distributed Checksum
18 # Clearinghouse".
19 #
20 # Parties not eligible to receive a license under this agreement can
21 # obtain a commercial license to use DCC by contacting Rhyolite Software
22 # at sales@rhyolite.com.
23 #
24 # A commercial license would be for Distributed Checksum and Reputation
25 # Clearinghouse software. That software includes additional features. This
26 # free license for Distributed ChecksumClearinghouse Software does not in any
27 # way grant permision to use Distributed Checksum and Reputation Clearinghouse
28 # software
29 #
30 # THE SOFTWARE IS PROVIDED "AS IS" AND RHYOLITE SOFTWARE, LLC DISCLAIMS ALL
31 # WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
32 # OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL RHYOLITE SOFTWARE, LLC
33 # BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
34 # OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
35 # WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
36 # ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
37 # SOFTWARE.
38 # Rhyolite Software DCC 1.3.103-1.25 $Revision$
39 # @configure_input@
40
41 # This file must protected with an equivalent to httpd.conf lines
42 # in the README file.
43
44
45 use strict 'subs';
46
47 use POSIX qw(strftime);
48
49
50 # get DCC parameters
51 local($user_dir,
52 $list_msg_link,
53 $msg_day_first, $msg_day_last,
54 $msg_first, $msg_last, $msg_newer,
55 $msg_part_num, @msgs_num,
56 %msgs_date, %msgs_from,
57 %msgs_result, %msgs_subject);
58 do('@cgibin@/common') || die("could not get DCC configuration: $!\n");
59
60 get_log_msgs($query{msg} ? $query{msg} : undef, 20, 1);
61
62 html_head("Messages Logged for $user at $hostname");
63
64 print "<H3>";
65 print $#msgs_num >= 0 ? ($#msgs_num+1) : "No";
66 print " messages logged for <EM>$user</EM> at $hostname at ";
67 print strftime "%x %X", localtime;
68 print "</H3>\n<P>\n<P class=warn><STRONG>\n";
69 print $query{result} ? html_str_encode($query{result}) : "&nbsp;";
70 print "</STRONG>\n<P>\n";
71 common_buttons();
72
73 print "</TABLE>\n";
74
75 if ($#msgs_num >= 0) {
76 my($msg_num, $msg, $next_date, $last_date);
77
78 print <<EOF;
79 <P>
80 <TABLE border=1 cellpadding="2%" frame=void rules=rows
81 summary="messages logged for $user at $hostname">
82 EOF
83
84 print_links();
85
86 for ($msg_num = $msg_first; $msg_num <= $msg_last; ++$msg_num) {
87 my($msg) = $msgs_num[$msg_num];
88
89 next if (!$msg);
90 $next_date = $msgs_date{$msg};
91 if ($next_date =~ s/(.*) .*/$1/) {
92 if (! $last_date) {
93 print "<TR><TH>\n";
94 print " <TH>$next_date";
95 if ($msg_part_num) {
96 print " part $msg_part_num";
97 $msg_part_num= 0;
98 }
99 print "\n <TH>From\n <TH>&nbsp;\n <TH>Subject\n";
100 } elsif ($last_date ne $next_date) {
101 print "<TR><TH>&nbsp\n";
102 print " <TH>$next_date";
103 print "\n <TH>&nbsp;\n <TH>&nbsp;\n <TH>&nbsp;\n";
104 }
105 $last_date = $next_date;
106 }
107
108 print "<TR><TD class=\"mono small\">$list_msg_link${url_ques}msg=$msg\">";
109 print $msg_num+1;
110 print <<EOF;
111 </A>
112 <TD class=mono>$msgs_date{$msg}
113 <TD>$msgs_from{$msg}
114 <TD class=small>$msgs_result{$msg}
115 <TD>$msgs_subject{$msg}
116 EOF
117 }
118
119 if ($msg_num > $#msgs_num) {
120 print <<EOF;
121 <TR><TH>&nbsp;
122 <TH>Next Day
123 <TH>&nbsp;
124 <TH>&nbsp;
125 <TH>&nbsp;
126 EOF
127 }
128
129 print_links();
130
131
132 print <<EOF;
133 </TABLE>
134
135 <P>
136 <TABLE class=small border=0 cellspacing=0 cellpadding=0>
137 <TR><TD class=strong>Grey
138 <TD>greylist embargo
139 <TD class=strong>OK-Grey
140 <TD>greylist embargo ended
141 <TR><TD class=strong>DCC
142 <TD>bulk according to DCC network&nbsp;&nbsp;&nbsp;
143 <TD class=strong>OK-DCC
144 <TD>not bulk according to DCC network
145 <TR><TD class=strong>Rep
146 <TD>bad DCC Reputation
147 <TR><TD class=strong>MTA
148 <TD>blacklisted by mail system
149 <TD class=strong>MTA-OK
150 <TD>whitelisted by mail system
151 <TR><TD class=strong>BL
152 <TD>blacklisted in whiteclnt files
153 <TD class=strong>WL
154 <TD>whitelisted in whiteclnt files
155 <TR><TD class=strong>DNSBL
156 <TD>DNS blacklisted URL
157 <TR><TD><I>italic</I>
158 <TD>checks off
159 </TABLE>
160
161 EOF
162 }
163
164 html_footer();
165 print "</BODY>\n</HTML>\n";
166
167 # re-enable mail notifications
168 unlink("$user_dir/notify.marker", "$user_dir/notify.pending",
169 "$user_dir/notify.block");
170 close(MARK)
171 if (open(MARK, "> $user_dir/notify.marker"));
172
173
174
175 sub print_links {
176 my($msg_num);
177
178 print "<TR><TD colspan=4>\n";
179 print " $list_log_link\">Newest</A>\n";
180 print_bounded_link($msg_day_last+1, "Next Day");
181 print_bounded_link($msg_newer, "Newer");
182 print_bounded_link($msg_first-1, "Older");
183 print_bounded_link($msg_day_first-1, "Previous Day");
184 print_bounded_link(0, "Oldest");
185 }
186
187
188
189 sub print_bounded_link {
190 my($msg_num, $name) = @_;
191 my($val);
192
193 if ($msg_num > $#msgs_num) {
194 $val = "";
195 } elsif ($msg_num < 0) {
196 $val = "${url_ques}msg=$msgs_num[0]";
197 } else {
198 $val = "${url_ques}msg=$msgs_num[$msg_num]";
199 }
200 print " $list_log_link$val\">$name</A>\n";
201 }