Handle hostnames with upper-case letters
[webmin.git] / itsecur-firewall / list_backup.cgi
1 #!/usr/bin/perl
2 # Show a form for backing up some or all firewall objects
3
4 require './itsecur-lib.pl';
5 &can_edit_error("backup");
6 &check_zip();
7 &header($text{'backup_title'}, "",
8         undef, undef, undef, undef, &apply_button());
9 print "<hr>\n";
10
11 print "<form action=backup.cgi/firewall.zip method=post>\n";
12 print "<table border>\n";
13 print "<tr $tb> <td><b>$text{'backup_header'}</b></td> </tr>\n";
14 print "<tr $cb> <td><table>\n";
15
16 # Show destination
17 ($mode, @dest) = &parse_backup_dest($config{'backup_dest'});
18 print "<tr> <td valign=top><b>$text{'backup_dest'}</b></td>\n";
19 print "<td><table cellpadding=0 cellspacing=0>\n";
20 printf "<tr> <td><input type=radio name=dest_mode value=0 %s></td> <td>%s</td> </tr>\n",
21         $mode == 0 ? "checked" : "", $text{'backup_dest0'};
22
23 printf "<tr> <td><input type=radio name=dest_mode value=1 %s></td> <td>%s</td>\n",
24         $mode == 1 ? "checked" : "", $text{'backup_dest1'};
25 printf "<td colspan=3><input name=dest size=40 value='%s'> %s</td> </tr>\n",
26         $mode == 1 ? $dest[0] : "", &file_chooser_button("dest");
27
28 printf "<tr> <td><input type=radio name=dest_mode value=3 %s></td> <td>%s</td>\n",
29         $mode == 3 ? "checked" : "", $text{'backup_dest3'};
30 printf "<td colspan=3><input name=email size=40 value='%s'></td> </tr>\n",
31         $mode == 3 ? $dest[0] : "";
32
33 printf "<tr> <td><input type=radio name=dest_mode value=2 %s></td>\n",
34         $mode == 2 ? "checked" : "";
35 printf "<td>%s</td> <td><input name=ftphost size=20 value='%s'></td>\n",
36         $text{'backup_dest2'}, $mode == 2 ? $dest[2] : "";
37 printf "<td>%s</td> <td><input name=ftpfile size=20 value='%s'></td> </tr>\n",
38         $text{'backup_ftpfile'}, $mode == 2 ? $dest[3] : "";
39 printf "<tr> <td></td> <td>%s</td> <td><input name=ftpuser size=15 value='%s'></td>\n",
40         $text{'backup_ftpuser'}, $mode == 2 ? $dest[0] : "";
41 printf "<td>%s</td> <td><input name=ftppass type=password size=15 value='%s'></td> </tr>\n",
42         $text{'backup_ftppass'}, $mode == 2 ? $dest[1] : "";
43 print "</table></td> </tr>\n";
44
45 # Show password
46 print "<tr> <td valign=top><b>$text{'backup_pass'}</b></td> <td>\n";
47 printf "<input type=radio name=pass_def value=1 %s> %s\n",
48         $config{'backup_pass'} ? "" : "checked", $text{'backup_nopass'};
49 printf "<input type=radio name=pass_def value=0 %s>\n",
50         $config{'backup_pass'} ? "checked" : "";
51 printf "<input type=password name=pass value='%s'></td> </tr>\n",
52         $config{'backup_pass'};
53
54 # Show what to backup
55 %what = map { $_, 1 } split(/\s+/, $config{'backup_what'});
56 print "<tr> <td valign=top><b>$text{'backup_what'}</b></td> <td>\n";
57 foreach $w (@backup_opts) {
58         printf "<input type=checkbox name=what value=%s %s> %s<br>\n",
59                 $w, $what{$w} ? "checked" : "", $text{$w."_title"};
60         }
61 if (defined(&select_all_link)) {
62         print &select_all_link("what", 0),"\n";
63         print &select_invert_link("what", 0),"\n";
64         }
65 print "</td> </tr>\n";
66
67 # Show schedule
68 $job = &find_backup_job();
69 print "<tr> <td valign=top><b>$text{'backup_sched'}</b></td> <td>\n";
70 printf "<input type=radio name=sched_def value=1 %s> %s\n",
71         $job ? "" : "checked", $text{'backup_nosched'};
72 printf "<input type=radio name=sched_def value=0 %s> %s\n",
73         $job ? "checked" : "", $text{'backup_interval'};
74 print "<select name=sched>\n";
75 foreach $s ("hourly", "daily", "weekly", "monthly", "yearly") {
76         printf "<option value=%s %s>%s\n",
77                 $s, $job && $job->{'special'} eq $s ? "selected" : "",
78                 ucfirst($s);
79         }
80 print "</select></td> </tr>\n";
81
82 print "</table></td></tr></table>\n";
83 print "<input type=submit value='$text{'backup_ok'}'>\n";
84 print "<input type=submit name=save value='$text{'backup_save'}'></form>\n";
85
86 print "<hr>\n";
87 &footer("", $text{'index_return'});
88