3 # Display all users on the system
5 require './mailboxes-lib.pl';
7 if ($config{'mail_system'} == 3) {
8 # Need to detect mail server
9 $ms = &detect_mail_system();
11 &ui_print_header(undef, $text{'index_title'}, "", undef, 1, 1);
12 &ui_print_endpage(&text('index_esystem',
13 "../config.cgi?$module_name"));
16 $config{'mail_system'} = $ms;
17 &save_module_config();
20 elsif (!$config{'send_mode'} || !$config{'auto'}) {
21 # Make sure mail system is valid
22 local ($ms) = grep { $_->[1] == $config{'mail_system'} }
24 if (!&check_mail_system($ms)) {
25 &ui_print_header(undef, $text{'index_title'}, "", undef, 1, 1);
26 &ui_print_endpage(&text('index_esystem2',
27 "../config.cgi?$module_name"));
31 # Make sure mail system is running
32 $err = &test_mail_system();
34 &ui_print_header(undef, $text{'index_title'}, "", undef, 1, 1);
35 &ui_print_endpage(&text('index_esystem3',
36 "../config.cgi?$module_name", $err));
39 # Show main page header
40 &ui_print_header(undef, $text{'index_title'}, "", undef, 1, 1, 0,
42 $text{'index_system'.$config{'mail_system'}});
44 # Check for Perl modules for SMTP authentication
45 if ($config{'smtp_user'}) {
46 local @needed = ( "Authen::SASL" );
47 local $smode = $config{'smtp_auth'} || "Cram-MD5";
50 push(@needed, "Authen::SASL::Perl::$smode");
51 foreach $n (@needed) {
55 "<p>".&text('index_eperl', "<tt>$n</tt>",
56 "/cpan/download.cgi?source=3&cpan=$n&mode=2&".
57 "return=/$module_name/&returndesc=".
58 &urlize($text{'index_return'}))."<p>\n".
59 "$text{'index_eperl2'}\n".
65 # Build a list of all available users
66 @users = &list_mail_users($config{'max_records'}, \&can_user);
71 print "<b>$text{'index_none'}</b> <p>\n";
73 elsif ($config{'max_records'} && @users > $config{'max_records'}) {
74 # Show input for searching for a user
75 print $text{'index_toomany'},"<p>\n";
76 print &ui_form_start("find.cgi");
77 print &ui_submit($text{'index_find'}),"\n";
78 print &ui_select("match", undef, [ [ "0", $text{'index_equals'} ],
79 [ "1", $text{'index_contains'} ] ]),"\n";
80 print &ui_user_textbox("user"),"\n";
85 # Show using selected mode and sort
86 &show_users_table(\@users, $config{'show_mail'});
89 if (&allowed_directory()) {
90 # Show form to view any mail file
92 print &ui_form_start("list_mail.cgi");
93 print &ui_submit($text{'index_file'}),"\n";
94 print &ui_textbox("user", undef, 40),"\n",
95 &file_chooser_button("user", $form),"<br>\n";
99 &ui_print_footer("/", $text{'index'});