3 # List hosts from /etc/hosts
5 require './net-lib.pl';
6 $access{'hosts'} || &error($text{'hosts_ecannot'});
7 &ui_print_header(undef, $text{'hosts_title'}, "");
9 if ($access{'hosts'} == 2) {
10 print &ui_form_start("delete_hosts.cgi", "post");
11 @links = ( &select_all_link("d"),
12 &select_invert_link("d"),
13 "<a href=\"edit_host.cgi?new=1\">$text{'hosts_add'}</a>" );
14 print &ui_links_row(\@links);
17 print &ui_columns_start([ $access{'hosts'} == 2 ? ( "" ) : ( ),
19 $text{'hosts_host'} ], undef, 0, \@tds);
20 foreach $h (&list_hosts()) {
22 if ($access{'hosts'} == 2) {
23 push(@cols, "<a href=\"edit_host.cgi?idx=$h->{'index'}\">".
24 &html_escape($h->{'address'})."</a>");
27 push(@cols, &html_escape($h->{'address'}));
29 push(@cols, join(" , ", map { &html_escape($_) }
31 if ($access{'hosts'} == 2) {
32 print &ui_checked_columns_row(\@cols, \@tds, "d",$h->{'index'});
35 print &ui_columns_row(\@cols);
38 print &ui_columns_end();
39 if ($access{'hosts'} == 2) {
40 print &ui_links_row(\@links);
41 print &ui_form_end([ [ "delete", $text{'hosts_delete'} ] ]);
44 &ui_print_footer("", $text{'index_return'});