]> git.ipfire.org Git - ipfire-2.x.git/blobdiff - config/cfgroot/header.pl
Bash promt im Fedora Core Style gemacht
[ipfire-2.x.git] / config / cfgroot / header.pl
index 18c1dad3fb3d97d910906c802782cec76691c96f..cedf81e19a8a2a42c9b1006d3ac24f80c2b5754b 100644 (file)
@@ -43,12 +43,11 @@ 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;
 }
 
@@ -88,15 +87,17 @@ if ( -d "/var/ipfire/langs/${language}/" ) {
 };
 
 ### Read IPFire Buildversion
-$FIREBUILD = "Datei firebuild nicht gefunden\n";
+$FIREBUILD = "File not found: firebuild\n";
 if (open(MYFile, "<${swroot}/firebuild")) {
     $FIREBUILD = <MYFile>;
+    chomp($FIREBUILD);
     $FIREBUILD = "(Build: $FIREBUILD)";
-    close(_File);
+    close(MYFile);
 };
 
 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]$/) {
@@ -130,25 +131,31 @@ sub genmenu {
                                'title' => "$tr{'alt home'}",
                                'enabled' => 1,
                                };
-    $subsystem->{'20.passwords'} = {
+    $subsystem->{'20.dialup'} = {
+                               'caption' => $tr{'alt dialup'},
+                               'uri' => '/cgi-bin/pppsetup.cgi',
+                               'title' => "$tr{'alt dialup'}",
+                               'enabled' => 1,
+                               };
+    $subsystem->{'30.passwords'} = {
                                'caption' => $tr{'sspasswords'},
                                'uri' => '/cgi-bin/changepw.cgi',
                                'title' => "$tr{'sspasswords'}",
                                'enabled' => 1,
                                };
-    $subsystem->{'30.ssh'} = {
+    $subsystem->{'40.ssh'} = {
                                'caption' => $tr{'ssh access'},
                                'uri' => '/cgi-bin/remote.cgi',
                                'title' => "$tr{'ssh access'}",
                                'enabled' => 1,
                                };
-    $subsystem->{'40.gui'} = {
+    $subsystem->{'50.gui'} = {
                                'caption' => $tr{'gui settings'},
                                'uri' => '/cgi-bin/gui.cgi',
                                'title' => "$tr{'gui settings'}",
                                'enabled' => 1,
                                };
-    $subsystem->{'50.shutdown'} = {
+    $subsystem->{'60.shutdown'} = {
                                'caption' => $tr{'shutdown'},
                                'uri' => '/cgi-bin/shutdown.cgi',
                                'title' => "$tr{'shutdown'} / $tr{'reboot'}",
@@ -201,10 +208,10 @@ sub genmenu {
                                  'title' => "Firewall-Diagramme",
                                 'enabled' => 1,
                                  };
-    $substatus->{'70.hddtemp'} = {
-                                 'caption' => "$tr{'harddisk temperature graphs'}",
-                                 'uri' => '/cgi-bin/hddgraph.cgi',
-                                 'title' => "$tr{'harddisk temperature graphs'}",
+    $substatus->{'70.hardwaregraphs'} = {
+                                 'caption' => "$tr{'hardware graphs'}",
+                                 'uri' => '/cgi-bin/hardwaregraphs.cgi',
+                                 'title' => "$tr{'hardware graphs'}",
                                 'enabled' => 1,
                                  };
     $substatus->{'80.connections'} = {
@@ -229,45 +236,56 @@ sub genmenu {
     my %subnetworkhash = ();
     my $subnetwork = \%subnetworkhash;
 
-    $subnetwork->{'10.proxy'} = {'caption' => 'Webproxy',
+    $subnetwork->{'10.netconf'} = {'caption' => "$tr{'net config'}",
+                               'uri' => '/cgi-bin/netconfig.cgi',
+                               'title' => "$tr{'net config'}",
+                               'enabled' => 0,
+                               };
+    $subnetwork->{'20.proxy'} = {'caption' => 'Webproxy',
                                'uri' => '/cgi-bin/proxy.cgi',
                                'title' => "Webproxy",
                                'enabled' => 1,
                                };
-    $subnetwork->{'20.urlfilter'} = {'caption' => 'URL-Filter',
+    $subnetwork->{'30.urlfilter'} = {'caption' => 'URL-Filter',
                                'uri' => '/cgi-bin/urlfilter.cgi',
                                'title' => "URL-Filter",
                                'enabled' => 1,
                                };
-    $subnetwork->{'30.dhcp'} = {'caption' => $tr{'dhcp server'},
+    $subnetwork->{'40.dhcp'} = {'caption' => $tr{'dhcp server'},
                                 'uri' => '/cgi-bin/dhcp.cgi',
                                 'title' => "$tr{'dhcp server'}",
                                 'enabled' => 1,
                                 };
-    $subnetwork->{'40.dialup'} = {
-                                 'caption' => $tr{'alt dialup'},
-                                 'uri' => '/cgi-bin/pppsetup.cgi',
-                                 'title' => "$tr{'alt dialup'}",
-                                 'enabled' => 1,
-                                 };
-    $subnetwork->{'50.hosts'} = {
+    $subnetwork->{'50.scheduler'} = {
+                                'caption' => $tr{'connscheduler'},
+                                'uri' => '/cgi-bin/connscheduler.cgi',
+                                'title' => "$tr{'connscheduler'}",
+                                'enabled' => 1,
+                                };
+    $subnetwork->{'60.hosts'} = {
                                 'caption' => $tr{'edit hosts'},
                                 'uri' => '/cgi-bin/hosts.cgi',
                                 'title' => "$tr{'edit hosts'}",
                                 'enabled' => 1,
                                 };
-    $subnetwork->{'60.upload'} = {
+    $subnetwork->{'70.upload'} = {
                                  'caption' => $tr{'upload'},
                                  'uri' => '/cgi-bin/upload.cgi',
                                  'title' => "$tr{'upload'}",
                                  'enabled' => 0,
                                  };
-    $subnetwork->{'70.aliases'} = {
+    $subnetwork->{'80.aliases'} = {
                                  'caption' => $tr{'aliases'},
                                  'uri' => '/cgi-bin/aliases.cgi',
                                  'title' => "$tr{'aliases'}",
                                  'enabled' => 0,
                                  };
+    $subnetwork->{'90.wakeonlan'} = {
+                                 'caption' => $tr{'WakeOnLan'},
+                                 'uri' => '/cgi-bin/wakeonlan.cgi',
+                                 'title' => "$tr{'WakeOnLan'}",
+                                 'enabled' => 1,
+                                 };
 
     my %subserviceshash = ();
     my $subservices = \%subserviceshash;
@@ -342,7 +360,13 @@ sub genmenu {
                                'title' => "$tr{'outgoing firewall'}",
                                'enabled' => 1,
                                };
-    $subfirewall->{'60.fwopts'} = {
+    $subfirewall->{'60.upnp'} = {
+                               'caption' => 'UPnP',
+                               'uri' => '/cgi-bin/upnp.cgi',
+                               'title' => "Universal Plug and Play",
+                               'enabled' => 1,
+                               };
+    $subfirewall->{'70.fwopts'} = {
                                'caption' => $tr{'options fw'},
                                'uri' => '/cgi-bin/optionsfw.cgi',
                                'title' => "$tr{'options fw'}",
@@ -378,7 +402,7 @@ sub genmenu {
                                'enabled' => 1
                                };
     $sublogs->{'60.urlfilter'} = {
-                               'caption' => $tr{'urlfilter log'},
+                               'caption' => $tr{'urlfilter logs'},
                                'uri' => '/cgi-bin/logs.cgi/urlfilter.dat',
                                'title' => "$tr{'urlfilter log'}",
                                'enabled' => 1,
@@ -463,7 +487,7 @@ sub genmenu {
     if (! blue_used()) {
        $menu->{'05.firewall'}{'subMenu'}->{'30.wireless'}{'enabled'} = 0;
     }
-    if (! $ethsettings{'CONFIG_TYPE'} =~ /^(2|3|6|7)$/ && $ethsettings{'RED_TYPE'} eq 'STATIC' ) {
+    if ( $ethsettings{'CONFIG_TYPE'} =~ /^(2|3|6|7)$/ && $ethsettings{'RED_TYPE'} eq 'STATIC' ) {
        $menu->{'03.network'}{'subMenu'}->{'70.aliases'}{'enabled'} = 1;
     }
 }
@@ -562,304 +586,6 @@ sub gettitle($) {
     return '';
 }
 
-
-sub showmenu() {
-    print <<EOF
-  <div id="menu-top">
-    <ul>
-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 '<li class="selected">';
-       } else {
-           print '<li>';
-       }
-
-       print <<EOF
-    <div class="rcorner">
-      <a href="$link">$menu->{$k1}{'caption'}</a>
-    </div>
-  </li>
-EOF
-;
-    }
-
-    print <<EOF
-    </ul>
-  </div>
-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
-  <div id="$id">
-    <ul>
-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 '<li class="selected">';
-       } else {
-           print '<li>';
-       }
-
-       print <<EOF
-      <a href="$link">$hash->{'caption'}</a>
-  </li>
-EOF
-;
-    }
-
-    print <<EOF
-    </ul>
-  </div>
-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 <<END
-<!DOCTYPE html 
-     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
-     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-
-<html>
-  <head>
-  <title>$title</title>
-
-    $extrahead
-    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
-END
-;
-    if ($settings{'FX'} eq 'on') {
-    print <<END
-    <meta http-equiv="Page-Enter" content="blendTrans(Duration=0.5,Transition=12)">
-    <meta http-equiv="Page-Exit" content="blendTrans(Duration=0.5,Transition=12)">
-END
-;
-    }
-    print <<END
-    <link rel="shortcut icon" href="/favicon.ico" />
-    <style type="text/css">\@import url(/include/style.css);</style>
-    <style type="text/css">\@import url(/include/menu.css);</style>
-    <style type="text/css">\@import url(/include/content.css);</style>
-    <script language="javascript" type="text/javascript">
-      
-        function swapVisibility(id) {
-            el = document.getElementById(id);
-           if(el.style.display != 'block') {
-               el.style.display = 'block'
-           }
-           else {
-               el.style.display = 'none'
-           }
-        }
-    </script>
-
-  </head>
-  <body>
-<!-- IPFIRE HEADER -->
-
-<div id="main">
-
-<div id="header">
-       <img id="logo-product" src="/images/logo_ipfire.gif">
-   <div id="header-icons">
-           <a href="http://users.ipfire.eu/" target="_blank"><img border="0" src="/images/help.gif"></a>
-   </div>
-</div>
-
-END
-;
-
-    &showmenu();
-
-print <<END
-<div id="content">
-  <table width="90%">
-    <tr>
-      <td valign="top">
-END
-;
-       
-    &showsubsection($menu);
-
-    print <<END
-      <p><center><img src="/images/iptux.png" width='160px' height='160px'></center></p>
-      </td>
-        <td width="100%" valign="top">
-        <div id="page-content">
-            <h2>$h2</h2>
-END
-    ;
-    
-    &showsubsubsection($menu);
-
-    eval {
-       require 'ipfire-network.pl';
-       $supported = check_support();
-       warn_unsupported($supported);
-    };
-}
-
-sub closepage () {
-    my $status = &connectionstatus();
-    $uptime = `/usr/bin/uptime`;
-       
-    print <<END
-         <div align="center">
-            <p>
-             <div style="font-size: 9px"><b>Status:</b> $status <b>Uptime:</b>$uptime <b>Version:</b> $FIREBUILD</div> 
-            </p>
-          </div>
-       </body>
-</html>
-END
-;
-}
-
-sub openbigbox
-{
-    my $width = $_[0];
-    my $align = $_[1];
-    my $sideimg = $_[2];
-
-    if ($errormessage) {
-       $bgcolor = "style='background-color: $colourerr;'";
-    } else {
-       $bgcolor = '';
-    }
-}
-
-sub closebigbox
-{
-#      print "</td></tr></table></td></tr></table>\n" 
-}
-
-sub openbox
-{
-       $width = $_[0];
-       $align = $_[1];
-       $caption = $_[2];
-
-       if ($caption) { print "<h3>$caption</h3>\n"; } else { print "&nbsp;"; }
-       
-       print "<table class=\"list\"><tr><td align=\"$align\">\n";
-}
-
-sub closebox
-{
-       print "</td></tr></table><br><br>";
-}
-
 sub writehash
 {
        my $filename = $_[0];
@@ -1361,19 +1087,19 @@ sub connectionstatus
                        } elsif ($pppsettings{'TYPE'} eq 'eagleusbadsl') {
                                $speed = `/usr/sbin/eaglestat | /bin/grep Rate`;
                        }
-                       $connstate = "<span class='ipcop_StatusBig'>$Lang::tr{'connected'} (<span class='ipcop_StatusBigRed'>$timestr</span>) $profileused (\@$speed)</span>";
+                       $connstate = "$Lang::tr{'connected'} ($timestr) $profileused (\@$speed)";
                } else {
-                       $connstate = "<span class='ipcop_StatusBig'>$Lang::tr{'connected'} (<span class='ipcop_StatusBigRed'>$timestr</span>) $profileused</span>";
+                       $connstate = "$Lang::tr{'connected'} ($timestr) $profileused";
                }
        } else {
                if (-e "${General::swroot}/red/dial-on-demand") {
-                   $connstate = "<span class='ipcop_StatusBig'>$Lang::tr{'dod waiting'} $profileused</span>";
+                   $connstate = "$Lang::tr{'dod waiting'} $profileused";
                } else {
-                   $connstate = "<span class='ipcop_StatusBig'>$Lang::tr{'connecting'} $profileused</span>";
+                   $connstate = "$Lang::tr{'connecting'} $profileused";
                }
        }
     } else {
-       $connstate = "<span class='ipcop_StatusBig'>$Lang::tr{'idle'} $profileused</span>";
+       $connstate = "$Lang::tr{'idle'} $profileused";
     }
     return $connstate;
 }
@@ -1500,7 +1226,8 @@ sub PrintActualLeases
 <td width='25%' align='center'><a href='$ENV{'SCRIPT_NAME'}?IPADDR'><b>$tr{'ip address'}</b></a></td>
 <td width='25%' align='center'><a href='$ENV{'SCRIPT_NAME'}?ETHER'><b>$tr{'mac address'}</b></a></td>
 <td width='20%' align='center'><a href='$ENV{'SCRIPT_NAME'}?HOSTNAME'><b>$tr{'hostname'}</b></a></td>
-<td width='30%' align='center'><a href='$ENV{'SCRIPT_NAME'}?ENDTIME'><b>$tr{'lease expires'} (local time d/m/y)</b></a></td>
+<td width='25%' align='center'><a href='$ENV{'SCRIPT_NAME'}?ENDTIME'><b>$tr{'lease expires'} (local time d/m/y)</b></a></td>
+<td width='5%' align='center'><b>Add to fix leases<b></td>
 </tr>
 END
     ;
@@ -1546,7 +1273,7 @@ END
 
     my $id = 0;
     foreach my $key (sort leasesort keys %entries) {
-
+       print "<form method='post' action='/cgi-bin/dhcp.cgi'>\n";
        my $hostname = &cleanhtml($entries{$key}->{HOSTNAME},"y");
 
        if ($id % 2) {
@@ -1557,10 +1284,10 @@ END
        }
 
        print <<END
-<td align='center'>$entries{$key}->{IPADDR}</td>
-<td align='center'>$entries{$key}->{ETHER}</td>
-<td align='center'>&nbsp;$hostname </td>
-<td align='center'>
+<td align='center'><input type='hidden' name='FIX_ADDR' value='$entries{$key}->{IPADDR}' />$entries{$key}->{IPADDR}</td>
+<td align='center'><input type='hidden' name='FIX_MAC' value='$entries{$key}->{ETHER}' />$entries{$key}->{ETHER}</td>
+<td align='center'><input type='hidden' name='FIX_REMARK' value='$hostname' />&nbsp;$hostname</td>
+<td align='center'><input type='hidden' name='FIX_ENABLED' value='on' />
 END
        ;
 
@@ -1572,7 +1299,11 @@ END
        } else {
            print "$enddate";
        }
-       print "</td></tr>";
+       print <<END
+<td><input type='hidden' name='ACTION' value='$Lang::tr{'add'}2' /><input type='submit' name='SUBMIT' value='$Lang::tr{'add'}' />
+</td></td></tr></form>
+END
+       ;
        $id++;
     }