3 # Display a list of all domain and address mappings
5 require './sendmail-lib.pl';
6 require './access-lib.pl';
8 $access{'access'} || &error($text{'access_ecannot'});
9 &ui_print_header(undef, $text{'access_title'}, "");
11 $conf = &get_sendmailcf();
12 $afile = &access_file($conf);
13 ($adbm, $adbmtype) = &access_dbm($conf);
15 # No Kaccess directive in sendmail.cf
16 print "<b>",&text('access_efeature', 'list_features.cgi'),"</b><p>\n";
17 &ui_print_footer("", $text{'index_return'});
22 print "<b>",&text('access_efile', "<tt>$afile</tt>",
23 "<tt>$adbm</tt>", "$gconfig{'webprefix'}/config.cgi?$module_name"),"</b> <p>\n";
24 print "<b>",&text('virtusers_createfile',
25 'create_file.cgi?mode=access'),"</b><p>\n";
26 &ui_print_footer("", $text{'index_return'});
30 # Get list of spam control rules, limited to those the user can edit
31 @accs = &list_access($afile);
32 if ($access{'smode'} == 2) {
33 @accs = grep { $_->{'from'} =~ /$access{'saddrs'}/i } @accs;
39 # Restrict to search results
40 @accs = grep { $_->{'from'} =~ /$in{'search'}/i ||
41 $_->{'to'} =~ /$in{'search'}/i } @accs;
43 elsif ($config{'max_records'} && @accs > $config{'max_records'}) {
45 print $text{'access_toomany'},"<br>\n";
46 print "<form action=list_access.cgi>\n";
47 print "<input type=submit value='$text{'access_go'}'>\n";
48 print "<input name=search size=20></form>\n";
54 if ($config{'sort_mode'} == 1) {
55 @accs = sort { $a->{'from'} cmp $b->{'from'} } @accs;
58 # render table of access rules
59 print &ui_form_start("delete_access.cgi", "post");
60 @links = ( &select_all_link("d", 1),
61 &select_invert_link("d", 1) );
62 print &ui_links_row(\@links);
63 if ($config{'columns'} == 2) {
64 $mid = int((@accs+1)/2);
65 print "<table width=100%> <tr><td width=50% valign=top>\n";
66 &accs_table(@accs[0..$mid-1]);
67 print "</td><td width=50% valign=top>\n";
68 if ($mid < @accs) { &accs_table(@accs[$mid..$#accs]); }
69 print "</td></tr> </table><br>\n";
74 print &ui_links_row(\@links);
75 print &ui_form_end([ [ "delete", $text{'access_delete'} ] ]);
77 print "<a href='edit_file.cgi?mode=access'>",
78 &text('file_edit', "<tt>$afile</tt>"),"</a><p>\n"
79 if ($access{'manual'});
80 print $text{'access_desc1'},"<p>\n";
82 &ui_print_footer("", $text{'index_return'});
86 local @tds = ( "width=5" );
87 print &ui_columns_start([ "",
88 $text{'access_source'},
89 $text{'access_action'},
90 $config{'show_cmts'} ? ( $text{'virtusers_cmt'} )
91 : ( ) ], 100, 0, \@tds);
93 $from = $m->{'tag'} ? "$m->{'tag'}: $m->{'from'}" : $m->{'from'};
95 push(@cols, "<a href=\"edit_access.cgi?num=$m->{'num'}\">".
96 &html_escape($from)."</a>");
97 push(@cols, &html_escape($m->{'action'}));
98 push(@cols, &html_escape($m->{'cmt'})) if ($config{'show_cmts'});
99 print &ui_checked_columns_row(\@cols, \@tds, "d", $m->{'from'});
101 print &ui_columns_end();