3 # Displays a list of all PAP secrets
5 require './pptp-server-lib.pl';
6 $access{'secrets'} || &error($text{'secrets_ecannot'});
7 &ui_print_header(undef, $text{'secrets_title'}, "", "secrets");
9 if (!-r $config{'pap_file'}) {
10 print "<p>", &text('secrets_enopfile', $config{'pap_file'},
11 "$gconfig{'webprefix'}/config.cgi?$module_name"),"<p>\n";
12 &ui_print_footer("/", $text{'secrets_return'});
16 @links = ( &select_all_link("d"),
17 &select_invert_link("d"),
18 "<a href=edit_secret.cgi>$text{'secrets_create'}</a>" );
20 # Get the system's hostname for selecting PPP accounts
21 $host = &get_ppp_hostname();
23 print &text('secrets_desc', "<tt>$config{'pap_file'}</tt>", "<tt>$host</tt>",
24 $config{'pap_file'} =~ /pap-secrets/ ? "PAP" : "CHAP"),"<p>\n";
26 @sec = grep { $_->{'server'} eq $host } &list_secrets();
28 print &ui_form_start("delete_secrets.cgi", "post");
29 @tds = ( "width=5", "nowrap", "nowrap" );
30 print &ui_links_row(\@links);
31 print &ui_columns_start(
32 [ "", $text{'secrets_user'}, $text{'secrets_ips'} ],
34 for($i=0; $i<@sec; $i++) {
37 push(@cols, "<a href=\"edit_secret.cgi?$i\">".
38 ($s->{'client'} ? &html_escape($s->{'client'})
39 : $text{'index_uany'})."</a>");
41 push(@cols, $i[0] eq "*" || $i[0] eq "" ?
42 $text{'edit_secret_aany'} :
43 $i[0] eq "-" ? $text{'edit_secret_anone'} :
44 html_escape(join(" ", @i)));
45 print &ui_checked_columns_row(\@cols, \@tds, "d", $i);
47 print &ui_columns_end();
48 print &ui_links_row(\@links);
49 print &ui_form_end([ [ "delete", $text{'secrets_delete'} ] ]);
52 print "<b>$text{'secrets_none'}</b><p>\n";
53 print &ui_links_row([ $links[2] ]);
56 &ui_print_footer("", $text{'secrets_return'});