Handle hostnames with upper-case letters
[webmin.git] / majordomo / save_info.cgi
1 #!/usr/local/bin/perl
2 # save_info.cgi
3 # Store the info and intro message for a list
4
5 require './majordomo-lib.pl';
6 require 'ctime.pl';
7 &ReadParse();
8 %access = &get_module_acl();
9 &can_edit_list(\%access, $in{'name'}) || &error($text{'edit_ecannot'});
10 $list = &get_list($in{'name'}, &get_config());
11 &lock_file($list->{'config'});
12 &lock_file($list->{'info'});
13 &lock_file($list->{'intro'});
14 $conf = &get_list_config($list->{'config'});
15 chop($ctime = ctime(time()));
16 $updated = "[Last updated on: $ctime]\n";
17
18 $in{'info'} =~ s/\r//g;
19 &open_tempfile(INFO, ">$list->{'info'}");
20 if (&find_value("date_info", $conf) eq "yes") {
21         &print_tempfile(INFO, $updated);
22         }
23 &print_tempfile(INFO, $in{'info'});
24 &print_tempfile(INFO, "\n") if ($in{'info'} !~ /\n$/);
25 &close_tempfile(INFO);
26 if ($in{'intro_def'}) {
27         unlink($list->{'intro'});
28         }
29 else {
30         $in{'intro'} =~ s/\r//g;
31         &open_tempfile(INTRO, ">$list->{'intro'}");
32         if (&find_value("date_intro", $conf) eq "yes") {
33                 &print_tempfile(INTRO, $updated);
34                 }
35         &print_tempfile(INTRO, $in{'intro'});
36         &print_tempfile(INTRO, "\n") if ($in{'intro'} !~ /\n$/);
37         &close_tempfile(INTRO);
38         &set_permissions($list->{'intro'});
39         }
40 &save_list_directive($conf, $list->{'config'},
41                      "description", $in{'description'});
42 &flush_file_lines();
43 &unlock_all_files();
44 &webmin_log("info", undef, $in{'name'});
45 &redirect("edit_list.cgi?name=$in{'name'}");
46