3 # Display all mailing lists and majordomo options
5 require './majordomo-lib.pl';
6 %access = &get_module_acl();
8 # Check for the majordomo config file
9 if (!-r $config{'majordomo_cf'}) {
10 &ui_print_header(undef, $text{'index_title'}, "", undef, 1, 1, 0,
11 &help_search_link("majordomo", "man", "doc", "google"));
12 print &text('index_econfig', "<tt>$config{'majordomo_cf'}</tt>",
13 "$gconfig{'webprefix'}/config.cgi?$module_name"),"<p>\n";
14 &ui_print_footer("/", $text{'index'});
18 # Check for the programs dir
19 if (!-d $config{'program_dir'}) {
20 &ui_print_header(undef, $text{'index_title'}, "", undef, 1, 1, 0,
21 &help_search_link("majordomo", "man", "doc", "google"));
22 print &text('index_eprograms', "<tt>$config{'program_dir'}</tt>",
23 "$gconfig{'webprefix'}/config.cgi?$module_name"),"<p>\n";
24 &ui_print_footer("/", $text{'index'});
28 # Check majordomo version
29 if (!-r "$config{'program_dir'}/majordomo_version.pl") {
30 &ui_print_header(undef, $text{'index_title'}, "", undef, 1, 1, 0,
31 &help_search_link("majordomo", "man", "doc", "google"));
32 print &text('index_eversion2', "majordomo_version.pl",
33 $config{'program_dir'},
34 "$gconfig{'webprefix'}/config.cgi?$module_name"),
36 &ui_print_footer("/", $text{'index'});
39 require "$config{'program_dir'}/majordomo_version.pl";
40 &ui_print_header(undef, $text{'index_title'}, "", undef, 1, 1, 0,
41 &help_search_link("majordomo", "man", "doc", "google"),
42 undef, undef, &text('index_version', $majordomo_version));
43 if ($majordomo_version < 1.94 || $majordomo_version >= 2) {
44 print "$text{'index_eversion'}<p>\n";
45 &ui_print_footer("/", $text{'index'});
49 # Check $homedir in majordomo.cf
50 $conf = &get_config();
51 if (!&homedir_valid($conf)) {
52 print &text('index_ehomedir', "<tt>$homedir</tt>"),"<p>\n";
53 &ui_print_footer("/", $text{'index'});
57 # Check $listdir in majordomo.cf
58 $listdir = &perl_var_replace(&find_value("listdir", $conf), $conf);
60 print &text('index_elistdir', "<tt>$listdir</tt>"),"<p>\n";
61 &ui_print_footer("/", $text{'index'});
65 # Check if module needed for aliases is OK
66 if ($config{'aliases_file'} eq 'postfix') {
67 # Postfix has to be installed
68 &foreign_installed("postfix", 1) ||
69 &ui_print_endpage(&text('index_epostfix', '../postfix/'));
71 elsif ($config{'aliases_file'} eq '') {
72 # Sendmail has to be installed
73 &foreign_installed("sendmail", 1) ||
74 &ui_print_endpage(&text('index_esendmail2', '','../sendmail/'));
77 # Only the sendmail module has to be installed
78 &foreign_check("sendmail") ||
79 &ui_print_endpage(&text('index_esendmail3'));
82 # Check for the majordomo aliases
83 $aliases_files = &get_aliases_file();
84 $email = &find_value("whoami", $conf); $email =~ s/\@.*$//g;
85 $owner = &find_value("whoami_owner", $conf); $owner =~ s/\@.*$//g;
86 @aliases = &foreign_call($aliases_module, "list_aliases", $aliases_files);
87 foreach $a (@aliases) {
88 if ($a->{'enabled'} && lc($a->{'name'}) eq lc($email)) {
91 if ($a->{'enabled'} && lc($a->{'name'}) eq lc($owner)) {
96 # Offer to setup aliases
97 if (!$majordomo_alias) {
98 print "<p>$text{'index_setupdesc'}\n";
99 print "<center><form action=alias_setup.cgi>\n";
100 if (!$majordomo_owner) {
101 print "<b>$text{'index_owner'}</b>\n";
102 print "<input name=owner size=25>\n";
103 print "<input type=hidden name=owner_a value='$owner'>\n";
105 print "<input type=hidden name=email_a value='$email'>\n";
106 print "<input type=submit value=\"$text{'index_setup'}\">\n";
107 print "</form></center>\n";
111 # Display active lists
112 @lists = &list_lists($conf);
113 @lists = sort { $a cmp $b } @lists if ($config{'sort_mode'});
114 map { $lcan{$_}++ } split(/\s+/, $access{'lists'});
115 foreach $l (grep { $lcan{$_} || $lcan{"*"} } @lists) {
116 push(@links, "edit_list.cgi?name=$l");
117 push(@titles, &html_escape($l));
118 push(@icons, "images/list.gif");
121 @crlinks = ( "<a href='create_form.cgi'>$text{'index_add'}</a>" );
123 push(@crlinks, "<a href='digest_form.cgi'>$text{'index_digest'}</a>");
125 if ($access{'create'}) {
126 print &ui_links_row(\@crlinks);
128 &icons_table(\@links, \@titles, \@icons, 5);
131 print "<b>$text{'index_none'}</b>.<p>\n";
133 if ($access{'create'}) {
134 print &ui_links_row(\@crlinks);
137 if ($access{'global'}) {
139 print "<table> <tr>\n";
140 print "<form action=edit_global.cgi>\n";
141 print "<td><input type=submit value='$text{'index_global'}'></td>\n";
142 print "<td>$text{'index_globaldesc'}</td> </tr> </form>\n";
146 &ui_print_footer("/", $text{'index'});