Handle hostnames with upper-case letters
[webmin.git] / sarg / save_style.cgi
1 #!/usr/local/bin/perl
2 # Save options for report colour styling
3
4 require './sarg-lib.pl';
5 &ReadParse();
6 $conf = &get_config();
7 $config_prefix = "style_";
8 &error_setup($text{'style_err'});
9
10 &lock_sarg_files();
11 &save_language($conf, "language");
12 &save_language($conf, "charset");
13 &save_opt_textbox($conf, "title", \&check_title);
14 &save_opt_textbox($conf, "title_color", \&check_colour);
15 &save_opt_textbox($conf, "font_face", \&check_font);
16 &save_opt_textbox($conf, "header_color", \&check_colour);
17 &save_opt_textbox($conf, "header_bgcolor", \&check_colour);
18 &save_opt_textbox($conf, "header_font_size", \&check_fontsize);
19 &save_opt_textbox($conf, "text_color", \&check_colour);
20 &save_opt_textbox($conf, "text_bgcolor", \&check_colour);
21
22 &save_opt_textbox($conf, "logo_image");
23 &save_opt_textbox($conf, "image_size", \&check_size);
24 &save_opt_textbox($conf, "logo_text");
25 &save_opt_textbox($conf, "logo_text_color", \&check_colour);
26
27 &save_opt_textbox($conf, "background_image");
28 &save_opt_textbox($conf, "background_color", \&check_colour);
29
30 &flush_file_lines();
31 &unlock_sarg_files();
32 &webmin_log("style");
33 &redirect("");
34
35 sub check_title
36 {
37 return $_[0] =~ /\S/ ? undef : $text{'style_etitle'};
38 }
39
40 sub check_colour
41 {
42 return $_[0] =~ /^\S+$/ ? undef : $text{'style_ecolour'};
43 }
44
45 sub check_font
46 {
47 return $_[0] =~ /^\S+$/ ? undef : $text{'style_efont'};
48 }
49
50 sub check_fontsize
51 {
52 return $_[0] =~ /^\-?\d+$/ ? undef : $text{'style_efontsize'};
53 }
54
55 sub check_size
56 {
57 return $_[0] =~ /^\d+\s+\d+$/ ? undef : $text{'style_esize'};
58 }
59