#!/usr/local/bin/perl # edit_shared.cgi # Edit or create a shared network require './dhcpd-lib.pl'; require './params-lib.pl'; &ReadParse(); $conf = &get_config(); ($par, $sha) = &get_branch('sha'); $sconf = $sha->{'members'}; # check acls %access = &get_module_acl(); &error_setup($text{'eacl_aviol'}); if ($in{'new'} ) { &error("$text{'eacl_np'} $text{'eacl_pin'}") unless &can('c', \%access, $sha) && &can('rw', \%access, $par); } else { &error("$text{'eacl_np'} $text{'eacl_psn'}") if !&can('r', \%access, $sha); } # display &ui_print_header(undef, $in{'new'} ? $text{'esh_crheader'} : $text{'esh_eheader'}, ""); print &ui_form_start("save_shared.cgi", "post"); print &ui_table_start($text{'esh_tabhdr'}, "width=100%", 4); print "
| $text{'esh_hosts'} | \n"; print "\n"; print " | $text{'esh_groups'} | \n"; print "\n"; print " | $text{'esh_subn'} | \n"; print "\n"; if (!$in{'new'}) { # inaccessible hosts in this shared network foreach $h (@host) { if (!&can('r', \%access, $h) && $inshar{$h} eq $sha->{'index'}) { print "{'index'},$sha->{'index'}\" type=hidden>\n"; } } # inaccessible groups in this shared network foreach $g (@group) { if (!&can('r', \%access, $g) && $inshar{$g} eq $sha->{'index'}) { print "{'index'},$sha->{'index'}\" type=hidden>\n"; } } # inaccessible subnets in this shared network foreach $s (@subn) { if (!&can('r', \%access, $s) && $inshar{$s} eq $sha->{'index'}) { print "{'index'},$sha->{'index'}\" type=hidden>\n"; } } } print " |
| \n" if &can('rw', \%access, $sha); print " | \n"; print " | \n" if &can('rw', \%access, $sha, 1); print " |
\n" if &can('rw', \%access, $sha); } else { print "\n"; print "\n"; } if ($config{'dhcpd_version'} >= 3 && !$in{'new'}) { # Display address pools print &ui_hr(); print &ui_subheading($text{'esh_pools'}); local $pn = 1; foreach $p (&find('pool', $sconf)) { push(@links, "edit_pool.cgi?uidx=$in{'idx'}&idx=$p->{'index'}"); push(@titles, &text('esub_pool', $pn)); push(@icons, "images/pool.gif"); $pn++; } if ($pn == 1) { print "$text{'esub_poolnone'}
\n";
}
else {
&icons_table(\@links, \@titles, \@icons, 5);
}
print "",
"$text{'esub_pooladd'}
\n";
}
print &ui_form_end();
&ui_print_footer("", $text{'esh_return'});