2 ################################################################################
4 # File: $RCSfile: add2whitelist.cgi,v $
5 # Revision: $Revision: 1.1 $
6 # Description: Add an email address to the blacklist
7 # Author: Andrew@DeFaria.com
8 # Created: Mon Jan 16 20:25:32 PST 2006
9 # Modified: $Date: 2013/06/12 14:05:47 $
12 # (C) Copyright 2000-2006, Andrew@DeFaria.com, all rights reserved.
14 ################################################################################
19 $0 = $FindBin::Script;
21 use lib "$FindBin::Bin/../lib";
27 use CGI qw/:standard *table/;
28 use CGI::Carp 'fatalsToBrowser';
36 my $nextseq = GetNextSequenceNo($userid, $type);
39 my $pattern = param "pattern$nextseq";
40 my $domain = param "domain$nextseq";
41 my $comment = param "comment$nextseq";
43 last if ((!defined $pattern || $pattern eq '') &&
44 (!defined $domain || $domain eq ''));
46 $sender = lc "$pattern\@$domain";
48 my ($status, $rule) = OnWhitelist($sender, $userid);
51 print br {-class => 'error'}, "The email address $sender is already on ${Userid}'s $type list";
53 my $messages = Add2Whitelist($sender, $userid, $comment);
55 print br "The email address, $sender, has been added to ${Userid}'s $type list";
58 print br 'Your previous message has been delivered';
60 print br "Your previous $messages messages have been delivered";
62 } elsif ($messages == -1) {
63 print br {-class => 'error'}, 'Unable to deliver message';
65 print br 'Unable to find any old messages but future messages will now be delivered.';
68 # Now remove this entry from the other lists (if present)
69 for my $otherlist ('black', 'null') {
70 my $sth = FindList($otherlist, $sender);
71 my ($sequence, $count);
73 ($_, $_, $_, $_, $_, $sequence) = GetList($sth);
76 $count = DeleteList($otherlist, $sequence);
77 print br "Removed $sender from ${Userid}'s " . ucfirst $otherlist . ' list'
80 ResequenceList($userid, $otherlist);
97 $userid ||= $ENV{USER};
99 $Userid = ucfirst $userid;
103 NavigationBar($userid);
109 -action => 'processaction.cgi',
113 print '<p></p><center>',
114 hidden ({-name => 'type',
116 submit ({-name => 'action',