3 # Display host-level permissions
5 require './mysql-lib.pl';
6 $access{'perms'} || &error($text{'perms_ecannot'});
7 &ui_print_header(undef, $text{'hosts_title'}, "");
9 $d = &execute_sql_safe($master_db, "select * from host order by host");
10 @rowlinks = ( "<a href='edit_host.cgi?new=1'>$text{'hosts_add'}</a>" );
11 if (@{$d->{'data'}}) {
12 print &ui_form_start("delete_hosts.cgi");
13 unshift(@rowlinks, &select_all_link("d", 0),
14 &select_invert_link("d", 0) );
15 print &ui_links_row(\@rowlinks);
17 print &ui_columns_start([ "",
20 $text{'hosts_perms'} ], 100, 0, \@tds);
22 foreach $u (@{$d->{'data'}}) {
24 next if ($access{'perms'} == 2 && !&can_edit_db($u->[1]));
26 push(@cols, "<a href='edit_host.cgi?idx=$i'>".
27 ($u->[1] eq '%' || $u->[1] eq '' ? $text{'hosts_any'}
28 : &html_escape($u->[1]))."</a>");
29 push(@cols, $u->[0] eq '%' || $u->[0] eq '' ?
30 $text{'hosts_any'} : &html_escape($u->[0]));
32 for($j=2; $j<=&db_priv_cols()+2-1; $j++) {
33 push(@priv, $text{"hosts_priv$j"}) if ($u->[$j] eq 'Y');
36 scalar(@priv) == &db_priv_cols() ? $text{'hosts_all'} :
37 !@priv ? $text{'hosts_none'} : join(" | ", @priv));
38 print &ui_checked_columns_row(\@cols, \@tds,
39 "d", $u->[0]." ".$u->[1]);
41 print &ui_columns_end();
44 print "<b>$text{'hosts_empty'}</b> <p>\n";
46 print &ui_links_row(\@rowlinks);
47 print &ui_form_end([ [ "delete", $text{'users_delete'} ]]) if (@{$d->{'data'}});
49 &ui_print_footer("", $text{'index_return'});