Handle hostnames with upper-case letters
[webmin.git] / openslp / index.cgi
1 #!/usr/local/bin/perl
2 #
3 # An OpenSLP webmin module
4 # by Monty Charlton <monty@caldera.com>,
5 #
6 # Copyright (c) 2000 Caldera Systems
7 #
8 # Permission to use, copy, modify, and distribute this software and its
9 # documentation under the terms of the GNU General Public License is hereby 
10 # granted. No representations are made about the suitability of this software 
11 # for any purpose. It is provided "as is" without express or implied warranty.
12 # See the GNU General Public License for more details.
13 #
14 require './slp-lib.pl';
15
16 # Check if OpenSLP is actually installed
17 if (!-x $config{'slpd'}) {
18         &ui_print_header(undef, $text{'index_title'}, "", "english", 1, 1, 0,
19                 &help_search_link("openslp", "man", "doc", "google"));
20         print &text('index_eslpd', "<tt>$config{'slpd'}</tt>",
21                   "$gconfig{'webprefix'}/config.cgi?$module_name"),"<p>\n";
22         &ui_print_footer("/", $text{'index'});
23         exit;
24         }
25
26 # Get the version number
27 $out = `$config{'slpd'} -v 2>&1`;
28 $out =~ /version:\s+(\S+)/i;
29 &ui_print_header(undef, $text{'index_title'}, "", "english", 1, 1, 0,
30         &help_search_link("openslp", "man", "doc", "google"),
31         undef, undef, &text('index_version', "$1"));
32
33 # Check if the config file exists
34 if (!-r $config{'slpd_conf'}) {
35         print &text('index_econf', "<tt>$config{'slpd_conf'}</tt>",
36                   "$gconfig{'webprefix'}/config.cgi?$module_name"),"<p>\n";
37         &ui_print_footer("/", $text{'index'});
38         exit;
39         }
40
41 @links =  ( "edit_snda.cgi", "edit_netcfg.cgi",
42             "edit_dacfg.cgi", "edit_log.cgi" );
43 @titles = ( $text{'snda_title'}, $text{'netcfg_title'},
44             $text{'dacfg_title'}, $text{'log_title'} );
45 @icons =  ( "images/snda.gif", "images/netcfg.gif",
46             "images/dacfg.gif", "images/log.gif" );
47 &icons_table(\@links, \@titles, \@icons);
48
49 print &ui_hr();
50 if (&slpd_is_running()) {
51   print "<form action=stop.cgi>\n";
52   print "<table width=100%><tr><td>\n";
53   print "<input type=submit ",
54         "value=\"$text{'index_stop'}\"></td>\n";
55   print "<td>$text{'index_stopmsg'}</td> </tr></table>\n";
56   print "</form>\n";  
57 }
58 else {
59   print "<form action=start.cgi>\n";
60   print "<table width=100%><tr><td>\n";
61   print "<input type=submit ",
62         "value=\"$text{'index_start'}\"></td>\n";
63   print "<td>$text{'index_startmsg'}</td> </tr></table>\n";
64   print "</form>\n";
65 }
66 &ui_print_footer("/", $text{'index'});
67