%settings = ();
%ethsettings = ();
%pppsettings = ();
-@URI = ();
+my @URI = split('\?', $ENV{'REQUEST_URI'});
### Make sure this is an SSL request
if ($ENV{'SERVER_ADDR'} && $ENV{'HTTPS'} ne 'on') {
};
};
-our $THEME_NAME = $settings{'THEME'};
+### Initialize user manual
+my %manualpages = ();
+&_read_manualpage_hash("${General::swroot}/main/manualpages");
+### Load selected language and theme functions
require "${swroot}/langs/en.pl";
require "${swroot}/langs/${language}.pl";
-eval `/bin/cat /srv/web/ipfire/html/themes/$THEME_NAME/include/functions.pl`;
+eval `/bin/cat /srv/web/ipfire/html/themes/ipfire/include/functions.pl`;
sub green_used() {
if ($ethsettings{'GREEN_DEV'} && $ethsettings{'GREEN_DEV'} ne "") {
$menu->{'02.status'}{'subMenu'}->{'74.modem-status'}{'enabled'} = 1;
}
+ # Disable the Dialup/PPPoE menu item when the RED interface is in IP mode
+ # (the "Network" module is loaded by general-functions.pl)
+ if(&Network::is_red_mode_ip()) {
+ $menu->{'01.system'}{'subMenu'}->{'20.dialup'}{'enabled'} = 0;
+ }
+
# Disbale unusable things in cloud environments
if (&General::running_in_cloud()) {
$menu->{'03.network'}{'subMenu'}->{'30.dhcp'}{'enabled'} = 0;
$menu->{'03.network'}{'subMenu'}->{'80.macadressmenu'}{'enabled'} = 0;
$menu->{'03.network'}{'subMenu'}->{'90.wakeonlan'}{'enabled'} = 0;
}
-
- # Disable proxy when no GREEN is available
- if (!&green_used()) {
- $menu->{'03.network'}{'subMenu'}->{'20.proxy'}{'enabled'} = 0;
- $menu->{'03.network'}{'subMenu'}->{'21.urlfilter'}{'enabled'} = 0;
- $menu->{'03.network'}{'subMenu'}->{'22.updxlrator'}{'enabled'} = 0;
- }
}
}
sub PrintActualLeases
{
- &openbox('100%', 'left', $tr{'current dynamic leases'});
+ &openbox('100%', 'left', $Lang::tr{'current dynamic leases'});
print <<END
<table width='100%' class='tbl'>
<tr>
-<th width='25%' align='center'><a href='$ENV{'SCRIPT_NAME'}?IPADDR'><b>$tr{'ip address'}</b></a></th>
-<th width='25%' align='center'><a href='$ENV{'SCRIPT_NAME'}?ETHER'><b>$tr{'mac address'}</b></a></th>
-<th width='20%' align='center'><a href='$ENV{'SCRIPT_NAME'}?HOSTNAME'><b>$tr{'hostname'}</b></a></th>
-<th width='25%' align='center'><a href='$ENV{'SCRIPT_NAME'}?ENDTIME'><b>$tr{'lease expires'} (local time d/m/y)</b></a></th>
-<th width='5%' align='center'><b>Add to fix leases</b></th>
+<th width='25%' align='center'><a href='$ENV{'SCRIPT_NAME'}?IPADDR'><b>$Lang::tr{'ip address'}</b></a></th>
+<th width='25%' align='center'><a href='$ENV{'SCRIPT_NAME'}?ETHER'><b>$Lang::tr{'mac address'}</b></a></th>
+<th width='20%' align='center'><a href='$ENV{'SCRIPT_NAME'}?HOSTNAME'><b>$Lang::tr{'hostname'}</b></a></th>
+<th width='25%' align='center'><a href='$ENV{'SCRIPT_NAME'}?ENDTIME'><b>$Lang::tr{'lease expires'} (local time d/m/y)</b></a></th>
+<th width='5%' align='center'><b>$Lang::tr{'dhcp make fixed lease'}</b></th>
</tr>
END
;
return $string;
}
}
+
+# Get user manual URL for a configuration page inside the "/cgi-bin/"
+# (reads current page from the environment variables unless defined)
+# Returns empty if no URL is available
+sub get_manualpage_url() {
+ my ($cgifile) = @_;
+ $cgifile //= substr($ENV{'SCRIPT_NAME'}, 9); # remove fixed "/cgi-bin/" path
+
+ # Ensure base url is configured
+ return unless($manualpages{'BASE_URL'});
+
+ # Return URL
+ if($cgifile && defined($manualpages{$cgifile})) {
+ return "$manualpages{'BASE_URL'}/$manualpages{$cgifile}";
+ }
+
+ # No manual page configured, return nothing
+ return;
+}
+
+# Private function to load a hash of configured user manual pages from file
+# (run check_manualpages.pl to make sure the file is correct)
+sub _read_manualpage_hash() {
+ my ($filename) = @_;
+
+ open(my $file, "<", $filename) or return; # Fail silent
+ while(my $line = <$file>) {
+ chomp($line);
+ next if(substr($line, 0, 1) eq '#'); # Skip comments
+ next if(index($line, '=', 1) == -1); # Skip incomplete lines
+
+ my($left, $value) = split(/=/, $line, 2);
+ if($left =~ /^([[:alnum:]\/._-]+)$/) {
+ my $key = $1;
+ $manualpages{$key} = $value;
+ }
+ }
+ close($file);
+}
+
+1; # End of package "Header"