3 # Display host access records
5 require './postgresql-lib.pl';
6 $access{'users'} || &error($text{'host_ecannot'});
7 &ui_print_header(undef, $text{'host_title'}, "", "list_hosts");
9 print "$text{'host_desc'}<p>\n";
11 $v = &get_postgresql_version();
12 @hosts = &get_hba_config($v);
13 print &ui_form_start("delete_hosts.cgi", "post");
14 @rowlinks = ( &select_all_link("d", 0),
15 &select_invert_link("d", 0),
16 "<a href='edit_host.cgi?new=1'>$text{'host_add'}</a>" );
17 print &ui_links_row(\@rowlinks);
19 @tds = ( "width=5", "width=25%", "width=25%", "width=25%",
20 "width=25%", "width=16" );
23 @tds = ( "width=5", "width=33%", "width=33%", "width=33%", "width=16" );
25 print &ui_columns_start([ "",
26 $text{'host_address'},
28 $v >= 7.3 ? ( $text{'host_user'} ) : ( ),
30 $text{'host_move'} ], 100, 0, \@tds);
33 local $ssl = $h->{'type'} eq 'hostssl' ? " ($text{'host_viassl'})" : "";
34 push(@cols, "<a href='edit_host.cgi?idx=$h->{'index'}'>".
36 $h->{'type'} eq 'local' ? $text{'host_local'} :
37 $h->{'netmask'} eq '255.255.255.255' ? $h->{'address'}.$ssl :
38 $h->{'netmask'} eq '0.0.0.0' ? $text{'host_any'}.$ssl :
39 $h->{'cidr'} ne "" ? $h->{'address'}.'/'.$h->{'cidr'}.$ssl :
40 $h->{'address'}.'/'.$h->{'netmask'}.$ssl)."</a>");
41 push(@cols, $h->{'db'} eq 'all' ? $text{'host_all'} :
42 $h->{'db'} eq 'sameuser' ? $text{'host_same'} :
45 push(@cols, $h->{'user'} eq 'all' ? $text{'host_uall'}
48 push(@cols, $text{"host_$h->{'auth'}"} || $h->{'auth'});
50 if ($h eq $hosts[@hosts-1]) {
51 $mover .= "<img src=images/gap.gif>";
54 $mover .= "<a href='down.cgi?idx=$h->{'index'}'>".
55 "<img src=images/down.gif border=0></a>";
57 if ($h eq $hosts[0]) {
58 $mover .= "<img src=images/gap.gif>";
61 $mover .= "<a href='up.cgi?idx=$h->{'index'}'>".
62 "<img src=images/up.gif border=0></a>";
65 print &ui_checked_columns_row(\@cols, \@tds, "d", $h->{'index'});
67 print &ui_columns_end();
68 print &ui_links_row(\@rowlinks);
69 print &ui_form_end([ [ "delete", $text{'user_delete'} ] ]);
71 &ui_print_footer("", $text{'index_return'});