From 8186b37230c7c73fc5f79411ab5890821c744a79 Mon Sep 17 00:00:00 2001 From: Jonatan Schlag Date: Thu, 8 Apr 2021 10:36:24 +0200 Subject: [PATCH] Hardcode theme to ipfire This disables the theme support and makes it impossible to use any other themes than the ipfire default theme. The only intention of this patch is to hardcode the theme to ipfire. To change any cgi we have is an ugly way, but the only way to do this fast. The colour handling needs certainly to be improved as well, but this will and should be done in other patches. Signed-off-by: Jonatan Schlag Signed-off-by: Michael Tremer --- config/cfgroot/graphs.pl | 4 +- config/cfgroot/header.pl | 3 +- html/cgi-bin/atm-status.cgi | 2 +- html/cgi-bin/backup.cgi | 2 +- html/cgi-bin/captive.cgi | 2 +- html/cgi-bin/connscheduler.cgi | 2 +- html/cgi-bin/ddns.cgi | 2 +- html/cgi-bin/dhcp.cgi | 2 +- html/cgi-bin/dns.cgi | 2 +- html/cgi-bin/dnsforward.cgi | 2 +- html/cgi-bin/firewall.cgi | 2 +- html/cgi-bin/fwhosts.cgi | 2 +- html/cgi-bin/guardian.cgi | 2 +- html/cgi-bin/gui.cgi | 45 -------------------- html/cgi-bin/hardwaregraphs.cgi | 2 +- html/cgi-bin/hosts.cgi | 2 +- html/cgi-bin/ids.cgi | 2 +- html/cgi-bin/index.cgi | 2 +- html/cgi-bin/ipinfo.cgi | 2 +- html/cgi-bin/location-block.cgi | 2 +- html/cgi-bin/logs.cgi/firewalllog.dat | 2 +- html/cgi-bin/logs.cgi/firewalllogcountry.dat | 2 +- html/cgi-bin/logs.cgi/firewalllogip.dat | 2 +- html/cgi-bin/logs.cgi/firewalllogport.dat | 2 +- html/cgi-bin/logs.cgi/ids.dat | 2 +- html/cgi-bin/logs.cgi/log.dat | 2 +- html/cgi-bin/logs.cgi/ovpnclients.dat | 2 +- html/cgi-bin/logs.cgi/proxylog.dat | 2 +- html/cgi-bin/logs.cgi/urlfilter.dat | 2 +- html/cgi-bin/mail.cgi | 2 +- html/cgi-bin/mdstat.cgi | 2 +- html/cgi-bin/media.cgi | 2 +- html/cgi-bin/memory.cgi | 2 +- html/cgi-bin/mpfire.cgi | 2 +- html/cgi-bin/netexternal.cgi | 2 +- html/cgi-bin/netinternal.cgi | 2 +- html/cgi-bin/netother.cgi | 2 +- html/cgi-bin/netovpnrw.cgi | 2 +- html/cgi-bin/netovpnsrv.cgi | 2 +- html/cgi-bin/ovpnmain.cgi | 2 +- html/cgi-bin/p2p-block.cgi | 2 +- html/cgi-bin/pakfire.cgi | 2 +- html/cgi-bin/pppsetup.cgi | 2 +- html/cgi-bin/proxy.cgi | 2 +- html/cgi-bin/qos.cgi | 2 +- html/cgi-bin/remote.cgi | 2 +- html/cgi-bin/routing.cgi | 2 +- html/cgi-bin/samba.cgi | 2 +- html/cgi-bin/services.cgi | 2 +- html/cgi-bin/system.cgi | 2 +- html/cgi-bin/tor.cgi | 2 +- html/cgi-bin/traffic.cgi | 2 +- html/cgi-bin/updatexlrator.cgi | 2 +- html/cgi-bin/vpnmain.cgi | 2 +- html/cgi-bin/vulnerabilities.cgi | 2 +- html/cgi-bin/wakeonlan.cgi | 2 +- html/cgi-bin/wirelessclient.cgi | 2 +- html/cgi-bin/wlanap.cgi | 2 +- html/html/themes/ipfire/include/functions.pl | 10 ++--- src/scripts/makegraphs | 2 +- src/squid-accounting/accounting.cgi | 2 +- src/wio/wio-graphs.pl | 2 +- src/wio/wio.cgi | 2 +- 63 files changed, 64 insertions(+), 116 deletions(-) diff --git a/config/cfgroot/graphs.pl b/config/cfgroot/graphs.pl index cf4a30de3..441d4c483 100644 --- a/config/cfgroot/graphs.pl +++ b/config/cfgroot/graphs.pl @@ -62,14 +62,12 @@ my @GRAPH_ARGS = ( "--alt-y-grid", ); -# Read the global settings files to get the current theme and after this load -# colors for this theme my %color = (); my %mainsettings = (); my %sensorsettings = (); &General::readhash("${General::swroot}/main/settings", \%mainsettings); -&General::readhash("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", \%color); +&General::readhash("/srv/web/ipfire/html/themes/ipfire/include/colors.txt", \%color); if ( $mainsettings{'RRDLOG'} eq "" ){ $mainsettings{'RRDLOG'}="/var/log/rrd"; diff --git a/config/cfgroot/header.pl b/config/cfgroot/header.pl index 8dea804d0..83ef01951 100644 --- a/config/cfgroot/header.pl +++ b/config/cfgroot/header.pl @@ -91,11 +91,10 @@ if ( -d "/var/ipfire/langs/${language}/" ) { }; }; -our $THEME_NAME = $settings{'THEME'}; 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 "") { diff --git a/html/cgi-bin/atm-status.cgi b/html/cgi-bin/atm-status.cgi index c2a9914f7..49f19209d 100644 --- a/html/cgi-bin/atm-status.cgi +++ b/html/cgi-bin/atm-status.cgi @@ -33,7 +33,7 @@ my %color = (); my %mainsettings = (); &General::readhash("${General::swroot}/main/settings", \%mainsettings); -&General::readhash("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", \%color); +&General::readhash("/srv/web/ipfire/html/themes/ipfire/include/colors.txt", \%color); &Header::showhttpheaders(); &Header::openpage($Lang::tr{'status information'}, 1, ''); diff --git a/html/cgi-bin/backup.cgi b/html/cgi-bin/backup.cgi index cac4146ab..683f8add4 100644 --- a/html/cgi-bin/backup.cgi +++ b/html/cgi-bin/backup.cgi @@ -42,7 +42,7 @@ my @backupisos = ""; $a = new CGI; &General::readhash("${General::swroot}/main/settings", \%mainsettings); -&General::readhash("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", \%color); +&General::readhash("/srv/web/ipfire/html/themes/ipfire/include/colors.txt", \%color); $cgiparams{'ACTION'} = ''; $cgiparams{'FILE'} = ''; diff --git a/html/cgi-bin/captive.cgi b/html/cgi-bin/captive.cgi index 8204eb7b3..51c5d45f2 100755 --- a/html/cgi-bin/captive.cgi +++ b/html/cgi-bin/captive.cgi @@ -69,7 +69,7 @@ unless (-e $settingsfile) { system("touch $settingsfile"); } &Header::getcgihash(\%cgiparams); &General::readhash("${General::swroot}/main/settings", \%mainsettings); -&General::readhash("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", \%color); +&General::readhash("/srv/web/ipfire/html/themes/ipfire/include/colors.txt", \%color); &General::readhash("$settingsfile", \%settings) if(-f $settingsfile); &General::readhash("${General::swroot}/ethernet/settings", \%netsettings); diff --git a/html/cgi-bin/connscheduler.cgi b/html/cgi-bin/connscheduler.cgi index 90aae52fb..1393df65f 100644 --- a/html/cgi-bin/connscheduler.cgi +++ b/html/cgi-bin/connscheduler.cgi @@ -34,7 +34,7 @@ require '/var/ipfire/connscheduler/lib.pl'; my %color = (); my %mainsettings = (); &General::readhash("${General::swroot}/main/settings", \%mainsettings); -&General::readhash("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", \%color); +&General::readhash("/srv/web/ipfire/html/themes/ipfire/include/colors.txt", \%color); my $buttontext = $Lang::tr{'add'}; my $hiddenvalue = 'add'; diff --git a/html/cgi-bin/ddns.cgi b/html/cgi-bin/ddns.cgi index 9b58db895..7e4ddb5b7 100644 --- a/html/cgi-bin/ddns.cgi +++ b/html/cgi-bin/ddns.cgi @@ -37,7 +37,7 @@ undef (@dummy); my %color = (); my %mainsettings = (); &General::readhash("${General::swroot}/main/settings", \%mainsettings); -&General::readhash("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", \%color); +&General::readhash("/srv/web/ipfire/html/themes/ipfire/include/colors.txt", \%color); # Config file for basic configuration. my $settingsfile = "${General::swroot}/ddns/settings"; diff --git a/html/cgi-bin/dhcp.cgi b/html/cgi-bin/dhcp.cgi index 867614f2a..dd379dc47 100644 --- a/html/cgi-bin/dhcp.cgi +++ b/html/cgi-bin/dhcp.cgi @@ -111,7 +111,7 @@ foreach my $itf (@ITFs) { &General::readhash("${General::swroot}/ethernet/settings", \%netsettings); &General::readhash("${General::swroot}/main/settings", \%mainsettings); &General::readhash("${General::swroot}/time/settings", \%timesettings); -&General::readhash("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", \%color); +&General::readhash("/srv/web/ipfire/html/themes/ipfire/include/colors.txt", \%color); #Get GUI values &Header::getcgihash(\%dhcpsettings); diff --git a/html/cgi-bin/dns.cgi b/html/cgi-bin/dns.cgi index 337166ccf..7dc113582 100755 --- a/html/cgi-bin/dns.cgi +++ b/html/cgi-bin/dns.cgi @@ -65,7 +65,7 @@ my $check_servers; my %color = (); my %mainsettings = (); &General::readhash("${General::swroot}/main/settings", \%mainsettings); -&General::readhash("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", \%color); +&General::readhash("/srv/web/ipfire/html/themes/ipfire/include/colors.txt", \%color); &Header::showhttpheaders(); &Header::getcgihash(\%cgiparams); diff --git a/html/cgi-bin/dnsforward.cgi b/html/cgi-bin/dnsforward.cgi index ed373c09a..749d1216a 100644 --- a/html/cgi-bin/dnsforward.cgi +++ b/html/cgi-bin/dnsforward.cgi @@ -43,7 +43,7 @@ my $changed = 'no'; my %color = (); my %mainsettings = (); &General::readhash("${General::swroot}/main/settings", \%mainsettings); -&General::readhash("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", \%color); +&General::readhash("/srv/web/ipfire/html/themes/ipfire/include/colors.txt", \%color); &Header::showhttpheaders(); diff --git a/html/cgi-bin/firewall.cgi b/html/cgi-bin/firewall.cgi index 532f99f91..4f4d63cc8 100644 --- a/html/cgi-bin/firewall.cgi +++ b/html/cgi-bin/firewall.cgi @@ -99,7 +99,7 @@ my $checkorange=''; my @protocols; &General::readhash("${General::swroot}/firewall/settings", \%fwdfwsettings); &General::readhash("${General::swroot}/main/settings", \%mainsettings); -&General::readhash("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", \%color); +&General::readhash("/srv/web/ipfire/html/themes/ipfire/include/colors.txt", \%color); &General::readhash($fwoptions, \%optionsfw); &General::readhash($ifacesettings, \%ifaces); &General::readhash("$configovpn", \%ovpnsettings); diff --git a/html/cgi-bin/fwhosts.cgi b/html/cgi-bin/fwhosts.cgi index fe5117ae5..84b018459 100644 --- a/html/cgi-bin/fwhosts.cgi +++ b/html/cgi-bin/fwhosts.cgi @@ -83,7 +83,7 @@ unless (-e $configsrvgrp) { system("touch $configsrvgrp"); } unless (-e $configlocationgrp) { system("touch $configlocationgrp"); } &General::readhash("${General::swroot}/main/settings", \%mainsettings); -&General::readhash("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", \%color); +&General::readhash("/srv/web/ipfire/html/themes/ipfire/include/colors.txt", \%color); &General::readhash("${General::swroot}/ethernet/settings", \%ownnet); &General::readhash("$configovpn", \%ovpnsettings); &General::readhasharray("$configipsec", \%ipsecconf); diff --git a/html/cgi-bin/guardian.cgi b/html/cgi-bin/guardian.cgi index 7dc6b0149..fb16be00e 100644 --- a/html/cgi-bin/guardian.cgi +++ b/html/cgi-bin/guardian.cgi @@ -60,7 +60,7 @@ our %netsettings = (); our %color = (); our %mainsettings = (); &General::readhash("${General::swroot}/main/settings", \%mainsettings); -&General::readhash("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", \%color); +&General::readhash("/srv/web/ipfire/html/themes/ipfire/include/colors.txt", \%color); # File declarations. my $settingsfile = "${General::swroot}/guardian/settings"; diff --git a/html/cgi-bin/gui.cgi b/html/cgi-bin/gui.cgi index f06b0f923..1b316a2a2 100644 --- a/html/cgi-bin/gui.cgi +++ b/html/cgi-bin/gui.cgi @@ -88,7 +88,6 @@ if ($cgiparams{'ACTION'} eq "$Lang::tr{'save'}") $mainsettings{'WINDOWWITHHOSTNAME'} = $cgiparams{'WINDOWWITHHOSTNAME'}; $mainsettings{'PPPUPDOWNBEEP'} = $cgiparams{'PPPUPDOWNBEEP'}; $mainsettings{'SPEED'} = $cgiparams{'SPEED'}; - $mainsettings{'THEME'} = $cgiparams{'theme'}; $mainsettings{'REFRESHINDEX'} = $cgiparams{'REFRESHINDEX'}; &General::writehash("${General::swroot}/main/settings", \%mainsettings); &Lang::reload($cgiparams{'lang'}); @@ -106,12 +105,6 @@ if ($cgiparams{'ACTION'} eq "$Lang::tr{'save'}") $cgiparams{'PPPUPDOWNBEEP'} = 'on'; } - if ($mainsettings{'THEME'}) { - $cgiparams{'THEME'} = $mainsettings{'THEME'}; - } else { - $cgiparams{'THEME'} = 'ipfire'; - } - if($mainsettings{'REFRESHINDEX'}) { $cgiparams{'REFRESHINDEX'} = $mainsettings{'REFRESHINDEX'}; } else { @@ -134,7 +127,6 @@ if ($cgiparams{'ACTION'} eq "$Lang::tr{'restore defaults'}") $cgiparams{'PPPUPDOWNBEEP'} = 'on'; $cgiparams{'REFRESHINDEX'} = 'off'; $cgiparams{'SPEED'} = 'on'; - $cgiparams{'THEME'} = 'ipfire'; } $checked{'WINDOWWITHHOSTNAME'}{'off'} = ''; @@ -210,43 +202,6 @@ END ; } -print < - -END -; -&Header::closebox(); -&Header::openbox('100%','left',$Lang::tr{'theme'}); -print< - -   -