#!/usr/bin/perl
+###############################################################################
+# #
+# IPFire.org - A linux based firewall #
+# Copyright (C) 2007 Michael Tremer & Christian Schmidt #
+# #
+# This program is free software: you can redistribute it and/or modify #
+# it under the terms of the GNU General Public License as published by #
+# the Free Software Foundation, either version 3 of the License, or #
+# (at your option) any later version. #
+# #
+# This program is distributed in the hope that it will be useful, #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
+# GNU General Public License for more details. #
+# #
+# You should have received a copy of the GNU General Public License #
+# along with this program. If not, see <http://www.gnu.org/licenses/>. #
+# #
+###############################################################################
+
+use strict;
+
+#usable only the following on debugging purpose
+#use warnings;
+#use CGI::Carp 'fatalsToBrowser';
+use CGI;
-#
-# $Id: webaccess.cgi,v 2.0 2006/01/11 00:00:00 marco.s Exp $
-#
+require '/var/ipfire/general-functions.pl';
+require "${General::swroot}/lang.pl";
+require "${General::swroot}/header.pl";
-use CGI;
-my $swroot = "/var/ipcop";
+my $swroot = "/var/ipfire";
my $apdir = "$swroot/proxy/advanced";
my $group_def_file = "$apdir/cre/classrooms";
my $svhosts_file = "$apdir/cre/supervisors";
my $banner = "A D V A N C E D P R O X Y - W E B A C C E S S M A N A G E R";
my %cgiparams;
-my %mainsettings;
my %proxysettings;
+my %temp;
my %acl=();
my @group_defs=();
my @groups=();
### Initialize environment
-&readhash("${swroot}/main/settings", \%mainsettings);
&readhash("${swroot}/proxy/advanced/settings", \%proxysettings);
-$language = $mainsettings{'LANGUAGE'};
### Initialize language
-if ($language =~ /^(\w+)$/) {$language = $1;}
- #
- # Uncomment this to force a certain language:
- # $language='en';
- #
-require "${swroot}/langs/en.pl";
-require "${swroot}/langs/${language}.pl";
+require "${swroot}/lang.pl";
&getcgihash(\%cgiparams);
foreach (@groups)
{
- if ($cgiparams{$_} eq $tr{'advproxy mode deny'}) { $acl{$_}='on'; }
- if ($cgiparams{$_} eq $tr{'advproxy mode allow'}) { $acl{$_}='off'; }
+ if ($cgiparams{$_} eq $Lang::tr{'advproxy mode deny'}) { $acl{$_}='on'; }
+ if ($cgiparams{$_} eq $Lang::tr{'advproxy mode allow'}) { $acl{$_}='off'; }
}
&read_all_groups;
((defined($proxysettings{'SUPERVISOR_PASSWORD'})) && ($proxysettings{'SUPERVISOR_PASSWORD'} eq '')))
{
&write_acl;
- system("/usr/local/bin/restartsquid");
+ system("/usr/local/bin/squidctrl restart >/dev/null 2>&1");
}
}
{
print <<END
<td align='center'>
- <font face='verdana,arial,helvetica' color='#000000' size='2'>$tr{'advproxy supervisor password'}:</font>
+ <font face='verdana,arial,helvetica' color='#000000' size='2'>$Lang::tr{'advproxy supervisor password'}:</font>
</td>
<td align='center'><input type='password' name='PASSWORD' size='15'></td>
END
if ((defined($acl{$_})) && ($acl{$_} eq 'on'))
{
print "</td><td width='120' align='center'>";
- print "<input type='submit' name='$_' value=' $tr{'advproxy mode allow'} '>";
+ print "<input type='submit' name='$_' value=' $Lang::tr{'advproxy mode allow'} '>";
print "</td><td width='16' bgcolor='#D00000'> </td>\n";
} else {
print "</td><td width='120' align='center'>";
- print "<input type='submit' name='$_' value=' $tr{'advproxy mode deny'} '>";
+ print "<input type='submit' name='$_' value=' $Lang::tr{'advproxy mode deny'} '>";
print "</td><td width='16' bgcolor='#00A000'> </td>\n";
}
}
} else {
print " <tr>\n";
print " <td align='center'>\n";
- print " <font face='verdana,arial,helvetica' color='#000000' size='2'>$tr{'advproxy no cre groups'}</font>\n";
+ print " <font face='verdana,arial,helvetica' color='#000000' size='2'>$Lang::tr{'advproxy no cre groups'}</font>\n";
print " </td>\n";
print " </tr>\n";
}
} else {
print " <tr>\n";
print " <td align='center'>\n";
- print " <font face='verdana,arial,helvetica' color='#000000' size='2'>$tr{'advproxy cre disabled'}</font>\n";
+ print " <font face='verdana,arial,helvetica' color='#000000' size='2'>$Lang::tr{'advproxy cre disabled'}</font>\n";
print " </td>\n";
print " </tr>\n";
}
<td bgcolor='#C0C0C0' align='right'>
<font face='verdana,arial,helvetica' color='#FFFFFF' size='1'>
<a href='http://www.advproxy.net' target='_blank'>Advanced Proxy</a> running on
- <a href='http://www.ipcop.org' target='_blank'>IPCop</a>
+ <a href='http://www.ipfire.org' target='_blank'>IPFire</a>
</font>
</td>
</tr>