X-Git-Url: http://git.ipfire.org/?p=people%2Fteissler%2Fipfire-2.x.git;a=blobdiff_plain;f=config%2Fcfgroot%2Fheader.pl;h=299d7664599290d5a7a4c828746d58c820d0d633;hp=552bb20ec409f9ab01cf3bf52651e3ddf57f2d74;hb=e2eb09157ee4e40b383319cfcf16ad69fc5d73d5;hpb=3ea75603a6009dcc159b63f1e6945801e2ce9b56 diff --git a/config/cfgroot/header.pl b/config/cfgroot/header.pl index 552bb20ec..299d76645 100644 --- a/config/cfgroot/header.pl +++ b/config/cfgroot/header.pl @@ -9,27 +9,18 @@ # Copyright (c) 2002/08/23 Mark Wormgoor validfqdn() # Copyright (c) 2003/09/11 Darren Critchley srtarray() # -# $Id: header.pl,v 1.34.2.39 2004/11/26 15:51:27 alanh Exp $ -# package Header; use CGI(); +use HTML::Entities(); use Socket; use Time::Local; $|=1; # line buffering -sub get_version() { - my $read_ver = `cat /etc/ipfire-release`; - if ($read_ver =~ /^$/) { - return "IPFire (unknown version)"; - } - return $read_ver; -} - -$Header::version = get_version(); $Header::revision = 'final'; $Header::swroot = '/var/ipfire'; +$Header::graphdir='/srv/web/ipfire/html/graphs'; $Header::pagecolour = '#ffffff'; #$Header::tablecolour = '#a0a0a0'; $Header::tablecolour = '#FFFFFF'; @@ -43,6 +34,7 @@ $Header::colourorange = '#FF9933'; $Header::colouryellow = '#FFFF00'; $Header::colourgreen = '#339933'; $Header::colourblue = '#333399'; +$Header::colourovpn = '#339999'; $Header::colourfw = '#000000'; $Header::colourvpn = '#990099'; $Header::colourerr = '#FF0000'; @@ -53,18 +45,17 @@ my $menu = \%menuhash; %settings = (); %ethsettings = (); @URI = (); -$Header::supported=0; ### Make sure this is an SSL request if ($ENV{'SERVER_ADDR'} && $ENV{'HTTPS'} ne 'on') { print "Status: 302 Moved\r\n"; - print "Location: https://$ENV{'SERVER_ADDR'}:10443/$ENV{'PATH_INFO'}\r\n\r\n"; + print "Location: https://$ENV{'SERVER_ADDR'}:444/$ENV{'PATH_INFO'}\r\n\r\n"; exit 0; } ### Initialize environment -&readhash("${swroot}/main/settings", \%settings); -&readhash("${swroot}/ethernet/settings", \%ethsettings); +&General::readhash("${swroot}/main/settings", \%settings); +&General::readhash("${swroot}/ethernet/settings", \%ethsettings); $language = $settings{'LANGUAGE'}; $hostname = $settings{'HOSTNAME'}; $hostnameintitle = 0; @@ -97,26 +88,26 @@ if ( -d "/var/ipfire/langs/${language}/" ) { }; }; - require "${swroot}/langs/en.pl"; require "${swroot}/langs/${language}.pl"; +eval `/bin/cat /srv/web/ipfire/html/themes/$settings{'THEME'}/include/functions.pl`; sub orange_used () { - if ($ethsettings{'CONFIG_TYPE'} =~ /^[1357]$/) { + if ($ethsettings{'CONFIG_TYPE'} =~ /^[24]$/) { return 1; } return 0; } sub blue_used () { - if ($ethsettings{'CONFIG_TYPE'} =~ /^[4567]$/) { + if ($ethsettings{'CONFIG_TYPE'} =~ /^[34]$/) { return 1; } return 0; } sub is_modem { - if ($ethsettings{'CONFIG_TYPE'} =~ /^[0145]$/) { + if ($ethsettings{'CONFIG_TYPE'} =~ /^[0]$/) { return 1; } return 0; @@ -124,410 +115,48 @@ sub is_modem { ### Initialize menu sub genmenu { + my %subsystemhash = (); my $subsystem = \%subsystemhash; - $subsystem->{'01.home'} = { - 'caption' => $tr{'alt home'}, - 'uri' => '/cgi-bin/index.cgi', - 'title' => "$tr{'alt home'}", - 'enabled' => 1, - }; - $subsystem->{'02.netwizard'} = { - 'caption' => $tr{'network configuration'}, - 'uri' => '/cgi-bin/netwizard.cgi', - 'title' => "$tr{'network configuration'}", - 'enabled' => 1, - }; - $subsystem->{'03.updates'} = { - 'caption' => $tr{'updates'}, - 'uri' => '/cgi-bin/updates.cgi', - 'title' => "$tr{'updates'}", - 'enabled' => 0, - }; - $subsystem->{'04.passwords'} = { - 'caption' => $tr{'sspasswords'}, - 'uri' => '/cgi-bin/changepw.cgi', - 'title' => "$tr{'sspasswords'}", - 'enabled' => 1, - }; - $subsystem->{'05.ssh'} = { - 'caption' => $tr{'ssh access'}, - 'uri' => '/cgi-bin/remote.cgi', - 'title' => "$tr{'ssh access'}", - 'enabled' => 1, - }; - $subsystem->{'06.gui'} = { - 'caption' => $tr{'gui settings'}, - 'uri' => '/cgi-bin/gui.cgi', - 'title' => "$tr{'gui settings'}", - 'enabled' => 1, - }; - $subsystem->{'07.backup'} = { - 'caption' => $tr{'backup'}, - 'uri' => '/cgi-bin/backup.cgi', - 'title' => "$tr{'backup'} / $tr{'restore'}", - 'enabled' => 1, - }; - $subsystem->{'08.shutdown'} = { - 'caption' => $tr{'shutdown'}, - 'uri' => '/cgi-bin/shutdown.cgi', - 'title' => "$tr{'shutdown'} / $tr{'reboot'}", - 'enabled' => 1, - }; - $subsystem->{'09.credits'} = { - 'caption' => $tr{'credits'}, - 'uri' => '/cgi-bin/credits.cgi', - 'title' => "$tr{'credits'}", - 'enabled' => 1, - }; - my %substatushash = (); my $substatus = \%substatushash; - $substatus->{'01.systemstatus'} = { - 'caption' => $tr{'sssystem status'}, - 'uri' => '/cgi-bin/status.cgi', - 'title' => "$tr{'system status information'}", - 'enabled' => 1, - }; - $substatus->{'02.networkstatus'} = { - 'caption' => $tr{'ssnetwork status'}, - 'uri' => '/cgi-bin/netstatus.cgi', - 'title' => "$tr{'network status information'}", - 'enabled' => 1, - }; - $substatus->{'03.systemgraphs'} = { - 'caption' => $tr{'system graphs'}, - 'uri' => '/cgi-bin/graphs.cgi', - 'novars' => 1, - 'title' => "$tr{'system graphs'}", - 'enabled' => 1, - }; - $substatus->{'04.trafficgraphs'} = { - 'caption' => $tr{'sstraffic graphs'}, - 'uri' => '/cgi-bin/graphs.cgi', - 'vars' => 'graph=network', - 'title' => "$tr{'network traffic graphs'}", - 'enabled' => 1, - }; - $substatus->{'05.proxygraphs'} = { - 'caption' => $tr{'ssproxy graphs'}, - 'uri' => '/cgi-bin/proxygraphs.cgi', - 'title' => "$tr{'proxy access graphs'}", - 'enabled' => 1, - }; - $substatus->{'06.connections'} = { - 'caption' => $tr{'connections'}, - 'uri' => '/cgi-bin/connections.cgi', - 'title' => "$tr{'connections'}", - 'enabled' => 1, - }; - $substatus->{'99.iptfilters'} = { - 'caption' => $tr{'iptfilters iptable rules'}, - 'uri' => '/cgi-bin/iptfilters.cgi', - 'title' => "$tr{'iptfilters iptable rules'}", - 'enabled' => 1, - }; my %subnetworkhash = (); my $subnetwork = \%subnetworkhash; - $subnetwork->{'01.dialup'} = { - 'caption' => $tr{'alt dialup'}, - 'uri' => '/cgi-bin/pppsetup.cgi', - 'title' => "$tr{'dialup settings'}", - 'enabled' => 0, - }; - $subnetwork->{'02.hosts'} = { - 'caption' => $tr{'edit hosts'}, - 'uri' => '/cgi-bin/hosts.cgi', - 'title' => "$tr{'host configuration'}", - 'enabled' => 1, - }; - $subnetwork->{'03.upload'} = { - 'caption' => $tr{'upload'}, - 'uri' => '/cgi-bin/upload.cgi', - 'title' => "$tr{'firmware upload'}", - 'enabled' => 0, - }; - $subnetwork->{'04.aliases'} = { - 'caption' => $tr{'aliases'}, - 'uri' => '/cgi-bin/aliases.cgi', - 'title' => "$tr{'external aliases configuration'}", - 'enabled' => 1, - }; - - my %subserviceshash = (); my $subservices = \%subserviceshash; - $subservices->{'01.dhcp'} = { - 'caption' => $tr{'dhcp server'}, - 'uri' => '/cgi-bin/dhcp.cgi', - 'title' => "$tr{'dhcp configuration'}", - 'enabled' => 1, - }; - $subservices->{'02.dyndns'} = { - 'caption' => $tr{'dynamic dns'}, - 'uri' => '/cgi-bin/ddns.cgi', - 'title' => "$tr{'dynamic dns client'}", - 'enabled' => 1, - }; - $subservices->{'03.time'} = { - 'caption' => $tr{'time server'}, - 'uri' => '/cgi-bin/time.cgi', - 'title' => "$tr{'time server'}", - 'enabled' => 1, - }; - $subservices->{'04.shaping'} = { - 'caption' => $tr{'traffic shaping'}, - 'uri' => '/cgi-bin/shaping.cgi', - 'title' => "$tr{'traffic shaping settings'}", - 'enabled' => 1, - }; - $subservices->{'05.ids'} = {'caption' => $tr{'intrusion detection'}, - 'enabled' => 1, - 'uri' => '/cgi-bin/ids.cgi', - 'title' => "$tr{'intrusion detection system'} (Snort)", - }; - - my %subfirewallhash = (); my $subfirewall = \%subfirewallhash; - - $subfirewall->{'01.dnat'} = { - 'caption' => $tr{'ssport forwarding'}, - 'uri' => '/cgi-bin/portfw.cgi', - 'title' => "$tr{'port forwarding configuration'}", - 'enabled' => 1, - }; - $subfirewall->{'02.xtaccess'} = { - 'caption' => $tr{'external access'}, - 'uri' => '/cgi-bin/xtaccess.cgi', - 'title' => "$tr{'external access configuration'}", - 'enabled' => 1, - }; - $subfirewall->{'03.dmz'} = { - 'caption' => $tr{'ssdmz pinholes'}, - 'uri' => '/cgi-bin/dmzholes.cgi', - 'title' => "$tr{'dmz pinhole configuration'}", - 'enabled' => 1, - }; - $subfirewall->{'04.outgoing'} = { - 'caption' => $tr{'outgoing firewall'}, - 'uri' => '/cgi-bin/outgoingfw.cgi', - 'title' => "$tr{'outgoing firewall'}", - 'enabled' => 1, - }; - - - - my %subhttphash = (); - my $subhttp = \%subhttphash; - $subhttp->{'01.proxy'} = { - 'caption' => $tr{'proxy'}, - 'uri' => '/cgi-bin/advproxy.cgi', - 'title' => "HTTP: $tr{'web proxy configuration'}", - 'enabled' => 1, - }; - $subhttp->{'02.contentfilter'} = { - 'caption' => $tr{'content filter'}, - 'uri' => '/cgi-bin/dansguardian.cgi', - 'title' => "HTTP: $tr{'content filter'}", - 'enabled' => 1, - }; - $subhttp->{'03.antivirus'} = { - 'caption' => $tr{'antivirus'}, - 'uri' => '/cgi-bin/httpantivirus.cgi', - 'title' => "HTTP: $tr{'antivirus'}", - 'enabled' => 1, - }; - $subhttp->{'04.proxymanagment'} = { - 'caption' => $tr{'DS Managment'}, - 'uri' => '/cgi-bin/proxygm.cgi', - 'title' => "HTTP: $tr{'DS Managment'}", - 'enabled' => 1, - }; - $subhttp->{'05.activatedgroups'} = { - 'caption' => $tr{'activated Groups'}, - 'uri' => '/cgi-bin/proxyag.cgi', - 'title' => "HTTP: $tr{'activated Groups'}", - 'enabled' => 1, - }; - $subhttp->{'06.advancedproxy'} = { - 'caption' => $tr{'Proxy Advanced'}, - 'uri' => '/cgi-bin/proxyad.cgi', - 'title' => "HTTP: $tr{'Proxy Advanced'}", - 'enabled' => 1, - }; - - - my %subproxyhash = (); - my $subproxy = \%subproxyhash; - - $subproxy->{'01.http'} = {'caption' => $tr{'HTTP'}, - 'enabled' => 1, - 'subMenu' => $subhttp - }; - $subproxy->{'02.ftp'} = {'caption' => 'FTP', - 'enabled' => 1, - 'subMenu' => $subftp - }; - - - - my %subopenvpnhash = (); - my $subopenvpn = \%subopenvpnhash; - $subopenvpn->{'01.server'} = {'caption' => $tr{'openvpn'}, - 'uri' => '/cgi-bin/openvpn.cgi', - 'title' => "$tr{'virtual private networking'}", - 'enabled' => 1, - }; - $subopenvpn->{'02.client'} = {'caption' => $tr{'openvpnclient'}, - 'uri' => '/cgi-bin/openvpnclient.cgi', - 'title' => "$tr{'virtual private networking'}", - 'enabled' => 1, - }; - - my %subvpnhash = (); - my $subvpn = \%subvpnhash; - - $subvpn->{'01.openvpn'} = {'caption' => $tr{'openvpn'}, - 'subMenu' => $subopenvpn, - 'enabled' => 1, - }; - $subvpn->{'02.ipsec'} = {'caption' => $tr{'ipsec'}, - 'uri' => '/cgi-bin/vpnmain.cgi', - 'title' => "$tr{'virtual private networking'}", - 'enabled' => 1, - }; + my %subipfirehash = (); + my $subipfire = \%subipfirehash; my %sublogshash = (); my $sublogs = \%sublogshash; - $sublogs->{'01.summary'} = {'caption' => $tr{'log summary'}, - 'uri' => '/cgi-bin/logs.cgi/summary.dat', - 'title' => "$tr{'log summary'}", - 'enabled' => 1 - }; - $sublogs->{'02.settings'} = {'caption' => $tr{'log settings'}, - 'uri' => '/cgi-bin/logs.cgi/config.dat', - 'title' => "$tr{'log settings'}", - 'enabled' => 1 - }; - $sublogs->{'03.proxy'} = {'caption' => $tr{'proxy logs'}, - 'uri' => '/cgi-bin/logs.cgi/proxylog.dat', - 'title' => "$tr{'proxy log viewer'}", - 'enabled' => 1 - }; - $sublogs->{'04.firewall'} = {'caption' => $tr{'firewall logs'}, - 'uri' => '/cgi-bin/logs.cgi/firewalllog.dat', - 'title' => "$tr{'firewall log viewer'}", - 'enabled' => 1 - }; - $sublogs->{'05.ids'} = {'caption' => $tr{'ids logs'}, - 'uri' => '/cgi-bin/logs.cgi/ids.dat', - 'title' => "$tr{'intrusion detection system log viewer'}", - 'enabled' => 1 - }; - $sublogs->{'06.contentfilter'} = {'caption' => $tr{'content filter logs'}, - 'uri' => '/cgi-bin/logs.cgi/dansguardian.dat', - 'title' => "$tr{'content filter log viewer'}", - 'enabled' => 1 - }; - $sublogs->{'07.urlfilter'} = { - 'caption' => $tr{'urlfilter log'}, - 'uri' => '/cgi-bin/logs.cgi/urlfilter.dat', - 'title' => "$tr{'urlfilter log'}", - 'enabled' => 1, - }; - $sublogs->{'08.openvpn'} = {'caption' => $tr{'openvpn log'}, - 'uri' => '/cgi-bin/logs.cgi/openvpn.dat', - 'title' => "$tr{'openvpn log'}", - 'enabled' => 1 - }; - $sublogs->{'09.system'} = {'caption' => $tr{'system logs'}, - 'uri' => '/cgi-bin/logs.cgi/log.dat', - 'title' => "$tr{'system log viewer'}", - 'enabled' => 1 - }; - $sublogs->{'10.userlog'} = {'caption' => $tr{'user proxy logs'}, - 'uri' => '/cgi-bin/logs.cgi/userlog.dat', - 'title' => "$tr{'user log viewer'}", - 'enabled' => 1 - }; + eval `/bin/cat /var/ipfire/menu.d/*.menu`; + eval `/bin/cat /var/ipfire/menu.d/*.main`; - my %subipfirehash = (); - my $subipfire = \%subipfirehash; - $subipfire->{'01.pakfire'} = {'caption' => $tr{'pakfire'}, - 'uri' => '/cgi-bin/pakfire.cgi', - 'title' => "$tr{'paketmanager'}", - 'enabled' => 1, - }; - $subipfire->{'02.samba'} = {'caption' => $tr{'samba'}, - 'uri' => '/cgi-bin/samba.cgi', - 'title' => "$tr{'samba'}", - 'enabled' => 1, - }; - - - - $menu->{'01.system'} = {'caption' => $tr{'alt system'}, - 'enabled' => 1, - 'subMenu' => $subsystem - }; - $menu->{'02.status'} = {'caption' => $tr{'status'}, - 'enabled' => 1, - 'subMenu' => $substatus - }; - $menu->{'03.network'} = {'caption' => $tr{'network'}, - 'enabled' => 1, - 'subMenu' => $subnetwork - }; - $menu->{'04.services'} = {'caption' => $tr{'alt services'}, - 'enabled' => 1, - 'subMenu' => $subservices - }; - $menu->{'05.firewall'} = {'caption' => $tr{'firewall'}, - 'enabled' => 1, - 'subMenu' => $subfirewall - }; - $menu->{'06.proxy'} = {'caption' => $tr{'alt proxy'}, - 'enabled' => 1, - 'subMenu' => $subproxy - }; - $menu->{'07.vpn'} = {'caption' => 'VPN', - 'enabled' => 1, - 'subMenu' => $subvpn - }; - $menu->{'08.logs'} = {'caption' => $tr{'alt logs'}, - 'enabled' => 1, - 'subMenu' => $sublogs - }; - $menu->{'09.ipfire'} = {'caption' => 'IPFire'}, - 'enabled' => 1, - 'subMenu' => $subipfire - }; - - - - if (! blue_used() && ! orange_used()) { - $menu->{'05.firewall'}{'subMenu'}->{'03.dmz'}{'enabled'} = 0; + if (! blue_used()) { + $menu->{'05.firewall'}{'subMenu'}->{'60.wireless'}{'enabled'} = 0; + } + if ( $ethsettings{'CONFIG_TYPE'} =~ /^(1|2|3|4)$/ && $ethsettings{'RED_TYPE'} eq 'STATIC' ) { + $menu->{'03.network'}{'subMenu'}->{'70.aliases'}{'enabled'} = 1; } - if (-e '/etc/FLASH') { - $menu{'06.proxy'}{'subMenu'}->{'01.http'}{'subMenu'}->{'01.proxy'}{'enabled'} = 0; #disable squid - $menu{'04.services'}{'subMenu'}->{'05.ids'}{'enabled'} = 0; #disable ids - $menu{'08.logs'}{'subMenu'}->{'05.ids'}{'enabled'} = 0; #disable ids + + if (&General::RedIsWireless()) { + $menu->{'01.system'}{'subMenu'}->{'21.wlan'}{'enabled'} = 1; } } sub showhttpheaders { - print "Pragma: no-cache\n"; - print "Cache-control: no-cache\n"; + print "Cache-control: private\n"; print "Connection: close\n"; - print "Content-type: text/html\n\n"; + print "Content-type: text/html; charset=UTF-8\n\n"; } sub is_menu_visible($) { @@ -616,360 +245,6 @@ sub gettitle($) { return ''; } - -sub showmenu() { - print < -
    -EOF -; - foreach my $k1 ( sort keys %$menu ) { - if (! $menu->{$k1}{'enabled'}) { - next; - } - - my $link = getlink($menu->{$k1}); - if ($link eq '') { - next; - } - if (! is_menu_visible($link)) { - next; - } - if ($menu->{$k1}->{'selected'}) { - print '
  • '; - } else { - print '
  • '; - } - - print < - $menu->{$k1}{'caption'} - -
  • -EOF -; - } - - print < - -EOF -; -} - -sub getselected($) { - my $root = shift; - if (!$root) { - return 0; - } - - foreach my $item (%$root) { - if ($root->{$item}{'selected'}) { - return $root->{$item}; - } - } -} - -sub showsubsection($$) { - my $root = shift; - my $id = shift; - if ($id eq '') { - $id = 'menu-left'; - } - - if (! $root) { - return; - } - my $selected = getselected($root); - if (! $selected) { - return; - } - my $submenus = $selected->{'subMenu'}; - if (! $submenus) { - return; - } - - print < -
      -EOF -; - foreach my $item (sort keys %$submenus) { - my $hash = $submenus->{$item}; - if (! $hash->{'enabled'}) { - next; - } - - my $link = getlink($hash); - if ($link eq '') { - next; - } - if (! is_menu_visible($link)) { - next; - } - if ($hash->{'selected'}) { - print '
    • '; - } else { - print '
    • '; - } - - print <$hash->{'caption'} -
    • -EOF -; - } - - print < - -EOF -; - -} - - -sub showsubsubsection($) { - my $root = shift; - if (!$root) { - return; - } - my $selected = getselected($root); - if (! $selected) { - return - } - if (! $selected->{'subMenu'}) { - return - } - - showsubsection($selected->{'subMenu'}, 'menu-subtop'); -} - - -sub get_helpuri() { - my $helpfile = ''; - if ($URI[0] =~ /.*\/([^\/]+)\.cgi/) { - $helpfile = $1; - } else { - return ''; - } - $helpfile .= '.help.html'; - - my $helpuri = '/doc/'.$language.'/'.$helpfile; - if (! -e $ENV{'DOCUMENT_ROOT'}.$helpuri) { - return ''; - } - return $helpuri; -} - - -sub openpage { - my $title = shift; - my $boh = shift; - my $extrahead = shift; - - @URI=split ('\?', $ENV{'REQUEST_URI'} ); - &readhash("${swroot}/main/settings", \%settings); - &genmenu(); - - my $h2 = gettitle($menu); - my $helpuri = get_helpuri(); - - $title = "IPFire - $title"; - if ($settings{'WINDOWWITHHOSTNAME'} eq 'on') { - $title = "$settings{'HOSTNAME'}.$settings{'DOMAINNAME'} - $title"; - } - - print < - - - - $title - - $extrahead - - - - - - - - - - - - -
      - -