Fix debug log
[webmin.git] / web-lib.pl
1 =head1 web-lib.pl
2
3 This file must be included by all Webmin CGI scripts, either directly or via
4 another module-specific .pl file. For example :
5
6  do '../web-lib.pl';
7  init_config();
8  do '../ui-lib.pl';
9  ui_print_header(undef, 'My Module', '');
10
11 This file in turn includes web-lib-funcs.pl, which is where the majority of
12 the Webmin API functions are defined.
13
14 =cut
15
16 $remote_error_handler = "error";
17 @INC = &unique(@INC, ".");
18 %month_to_number_map = ( 'jan' => 0, 'feb' => 1, 'mar' => 2, 'apr' => 3,
19                          'may' => 4, 'jun' => 5, 'jul' => 6, 'aug' => 7,
20                          'sep' => 8, 'oct' => 9, 'nov' =>10, 'dec' =>11 );
21 %number_to_month_map = reverse(%month_to_number_map);
22 $main::initial_process_id ||= $$;
23 $main::default_debug_log_size = 10*1024*1024;
24
25 $webmin_feedback_address = "feedback\@webmin.com";
26 $default_lang = "en";
27 $default_charset = "iso-8859-1";
28 $osdn_download_host = "prdownloads.sourceforge.net";
29 $osdn_download_port = 80;
30
31 =head2 unique(string, ...)
32
33 Returns the unique elements of some array, passed as its parameters.
34
35 =cut
36 sub unique
37 {
38 my (%found, @rv);
39 foreach my $e (@_) {
40         if (!$found{$e}++) { push(@rv, $e); }
41         }
42 return @rv;
43 }
44
45 if (!$done_web_lib_funcs) {
46         my $script = -r '../web-lib-funcs.pl' ? '../web-lib-funcs.pl'
47                                                  : 'web-lib-funcs.pl';
48         do $script;
49         }
50
51 1;
52