Handle hostnames with upper-case letters
[webmin.git] / shorewall / savecmt.cgi
1 #!/usr/bin/perl
2 # Updated, modify or delete a comment
3
4 require './shorewall-lib.pl';
5 &ReadParse();
6 &can_access($in{'table'}) || &error($text{'list_ecannot'});
7 $pfunc = &get_parser_func(\%in);
8 &error_setup($text{"comment_err"});
9
10 &lock_table($in{'table'});
11 if ($in{'delete'}) {
12         # Just delete one row
13         &delete_table_row($in{'table'}, $pfunc, $in{'idx'});
14         }
15 else {
16         # Validate inputs
17         $in{'msg'} =~ /\S/ || &error($text{'comment_enone'});
18         $line = "COMMENT $in{'msg'}";
19
20         # Update or add
21         if ($in{'new'}) {
22                 &create_table_row($in{'table'}, $pfunc, $line);
23                 }
24         else {
25                 # Updating 
26                 &modify_table_row($in{'table'}, $pfunc, $in{'idx'}, $line);
27                 }
28         }
29 &unlock_table($in{'table'});
30 &webmin_log($in{'new'} ? "create" : $in{'delete'} ? "delete" : "modify",
31             "comment", $in{'table'});
32 &redirect("list.cgi?table=$in{'table'}");
33