Mercurial > notdcc
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cgi-bin/list-log.in Tue Mar 10 13:49:58 2009 +0100 @@ -0,0 +1,201 @@ +#! @PERL@ -wT + +# List the messages in a user's log directory + +# Copyright (c) 2008 by Rhyolite Software, LLC +# +# This agreement is not applicable to any entity which sells anti-spam +# solutions to others or provides an anti-spam solution as part of a +# security solution sold to other entities, or to a private network +# which employs the DCC or uses data provided by operation of the DCC +# but does not provide corresponding data to other users. +# +# Permission to use, copy, modify, and distribute this software without +# changes for any purpose with or without fee is hereby granted, provided +# that the above copyright notice and this permission notice appear in all +# copies and any distributed versions or copies are either unchanged +# or not called anything similar to "DCC" or "Distributed Checksum +# Clearinghouse". +# +# Parties not eligible to receive a license under this agreement can +# obtain a commercial license to use DCC by contacting Rhyolite Software +# at sales@rhyolite.com. +# +# A commercial license would be for Distributed Checksum and Reputation +# Clearinghouse software. That software includes additional features. This +# free license for Distributed ChecksumClearinghouse Software does not in any +# way grant permision to use Distributed Checksum and Reputation Clearinghouse +# software +# +# THE SOFTWARE IS PROVIDED "AS IS" AND RHYOLITE SOFTWARE, LLC DISCLAIMS ALL +# WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES +# OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL RHYOLITE SOFTWARE, LLC +# BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES +# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +# ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +# SOFTWARE. +# Rhyolite Software DCC 1.3.103-1.25 $Revision$ +# @configure_input@ + +# This file must protected with an equivalent to httpd.conf lines +# in the README file. + + +use strict 'subs'; + +use POSIX qw(strftime); + + +# get DCC parameters +local($user_dir, + $list_msg_link, + $msg_day_first, $msg_day_last, + $msg_first, $msg_last, $msg_newer, + $msg_part_num, @msgs_num, + %msgs_date, %msgs_from, + %msgs_result, %msgs_subject); +do('@cgibin@/common') || die("could not get DCC configuration: $!\n"); + +get_log_msgs($query{msg} ? $query{msg} : undef, 20, 1); + +html_head("Messages Logged for $user at $hostname"); + +print "<H3>"; +print $#msgs_num >= 0 ? ($#msgs_num+1) : "No"; +print " messages logged for <EM>$user</EM> at $hostname at "; +print strftime "%x %X", localtime; +print "</H3>\n<P>\n<P class=warn><STRONG>\n"; +print $query{result} ? html_str_encode($query{result}) : " "; +print "</STRONG>\n<P>\n"; +common_buttons(); + +print "</TABLE>\n"; + +if ($#msgs_num >= 0) { + my($msg_num, $msg, $next_date, $last_date); + + print <<EOF; +<P> +<TABLE border=1 cellpadding="2%" frame=void rules=rows + summary="messages logged for $user at $hostname"> +EOF + + print_links(); + + for ($msg_num = $msg_first; $msg_num <= $msg_last; ++$msg_num) { + my($msg) = $msgs_num[$msg_num]; + + next if (!$msg); + $next_date = $msgs_date{$msg}; + if ($next_date =~ s/(.*) .*/$1/) { + if (! $last_date) { + print "<TR><TH>\n"; + print " <TH>$next_date"; + if ($msg_part_num) { + print " part $msg_part_num"; + $msg_part_num= 0; + } + print "\n <TH>From\n <TH> \n <TH>Subject\n"; + } elsif ($last_date ne $next_date) { + print "<TR><TH> \n"; + print " <TH>$next_date"; + print "\n <TH> \n <TH> \n <TH> \n"; + } + $last_date = $next_date; + } + + print "<TR><TD class=\"mono small\">$list_msg_link${url_ques}msg=$msg\">"; + print $msg_num+1; + print <<EOF; +</A> + <TD class=mono>$msgs_date{$msg} + <TD>$msgs_from{$msg} + <TD class=small>$msgs_result{$msg} + <TD>$msgs_subject{$msg} +EOF + } + + if ($msg_num > $#msgs_num) { + print <<EOF; +<TR><TH> + <TH>Next Day + <TH> + <TH> + <TH> +EOF + } + + print_links(); + + + print <<EOF; +</TABLE> + +<P> +<TABLE class=small border=0 cellspacing=0 cellpadding=0> +<TR><TD class=strong>Grey + <TD>greylist embargo + <TD class=strong>OK-Grey + <TD>greylist embargo ended +<TR><TD class=strong>DCC + <TD>bulk according to DCC network + <TD class=strong>OK-DCC + <TD>not bulk according to DCC network +<TR><TD class=strong>Rep + <TD>bad DCC Reputation +<TR><TD class=strong>MTA + <TD>blacklisted by mail system + <TD class=strong>MTA-OK + <TD>whitelisted by mail system +<TR><TD class=strong>BL + <TD>blacklisted in whiteclnt files + <TD class=strong>WL + <TD>whitelisted in whiteclnt files +<TR><TD class=strong>DNSBL + <TD>DNS blacklisted URL +<TR><TD><I>italic</I> + <TD>checks off +</TABLE> + +EOF +} + +html_footer(); +print "</BODY>\n</HTML>\n"; + +# re-enable mail notifications +unlink("$user_dir/notify.marker", "$user_dir/notify.pending", + "$user_dir/notify.block"); +close(MARK) + if (open(MARK, "> $user_dir/notify.marker")); + + + +sub print_links { + my($msg_num); + + print "<TR><TD colspan=4>\n"; + print " $list_log_link\">Newest</A>\n"; + print_bounded_link($msg_day_last+1, "Next Day"); + print_bounded_link($msg_newer, "Newer"); + print_bounded_link($msg_first-1, "Older"); + print_bounded_link($msg_day_first-1, "Previous Day"); + print_bounded_link(0, "Oldest"); +} + + + +sub print_bounded_link { + my($msg_num, $name) = @_; + my($val); + + if ($msg_num > $#msgs_num) { + $val = ""; + } elsif ($msg_num < 0) { + $val = "${url_ques}msg=$msgs_num[0]"; + } else { + $val = "${url_ques}msg=$msgs_num[$msg_num]"; + } + print " $list_log_link$val\">$name</A>\n"; +}