Handle hostnames with upper-case letters
[webmin.git] / squid / edit_auth.cgi
1 #!/usr/local/bin/perl
2 # edit_auth.cgi
3 # Display authentication options and list of proxy users
4
5 require './squid-lib.pl';
6 $access{'proxyauth'} || &error($text{'eauth_ecannot'});
7 &ui_print_header(undef, $text{'eauth_header'}, "", undef, 0, 0, 0, &restart_button());
8 $conf = &get_config();
9
10 print "<form action=save_auth.cgi>\n";
11 print "<table border width=100%>\n";
12 print "<tr $tb> <td><b>$text{'eauth_aopt'}</b></td> </tr>\n";
13 print "<tr $cb> <td><table>\n";
14
15 $v = &find_config("proxy_auth", $conf);
16 $authfile = $v->{'values'}->[0];
17 $authdom = $v->{'values'}->[1];
18 print "<tr> <td><b>$text{'eauth_puf'}</b></td> <td>\n";
19 printf "<input type=radio name=authfile_def value=1 %s> $text{'eauth_none'}&nbsp;\n",
20         $authfile ? "" : "checked";
21 printf "<input type=radio name=authfile_def value=0 %s>\n",
22         $authfile ? "checked" : "";
23 printf "<input name=authfile size=30 value=\"%s\">\n",
24         $authfile ? $authfile : "";
25 print &file_chooser_button("authfile"),"</td> </tr>\n";
26
27 print "<tr>\n";
28 print "<td><b>$text{'eauth_nologin'}</b></td> <td>\n";
29 printf "<input type=radio name=authdom_def value=1 %s> $text{'eauth_none'}&nbsp;\n",
30         $authdom ? "" : "checked";
31 printf "<input type=radio name=authdom_def value=0 %s>\n",
32         $authdom ? "checked" : "";
33 printf "<input name=authdom size=20 value=\"%s\"></td>\n",
34         $authdom ? $authdom : "";
35 print "</tr>\n";
36
37 print "</table></td></tr></table>\n";
38 print "<input type=submit value=$text{'eauth_buttsave'}></form>\n";
39
40 if ($authfile) {
41         print &ui_hr();
42         print $text{'eauth_msgaccess'};
43         print "\n<p>\n";
44         @users = &list_auth_users($authfile);
45         if (@users) {
46                 print "<a href=\"edit_user.cgi?new=1\">$text{'eauth_addpuser'}</a><br>\n";
47                 print "<table border width=100%>\n";
48                 print "<tr $tb> <td><b>$text{'eauth_pusers'}</b></td> </tr>\n";
49                 print "<tr $cb> <td><table width=100%>\n";
50                 for($i=0; $i<@users; $i++) {
51                         print "<tr>\n" if ($i%4 == 0);
52                         print "<td width=25%><a href=\"edit_user.cgi?",
53                               "index=$i\">$users[$i]->{'user'}</a></td>\n";
54                         print "</tr>\n" if ($i%4 == 3);
55                         }
56                 while($i++%4) { print "<td width=25%></td>\n"; }
57                 print "</table></td></tr></table>\n";
58                 }
59         else {
60                 print "<b>$text{'eauth_nopusers'}</b> <p>\n";
61                 }
62         print "<a href=\"edit_user.cgi?new=1\">$text{'eauth_addpuser'}</a><p>\n";
63         }
64
65 &ui_print_footer("", $text{'eauth_return'});
66