Handle hostnames with upper-case letters
[webmin.git] / apache / list_authusers.cgi
1 #!/usr/local/bin/perl
2 # list_authusers.cgi
3 # Displays a list of users from a text file
4
5 require './apache-lib.pl';
6 require './auth-lib.pl';
7
8 $conf = &get_config();
9 &ReadParse();
10 &allowed_auth_file($in{'file'}) ||
11         &error(&text('authu_ecannot', $in{'file'}));
12 $desc = &text('authu_header', "<tt>$in{'file'}</tt>");
13 &ui_print_header($desc, $text{'authu_title'}, "");
14 $f = &server_root($in{'file'}, $conf);
15
16 @users = sort { $a cmp $b } &list_authusers($f);
17 if (@users) {
18         print "<table border width=100%>\n";
19         print "<tr $tb> <td><b>",&text('authu_header2', "<tt>$f</tt>"),
20               "</b></td> </tr>\n";
21         print "<tr $cb> <td><table width=100%>\n";
22         for($i=0; $i<@users; $i++) {
23                 $u = $users[$i];
24                 if ($i%4 == 0) { print "<tr>\n"; }
25                 printf "<td width=25%%><a href=\"edit_authuser.cgi?user=$u&".
26                   "file=%s&url=%s\">$u</a></td>\n",
27                   &urlize($f), &urlize(&this_url());
28                 if ($i%4 == 3) { print "</tr>\n"; }
29                 }
30         while($i++%4) { print "<td width=25%></td>\n"; }
31         print "</table></td></tr></table>\n";
32         }
33 else {
34         print "<b>",&text('authu_none', "<tt>$f</tt>"),"</b><p>\n";
35         }
36 printf "<a href=\"edit_authuser.cgi?file=%s&url=%s\">%s</a><p>\n",
37         &urlize($f), &urlize(&this_url()), $text{'authu_add'};
38
39 print &ui_hr();
40 $s = $config{"sync_$f"};
41 print "<form action=save_sync.cgi>\n";
42 print "$text{'authu_sync'} <p>\n";
43 print "<input type=hidden name=file value='$f'>\n";
44 print "<input type=hidden name=url value='$in{'url'}'>\n";
45 printf "<input type=checkbox name=sync value=create %s> %s<br>\n",
46         $s =~ /create/ ? 'checked' : '', $text{'authu_screate'};
47 printf "<input type=checkbox name=sync value=modify %s> %s<br>\n",
48         $s =~ /modify/ ? 'checked' : '', $text{'authu_smodify'};
49 printf "<input type=checkbox name=sync value=delete %s> %s<br>\n",
50         $s =~ /delete/ ? 'checked' : '', $text{'authu_sdelete'};
51 print "<input type=submit value='$text{'save'}'></form>\n";
52
53 &ui_print_footer($in{'url'}, $text{'auth_return'});
54