3 # Display icons for the various shorewall configuration files
5 require './shorewall-lib.pl';
7 if (!&has_command($config{'shorewall'})) {
8 &ui_print_header(undef, $text{'index_title'}, "", undef, 1, 1);
9 print "<p>",&text('index_ecmd', "<tt>$config{'shorewall'}</tt>",
10 "$gconfig{'webprefix'}/config.cgi?$module_name"),"<p>\n";
14 $shorewall_version = &get_shorewall_version(1);
15 &open_tempfile(VERSION, ">$module_config_directory/version");
16 &print_tempfile(VERSION, $shorewall_version,"\n");
17 &close_tempfile(VERSION);
19 &ui_print_header(undef, $text{'index_title'}, "", undef, 1, 1, 0,
20 &help_search_link("shorewall", "doc", "google"),
21 undef, undef, &text('index_version', &get_printable_version($shorewall_version)));
23 if (!-d $config{'config_dir'}) {
24 # Config dir not found!
25 print "<p>",&text('index_edir',
26 "<tt>$config{'config_dir'}</tt>",
27 "$gconfig{'webprefix'}/config.cgi?$module_name"),"<p>\n";
30 # Just show the file icons
31 @files = grep { &can_access($_) } @shorewall_files;
32 @titles = map { $text{&clean_name($_)."_title"}."<br>($_)" } @files;
33 @links = map { "list.cgi?table=".$_ } @files;
34 @icons = map { "images/".$_.".gif" } @files;
35 &icons_table(\@links, \@titles, \@icons, 4);
37 # Check if shorewall is running by looking for the 'shorewall'
38 # chain in the filter table
40 print "<table width=100%>\n";
41 system("$config{'shorewall'} status 2>&1");
43 # Down .. offer to start
44 # unless no permissions
45 unless ($access{'nochange'}) {
46 print "<form action=start.cgi>\n";
47 print "<tr> <td><input type=submit ",
48 "value='$text{'index_start'}'></td>\n";
49 print "<td>$text{'index_startdesc'}</td> </tr>\n";
54 # Up .. offer to restart, clear and stop
55 # unless nochange is set
56 unless ($access{'nochange'}) {
57 print "<form action=restart.cgi>\n";
58 print "<tr> <td><input type=submit ",
59 "value='$text{'index_restart'}'></td>\n";
60 print "<td>$text{'index_restartdesc'}</td> </tr>\n";
63 print "<form action=refresh.cgi>\n";
64 print "<tr> <td><input type=submit ",
65 "value='$text{'index_refresh'}'></td>\n";
66 print "<td>$text{'index_refreshdesc'}</td> </tr>\n";
69 print "<form action=clear.cgi>\n";
70 print "<tr> <td><input type=submit ",
71 "value='$text{'index_clear'}'></td>\n";
72 print "<td>$text{'index_cleardesc'}</td> </tr>\n";
75 print "<form action=stop.cgi>\n";
76 print "<tr> <td><input type=submit ",
77 "value='$text{'index_stop'}'></td>\n";
78 print "<td>$text{'index_stopdesc'}</td> </tr>\n";
81 print "<form action=status.cgi>\n";
82 print "<tr> <td><input type=submit ",
83 "value='$text{'index_status'}'></td>\n";
84 print "<td>$text{'index_statusdesc'}</td> </tr>\n";
88 # Always offer to check
89 print "<form action=check.cgi>\n";
90 print "<tr> <td><input type=submit ",
91 "value='$text{'index_check'}'></td>\n";
92 print "<td>$text{'index_checkdesc'}</td> </tr>\n";
94 print "<form action=dump.cgi>\n";
95 print "<tr> <td><input type=submit ",
96 "value='$text{'index_dump'}'></td>\n";
97 print "<td>$text{'index_dumpdesc'}</td> </tr>\n";
103 &ui_print_footer("/", $text{'index'});