3 # postfix-module by Guillaume Cottenceau <gc@mandrakesoft.com>,
4 # for webmin by Jamie Cameron
6 # A word about this module.
8 # Postfix provides a command to control its parameters: `postconf'.
9 # That's the reason why I don't parse and set the values manually.
10 # It's much better because it can resist to changes of the Postfix
13 # However, to `set back to default' an already changed parameter,
14 # there is no way to do it in the case of dynamic parameters.
15 # [example: I mean that for `static' parameters, which defaults to
16 # `0', I can set the parameter to `0' ; but for `dynamic'
17 # parameters such as domainname [which comes from a system call]
19 # So for this special case, I parse the config file, and delete
20 # manually the correct line.
26 require './postfix-lib.pl';
28 if (&has_command($config{'postfix_config_command'}) &&
29 &backquote_command("$config{'postfix_config_command'} mail_version 2>&1", 1) =~ /mail_version\s*=\s*(.*)/) {
31 $postfix_version = $1;
33 &ui_print_header(undef, $text{'index_title'}, "", "intro", 1, 1, 0,
34 &help_search_link("postfix", "man", "doc", "google"),
35 undef, undef, $postfix_version ?
36 &text('index_version', $postfix_version) : undef);
38 # Save the version for use by other CGIs
39 &open_tempfile(VERSION, ">$module_config_directory/version", 0, 1);
40 &print_tempfile(VERSION, "$postfix_version\n");
41 &close_tempfile(VERSION);
43 # Verify the postfix control command
44 if (!-x $config{'postfix_control_command'}) {
45 print &text('index_epath',
46 "<tt>$config{'postfix_control_command'}</tt>",
47 "../config.cgi?$module_name"),"<p>\n";
49 &foreign_require("software", "software-lib.pl");
50 $lnk = &software::missing_install_link(
51 "postfix", $text{'index_postfix'},
52 "../$module_name/", $text{'index_title'});
53 print $lnk,"<p>\n" if ($lnk);
55 &ui_print_footer("/", $text{'index'});
59 # Verify the postfix config command
60 if (!-x $config{'postfix_config_command'}) {
61 print &text('index_econfig',
62 "<tt>$config{'postfix_config_command'}</tt>",
63 "../config.cgi?$module_name"),"<p>\n";
64 &ui_print_footer("/", $text{'index'});
68 # Verify the postsuper command
69 if (!-x $config{'postfix_super_command'}) {
70 print &text('index_esuper',
71 "<tt>$config{'postfix_super_command'}</tt>",
72 "../config.cgi?$module_name"),"<p>\n";
73 &ui_print_footer("/", $text{'index'});
77 # Verify that current configuration is valid. If not, only allow manual editing
78 if ($config{'index_check'} && ($err = &check_postfix())) {
79 print &text('check_error'),"<p>\n";
80 print "<pre>$err</pre>\n";
81 if ($access{'manual'}) {
82 print "<a href=edit_manual.cgi>$text{'check_manual'}</a><p>\n";
84 &ui_print_footer("/", $text{'index'});
88 @onames = ( "general", "address_rewriting", "aliases", "canonical", "virtual", "transport", "relocated", "header", "body", "bcc",
89 "local_delivery", "resource",
90 "smtpd", "smtp", "sasl", "client",
91 "rate", "debug", $postfix_version > 2 ? ( ) : ( "ldap" ),
92 "master", "mailq", "postfinger", "boxes", "manual" );
94 $access{'boxes'} = &foreign_available("mailboxes");
95 foreach $oitem (@onames)
97 if ($access{$oitem}) {
98 push (@olinks, $oitem eq "boxes" ? "../mailboxes/"
100 push (@otitles, $oitem eq 'manual' ? $text{'cmanual_title'}
101 : $text{$oitem . "_title"});
102 if ($oitem eq 'mailq' && !$config{'mailq_count'}) {
104 local @mqueue = &list_queue();
105 local $mcount = scalar(@mqueue);
106 $otitles[$#otitles] .=
107 "<br>".&text('mailq_count', $mcount);
109 push (@oicons, "images/" . $oitem . ".gif");
113 &icons_table(\@olinks, \@otitles, \@oicons);
116 if ($access{'startstop'})
120 if (&is_postfix_running())
122 print "<table cellpadding=5 width=100%><tr><td>\n";
123 print "<form action=stop.cgi>\n";
124 print "<input type=submit value=\"$text{'index_stop'}\">\n";
125 print "</td> <td>$text{'index_stopmsg'}\n";
129 print "<table cellpadding=5 width=100%><tr><td>\n";
130 print "<form action=start.cgi>\n";
131 print "<input type=submit value=\"$text{'index_start'}\">\n";
132 print "</td> <td>$text{'index_startmsg'}\n";
134 print "</td></tr></table></form>\n";
137 &ui_print_footer("/", $text{'index'});