#!/usr/bin/perl # index.cgi # Show icons for rules, services, groups and NAT require './itsecur-lib.pl'; &header($text{'index_title'}, "", undef, 1, 1, 0, &apply_button(), undef, undef, &text('index_version', $module_info{'version'})); print "
\n"; # Icons table @can_opts = grep { $_ eq "backup" || $_ eq "restore" || $_ eq "remote" || $_ eq "import" ? &can_edit($_) : &can_use($_) } @opts; @links = map { "list_".$_.".cgi" } @can_opts; @titles = map { $text{$_."_title"} } @can_opts; @icons = map { "images/".$_.".gif" } @can_opts; @hrefs = map { ($_ eq "logs" || $_ eq "authlogs") && $config{'open_logs'} ? "target=_new" : "" } @can_opts; &itsecur_icons_table(\@links, \@titles, \@icons, 4, \@hrefs); if (&can_edit("apply") || &can_edit("bootup")) { print "
\n"; } print "\n"; if (&can_edit("apply")) { # Apply button print "\n"; print "\n"; print "\n"; print "\n"; } if (&can_edit("bootup")) { &foreign_require("init", "init-lib.pl"); $atboot = &init::action_status("itsecur-firewall") == 2; # At-boot button print "\n"; print "\n"; print "\n"; } print "
$text{'index_applydesc'}
\n"; printf " %s\n", $atboot ? "checked" : "", $text{'yes'}; printf " %s\n", $atboot ? "" : "checked", $text{'no'}; print " $text{'index_bootupdesc'}
\n"; print "
\n"; &footer("/", $text{'index'}); # itsecur_icons_table(&links, &titles, &icons, [columns], [href], [width], [height]) # Renders a 4-column table of icons sub itsecur_icons_table { &load_theme_library(); if (defined(&theme_icons_table)) { &theme_icons_table(@_); return; } local ($i, $need_tr); local $cols = $_[3] ? $_[3] : 4; local $per = int(100.0 / $cols); print "\n"; for($i=0; $i<@{$_[0]}; $i++) { if ($i%$cols == 0) { print "\n"; } print "\n"; if ($i%$cols == $cols-1) { print "\n"; } } while($i++%$cols) { print "\n"; $need_tr++; } print "\n" if ($need_tr); print "
\n"; &generate_icon($_[2]->[$i], $_[1]->[$i], $_[0]->[$i], ref($_[4]) ? $_[4]->[$i] : $_[4], $_[5], $_[6]); print "
\n"; }