Handle hostnames with upper-case letters
[webmin.git] / pam / index.cgi
1 #!/usr/local/bin/perl
2 # index.cgi
3 # Display PAM services on the system
4
5 require './pam-lib.pl';
6 &ui_print_header(undef, $text{'index_title'}, undef, undef, 1, 1, 0,
7         &help_search_link("pam", "man", "howto", "doc"));
8
9 @pams = sort { $a->{'name'} cmp $b->{'name'} } &get_pam_config();
10 if (!@pams) {
11         print "<p>",&text('index_none', "<tt>$config{'pam_dir'}</tt>",
12                           "$gconfig{'webprefix'}/config.cgi?$module_name"),"<p>\n";
13         &ui_print_footer("/", $text{'index'});
14         exit;
15         }
16
17 @links = ( "<a href='create_form.cgi'>$text{'index_add'}</a>" );
18 print &ui_links_row(\@links);
19 $mid = int((@pams-1) / 2);
20 print "<table width=100%><tr> <td width=50% valign=top>\n";
21 &pam_table(@pams[0 .. $mid]);
22 print "</td> <td width=50% valign=top>\n";
23 &pam_table(@pams[$mid+1 .. $#pams]);
24 print "</td> </tr></table>\n";
25 print &ui_links_row(\@links);
26
27 &ui_print_footer("/", $text{'index'});
28
29 sub pam_table
30 {
31 print &ui_columns_start([ $text{'index_name'}, $text{'index_desc'} ], 100);
32 foreach $p (@_) {
33         local $t = $text{'desc_'.$p->{'name'}};
34         print &ui_columns_row([
35                 "<a href='edit_pam.cgi?idx=$p->{'index'}'>".
36                 &html_escape($p->{'name'})."</a>",
37                 $p->{'desc'} || $t
38                 ]);
39         }
40 print &ui_columns_end();
41 }
42