-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsearch.cgi
executable file
·59 lines (53 loc) · 1.46 KB
/
search.cgi
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
#!/usr/local/bin/perl
# Search for list members across all lists
use strict;
use warnings;
our (%text, %in);
require './virtualmin-mailman-lib.pl';
&ReadParse();
&error_setup($text{'search_err'});
$in{'email'} || &error($text{'search_eemail'});
# Get all lists
my @alllists = &list_lists();
my @lists = grep { &can_edit_list($_) } @alllists;
if (!$in{'doms'}) {
# In this domain only
@lists = grep { $_->{'dom'} eq $in{'show'} } @lists;
}
my $desc = $in{'doms'} ? &virtual_server::text('indom', $in{'show'}) : undef;
&ui_print_header($desc, $text{'search_title'}, "");
# Build table of matching emails
my @table;
my $re = $in{'email'};
foreach my $l (@lists) {
my @mems = &list_members($l);
my (undef, $adminurl) = &get_mailman_web_urls($l);
foreach my $m (@mems) {
if ($m->{'email'} =~ /\Q$re\E/i) {
my @acts;
push(@acts,
&ui_link("delete_member.cgi?list=".
&urlize($l->{'list'})."&".
"show=".&urlize($in{'show'})."&".
&urlize($m->{'email'})."=1'>",
$text{'search_delete'}));
push(@acts, &ui_link($adminurl, $text{'search_man'}));
push(@table, [ $m->{'email'},
$l->{'list'},
$l->{'dom'},
&ui_links_row(\@acts) ]);
}
}
}
# Show the table
print &ui_columns_table(
[ $text{'search_email'}, $text{'search_list'},
$text{'search_dom'}, $text{'search_actions'} ],
100,
\@table,
undef,
0,
undef,
$text{'search_none'}
);
&ui_print_footer("index.cgi?show=$in{'show'}", $text{'index_return'});